Add tee UML state machine diagram
Refactor common actions into entry actions
Handle writing
Correct conditional guards
Use do for write actions to allow exiting
Remove *, add data written escape
Add termination conditions