added memoization decorator