cleaned up and added doc strings to pairs code