     }
 
     func configure() {
-        setMeters([MeterConf(name: "s", actionLimit: nil, timeLimit: 60, restTime: 60), MeterConf(name: "m", actionLimit: nil, timeLimit: 420, restTime: 900)])
-    }
-
-    init(clock: (() -> Double), makeFile: ((path: String?, mode: String) -> File), root: String?, errors: [String]) {
+        setMeters([MeterConf(name: "s", actionLimit: nil, timeLimit: 45, restTime: 45), MeterConf(name: "m", actionLimit: nil, timeLimit: 420, restTime: 900)])
+    }
+
+    init(clock: (() -> Double), makeFile: ((path: String?, mode: String, errorLog: ErrorLog) -> File), root: String?, errorLog: ErrorLog) {
         self.clock = clock
-        self.errors = errors
+        self.errorLog = errorLog
         let s = NSUUID().UUIDString
-        self.id = s.substringFromIndex(advance(s.endIndex, -12))
+        id = s.substringFromIndex(advance(s.endIndex, -12))
         var statePath: String?
         if root != nil {
-            statePath = "\(root!)/state-\(id).txt"
-        }
-        state = makeFile(path: statePath, mode: "w")
+            statePath = "\(root!)/state/\(id).txt"
+        }
+        state = makeFile(path: statePath, mode: "w", errorLog: errorLog)
         configure()
         expire()
-        tick()
     }
     
     func meta(i: Int) -> Double {

    }

    func applicationDidFinishLaunching(aNotification: NSNotification) {
        let prompt: String = kAXTrustedCheckOptionPrompt.takeUnretainedValue()
        let trusted = AXIsProcessTrustedWithOptions([prompt: true]) != 0
        if !trusted {
            NSApplication.sharedApplication().terminate(nil)
            return
        }
        
        var root : String? = "~/Library/Application Support/Ergometer/state".stringByStandardizingPath
        var errors = [String]()
        var e : NSError?
        if !NSFileManager.defaultManager().createDirectoryAtPath(root!, withIntermediateDirectories: true, attributes: nil, error: &e) {
            root = nil
            errors.append(e?.localizedDescription ?? "Unsaved data")
        }
        
        item = NSStatusBar.systemStatusBar().statusItemWithLength(/* NSVariableStatusItemLength */ -1)
        app = App(clock: systemClock, makeFile: makeSystemFile, root: root, errors: errors)
        let mask : NSEventMask =
            .KeyDownMask |
            .FlagsChangedMask |

    return (x ?? 0) != 0
}

func red(s: String) -> NSAttributedString {
    let style = [NSForegroundColorAttributeName: NSColor.redColor()]
    return NSAttributedString(string: s, attributes: style)
}

func redUnlessPositive(x: Double) -> NSAttributedString {
    let s = "\(Int(round(x)))"
    return x > 0 ? NSAttributedString(string: s) : red(s)
}

class Meter {
