Added file indexing for optimization.