Memoization realised. Slow