Add original db code for further refactoring