this makes me feel that the `$depth` parameter is more a boolean flag instead of an int?