This loop is common code -- it should be a static NValue function that returns i.