refactored browser script