nit: maybe use a base <div> container and set its innerHTML, to make this easier to read?