rafactoring with models and controllers