Refactored db in separate headers and namespace