Refactoring for W3C compatibility.