minor change in returnIndex