Refactoring of `cs\Index`:
* less amount of repeated code
* better structure
* easier to read and support.