Implemented caching of solutions