added pure functions increment and selector. Added cascade method to statemachine