rework module to allow for default connection or specified connection
add tests. fix bug