Some refactoring and simplification, working towards handling pair contractions