order entries in the right order