Refactors connections management