Top level logic for predicate