refactored connection, not tested yet
fixes to net refactoring