Block until all connections done, and some refactoring