Refactor dao