clean and sort