cleaned up code a bit
cleaned up code for stackoverflow question
extracted autologin info out into its own separate package