updated checkPair() and added some printing functions