cachematrix submission 2

Updated code with comments