Extract out Index module

This PR extracts index options to it's own class, to clean up the code a bit and make easier to test.

This PR does not change the API of the gem.