database passing

Added function arguments to pass database through so the connector knows
which database to work with
Connector cleanup 2

More attempts at cleaning up the connector. Not sure how well this is
working since I still can't test anything because it's too broken.