Use correct context for paircopy
Simplify code