controller generator test added and refactoring