Do a better job of clean up, so the browser doesn't crash