Refactored code to allow private browsing