DB module refactoring