added indices generation logic