Can specify the depth of flattening