formatted the state machine code so text is readable
work in progress for naive memory implementation