Fix issue #1.

Encapsulate the state_machine structure into the C file, as advised by @pierluca.