Moved connection file to includes folder

Moved some code out of the main file