refactored RangeValidator.