move connection out into own class