smartIdx added for faster reordering of data