Improved indexing process. This change helps to close #8.