update cachematrix with working code