better algorithm
Merge pull request #12 from CandidKilsborne/algorithm-refining

better algorithm