Finalized state machine for the word and defition code. No more switch statement.