Minor pairing bug fix, clean up code