storing last index