make module not depend on browser code, which allowed a refactor and cleanup