Updated cahing implementation. Seems to increase speed noticably