Fix sorting of children.

share code between sorters and handlers.

Add name and tostring to handlers and sorters.