Implemented merging to following list.
More tests.
Minor refucktorisation.