Large update.

Actions are renamed to Functions, StateMachine is now derived from
State, better variables storage implemented, many new Functions and
Transitions implemented, 7 examples created etc.