refactored trigger