memoization: fixed broken test and reapplied all commits squashed in one
Merge pull request #56 from vitobasso/feature-memoization2

memoization