Sort output by name where possible