     }
 
     func toggleDisplaySleep(sender: AnyObject?) {
-        if NSUserDefaults.standardUserDefaults().valueForKey("allowDisplaySleep") as Bool {
+        if assertion?.type == PowerAssertionType.PreventUserIdleSystemSleep {
             assertion?.type = PowerAssertionType.PreventUserIdleDisplaySleep
         } else {
             assertion?.type = PowerAssertionType.PreventUserIdleSystemSleep

     */
    override init() {
        // Setup 1st Assertion
        assertion = PowerAssertion(name: "Barista Prevent Sleep", type: .PreventUserIdleSystemSleep, level: .Off)
        if assertion == nil {
            fatalError("Could not create assertion, abort!")
        }


        menu.addItem(NSMenuItem.separatorItem())
        menu.addItem(mItemQuit)
    }

    
