Updating cachematrix functions for Assignment 2