         
         let refreshRate = NSUserDefaults.standardUserDefaults().integerForKey("refreshRate")
         
-        NSTimer.scheduledTimerWithTimeInterval(Double(refreshRate), target: self, selector: #selector(MainViewController.update), userInfo: nil, repeats: true)
+        self.timer = NSTimer.scheduledTimerWithTimeInterval(Double(refreshRate), target: self, selector: #selector(MainViewController.update), userInfo: nil, repeats: true)
     }
     
     override func viewDidAppear(animated: Bool) {

            self.mapView.showsUserLocation = true
            self.locationManager.startUpdatingLocation()
        }
    }

    override func didReceiveMemoryWarning() {

    @IBOutlet weak var labelScore: UILabel!
    
    var locationManager = CLLocationManager()
    var timer: NSTimer?

    override func viewDidLoad() {
        super.viewDidLoad()
