Refactor code. Let connect and disconnect work.