second edit of cachematrix.R