Updating cachematrix for Programming Assignment 2