refactor of browser html parse logic