Code changes for caching matrix inverse