[Chapter 4]

Adds memoizing