Corrected usage of indexOf