Added state diagram for system state analysis