rewrote connect/disconnect