Introduced subdefinitions. Moved all events to subdefs. Fixed nested scoping. Added decorators.