Move term comparator into API