Final modifications to autodetect flash