refactoring
better recoverty from lost connections