Refactoring
Adding db functionality to hierarchy