compare.py: massive cleanups