Rewrite DB interface, tests and MultiDatabase integration