sped up performance by doing 'IsIdentity' check before finding inverse