A new algorithm combining fragments

Rewrite uniteFragments. Now all fragments are checked, and fragment with
maximal number of neighbors in closed area.