Cleaned up the svg groups in the legend for easier manipulation.