cacheSolve function implemented