refactoring the dao layer