use predicate instead of function for validator