database refactor