Moved connection code into function so it will be easier to reorder command line arguments.
Moved connection code into function so it will be easier to reorder
command line arguments.

rdwilliamson/glacier