Refactoring Connection, bugfixes :-)