add diagram function to show overlap, and modify some pairregistration code