Edited cachematrix.R, updated solution - version 2