Created better handling of browser state and cwd in browser module