refactored indexterm handling and added tests
Merge pull request #27 from oreillymedia/sarah

Refactored indexterm handling