Added closest and farthest square predicates