Fix up depth sorting.
Remove unused methods.