Added refactored version of ConnectionHandler, need to do manual merge
later