updated code, still at index number stage