More work on DBManager

Taking a break now. Lots got done, refactoring hardcore before
continuing.