Sorting and varibable rename