Use predicate function to simplify a bit.