refactoring + connectionmanager tests