added logic to generate dao automatically and refine codes