Implement index generation.