consolidate cleanup functions (issue #html)