added id transformation for arrays in sorting