Added support for writing formulae.