             return
         }
 
-        createBeaconRegion()
         locationManager?.startRangingBeaconsInRegion(beaconRegion)
 
         NSLog("Ranging turned on for region: \(beaconRegion)")

    }

    var locationManager: CLLocationManager?
    var beaconRegion: CLBeaconRegion?
    var peripheralManager: CBPeripheralManager?
    var detectedBeacons: Array<CLBeacon> = []
    var monitoringSwitch, advertisingSwitch, rangingSwitch: UISwitch?


        let major: CLBeaconMajorValue = CLBeaconMajorValue(arc4random_uniform(5000))
        let minor: CLBeaconMinorValue = CLBeaconMajorValue(arc4random_uniform(5000))
        var region: CLBeaconRegion = CLBeaconRegion(proximityUUID: beaconRegion.proximityUUID, major: major, minor: minor, identifier: beaconRegion.identifier)
        var beaconPeripheralData: NSMutableDictionary = region.peripheralDataWithMeasuredPower(nil)

        peripheralManager?.startAdvertising(beaconPeripheralData as [NSObject : AnyObject])
