Fix numbering issue and perform some cleanup

The template <xsl:template name="pn" match="paragraph-numbered">
contains most of the modifications