Refactoring DB class