             controller.connect()
         })
         discovery.startDiscovery()
-        waitForExpectationsWithTimeout(20.0, handler: {_ in discovery.stopDiscovery() })
+        waitForExpectationsWithTimeout(20.0) {_ in discovery.stopDiscovery() }
 
         XCTAssert(framesDisplayed >= expectedMinDisplayedFrameCount, "Nuimo controller should display at least \(expectedMinDisplayedFrameCount) animation frames but it displayed only \(framesDisplayed) frames")
         XCTAssert(framesDisplayed <= expectedMaxDisplayedFrameCount, "Nuimo controller should not display more than \(expectedMaxDisplayedFrameCount) but it displayed \(framesDisplayed)")
     }
 }
 
-func after(delay: NSTimeInterval, _ block: dispatch_block_t) {
+func after(delay: NSTimeInterval, block: dispatch_block_t) {
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(delay * Double(NSEC_PER_SEC))), dispatch_get_main_queue(), block)
 }
 

                    var frameIndex = 0
                    var nextFrame = {}
                    nextFrame = {
                        after(sendFramesRepeatInterval, {
                            guard frameIndex < sendFramesCount else {
                                controller.disconnect()
                                expectation.fulfill()

            expectation.fulfill()
        })
        discovery.startDiscovery()
        waitForExpectationsWithTimeout(10.0) {_ in discovery.stopDiscovery() }
    }

    func testNuimoControllerConnects() {
