refactory htmlparser