commented aindex function