added state_machine
Merge pull request #12 from stas-tanko/stas

added state_machine