Implemented memoization. Uses too much ram, and might be buggy.
Make memoization a compile time option.
spelling fix
Merge pull request #1 from samal84/master

Memoization