Modified cache to be smarter