working on issue 366 (some success but not complete)

Still fails on CR example (in a very odd way).