refactor of brwoser html logic