added functions for cacheMatrix