Fixed bug in moemoized function. Since I actually need
per-instance caching, I used a regular caching object instead.