refactor valid_value to be more generic by requiring valid_values must respond to casecmp instead of is a String