Spec trigger() as a function
Optimize trigger