refactoring tickets controller and model