Added maxModalDepth function.