beginning to refactor machine to use union types of nodes and definitions better. more verbose, but clearer and more extensible
finished refactoring enough for now on the graph structure