Extensive refactorization of the XML construction in the styles package