More refactoring of connection usage.