         print("elevator: \(short_id()) closing doors at floor: \(floor)")
    }
     
-    func arriveAtFloor() {
+    func arriveAtFloor(request: Request) {
         open()
         sleep(2)
+        request.destinationAction?()
         close()
     }
     

    var direction: Direction = Direction.Idle
    var floor: Int = 1
    var type: RequestType
    
    init(direction: Direction, floor: Int, type: RequestType) {
        self.direction = direction
        self.floor = floor
        self.type = type
    }
    
    init(floor: Int) {

    }
    
    func run() {
        simulateCallingElevator(delay: 3.0, floor: 3, direction: Direction.Up, destinationFloor: 4)
        simulateCallingElevator(delay: 6.0, floor: 8, direction: Direction.Down, destinationFloor: 2)
        simulateCallingElevator(delay: 9.0, floor: 1, direction: Direction.Up, destinationFloor: 9)
        simulateCallingElevator(delay: 10.0, floor: 5, direction: Direction.Up, destinationFloor: 9)
        simulateCallingElevator(delay: 12.0, floor: 5, direction: Direction.Down, destinationFloor: 1)
        simulateCallingElevator(delay: 15.0, floor: 10, direction: Direction.Down, destinationFloor: 1)
        simulateCallingElevator(delay: 18.0, floor: 3, direction: Direction.Down, destinationFloor: 1)
    }
    
    func description() -> String {
        return "<Building id: \(short_id()) floors: \(floors)>"
    }

    func simulateCallingElevator(delay: Double, floor: Int, direction: Direction, destinationFloor: Int) {
        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + delay) {
            let request = Request(direction: direction, floor: floor, type: RequestType.Floor, block: {
                [destinationFloor] () -> () in
                self.control.callElevator(request: Request(floor: destinationFloor))
            })
            self.control.callElevator(request: request)
        }
    }
}

let building = Building(floors: 10)
building.run()
