Add support for `flatten` and `background`