Proper depth sorting.