Moving connection stuff to new file.