Yeah, the code UBB comes with isn't the most finely-tuned around
We've talked about messing with the template code before, but we've held off on any major changes mainly to stay upgrade-ready. That way "our" version was still close enough to UBB's original so we could apply patches and upgrades from them without having to code down again.
Now that UBB/InfoPop has changed to a completely different implementation, we should be able to make some more changes, especially html-wise, that may clean the code up a bit.