Further modifications to index as required for HW3