refactor browser.js