Cleaned up cacheSolve