changes for caching inverse of matrix