Changes for integration testing, esp. rewired so DB now injected instead
of DBFactory.