Major reorganization of comparative analysis code