Refactoring DB interface wip