     func applicationDidBecomeActive(application: UIApplication) {
         NSLog("enable")
 
-        flashService!.enable()
+        flashService.enable()
     }
     
     // When app is not active, shut down bluetooth to conserve battery life
     func applicationWillResignActive(application: UIApplication) {
         NSLog("disable")
 
-        flashService!.disable()
+        flashService.disable()
     }
 
     // Called every second by timer

        flashService = NVFlashService()
        
        // Optional: receive callbacks when flashes come into range or are connected/disconnected
        flashService!.delegate = self
        
        // Auto connect to closest flash
        flashService!.autoConnect = true
        
        // Uncomment to auto connect to more than one flash
        // flashService!.autoConnectMaxFlashes = 4
        
        // Set a timer to toggle flash every second.
        timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self,

@UIApplicationMain
class AppDelegate: NSObject, UIApplicationDelegate, NVFlashServiceDelegate {

    var flashService: NVFlashService!
    var timer: NSTimer!

    func applicationDidFinishLaunching(application: UIApplication) {
        NSLog("init")
