Database refactoring 3