rearranging code to get alphabetical order