added events to statemachine, updated documentation and tests