refactor trigger