Centralizing some code and making sure DefaultDatabase is set
Cleanup
Port some more legacy config
Cleanup
Update to recent API change