refactoring validator and controllers.