Refactored trigger handling