Refactored connections class