Refactoring db package.