Moved the jquery connection functions