Added state diagram