refactoring of DAO