Removing commented out (duplicate) code in device detection
Moving broadcast call on all interfaces into try: except: