Updated cachematrix.R according to assignment