Register Event.Type enum from within scripting environment rather than global library
Wrap quit reason in parantheses
Hook event callbacks via binary flags