Connections can be closed.
Some small refactorings.