Change memorize function interface