refactoring the dao