Refactor of the text/heading reconfiguration code.