Sort IDs and UI components