Sorting and alias expansion