Refactored browser code