got rid of unnecessary indexOf