simplifying event trigger code.