sort items in the correct order