Modify flatten formulae