refactor and add dao template