tidying matrix inverse stuff