private flatten