Rewrote htmlgen.js