fix bugs, typos, and pairwise done.