refactor ticket controller