Sort tasks in a list