Corrected commenting out of state-detection code