Updated cachematrix code to complete Assignment 2