fix a race condition bugs in seed merger

Signed-off-by: Sébastien Boisvert <sebastien.boisvert.3@ulaval.ca>
split the code in smaller methods

Link: https://github.com/sebhtml/ray/issues/188
Signed-off-by: Sébastien Boisvert <sebastien.boisvert.3@ulaval.ca>