moved state machine app from the old project. small refactoring done, some more needed