memoizing products properly
memoizing products properly