working version of cachematrix.R w/o documentation