major refactor to move to separate dao and controller