implemented find-first-index function