Implemented cacheSolve