Added depth sorting