Refactor tail array and introduce dense index array.