Massive refactoring includes perfect generation of a connection via a function rather than the error prone method of cloning an instance.
Performed some small code cleanup.
Did some small refactoring.