moved auth and ssl setup to own methods

it was unnecessary to have the setup code in the main method, so moved it to separate ones.