Optimizer: merge #printfooter with the real footer, other minor tweaks