Depth sorting. And other stuff