Added ability to use memoization for methods

See issue #1