Improves and simplifies the pair insertion and completion routines.