State changes and detection