cw.lua.in: simplify main code block