refactored code

* controller