initial attempt
writing the cache solve function