Refactored connection_manager. Extracted message handlers, modified callback handling. Renamed parts of the public API