refactored model and controller, need to update tests