Flattening scripts