added some more debug mode output, cleaned up/simplified code in check_browser()