Added more comprehensive tests, and more cardinality tests