Cleanup
Fix intermediate merging and result construction

This should fix most issues due to wrong usage of optimized merge
function on Intermediate and RawResult.
Resolves #7
Open issues:
- code refactoring
  - maybe rewrite parts
  - cleanup of ContextIndex
  - remove code duplication
- limiting of intermediate results needs work
Minor refactoring of ContextIndex