changed is_valid for the range rather then single value