Adds memoization to the demo