added context to state machines