improve index generation