Also why do we have to check the index twice? I would do an early return if it is -1.