"arr(validSignalIndex) != -1" should be sufficient here