Cleaning up severely

Added DBManager to do all the DB work, so there's some work spread.