Added code to invert and cache a matrix