Had to reverse caching optimisation because of memory error