crashes in compress_dag
fixed the crash
draft but buggy version
revised
added marching up for interior
revised