adding function memoizer