depth sorting and stuff!