added comments and catch error on test cases where we provide an invertable matrix