Generalized collect method of StyleMagic and improved HTML output