Code cleanup at createValidValue()