Made cartesianProduct use greedy planning