Sorting by depth works now. It ended up having to be pretty hacky. Comments available for those who are interested.