Functional, working version of cachematrix.R