Use memoization

Fork me on GitHub