I assume that callers should only be allowed to call this function once.  Or that if the group class is changed, the entire HTML structure will have to be rebuilt.

I like the idea of having a group class, though: it adds flexibility for the future.