Add flatten task