Some refactoring on the dao package