refactors triggerEvent method