Refactoring db package object