updated to handle different browser use cases