Update to cachematrix.R

The changes requested for the assignment, see comments in the file.