started moving connection functions into the main class