Event create/trigger

Event creation, triggering, and an example.
Also reformatted code.