Working loops in compare-dm.py