Updated comments and factored a connection function out of the script