tweaked some connection management code, 1st 2 tests are passing