Part way through database refactor into classes

Initial refactor done, but still need to get all the tests running etc.

The idea is to make database objects that contain password etc, rather
than having the password in a global dictionary.