Wrote cacheSolve function