Refactored memoization. Included tools specs.