Refactored on() and once() trigger logic into keygates