Tidied up nested sorting example