Connector refactored

This is how I'd do it.
I moved all methods to the class prototype since otherwise it would create new functions on every new class instance.