modified cacheSolve function