Refactoring Database package