Refactored lib.connection package