moved some instances both within the file and to Pair.hs