Implemented Memoization for functions and object methods.