used itertools.product to remove one level nesting