add tests for empty sequences
fix results ordering
add test for out of order merging
refactor sequence merging method to simplify testing
Merge pull request #871 from metamx/backport-fix-results-ordering

Backport fix results ordering