Added state transitions

State transitions are now recorded in state trees by parsing the body of event functions.