Sort things in the right order