now uses itertools