Add cardinality and rank functionality