added functionality for cachematrix.R