Modified: Tidy functions.
Modified: Tidy logic of append elements.