DOM parser refactoring