Update isFinite check
Exports cartesian product