further refactoring assimilation code