implement controller
Refactoring model