fixed error message typo for k option
added a function for cardinality estimation and refactored code to use the new function