added memoize decorator