Merge pull request #1 from shiganaiman/master

change logic
start to make pairwise algorithm