Initial refactoring towards introduction of the junction vertex.