started work on find and calcindex function