State machine structure from text file

Fixes #72