State diagram for homework