refactors connections