Change memoize!() to be a function instead