Added state diagram for simulation