updated implementation of makeCacheMatrix and cacheSolve