refactor htmlparser