refactor ticket controller.