some small refactoring and some tests for index impls
reduced level of abstraction in index typeclass to avoid compiler crash. Removed index instance for ContextIndex.