refactor Dao and unit initialization