Add state machine diagram to documentation
Remove unused variables