Corrected spelling of 'indices' and minor code cleanup