Added functions for caching matrix inverse