Error handling improvements and adding some basic handling for the browser