Final version with new createValidValue()