Got the cache and solve to work

Next, need to add comments to code