Implementation for makeCacheMatrix and cacheSolve