html output and cleanup