Common utils and cardinality tool