moved connections to their own class and added tests