Fixing Automaton

This pull request cleans up some rough edges of automaton. It also makes it pass the test currently committed, and provides reasonable-looking output for @mcanini's experiments.