Some refactoring that allows us for easier use of connect/disconnect