Implementing diagram merge