Fixed compaction some more and the algorithms look ok.