Smarter memoisation
Fixed