Refactoring

Connect and disconnect