         defaults.synchronize()
     }
 
-    func boolForKey(key: String) -> Bool {
+    func boolForKey(key: String, defaultValue: Bool) -> Bool {
         let defaults = NSUserDefaults.standardUserDefaults()
-        return defaults.boolForKey(key)
+
+        if let result = defaults.objectForKey(key) {
+            return result.boolValue
+        }
+        else {
+            return defaultValue
+        }
     }
 }


    var UDPEnabled: Bool {
        get {
            return boolForKey(Keys.UDPEnabled)
        }
        set {
            setBool(newValue, forKey: Keys.UDPEnabled)


    var isUserLoggedIn: Bool {
        get {
            return boolForKey(Keys.isUserLoggedIn, defaultValue: false)
        }
        set {
            setBool(newValue, forKey: Keys.isUserLoggedIn)
