define(['TapsModel', 'TextInputDialog', 'TwitterConfirmer'],
function(TapsModel, TextInputDialog, TwitterConfirmer) {

    function onViewAddClicked(model, newTextDialog)
    {
        function callback(newText)
        {
            // Timeout is here to give page chance to change back from the TextInputDialog
            // so that the twitter confirmer dialog shows properly.
            setTimeout(function() { model.add(newText, true); }, 300);
        }
        newTextDialog.show("Add Item", "Enter new text:", '', callback);
    }

    function onViewItemChangeClicked(model, newTextDialog, originalName)
    {
        function callback(newText)
        {
            // Timeout is here to give page chance to change back from the TextInputDialog
            // so that the twitter confirmer dialog shows properly.
            setTimeout(function() { model.change(originalName, newText); }, 300);
        }
        newTextDialog.show("Change Item", "Enter new text:", originalName, callback);
    }

    function EditPage(id, twitter, viewFactory)
    {
        var app = this;

        var newTextDialog = new TextInputDialog("newTextDialog");

        this.view = viewFactory.newEditView(id);
        this.view.onAddClicked("#newTextDialog", function() {
            onViewAddClicked(app.model, newTextDialog);
        });
        this.view.onChangeClicked("#newTextDialog", function(item) {
            onViewItemChangeClicked(app.model, newTextDialog, item.name);
        });
        this.view.onRefreshClicked("#", function() {
            app.model.load(twitter.authorisedScreenName());
        });
        this.view.onRemoveClicked("#", function(item) {
            app.model.remove(item.name);
        });

        this.model = new TapsModel(new TwitterConfirmer(twitter, this.view.page));
        this.model.onItemsLoaded(function(items) { app.view.refresh(items); });
        this.model.onItemRemoved(function(item) { app.view.remove(item); });

        this.id = id;
    }

    EditPage.prototype.show = function(title, twitterScreenName)
    {
        this.view.clear();
        this.view.setHeading(title);
        this.model.load(twitterScreenName);
    };

    return EditPage;

});

@@ -125,19 +125,17 @@
 unction 
-onV
+v
 iewAddCl
@@ -133,26 +133,24 @@
 viewAddClick
-ed
 (model, newT
@@ -431,25 +431,25 @@
 , true); %7D, 
-3
+5
 00);%0A       
@@ -544,26 +544,20 @@
 unction 
-onViewItem
+view
 ChangeCl
@@ -559,18 +559,16 @@
 ngeClick
-ed
 (model, 
@@ -886,9 +886,9 @@
  %7D, 
-3
+5
 00);
@@ -1049,33 +1049,8 @@
   %7B%0A
-        var app = this;%0A%0A
     
@@ -1111,25 +1111,24 @@
 alog%22);%0A
-%0A
         
 this.vie
@@ -1115,29 +1115,28 @@
 %22);%0A        
-this.
+var 
 view = viewF
@@ -1163,29 +1163,102 @@
 d);%0A        
-this.
+var model = new TapsModel(new TwitterConfirmer(twitter, view.page));%0A%0A        
 view.onAddCl
@@ -1306,19 +1306,17 @@
         
-onV
+v
 iewAddCl
@@ -1314,31 +1314,25 @@
 viewAddClick
-ed(app.
+(
 model, newTe
@@ -1358,29 +1358,24 @@
 %7D);%0A        
-this.
 view.onChang
@@ -1434,18 +1434,12 @@
     
-onViewItem
+view
 Chan
@@ -1449,15 +1449,9 @@
 lick
-ed(app.
+(
 mode
@@ -1492,37 +1492,32 @@
     %7D);%0A        
-this.
 view.onRefreshCl
@@ -1548,28 +1548,24 @@
             
-app.
 model.load(t
@@ -1612,29 +1612,24 @@
 %7D);%0A        
-this.
 view.onRemov
@@ -1671,20 +1671,16 @@
         
-app.
 model.re
@@ -1721,96 +1721,8 @@
     
-this.model = new TapsModel(new TwitterConfirmer(twitter, this.view.page));%0A        this.
 mode
@@ -1751,28 +1751,24 @@
 on(items) %7B 
-app.
 view.refresh
@@ -1784,29 +1784,24 @@
 %7D);%0A        
-this.
 model.onItem
@@ -1829,12 +1829,8 @@
 ) %7B 
-app.
 view
@@ -1871,16 +1871,70 @@
 d = id;%0A
+        this.view = view;%0A        this.model = model;%0A
     %7D%0A%0A 

Tidy up in EditPage constructor