 
     # Initialize CodeMirror document
     doc = cmTaskpaper.editor.doc
-    doc.on 'change', () =>
-        amplify.publish 'outline-changed', doc.changeGeneration(), 'doc.change'
+    docView = new DocView(syncMaster, doc)
 
     # Initialize outline
-    outline = new birch.Outline.createTaskPaperOutline(doc.getValue())
-    outline.generation = doc.changeGeneration()
-    outline.onDidEndChanges () ->
-        outline.generation++
-        amplify.publish 'outline-changed', outline.generation, 'outline.onDidEndChanges'
+    outline = new birch.Outline.createTaskPaperOutline(syncMaster.data)
+    outlineView = new OutlineView(syncMaster, outline)
+
 
     cmTaskpaper.title.text = 'CodeMirror View'
     panel.insertLeft(cmTaskpaper)

# The main application entry point.
#
main = () ->
    panel = new DockPanel()
    panel.id = 'main'


    panel.attach(document.body)

    window.onresize = () -> panel.update()

    loadDefault = () ->
        cmTaskpaper.loadTarget './todo.taskpaper', () ->
