diff --git a/po/POTFILES.in b/po/POTFILES.in
index 0bf4572..2bc5b83 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -311,6 +311,7 @@ src/gnome-utils/gnc-recurrence.c
 src/gnome-utils/gnc-splash.c
 src/gnome-utils/gnc-sx-instance-dense-cal-adapter.c
 src/gnome-utils/gnc-sx-list-tree-model-adapter.c
+src/gnome-utils/gnc-tree-control-split-reg.c
 src/gnome-utils/gnc-tree-model-account.c
 src/gnome-utils/gnc-tree-model-account-types.c
 src/gnome-utils/gnc-tree-model-budget.c
diff --git a/src/engine/Transaction.c b/src/engine/Transaction.c
index b0f7a66..51a833f 100644
--- a/src/engine/Transaction.c
+++ b/src/engine/Transaction.c
@@ -1021,36 +1021,42 @@ xaccTransGetAccountAmount (const Transaction *trans, const Account *acc)
 gboolean
 xaccTransGetRateForCommodity(const Transaction *trans,
                              const gnc_commodity *split_com,
-                             const Split *split_to_exclude, gnc_numeric *rate)
+                             const Split *split, gnc_numeric *rate)
 {
     GList *splits;
     gnc_commodity *trans_curr;
 
-    trans_curr = xaccTransGetCurrency(trans);
-    if (gnc_commodity_equal(trans_curr, split_com)) {
+    trans_curr = xaccTransGetCurrency (trans);
+    if (gnc_commodity_equal (trans_curr, split_com))
+    {
         if (rate) 
-            *rate = gnc_numeric_create(1, 1);
+            *rate = gnc_numeric_create (1, 1);
         return TRUE;
     }
 
-    for (splits = trans->splits; splits; splits = splits->next) {
+    for (splits = trans->splits; splits; splits = splits->next)
+    {
         Split *s = splits->data;
         gnc_commodity *comm;
 
-        if (s == split_to_exclude) continue;
-        if (!xaccTransStillHasSplit(trans, s)) continue;
+        if (!xaccTransStillHasSplit (trans, s)) continue;
 
-        comm = xaccAccountGetCommodity(xaccSplitGetAccount(s));
-        if (gnc_commodity_equal(split_com, comm)) {
-            gnc_numeric amt = xaccSplitGetAmount(s);
-            gnc_numeric val = xaccSplitGetValue(s);
-
-            if (!gnc_numeric_zero_p(xaccSplitGetValue(s)) &&
-                !gnc_numeric_zero_p(xaccSplitGetValue(s))) {
-                if (rate) 
-                    *rate = gnc_numeric_div(amt, val, GNC_DENOM_AUTO,
-                                            GNC_HOW_DENOM_REDUCE);
-                return TRUE;
+        if (s == split)
+        {
+            comm = xaccAccountGetCommodity (xaccSplitGetAccount(s));
+            if (gnc_commodity_equal (split_com, comm))
+            {
+                gnc_numeric amt = xaccSplitGetAmount (s);
+                gnc_numeric val = xaccSplitGetValue (s);
+
+                if (!gnc_numeric_zero_p (xaccSplitGetAmount (s)) &&
+                    !gnc_numeric_zero_p (xaccSplitGetValue (s)))
+                {
+                    if (rate) 
+                        *rate = gnc_numeric_div (amt, val, GNC_DENOM_AUTO,
+                                                GNC_HOW_DENOM_REDUCE);
+                    return TRUE;
+                }
             }
         }
     }
@@ -1983,6 +1989,14 @@ xaccTransGetDate (const Transaction *trans)
     return trans ? trans->date_posted.tv_sec : 0;
 }
 
+/*################## Added for Reg2 #################*/
+time64
+xaccTransGetDateEntered (const Transaction *trans)
+{
+    return trans ? trans->date_entered.tv_sec : 0;
+}
+/*################## Added for Reg2 #################*/
+
 void
 xaccTransGetDatePostedTS (const Transaction *trans, Timespec *ts)
 {
diff --git a/src/engine/Transaction.h b/src/engine/Transaction.h
index 6885798..9df4584 100644
--- a/src/engine/Transaction.h
+++ b/src/engine/Transaction.h
@@ -560,6 +560,11 @@ Timespec      xaccTransRetDatePostedTS (const Transaction *trans);
     the date when this transaction was posted at the bank. */
 GDate      xaccTransGetDatePostedGDate (const Transaction *trans);
 
+/*################## Added for Reg2 #################*/
+/** Retrieve the date of when the transaction was entered. The entered
+ * date is the date when the register entry was made.*/
+time64        xaccTransGetDateEntered (const Transaction *trans);
+/*################## Added for Reg2 #################*/
 /** Retrieve the date of when the transaction was entered. The entered
  * date is the date when the register entry was made.*/
 void          xaccTransGetDateEnteredTS (const Transaction *trans, Timespec *ts);
diff --git a/src/gnome-utils/Makefile.am b/src/gnome-utils/Makefile.am
index cf656ba..a0e7ef2 100644
--- a/src/gnome-utils/Makefile.am
+++ b/src/gnome-utils/Makefile.am
@@ -83,6 +83,7 @@ libgncmod_gnome_utils_la_SOURCES = \
   gnc-splash.c \
   gnc-sx-instance-dense-cal-adapter.c \
   gnc-sx-list-tree-model-adapter.c \
+  gnc-tree-control-split-reg.c \
   gnc-tree-model.c \
   gnc-tree-model-account-types.c \
   gnc-tree-model-account.c \
@@ -160,6 +161,7 @@ gncinclude_HEADERS = \
   gnc-splash.h \
   gnc-sx-instance-dense-cal-adapter.h \
   gnc-sx-list-tree-model-adapter.h \
+  gnc-tree-control-split-reg.h \
   gnc-tree-model.h \
   gnc-tree-model-account-types.h \
   gnc-tree-model-account.h \
diff --git a/src/gnome-utils/dialog-transfer.c b/src/gnome-utils/dialog-transfer.c
index edd45d8..86c8f1c 100644
--- a/src/gnome-utils/dialog-transfer.c
+++ b/src/gnome-utils/dialog-transfer.c
@@ -1689,6 +1689,7 @@ gnc_xfer_dialog_fetch (GtkButton *button, XferDialog *xferData)
     SCM quotes_func;
     SCM book_scm;
     SCM scm_window;
+    gboolean have_price = FALSE;
 
     g_return_if_fail (xferData);
 
@@ -1730,6 +1731,22 @@ gnc_xfer_dialog_fetch (GtkButton *button, XferDialog *xferData)
         rate = gnc_price_get_value (prc);
         gnc_amount_edit_set_amount(GNC_AMOUNT_EDIT(xferData->price_edit), rate);
         gnc_price_unref (prc);
+        have_price = TRUE;
+    }
+
+    /* Lets try reversing the commodities */
+    if(!have_price)
+    {
+        prc = gnc_pricedb_lookup_latest (xferData->pricedb, to, from);
+        if (prc)
+        {
+            rate = gnc_numeric_div (gnc_numeric_create (1, 1), gnc_price_get_value (prc),
+                                 GNC_DENOM_AUTO, GNC_HOW_DENOM_REDUCE);
+
+            gnc_amount_edit_set_amount(GNC_AMOUNT_EDIT(xferData->price_edit), rate);
+            gnc_price_unref (prc);
+            have_price = TRUE;
+        }
     }
 
     LEAVE("quote retrieved");
diff --git a/src/gnome-utils/gnc-tree-model-split-reg.c b/src/gnome-utils/gnc-tree-model-split-reg.c
index ece9a84..0510bb2 100644
--- a/src/gnome-utils/gnc-tree-model-split-reg.c
+++ b/src/gnome-utils/gnc-tree-model-split-reg.c
@@ -1,6 +1,6 @@
 /********************************************************************\
  * gnc-tree-model-split-reg.c -- GtkTreeView implementation to      *
- *                     display registers   in a GtkTreeView.        *
+ *                       display registers in a GtkTreeView.        *
  *                                                                  *
  * Copyright (C) 2012 Robert Fewell                                 *
  * Copyright (C) 2006-2007 Chris Shoemaker <c.shoemaker@cox.net>    *
@@ -49,12 +49,14 @@
 /* Signal codes */
 enum
 {
-    REFRESH_SIGNAL,
+    REFRESH_VIEW,
+    REFRESH_STATUS_BAR,
+    TRANS_DELETE,
     LAST_SIGNAL
 };
 
 /** Static Globals *******************************************************/
-static QofLogModule log_module = GNC_MOD_GUI;
+static QofLogModule log_module = GNC_MOD_LEDGER;
 
 /** Declarations *********************************************************/
 static void gnc_tree_model_split_reg_class_init (GncTreeModelSplitRegClass *klass);
@@ -81,7 +83,7 @@ static gboolean	gnc_tree_model_split_reg_iter_has_child (GtkTreeModel *tree_mode
 static int gnc_tree_model_split_reg_iter_n_children (GtkTreeModel *tree_model, GtkTreeIter *iter);
 static gboolean	gnc_tree_model_split_reg_iter_nth_child (GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *parent, int n);
 static gboolean	gnc_tree_model_split_reg_iter_parent (GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *child);
-static void increment_stamp (GncTreeModelSplitReg *model);
+static void gtm_increment_stamp (GncTreeModelSplitReg *model);
 
 /** Component Manager Callback ******************************************/
 static void gnc_tree_model_split_reg_event_handler (QofInstance *entity, QofEventId event_type, GncTreeModelSplitReg *model, GncEventData *ed);
@@ -103,7 +105,8 @@ struct GncTreeModelSplitRegPrivate
     GList *bsplit_parent_node;  // this equals the tnode of the transaction with the blank split
 
 
-    gboolean include_subacc;    //FIXME this is just placed here as the QOF Event is testing for it
+    gboolean display_subacc;    // Are we displaying subaccounts
+    gboolean display_gl;        // Is this the General ledger
 
 
 
@@ -113,10 +116,10 @@ struct GncTreeModelSplitRegPrivate
     GncGUID template_account;
 
     /* User data for users of SplitRegisters */
-    gpointer user_data;
+    gpointer user_data; //FIXME This is used to get parent window, maybe move to view
 
     /* hook to get parent widget */
-    SRGetParentCallback2 get_parent;
+    SRGetParentCallback2 get_parent; //FIXME This is used to get parent window, maybe move to view
 
 /* ^^^^ #### This is stuff I have dumped here from old reg #### ^^^^ */
 
@@ -130,16 +133,18 @@ struct GncTreeModelSplitRegPrivate
 };
 
 
+/* Define some background colors for the rows */
 #define GREENROW "#BFDEB9"
 #define TANROW "#F6FFDA"
 #define SPLITROW "#EDE7D3"
 #define YELLOWROW "#FFEF98"
 
 
-#define TROW1 0x1
-#define TROW2 0x2
-#define SPLIT 0x4
-#define BLANK 0x8
+
+#define TROW1 0x1 // Transaction row 1 depth 1
+#define TROW2 0x2 // Transaction row 2 depth 2
+#define SPLIT 0x4 // Split row         depth 3
+#define BLANK 0x8 // Blank tow
 #define IS_TROW1(x) (GPOINTER_TO_INT((x)->user_data) & TROW1)
 #define IS_TROW2(x) (GPOINTER_TO_INT((x)->user_data) & TROW2)
 #define IS_BLANK(x) (GPOINTER_TO_INT((x)->user_data) & BLANK)
@@ -148,12 +153,13 @@ struct GncTreeModelSplitRegPrivate
 #define IS_BLANK_TRANS(x) (IS_BLANK(x) && !IS_SPLIT(x))
 /* Meaning of user_data fields in iter struct:
  *
- * user_data:  a bitfield for BLANK, SPLIT, TROW1, TROW2
+ * user_data:  a bitfield for TROW1, TROW2, SPLIT, BLANK
  * user_data2: a pointer to a node in a GList of Transactions               
  * user_data3: a pointer to a node in a GList of Splits.
  *            
  */
 
+
 /*FIXME This is the original define 
 #define VALID_ITER(model, iter) \
     (GNC_IS_TREE_MODEL_TRANSACTION(model) &&                            \
@@ -174,6 +180,24 @@ struct GncTreeModelSplitRegPrivate
    (!IS_SPLIT (iter) && (iter).user_data2) || (IS_BLANK_TRANS (iter) && (iter).user_data3 == NULL)))
 
 
+/* Used in the sort functions */
+gboolean
+gnc_tree_model_split_reg_is_blank_trans (GncTreeModelSplitReg *model, GtkTreeIter *iter)
+{
+
+
+//g_print("\nIter is %s\n", iter_to_string (iter));
+//g_print("Path for iter is %s\n", gtk_tree_path_to_string (gnc_tree_model_split_reg_get_path (GTK_TREE_MODEL (model), iter)));
+
+//g_print("iter is blank %d\n", IS_BLANK_TRANS (iter));
+
+
+
+    return IS_BLANK_TRANS (iter);
+}
+
+
+/* Validate the iter */
 static gboolean
 gtm_valid_iter (GncTreeModelSplitReg *model, GtkTreeIter *iter)
 {
@@ -186,8 +210,9 @@ gtm_valid_iter (GncTreeModelSplitReg *model, GtkTreeIter *iter)
 }
 
 
+/* Make an iter from the given parameters */
 static GtkTreeIter
-make_iter (GncTreeModelSplitReg *model, gint f, GList *tnode, GList *snode)
+gtm_make_iter (GncTreeModelSplitReg *model, gint f, GList *tnode, GList *snode)
 {
     GtkTreeIter iter, *iter_p;
     iter_p = &iter;
@@ -272,17 +297,38 @@ gnc_tree_model_split_reg_class_init (GncTreeModelSplitRegClass *klass)
     o_class->finalize = gnc_tree_model_split_reg_finalize;
     o_class->dispose = gnc_tree_model_split_reg_dispose;
 
-    gnc_tree_model_split_reg_signals[REFRESH_SIGNAL] =
-        g_signal_new("refresh_signal",
+    gnc_tree_model_split_reg_signals[REFRESH_VIEW] =
+        g_signal_new("refresh_view",
                      G_TYPE_FROM_CLASS (o_class),
                      G_SIGNAL_RUN_LAST,
-                     G_STRUCT_OFFSET (GncTreeModelSplitRegClass, refresh_signal),
+                     G_STRUCT_OFFSET (GncTreeModelSplitRegClass, refresh_view),
                      NULL, NULL,
                      g_cclosure_marshal_VOID__VOID,
                      G_TYPE_NONE, 0);
 
-    klass->refresh_signal = NULL;
+    gnc_tree_model_split_reg_signals[REFRESH_STATUS_BAR] =
+        g_signal_new("refresh_status_bar",
+                     G_TYPE_FROM_CLASS (o_class),
+                     G_SIGNAL_RUN_LAST,
+                     G_STRUCT_OFFSET (GncTreeModelSplitRegClass, refresh_status_bar),
+                     NULL, NULL,
+                     g_cclosure_marshal_VOID__VOID,
+                     G_TYPE_NONE, 0);
 
+    gnc_tree_model_split_reg_signals[TRANS_DELETE] =
+        g_signal_new("trans_delete",
+                     G_TYPE_FROM_CLASS (o_class),
+                     G_SIGNAL_RUN_FIRST,
+                     G_STRUCT_OFFSET (GncTreeModelSplitRegClass, trans_delete),
+                     NULL, NULL,
+                     g_cclosure_marshal_VOID__POINTER,
+                     G_TYPE_NONE,
+                     1,
+                     G_TYPE_POINTER);
+
+    klass->refresh_view = NULL;
+    klass->refresh_status_bar = NULL;
+    klass->trans_delete = NULL;
 }
 
 
@@ -328,10 +374,10 @@ gnc_tree_model_split_reg_init (GncTreeModelSplitReg *model)
 
     model->priv = g_new0 (GncTreeModelSplitRegPrivate, 1);
 
-    gnc_gconf_general_register_cb(KEY_ACCOUNTING_LABELS,
+    gnc_gconf_general_register_cb (KEY_ACCOUNTING_LABELS,
                                   gnc_tree_model_split_reg_gconf_changed,
                                   model);
-    gnc_gconf_general_register_cb(KEY_ACCOUNT_SEPARATOR,
+    gnc_gconf_general_register_cb (KEY_ACCOUNT_SEPARATOR,
                                   gnc_tree_model_split_reg_gconf_changed,
                                   model);
     LEAVE(" ");
@@ -343,12 +389,12 @@ gnc_tree_model_split_reg_finalize (GObject *object)
 {
     GncTreeModelSplitReg *model;
 
-    ENTER("model %p", object);
+    ENTER("model split reg %p", object);
     g_return_if_fail (object != NULL);
     g_return_if_fail (GNC_IS_TREE_MODEL_SPLIT_REG (object));
 //g_print("gnc_tree_model_split_reg_finalize\n");
-    model = GNC_TREE_MODEL_SPLIT_REG (object);
 
+    model = GNC_TREE_MODEL_SPLIT_REG (object);
 
     if (G_OBJECT_CLASS (parent_class)->finalize)
         G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -363,7 +409,7 @@ gnc_tree_model_split_reg_dispose (GObject *object)
     GncTreeModelSplitReg *model;
 
 //g_print("gnc_tree_model_split_reg_dispose\n");
-    ENTER("model %p", object);
+    ENTER("model split reg %p", object);
     g_return_if_fail (object != NULL);
     g_return_if_fail (GNC_IS_TREE_MODEL_SPLIT_REG (object));
 
@@ -400,6 +446,7 @@ gnc_tree_model_split_reg_dispose (GObject *object)
 /************************************************************/
 /*                   New Model Creation                     */
 /************************************************************/
+/* Create a new tree model */
 GncTreeModelSplitReg *
 gnc_tree_model_split_reg_new (SplitRegisterType2 reg_type, SplitRegisterStyle2 style,
                         gboolean use_double_line, gboolean is_template)
@@ -416,6 +463,8 @@ g_print("gnc_tree_model_split_reg_new and Model pointer is %p\n", model);
 
     priv = model->priv;
     priv->book = gnc_get_current_book();
+    priv->display_gl = FALSE;
+    priv->display_subacc = FALSE;
 
     model->type = reg_type;
     model->style = style;
@@ -431,8 +480,7 @@ g_print("gnc_tree_model_split_reg_new and Model pointer is %p\n", model);
 
     /* Setup some config entries */
     model->use_accounting_labels = gnc_gconf_get_bool (GCONF_GENERAL, KEY_ACCOUNTING_LABELS, NULL);
-    model->use_colors = gnc_gconf_get_bool (GCONF_GENERAL_REGISTER, "use_theme_colors", NULL);
-/*    model->use_double_line = gnc_gconf_get_bool (GCONF_GENERAL_REGISTER, "double_line_mode", NULL); */
+    model->use_theme_colors = gnc_gconf_get_bool (GCONF_GENERAL_REGISTER, "use_theme_colors", NULL);
     model->alt_colors_by_txn = gnc_gconf_get_bool (GCONF_GENERAL_REGISTER, "alternate_color_by_transaction", NULL);
     model->read_only = FALSE;
 
@@ -443,7 +491,6 @@ g_print("gnc_tree_model_split_reg_new and Model pointer is %p\n", model);
     priv->num_list = gtk_list_store_new (1, G_TYPE_STRING);
     priv->numact_list = gtk_list_store_new (1, G_TYPE_STRING);
 
-
     priv->event_handler_id = qof_event_register_handler
                              ((QofEventHandler)gnc_tree_model_split_reg_event_handler, model);
 
@@ -452,8 +499,9 @@ g_print("gnc_tree_model_split_reg_new and Model pointer is %p\n", model);
 }
 
 
+/* ForEach function to remove all model entries */
 static gboolean
-remove_foreach_func (GtkTreeModel *model,
+gtm_remove_foreach_func (GtkTreeModel *model,
               GtkTreePath  *path,
               GtkTreeIter  *iter,
               GList       **rowref_list)
@@ -467,13 +515,15 @@ remove_foreach_func (GtkTreeModel *model,
     return FALSE; /* do not stop walking the store, call us with next row */
 }
 
+
+/* Remove all model entries */
 static void
-gtv_remove_all_rows (GncTreeModelSplitReg *model)
+gtm_remove_all_rows (GncTreeModelSplitReg *model)
 {
     GList *rr_list = NULL;    /* list of GtkTreeRowReferences to remove */
     GList *node;
 
-    gtk_tree_model_foreach (GTK_TREE_MODEL(model), (GtkTreeModelForeachFunc)remove_foreach_func, &rr_list);
+    gtk_tree_model_foreach (GTK_TREE_MODEL(model), (GtkTreeModelForeachFunc)gtm_remove_foreach_func, &rr_list);
 
     rr_list = g_list_reverse (rr_list);
 
@@ -494,57 +544,57 @@ gtv_remove_all_rows (GncTreeModelSplitReg *model)
 }
 
 
+/* Load the model with unique transactions based on a GList of splits */
 void
 gnc_tree_model_split_reg_load (GncTreeModelSplitReg *model, GList *slist, Account *default_account)
 {
     GncTreeModelSplitRegPrivate *priv;
-    GList *tlist;
-    gint no_rows = 0;
 
-    ENTER("Load Model");
+    ENTER("Load ModelSplitReg = %p and slist length is %d", model, g_list_length (slist));
 
     priv = model->priv;
 
     /* Clear the treeview */
-    gtv_remove_all_rows (model);
+    gtm_remove_all_rows (model);
     priv->tlist = NULL;
 
 g_print("Model load pointer is %p and slist length is %d\n", model, g_list_length (slist));
 
     /* Get a list of Unique Transactions from an slist */
-    tlist = xaccSplitListGetUniqueTransactions (slist);
+    priv->tlist = xaccSplitListGetUniqueTransactions (slist);
+
+    /* Add the blank transaction to the tlist */
+    priv->tlist = g_list_append (priv->tlist, priv->btrans);
 
     /* Update the completion model liststores */
     gnc_tree_model_split_reg_update_completion (model);
 
-    /* Add the blank transaction to the tlist */
-    tlist = g_list_append (tlist, priv->btrans);
-
     priv->anchor = default_account;
     priv->bsplit_parent_node = NULL;
-    priv->tlist = tlist;
 
     LEAVE("Leave Model Load");
 }
 
 
+/*FIXME Not sure about this */
 void
 gnc_tree_model_split_reg_set_template_account (GncTreeModelSplitReg *model, Account *template_account)
 {
     GncTreeModelSplitRegPrivate *priv;
 
-g_print("gnc_tree_model_split_reg_set_template_account\n");
+//g_print("gnc_tree_model_split_reg_set_template_account\n");
     priv = model->priv;
     priv->template_account = *xaccAccountGetGUID (template_account);
 }
 
 
+/* Destroy the model */
 void
 gnc_tree_model_split_reg_destroy (GncTreeModelSplitReg *model)
 {
 
-    ENTER("reg=%p", model);
-g_print("gnc_tree_model_split_reg_destroy\n");
+    ENTER("ModelSplitReg = %p", model);
+//g_print("gnc_tree_model_split_reg_destroy - remove two gconfs\n");
 
     gnc_gconf_general_remove_cb (KEY_ACCOUNTING_LABELS,
                                 gnc_tree_model_split_reg_gconf_changed,
@@ -556,13 +606,14 @@ g_print("gnc_tree_model_split_reg_destroy\n");
 }
 
 
+/* Setup the data to obtain the parent window */
 void
 gnc_tree_model_split_reg_set_data (GncTreeModelSplitReg *model, gpointer user_data,
                                   SRGetParentCallback2 get_parent)
 {
     GncTreeModelSplitRegPrivate *priv;
-g_print("gnc_tree_model_split_reg_set_data user_data %p\n", user_data);
-/*FIXME Not sure if this is needed or what it is for */
+//g_print("gnc_tree_model_split_reg_set_data user_data %p\n", user_data);
+/*FIXME This is used to get the parent window, mabe move to view */
     priv = model->priv;
 
     priv->user_data = user_data;
@@ -570,11 +621,12 @@ g_print("gnc_tree_model_split_reg_set_data user_data %p\n", user_data);
 }
 
 
+/* Update the config of this model */
 void
 gnc_tree_model_split_reg_config (GncTreeModelSplitReg *model, SplitRegisterType2 newtype,
                                  SplitRegisterStyle2 newstyle, gboolean use_double_line)
 {
-g_print("gnc_tree_model_split_reg_config\n");
+//g_print("gnc_tree_model_split_reg_config\n");
 
     model->type = newtype;
 
@@ -585,22 +637,6 @@ g_print("gnc_tree_model_split_reg_config\n");
     model->use_double_line = use_double_line;
 }
 
-/* Returns a Split that matches the current Account */
-static Split *
-get_account_split (GncTreeModelSplitReg *model, Transaction *trans)
-{
-    int i;
-    Split *split = NULL;
-    Account *anchor = model->priv->anchor;
-
-    for (i = 0; (split = xaccTransGetSplit (trans, i)); i++) {
-        if (anchor == xaccSplitGetAccount (split))
-            return split;
-    }
-    return NULL;
-}
-
-
 /************************************************************/
 /*        Gnc Tree Model Debugging Utility Function         */
 /************************************************************/
@@ -713,8 +749,6 @@ gnc_tree_model_split_reg_get_column_type (GtkTreeModel *tree_model, int index)
     case GNC_TREE_MODEL_SPLIT_REG_COL_DESCNOTES:
     case GNC_TREE_MODEL_SPLIT_REG_COL_TRANSVOID:
     case GNC_TREE_MODEL_SPLIT_REG_COL_RECN:
-
-    case GNC_TREE_MODEL_SPLIT_REG_COL_COLOR:
         return G_TYPE_STRING;
 
     case GNC_TREE_MODEL_SPLIT_REG_COL_RO:
@@ -734,10 +768,10 @@ gnc_tree_model_split_reg_get_iter (GtkTreeModel *tree_model,
 {
     /* Sets iter to a valid iterator pointing to path. */
     GncTreeModelSplitReg *model = GNC_TREE_MODEL_SPLIT_REG (tree_model);
-    Account *account;
     GList *tnode;
     SplitList *slist;
     GList *snode;
+    Split *split;
     gint depth, *indices, flags = 0;
 
     g_return_val_if_fail (GNC_IS_TREE_MODEL_SPLIT_REG (tree_model), FALSE);
@@ -748,8 +782,6 @@ gnc_tree_model_split_reg_get_iter (GtkTreeModel *tree_model,
         g_free (path_string);
     }
 
-    account = model->priv->anchor;
-
     depth = gtk_tree_path_get_depth (path);
 
     indices = gtk_tree_path_get_indices (path);
@@ -772,14 +804,11 @@ gnc_tree_model_split_reg_get_iter (GtkTreeModel *tree_model,
         }
         else
         {
-            if (account != NULL)
-            {
-                Split *split = get_account_split (model, tnode->data); // get account split
-                snode = g_list_find (slist, split);
-            }
-            else
-                snode = g_list_nth (slist, 0); // else first split
+            split = xaccTransGetSplit (tnode->data, 0); // else first split
+            snode = g_list_find (slist, split);
         }
+
+
     }
     else if (depth == 2) { /* Trans Row 2 */
         flags = TROW2;
@@ -790,13 +819,8 @@ gnc_tree_model_split_reg_get_iter (GtkTreeModel *tree_model,
         }
         else
         {
-            if (account != NULL)
-            {
-                Split *split = get_account_split (model, tnode->data); // get account split
-                snode = g_list_find (slist, split);
-            }
-            else
-                snode = g_list_nth (slist, 0); // else first split
+            split = xaccTransGetSplit (tnode->data, 0); // else first split
+            snode = g_list_find (slist, split);
         }
     }
     else if (depth == 3) /* Split */
@@ -810,7 +834,10 @@ gnc_tree_model_split_reg_get_iter (GtkTreeModel *tree_model,
             snode = model->priv->bsplit_node;
         }
         else
-            snode = g_list_nth (slist, indices[2]);
+        {
+            split = xaccTransGetSplit (tnode->data, indices[2]);
+            snode = g_list_find (slist, split);
+        }
 
         if (!snode) {
             DEBUG("path index off end of slist");
@@ -823,7 +850,7 @@ gnc_tree_model_split_reg_get_iter (GtkTreeModel *tree_model,
         goto fail;
     }
 
-    *iter = make_iter (model, flags, tnode, snode);
+    *iter = gtm_make_iter (model, flags, tnode, snode);
 /*    g_assert(VALID_ITER(model, iter)); */
     LEAVE("True");
     return TRUE;
@@ -843,7 +870,6 @@ gnc_tree_model_split_reg_get_path (GtkTreeModel *tree_model, GtkTreeIter *iter)
     GtkTreePath *path;
     gint tpos, spos;
     GList *tnode, *snode;
-    GList *slist;
 
     g_return_val_if_fail (GNC_IS_TREE_MODEL_SPLIT_REG (model), NULL);
 
@@ -854,7 +880,6 @@ gnc_tree_model_split_reg_get_path (GtkTreeModel *tree_model, GtkTreeIter *iter)
 
     tnode = iter->user_data2;
 
-    slist = xaccTransGetSplitList (tnode->data);
     snode = iter->user_data3;
 
     /* Level 1 */
@@ -878,10 +903,15 @@ gnc_tree_model_split_reg_get_path (GtkTreeModel *tree_model, GtkTreeIter *iter)
             spos = xaccTransCountSplits (tnode->data);
         }
         else
-            spos = g_list_position (slist, snode);
+        {
+            /* Can not use snode position directly as slist length does not follow
+               number of splits exactly, especailly if you delete a split */
+            spos = xaccTransGetSplitIndex (tnode->data, snode->data);
+        }
 
         if (spos == -1)
             goto fail;
+
         gtk_tree_path_append_index (path, 0); /* Add the Level 2 part */
         gtk_tree_path_append_index (path, spos);
     }
@@ -899,7 +929,6 @@ gnc_tree_model_split_reg_get_path (GtkTreeModel *tree_model, GtkTreeIter *iter)
 }
 
 
-
 /* Return TRUE if this row should be marked read only */
 static gboolean
 gtm_get_read_only (GncTreeModelSplitReg *model, Transaction *trans)
@@ -929,14 +958,15 @@ gtm_get_read_only (GncTreeModelSplitReg *model, Transaction *trans)
     return FALSE;
 }
 
+
 /* Returns the row color */
-static gchar*
-gtm_get_row_color (GncTreeModelSplitReg *model, gboolean is_trow1, gboolean is_trow2, gboolean is_split, gint num)
+gchar*
+gnc_tree_model_split_reg_get_row_color (GncTreeModelSplitReg *model, gboolean is_trow1, gboolean is_trow2, gboolean is_split, gint num)
 {
 
     gchar *cell_color = NULL;
 
-    if(!model->use_colors)
+    if(!model->use_theme_colors)
     {
         if(model->use_double_line)
         {
@@ -1029,10 +1059,6 @@ gnc_tree_model_split_reg_get_value (GtkTreeModel *tree_model,
     case GNC_TREE_MODEL_SPLIT_REG_COL_DUEDATE:
         break;
 
-    case GNC_TREE_MODEL_SPLIT_REG_COL_COLOR:
-            g_value_set_string (value, gtm_get_row_color (model, IS_TROW1 (iter), IS_TROW2 (iter), IS_SPLIT (iter), indices[0]));
-        break;
-
     case GNC_TREE_MODEL_SPLIT_REG_COL_NUMACT:
         break;
 
@@ -1065,8 +1091,8 @@ gnc_tree_model_split_reg_iter_next (GtkTreeModel *tree_model, GtkTreeIter *iter)
        If there is no next iter, FALSE is returned and iter is set to be
        invalid */
     GncTreeModelSplitReg *model = GNC_TREE_MODEL_SPLIT_REG (tree_model);
-    Account *account;
     Transaction *trans;
+    Split *split;
     SplitList *slist;
     GList *tnode = NULL, *snode = NULL;
     gint flags = 0;
@@ -1085,8 +1111,6 @@ gnc_tree_model_split_reg_iter_next (GtkTreeModel *tree_model, GtkTreeIter *iter)
         goto fail;
     }
 
-    account = model->priv->anchor;
-
     if (IS_TROW1 (iter)) {
         flags = TROW1;
         tnode = iter->user_data2;
@@ -1106,22 +1130,24 @@ gnc_tree_model_split_reg_iter_next (GtkTreeModel *tree_model, GtkTreeIter *iter)
         }
         else
         {
-            if (account != NULL)
-            {
-                Split *split = get_account_split (model, tnode->data); // get account split
-                snode = g_list_find (slist, split);
-            }
-            else
-                snode = g_list_nth (slist, 0); // else first split
+            split = xaccTransGetSplit (tnode->data, 0);
+            snode = g_list_find (slist, split);
         }
     }
 
     if (IS_SPLIT (iter)) {
 
+        gint i = 0;
         flags = SPLIT;
         tnode = iter->user_data2;
+
+        slist = xaccTransGetSplitList (tnode->data);
         snode = iter->user_data3;
-        snode = g_list_next (snode);
+
+        i = xaccTransGetSplitIndex (tnode->data, snode->data);
+        i++;
+        split = xaccTransGetSplit (tnode->data, i);
+        snode = g_list_find (slist, split);
 
         if (!snode) {
             if (tnode == model->priv->bsplit_parent_node) {
@@ -1134,7 +1160,7 @@ gnc_tree_model_split_reg_iter_next (GtkTreeModel *tree_model, GtkTreeIter *iter)
         }
     }
 
-    *iter = make_iter (model, flags, tnode, snode);
+    *iter = gtm_make_iter (model, flags, tnode, snode);
     LEAVE("iter %s", iter_to_string (iter));
     return TRUE;
  fail:
@@ -1152,18 +1178,16 @@ gnc_tree_model_split_reg_iter_children (GtkTreeModel *tree_model,
        FALSE is returned and iter is set to be invalid. Parent will remain a valid
        node after this function has been called. */
     GncTreeModelSplitReg *model = GNC_TREE_MODEL_SPLIT_REG (tree_model);
-    Account *account;
     GList *tnode = NULL, *snode = NULL;
     gint flags = 0;
     Transaction *trans;
+    Split *split;
     SplitList *slist;
 
     g_return_val_if_fail (GNC_IS_TREE_MODEL_SPLIT_REG (tree_model), FALSE);
-    ENTER("model %p, iter %p (to be filed in), parent %s",
+    ENTER("model %p, iter %p , parent %s",
           tree_model, iter, (parent_iter ? iter_to_string(parent_iter) : "(null)"));
 
-    account = model->priv->anchor;
-
     if (!parent_iter)
     {
         /* Get the very first iter */
@@ -1179,17 +1203,12 @@ gnc_tree_model_split_reg_iter_children (GtkTreeModel *tree_model,
             }
             else
             {
-                if (account != NULL)
-                {
-                    Split *split = get_account_split (model, tnode->data); // get account split
-                    snode = g_list_find (slist, split);
-                }
-                else
-                    snode = g_list_nth (slist, 0); // else first split
+                split = xaccTransGetSplit (tnode->data, 0);
+                snode = g_list_find (slist, split);
             }
 
-            *iter = make_iter (model, flags, tnode, snode);
-            LEAVE("iter (2) %s", iter_to_string (iter));
+            *iter = gtm_make_iter (model, flags, tnode, snode);
+            LEAVE("Parent iter NULL, First iter is %s", iter_to_string (iter));
             return TRUE;
         }
         else
@@ -1214,13 +1233,8 @@ gnc_tree_model_split_reg_iter_children (GtkTreeModel *tree_model,
         }
         else
         {
-            if (account != NULL)
-            {
-                Split *split = get_account_split (model, tnode->data); // get account split
-                snode = g_list_find (slist, split);
-            }
-            else
-                snode = g_list_nth (slist, 0); // else first split
+            split = xaccTransGetSplit (tnode->data, 0);
+            snode = g_list_find (slist, split);
         }
     }
 
@@ -1228,38 +1242,34 @@ gnc_tree_model_split_reg_iter_children (GtkTreeModel *tree_model,
     {
         tnode = parent_iter->user_data2;
 
-        if ((tnode->data == model->priv->btrans) && (tnode != model->priv->bsplit_parent_node)) // blank trans has no splits to start with
+        if ((tnode->data == model->priv->btrans) && (tnode != model->priv->bsplit_parent_node)) // blank trans has no split to start with
+            goto fail;
+        else if ((tnode->data != model->priv->btrans) && (xaccTransCountSplits (tnode->data) == 0) && (tnode != model->priv->bsplit_parent_node)) // trans has no splits after trans reinit.
             goto fail;
-    }
-
-    if (IS_TROW2 (parent_iter))
-    {
-        flags = SPLIT;
-        tnode = parent_iter->user_data2;
-        slist = xaccTransGetSplitList (tnode->data);
-
-        if ((tnode->data == model->priv->btrans) && (tnode == model->priv->bsplit_parent_node))
-        {
-            flags |= BLANK;
-            snode = model->priv->bsplit_node;
-        }
         else
-        {
-            if (account != NULL)
+        { 
+            flags = SPLIT;
+            tnode = parent_iter->user_data2;
+            slist = xaccTransGetSplitList (tnode->data);
+
+            if (((tnode->data == model->priv->btrans) || (xaccTransCountSplits (tnode->data) == 0)) && (tnode == model->priv->bsplit_parent_node))
             {
-                Split *split = get_account_split (model, tnode->data); // get account split
-                snode = g_list_find (slist, split);
+                flags |= BLANK;
+                snode = model->priv->bsplit_node;
             }
             else
-                snode = g_list_nth (slist, 0); // else first split
+            {
+                split = xaccTransGetSplit (tnode->data, 0);
+                snode = g_list_find (slist, split);
+            }
         }
     }
 
     if (IS_SPLIT (parent_iter)) // Splits do not have children
         goto fail;
 
-    *iter = make_iter (model, flags, tnode, snode);
-    LEAVE("iter %s", iter_to_string (iter));
+    *iter = gtm_make_iter (model, flags, tnode, snode);
+    LEAVE("First Child iter is %s", iter_to_string (iter));
     return TRUE;
  fail:
     LEAVE("iter has no children");
@@ -1273,20 +1283,40 @@ gnc_tree_model_split_reg_iter_has_child (GtkTreeModel *tree_model, GtkTreeIter *
 {
     /* Returns TRUE if iter has children, FALSE otherwise. */
     GncTreeModelSplitReg *model = GNC_TREE_MODEL_SPLIT_REG (tree_model);
+    GList *tnode;
 
     g_return_val_if_fail (GNC_IS_TREE_MODEL_SPLIT_REG (tree_model), FALSE);
 
     ENTER("model %p, iter %s", tree_model, iter_to_string (iter));
 
-    if (IS_TROW1 (iter))
+    tnode = iter->user_data2; 
+
+    if (IS_TROW1 (iter)) //Normal Transaction TROW1
     {
         LEAVE ("Transaction Row 1 is yes");
         return TRUE;
     }
 
-    if (IS_TROW2 (iter))
+    if (IS_TROW2 (iter) && !(IS_BLANK (iter))) //Normal Transaction TROW2
+    {
+        if (xaccTransCountSplits (tnode->data) != 0) // with splits
+	{
+            LEAVE ("Transaction Row 2 is yes");
+            return TRUE;
+        }
+        else
+        {
+            if (tnode == model->priv->bsplit_parent_node) // with no splits, just blank split
+	    {
+                LEAVE ("Transaction Row 2 is yes, blank split");
+                return TRUE;
+            }
+        }
+    }
+
+    if (IS_TROW2 (iter) && IS_BLANK (iter) && (tnode == model->priv->bsplit_parent_node)) //Blank Transaction TROW2
     {
-        LEAVE ("Transaction Row 2 is yes");
+        LEAVE ("Blank Transaction Row 2 is yes");
         return TRUE;
     }
 
@@ -1342,8 +1372,8 @@ gnc_tree_model_split_reg_iter_nth_child (GtkTreeModel *tree_model,
 {
     /* Sets iter to be the n'th child of parent, using the given index. 0 > */
     GncTreeModelSplitReg *model = GNC_TREE_MODEL_SPLIT_REG (tree_model);
-    Account *account;
     Transaction *trans;
+    Split *split;
     SplitList *slist;
     GList *tnode, *snode;
     gint flags = 0;
@@ -1351,8 +1381,6 @@ gnc_tree_model_split_reg_iter_nth_child (GtkTreeModel *tree_model,
     ENTER("model %p, iter %s, n %d", tree_model, iter_to_string (parent_iter), n);
     g_return_val_if_fail (GNC_IS_TREE_MODEL_SPLIT_REG (tree_model), FALSE);
 
-    account = model->priv->anchor;
-
     if (parent_iter == NULL) {  /* Top-level */
         flags = TROW1;
         tnode = g_list_nth (model->priv->tlist, n);
@@ -1372,21 +1400,15 @@ gnc_tree_model_split_reg_iter_nth_child (GtkTreeModel *tree_model,
         }
         else
         {
-            if (account != NULL)
-            {
-                Split *split = get_account_split (model, tnode->data); // get account split
-                snode = g_list_find (slist, split);
-            }
-            else
-                snode = g_list_nth (slist, 0); // else first split
+            split = xaccTransGetSplit (tnode->data, 0);
+            snode = g_list_find (slist, split);
         }
 
-        *iter = make_iter (model, flags, tnode, snode);
+        *iter = gtm_make_iter (model, flags, tnode, snode);
         LEAVE ("iter (2) %s", iter_to_string (iter));
         return TRUE;
     }
 
-    DEBUG("parent iter %s", iter_to_string (parent_iter));
 /*    g_assert(VALID_ITER(model, parent_iter)); */
 
     if (IS_SPLIT (parent_iter))
@@ -1416,7 +1438,7 @@ gnc_tree_model_split_reg_iter_nth_child (GtkTreeModel *tree_model,
         {
             snode = NULL;
         }
-        else if ((tnode == model->priv->bsplit_parent_node) && (xaccTransCountSplits(trans) == n))
+        else if ((tnode == model->priv->bsplit_parent_node) && (xaccTransCountSplits (trans) == n))
         {
             flags = SPLIT | BLANK;
             snode = model->priv->bsplit_node;
@@ -1425,11 +1447,12 @@ gnc_tree_model_split_reg_iter_nth_child (GtkTreeModel *tree_model,
         {
             flags = SPLIT;
             slist = xaccTransGetSplitList (trans);
-            snode = g_list_nth (slist, n);
+            split = xaccTransGetSplit (trans, n);
+            snode = g_list_find (slist, split);
         }
     }
 
-    *iter = make_iter (model, flags, tnode, snode);
+    *iter = gtm_make_iter (model, flags, tnode, snode);
     LEAVE("iter of child with index %u is %s", n, iter_to_string (iter));
     return TRUE;
  fail:
@@ -1471,7 +1494,7 @@ gnc_tree_model_split_reg_iter_parent (GtkTreeModel *tree_model,
     if (tnode->data == model->priv->btrans)
         flags |= BLANK;
 
-    *iter = make_iter (model, flags, tnode, snode);
+    *iter = gtm_make_iter (model, flags, tnode, snode);
     LEAVE("parent iter is %s", iter_to_string (iter));
     return TRUE;
  fail:
@@ -1481,16 +1504,17 @@ gnc_tree_model_split_reg_iter_parent (GtkTreeModel *tree_model,
 }
 
 
-/*###################################################################*/
-
+/*##########################################################################*/
+/* increment the stamp of the model */
 static void
-increment_stamp (GncTreeModelSplitReg *model)
+gtm_increment_stamp (GncTreeModelSplitReg *model)
 {
     do model->stamp++;
     while (model->stamp == 0);
 }
 
 
+/* Return these values based on the model and iter provided */
 gboolean
 gnc_tree_model_split_reg_get_split_and_trans (
     GncTreeModelSplitReg *model, GtkTreeIter *iter,
@@ -1548,7 +1572,12 @@ gnc_tree_model_split_reg_get_path_to_split_and_trans (GncTreeModelSplitReg *mode
     }
 
     if (trans == NULL && split != NULL)
-        trans = xaccSplitGetParent (split);
+    {
+        if (split == model->priv->bsplit)
+            trans = model->priv->bsplit_parent_node->data;
+        else
+            trans = xaccSplitGetParent (split);      
+    }
 
     if (trans != NULL)
     {
@@ -1559,21 +1588,23 @@ gnc_tree_model_split_reg_get_path_to_split_and_trans (GncTreeModelSplitReg *mode
         gtk_tree_path_append_index (path, tpos);
     }
 
-    if (trans == NULL && split != NULL)
+    if (split != NULL)
     {
         slist = xaccTransGetSplitList (trans);
         /* Level 3 */
-        spos = g_list_index (slist, split);
+        spos = xaccTransGetSplitIndex (trans, split);
         if (spos == -1)
         {
             if (model->priv->bsplit == split) // test for blank split
-                spos = g_list_length (slist);
+                spos = xaccTransCountSplits (trans);
             else
-                spos = 0;
+                spos = -1;
         }
         gtk_tree_path_append_index (path, 0); /* Level 2 */
-        gtk_tree_path_append_index (path, spos);
+        if (spos != -1)
+            gtk_tree_path_append_index (path, spos);
     }
+
     return path;
 }
 
@@ -1592,7 +1623,7 @@ gnc_tree_model_split_reg_get_iter_from_trans_and_split (
     g_return_val_if_fail (GNC_IS_TREE_MODEL_SPLIT_REG (model), FALSE);
     g_return_val_if_fail (iter1, FALSE);
     g_return_val_if_fail (iter2, FALSE);
-
+    PINFO("get_iter model %p, trans %p, split %p\n", model, trans, split);
 //g_print("get_iter model %p, trans %p, split %p\n", model, trans, split);
 
     priv = model->priv;
@@ -1601,7 +1632,7 @@ gnc_tree_model_split_reg_get_iter_from_trans_and_split (
 
     if (trans && priv->book != xaccTransGetBook (trans)) return FALSE;
     if (split && priv->book != xaccSplitGetBook (split)) return FALSE;    
-    if (split && !xaccTransStillHasSplit(trans, split)) return FALSE;
+    if (split && !xaccTransStillHasSplit (trans, split)) return FALSE;
 
     tnode = g_list_find (priv->tlist, trans);
     if (!tnode) return FALSE;
@@ -1615,6 +1646,7 @@ gnc_tree_model_split_reg_get_iter_from_trans_and_split (
     if (split)
     {
         GList *slist = xaccTransGetSplitList (trans);
+//g_print("get_iter count splits for trans %p %d\n", trans, xaccTransCountSplits (trans));
         snode = g_list_find (slist, split);
         flags1 = SPLIT;
         if (!snode && split == (Split *) ((GList *)priv->bsplit_node)->data)
@@ -1625,92 +1657,111 @@ gnc_tree_model_split_reg_get_iter_from_trans_and_split (
         if (!snode) return FALSE;
     }
 
-    *iter1 = make_iter (model, flags1, tnode, snode);
-    *iter2 = make_iter (model, flags2, tnode, snode);
+    *iter1 = gtm_make_iter (model, flags1, tnode, snode);
+    *iter2 = gtm_make_iter (model, flags2, tnode, snode);
 
     return TRUE;
 }
 
 
+/* Return the blank split */
 Split *
 gnc_tree_model_split_get_blank_split (GncTreeModelSplitReg *model)
 {
     return model->priv->bsplit;
 }
 
-/*###################################################################*/
 
+/* Return the blank transaction */
+Transaction *
+gnc_tree_model_split_get_blank_trans (GncTreeModelSplitReg *model)
+{
+    return model->priv->btrans;
+}
+
+/*##########################################################################*/
+
+/* Update the parent when row changes made */
 static void
-update_parent (GncTreeModelSplitReg *model, GtkTreePath *path)
+gtm_update_parent (GncTreeModelSplitReg *model, GtkTreePath *path)
 {
     GList *tnode;
     GtkTreeIter iter;
 
-//g_print("update_parent - '%s'\n", gtk_tree_path_to_string (path));
+//g_print("gtm_update_parent - '%s'\n", gtk_tree_path_to_string (path));
 
+    ENTER(" ");
     if (gtk_tree_path_up (path) && gnc_tree_model_split_reg_get_iter (GTK_TREE_MODEL (model), &iter, path))
     {
+//g_print("gtm_update_parent row_changed - '%s'\n", gtk_tree_path_to_string (path));
         gtk_tree_model_row_changed (GTK_TREE_MODEL (model), path, &iter);
 
         tnode = iter.user_data2;
 
-        /* If this is the blank transaction, the only split will be deleteted, hence toggle has child */ 
+        /* If this is the blank transaction, the only split will be deleted, hence toggle has child */ 
         if (IS_BLANK_TRANS (&iter) && (tnode->data == model->priv->btrans) && (xaccTransCountSplits (model->priv->btrans) == 0))
         {
             gchar *path_string = gtk_tree_path_to_string (path);
             PINFO("toggling has_child at row %s\n", path_string);
             g_free (path_string);
-
-            increment_stamp (model);
+//g_print("gtm_update_parent toggle has child - '%s'\n", gtk_tree_path_to_string (path));
+            gtm_increment_stamp (model);
             gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (model), path, &iter);
         }
     }
+    LEAVE(" ");
 }
 
 
+/* Insert row at iter */
 static void
-insert_row_at (GncTreeModelSplitReg *model, GtkTreeIter *iter)
+gtm_insert_row_at (GncTreeModelSplitReg *model, GtkTreeIter *iter)
 {
     GtkTreePath *path;
-//g_print("insert_row_at\n");
+//g_print("gtm_insert_row_at\n");
 //    g_assert (VALID_ITER (model, iter));
+    ENTER(" ");
     path = gnc_tree_model_split_reg_get_path (GTK_TREE_MODEL (model), iter);
-//g_print("insert_row_at - Path is '%s'\n", gtk_tree_path_to_string (path));
+//g_print("gtm_insert_row_at - Path is '%s'\n", gtk_tree_path_to_string (path));
     if (!path)
         PERR("Null path");
 
-    increment_stamp (model);
+    gtm_increment_stamp (model);
     if (gnc_tree_model_split_reg_get_iter (GTK_TREE_MODEL (model), iter, path))
     {
-//g_print("insert_row_at - Path is '%s' valid iter\n", gtk_tree_path_to_string (path));
+//g_print("gtm_insert_row_at - Path is '%s' valid iter\n", gtk_tree_path_to_string (path));
         gtk_tree_model_row_inserted (GTK_TREE_MODEL (model), path, iter);
     }
     else
         PERR("Tried to insert with invalid iter.");
 
-    update_parent (model, path);
+    gtm_update_parent (model, path);
     gtk_tree_path_free (path);
+    LEAVE(" ");
 }
 
+
+/* Delete row at path */
 static void
-delete_row_at_path (GncTreeModelSplitReg *model, GtkTreePath *path)
+gtm_delete_row_at_path (GncTreeModelSplitReg *model, GtkTreePath *path)
 {
     gint depth;
 
     if (!path)
         PERR("Null path");
-    increment_stamp (model);
+    ENTER(" ");
+    gtm_increment_stamp (model);
     gtk_tree_model_row_deleted (GTK_TREE_MODEL (model), path);
 
     depth = gtk_tree_path_get_depth (path);
-//g_print("delete_row_at_path %s and depth %d\n", gtk_tree_path_to_string (path), depth);
+//g_print("gtm_delete_row_at_path %s and depth %d\n", gtk_tree_path_to_string (path), depth);
     if (depth == 2)
     {
-        update_parent (model, path);
+        gtm_update_parent (model, path);
     }
     else if (depth == 3)
     {
-        update_parent (model, path);
+        gtm_update_parent (model, path);
     }
     else
     {
@@ -1719,42 +1770,47 @@ delete_row_at_path (GncTreeModelSplitReg *model, GtkTreePath *path)
         { 
             GList *tnode = iter.user_data2;
             GncTreeModelSplitRegPrivate *priv = model->priv;
-//g_print("delete_row_at_path bsplit - Path is '%s'\n", gtk_tree_path_to_string (path));
+//g_print("gtm_delete_row_at_path bsplit - Path is '%s'\n", gtk_tree_path_to_string (path));
             if (tnode == priv->bsplit_parent_node)
                 priv->bsplit_parent_node = NULL;
         }
     }
+    LEAVE(" ");
 }
 
 
+/* Delete row at iter */
 static void
-delete_row_at (GncTreeModelSplitReg *model, GtkTreeIter *iter)
+gtm_delete_row_at (GncTreeModelSplitReg *model, GtkTreeIter *iter)
 {
     GtkTreePath *path;
 //    g_assert(VALID_ITER (model, iter));
 
-//g_print("delete_row_at\n");
+//g_print("gtm_delete_row_at\n");
+    ENTER(" ");
     path = gnc_tree_model_split_reg_get_path (GTK_TREE_MODEL (model), iter);
-//g_print("delete_row_at - Path is '%s'\n", gtk_tree_path_to_string (path));
-    delete_row_at_path (model, path);
+//g_print("gtm_delete_row_at - Path is '%s'\n", gtk_tree_path_to_string (path));
+    gtm_delete_row_at_path (model, path);
     gtk_tree_path_free (path);
+    LEAVE(" ");
 }
 
 
+/* Change row at iter */
 static void
-changed_row_at (GncTreeModelSplitReg *model, GtkTreeIter *iter)
+gtm_changed_row_at (GncTreeModelSplitReg *model, GtkTreeIter *iter)
 {
     GtkTreePath *path;
 //    g_assert(VALID_ITER (model, iter));
-//g_print("changed_row_at\n");
+g_print("gtm_changed_row_at\n");
     path = gnc_tree_model_split_reg_get_path (GTK_TREE_MODEL (model), iter);
     if (!path)
         PERR ("Null path");
-//g_print("changed_row_at - Path is '%s'\n", gtk_tree_path_to_string (path));
-    increment_stamp (model);
+//g_print("gtm_changed_row_at - Path is '%s'\n", gtk_tree_path_to_string (path));
+    gtm_increment_stamp (model);
     if (gnc_tree_model_split_reg_get_iter (GTK_TREE_MODEL (model), iter, path))
     {
-//g_print("changed_row_at - Path is '%s' valid iter\n", gtk_tree_path_to_string (path));
+//g_print("gtm_changed_row_at - Path is '%s' valid iter\n", gtk_tree_path_to_string (path));
         gtk_tree_model_row_changed (GTK_TREE_MODEL (model), path, iter);
     }
     else 
@@ -1764,24 +1820,25 @@ changed_row_at (GncTreeModelSplitReg *model, GtkTreeIter *iter)
 }
 
 
+/* Insert transaction into model */
 static void
-insert_trans (GncTreeModelSplitReg *model, Transaction *trans)
+gtm_insert_trans (GncTreeModelSplitReg *model, Transaction *trans)
 {
     GtkTreeIter iter;
     GtkTreePath *path;
     GList *tnode = NULL, *snode = NULL;
-//g_print("insert_trans %p\n", trans);
+//g_print("gtm_insert_trans model %p and trans %p\n", model, trans);
     model->priv->tlist = g_list_prepend (model->priv->tlist, trans);
     tnode = g_list_find (model->priv->tlist, trans);
 
-    iter = make_iter (model, TROW1, tnode, NULL);
-    insert_row_at (model, &iter);
+    iter = gtm_make_iter (model, TROW1, tnode, NULL);
+    gtm_insert_row_at (model, &iter);
     path = gnc_tree_model_split_reg_get_path (GTK_TREE_MODEL (model), &iter);
     gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (model), path, &iter);
     gtk_tree_path_free (path);
 
-    iter = make_iter (model, TROW2, tnode, NULL);
-    insert_row_at (model, &iter);
+    iter = gtm_make_iter (model, TROW2, tnode, NULL);
+    gtm_insert_row_at (model, &iter);
     path = gnc_tree_model_split_reg_get_path (GTK_TREE_MODEL (model), &iter);
     gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (model), path, &iter);
     gtk_tree_path_free (path);
@@ -1792,18 +1849,20 @@ insert_trans (GncTreeModelSplitReg *model, Transaction *trans)
     {
         if (xaccTransStillHasSplit (trans, snode->data))
         {
-            iter = make_iter (model, SPLIT, tnode, snode);
-            insert_row_at (model, &iter);
+            iter = gtm_make_iter (model, SPLIT, tnode, snode);
+            gtm_insert_row_at (model, &iter);
         }
     }
 }
 
+
+/* Delete transaction from model */
 static void
-delete_trans (GncTreeModelSplitReg *model, Transaction *trans)
+gtm_delete_trans (GncTreeModelSplitReg *model, Transaction *trans)
 {
     GtkTreeIter iter;
     GList *tnode = NULL, *snode = NULL;
-//g_print("delete_trans %p\n", trans);
+//g_print("gtm_delete_trans %p\n", trans);
     tnode = g_list_find (model->priv->tlist, trans);
 //g_print("tlist length is %d\n", g_list_length (model->priv->tlist));
 
@@ -1813,8 +1872,8 @@ delete_trans (GncTreeModelSplitReg *model, Transaction *trans)
     {
 //g_print("a delete blank split\n");
         /* Delete the row where the blank split is. */
-        iter = make_iter (model, SPLIT | BLANK, tnode, model->priv->bsplit_node);
-        delete_row_at (model, &iter);
+        iter = gtm_make_iter (model, SPLIT | BLANK, tnode, model->priv->bsplit_node);
+        gtm_delete_row_at (model, &iter);
         model->priv->bsplit_parent_node = NULL;
     }
 
@@ -1822,16 +1881,16 @@ delete_trans (GncTreeModelSplitReg *model, Transaction *trans)
     {
         if (xaccTransStillHasSplit (trans, snode->data))
         {
-            iter = make_iter (model, SPLIT, tnode, snode);
-            delete_row_at (model, &iter);
+            iter = gtm_make_iter (model, SPLIT, tnode, snode);
+            gtm_delete_row_at (model, &iter);
         }
     }
 
-    iter = make_iter (model, TROW2, tnode, NULL);
-    delete_row_at (model, &iter);
+    iter = gtm_make_iter (model, TROW2, tnode, NULL);
+    gtm_delete_row_at (model, &iter);
 
-    iter = make_iter (model, TROW1, tnode, NULL);
-    delete_row_at (model, &iter);
+    iter = gtm_make_iter (model, TROW1, tnode, NULL);
+    gtm_delete_row_at (model, &iter);
 
     model->priv->tlist = g_list_delete_link (model->priv->tlist, tnode);
 }
@@ -1855,25 +1914,21 @@ gnc_tree_model_split_reg_set_blank_split_parent (GncTreeModelSplitReg *model, Tr
 
 g_print("gnc_tree_model_split_reg_set_blank_split_parent bsplit %p and trans %p\n", priv->bsplit, trans);
 
-//g_print("tnode pointer is %p\n", tnode);
-
     bs_parent_node = priv->bsplit_parent_node;
 
-//g_print("bs_parent_node pointer is %p\n", bs_parent_node);
-
     if (tnode != bs_parent_node)
     {
         moved = (bs_parent_node != NULL);
         if (moved)
         {
             /* Delete the row where the blank split used to be. */
-            iter = make_iter (model, SPLIT | BLANK, bs_parent_node, priv->bsplit_node);
-            delete_row_at (model, &iter);
+            iter = gtm_make_iter (model, SPLIT | BLANK, bs_parent_node, priv->bsplit_node);
+            gtm_delete_row_at (model, &iter);
             priv->bsplit_parent_node = NULL;
         }
         priv->bsplit_parent_node = tnode;
-        iter = make_iter (model, SPLIT | BLANK, tnode, priv->bsplit_node);
-        insert_row_at (model, &iter);
+        iter = gtm_make_iter (model, SPLIT | BLANK, tnode, priv->bsplit_node);
+        gtm_insert_row_at (model, &iter);
         xaccSplitReinit (priv->bsplit); // set split back to default entries
     } else
         moved = FALSE;
@@ -1882,24 +1937,23 @@ g_print("gnc_tree_model_split_reg_set_blank_split_parent bsplit %p and trans %p\
 }
 
 
+/* Make a new blank split and insert at iter */
 static void
-make_new_blank_split (GncTreeModelSplitReg *model)
+gtm_make_new_blank_split (GncTreeModelSplitReg *model)
 {
     GtkTreeIter iter;
     Split *split;
     GList *tnode = model->priv->bsplit_parent_node;
 
-//g_print("make_new_blank_split");
-
     split = xaccMallocSplit (model->priv->book);
     model->priv->bsplit = split;
     model->priv->bsplit_node->data = model->priv->bsplit;
 
-//g_print(" new bsplit is %p\n", split);
+//g_print("gtm_make_new_blank_split - bsplit is %p and trans is %p\n", split, tnode->data);
 
-    /* Insert the new row */
-    iter = make_iter (model, BLANK|SPLIT, tnode, model->priv->bsplit_node);
-    insert_row_at (model, &iter);
+    /* Insert the new blank split */
+    iter = gtm_make_iter (model, BLANK|SPLIT, tnode, model->priv->bsplit_node);
+    gtm_insert_row_at (model, &iter);
 }
 
 
@@ -1908,7 +1962,7 @@ make_new_blank_split (GncTreeModelSplitReg *model)
  * function is called from the treeview to tell the model to commit
  * the blank split.
  */
-static void
+void
 gnc_tree_model_split_reg_commit_blank_split (GncTreeModelSplitReg *model)
 {
     Split *bsplit;
@@ -1925,25 +1979,23 @@ g_print("gnc_tree_model_split_reg_commit_blank_split\n");
         PERR("blank split has no trans");
         return;
     }
+
     trans = tnode->data;
     if (xaccTransGetSplitIndex (trans, bsplit) == -1) {
         PINFO("blank split has been removed from this trans");
         return;
     }
+
     snode = g_list_find (xaccTransGetSplitList (trans), bsplit);
     if (!snode) {
         PERR("Failed to turn blank split into real split");
         return;
     }
 
-    if (xaccSplitGetAccount (bsplit) == NULL) //FIXME this would make sure we have an account, not sure its valid.
-        xaccTransScrubOrphans (trans);
-
     /* If we haven't set an amount yet, and there's an imbalance, use that. */
     if (gnc_numeric_zero_p (xaccSplitGetAmount (bsplit)))
     {
         gnc_numeric imbal = gnc_numeric_neg (xaccTransGetImbalanceValue (trans));
-
         if (!gnc_numeric_zero_p (imbal))
         {
             gnc_numeric amount, rate;
@@ -1966,24 +2018,26 @@ g_print("gnc_tree_model_split_reg_commit_blank_split\n");
         }
     }
     /* Mark the old blank split as changed */
-    iter = make_iter (model, SPLIT, tnode, snode);
-    changed_row_at (model, &iter);
-    make_new_blank_split (model);
+    iter = gtm_make_iter (model, SPLIT, tnode, snode);
+    gtm_changed_row_at (model, &iter);
+    gtm_make_new_blank_split (model);
 }
 
 
+/* Update the dsiplay sub account and general ledger settings */
 void
-gnc_tree_model_split_reg_commit_split (GncTreeModelSplitReg *model, Split *split)
+gnc_tree_model_split_reg_set_display (GncTreeModelSplitReg *model, gboolean subacc, gboolean gl)
 {
-g_print("gnc_tree_model_split_reg_commit_split %p\n", split);
-    if (split == model->priv->bsplit)
-        gnc_tree_model_split_reg_commit_blank_split (model);
+    GncTreeModelSplitRegPrivate *priv = model->priv;
+
+    priv->display_subacc = subacc;
+    priv->display_gl = gl;
 }
 
 
 /* Returns just the path to the transaction if idx_of_split is -1. */
 static GtkTreePath *
-get_removal_path (GncTreeModelSplitReg *model, Transaction *trans,
+gtm_get_removal_path (GncTreeModelSplitReg *model, Transaction *trans,
                  gint idx_of_split)
 {
     GncTreeModelSplitRegPrivate *priv;
@@ -1991,7 +2045,7 @@ get_removal_path (GncTreeModelSplitReg *model, Transaction *trans,
     GtkTreeIter iter;
     GtkTreePath *path;
 
-//g_print("get_removal_path trans is %p idx of split is %d\n", trans, idx_of_split);
+//g_print("gtm_get_removal_path trans is %p idx of split is %d\n", trans, idx_of_split);
 
     g_return_val_if_fail (GNC_IS_TREE_MODEL_SPLIT_REG (model), NULL);
     g_return_val_if_fail (trans, NULL);
@@ -2002,7 +2056,7 @@ get_removal_path (GncTreeModelSplitReg *model, Transaction *trans,
     tnode = g_list_find (priv->tlist, trans);
     if (!tnode) return FALSE;
 
-    iter = make_iter (model, TROW1, tnode, NULL); // TROW1
+    iter = gtm_make_iter (model, TROW1, tnode, NULL); // TROW1
     path = gnc_tree_model_split_reg_get_path (GTK_TREE_MODEL (model), &iter);
 
     if (idx_of_split >= 0)
@@ -2013,16 +2067,14 @@ get_removal_path (GncTreeModelSplitReg *model, Transaction *trans,
     else if (idx_of_split != -1)
         PERR("Invalid idx_of_split");
 
-//g_print("get_removal_path - Return Path is '%s'\n", gtk_tree_path_to_string (path));
+//g_print("gtm_get_removal_path - Return Path is '%s'\n", gtk_tree_path_to_string (path));
 
     return path;
 }
 
 
-
-
-/*###################################################################*/
-/* Combo and Autocompletion ListStore functions */
+/*##########################################################################*/
+/*             Combo and Autocompletion ListStore functions                 */
 
 Account *
 gnc_tree_model_split_reg_get_anchor (GncTreeModelSplitReg *model)
@@ -2031,7 +2083,6 @@ gnc_tree_model_split_reg_get_anchor (GncTreeModelSplitReg *model)
     return model->priv->anchor;
 }
 
-
 GtkListStore *
 gnc_tree_model_split_reg_get_description_list (GncTreeModelSplitReg *model)
 {
@@ -2039,7 +2090,6 @@ gnc_tree_model_split_reg_get_description_list (GncTreeModelSplitReg *model)
     return model->priv->description_list;
 }
 
-
 GtkListStore *
 gnc_tree_model_split_reg_get_notes_list (GncTreeModelSplitReg *model)
 {
@@ -2047,7 +2097,6 @@ gnc_tree_model_split_reg_get_notes_list (GncTreeModelSplitReg *model)
     return model->priv->notes_list;
 }
 
-
 GtkListStore *
 gnc_tree_model_split_reg_get_memo_list (GncTreeModelSplitReg *model)
 {
@@ -2055,7 +2104,6 @@ gnc_tree_model_split_reg_get_memo_list (GncTreeModelSplitReg *model)
     return model->priv->memo_list;
 }
 
-
 GtkListStore *
 gnc_tree_model_split_reg_get_numact_list (GncTreeModelSplitReg *model)
 {
@@ -2064,7 +2112,7 @@ gnc_tree_model_split_reg_get_numact_list (GncTreeModelSplitReg *model)
 }
 
 
-/* Return TRUE if string all ready exists in the list */
+/* Return TRUE if string already exists in the list */
 static gboolean
 gtm_check_for_duplicates (GtkListStore *liststore, const gchar *string)
 {
@@ -2091,7 +2139,7 @@ gtm_check_for_duplicates (GtkListStore *liststore, const gchar *string)
 }
 
 
-/* Create the Auto Complete List Stores.... */
+/* Update the Auto Complete List Stores.... */
 void
 gnc_tree_model_split_reg_update_completion (GncTreeModelSplitReg *model)
 {
@@ -2100,9 +2148,13 @@ gnc_tree_model_split_reg_update_completion (GncTreeModelSplitReg *model)
     GList *tlist, *tnode, *slist, *snode;
     int cnt, nSplits;
 
+g_print("gnc_tree_model_split_reg_update_completion\n");
+
     priv = model->priv;
     tlist = priv->tlist;
 
+//g_print("gnc_tree_model_split_reg_update_completion tlist length is %d\n", g_list_length (tlist));
+
     /* Clear the liststores */
     gtk_list_store_clear (priv->description_list);
     gtk_list_store_clear (priv->notes_list);
@@ -2143,12 +2195,12 @@ gnc_tree_model_split_reg_update_completion (GncTreeModelSplitReg *model)
         }
 
         /* Add to the Num list */
-        /* Get transaction-number with gnc_get_num_action which is the same as
-         * xaccTransGetNum with these arguments; not sure what is being done
-         * here so not sure if this is correct; won't get the same 'num' entered
-         * by user in a register if book option to use split-action for 'num'
-         * field is set */
-        string = gnc_get_num_action (trans, NULL);
+        /* Get transaction-number with gnc_get_num_action which is the same as 
+         * xaccTransGetNum with these arguments; not sure what is being done 
+         * here so not sure if this is correct; won't get the same 'num' entered 
+         * by user in a register if book option to use split-action for 'num' 
+         * field is set */ 
+        string = gnc_get_num_action (trans, NULL); 
         if(g_strcmp0 (string, ""))
         {
             if(gtm_check_for_duplicates (priv->num_list, string) == FALSE)
@@ -2179,6 +2231,9 @@ gnc_tree_model_split_reg_update_completion (GncTreeModelSplitReg *model)
             snode = snode->next;
          }
     }
+//g_print("desc list is %d long\n", gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->description_list), NULL));
+//g_print("notes list is %d long\n", gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->notes_list), NULL));
+//g_print("memo list is %d long\n", gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->memo_list), NULL));
 }
 
 
@@ -2193,7 +2248,7 @@ gnc_tree_model_split_reg_get_action_list (GncTreeModelSplitReg *model)
     priv = model->priv;
     store = priv->numact_list;
 
-//FIXME This may need more thought ???
+//FIXME This may need some more thought ???
 
     /* Clear the liststore */
     gtk_list_store_clear (store);
@@ -2465,7 +2520,7 @@ gnc_tree_model_split_reg_event_handler (QofInstance *entity,
             {
 //g_print("--Change model %p split %p\n", model, split); //works
                 DEBUG ("change split %p (%s)", split, name);
-                changed_row_at (model, &iter1);
+                gtm_changed_row_at (model, &iter1);
 
                 /* If we change split to different account, remove from view */
                 if (priv->anchor != NULL)
@@ -2475,7 +2530,7 @@ gnc_tree_model_split_reg_event_handler (QofInstance *entity,
                     trans = xaccSplitGetParent (split);
                     find_split = xaccTransFindSplitByAccount (trans, priv->anchor);
                     if (find_split == NULL)
-                        delete_trans (model, trans);
+                        gtm_delete_trans (model, trans);
                 }
             }
             break;
@@ -2507,26 +2562,26 @@ gnc_tree_model_split_reg_event_handler (QofInstance *entity,
             {
 //g_print("--Insert model %p split %p\n", model, split); //works
                 DEBUG ("add split %p (%s)", split, name);
-                insert_row_at (model, &iter1);
+                gtm_insert_row_at (model, &iter1);
             }
             break;
         case GNC_EVENT_ITEM_REMOVED:
 //g_print("--gnc_tree_model_split_reg_event_handler - Remove Split\n");
             split = (Split *) ed->node;
 
-            path = get_removal_path (model, trans, ed->idx);
+            path = gtm_get_removal_path (model, trans, ed->idx);
             if (path)
             {
 //g_print("--Delete model %p split %p\n", model, split); //works
                 DEBUG ("remove split %p from trans %p (%s)", split, trans, name);
                 if (ed->idx == -1)
-                    delete_trans (model, trans); //Not sure when this would be so
+                    gtm_delete_trans (model, trans); //Not sure when this would be so
                 else
-                    delete_row_at_path (model, path);
+                    gtm_delete_row_at_path (model, path);
                 gtk_tree_path_free (path);
             }
             if (split == priv->bsplit)
-                make_new_blank_split (model);
+                gtm_make_new_blank_split (model);
             break;
         case QOF_EVENT_MODIFY:
 //g_print("--gnc_tree_model_split_reg_event_handler - Modify Trans\n");
@@ -2539,19 +2594,20 @@ gnc_tree_model_split_reg_event_handler (QofInstance *entity,
                 tnode = g_list_find (priv->tlist, priv->btrans);
 //g_print("--Insert model %p Blank trans %p\n", model, priv->btrans); //works
                 /* Insert a new blank trans */
-                iter1 = make_iter (model, TROW1 | BLANK, tnode, NULL);
-                insert_row_at (model, &iter1);
-                iter2 = make_iter (model, TROW2 | BLANK, tnode, NULL);
-                insert_row_at (model, &iter2);
+                iter1 = gtm_make_iter (model, TROW1 | BLANK, tnode, NULL);
+                gtm_insert_row_at (model, &iter1);
+                iter2 = gtm_make_iter (model, TROW2 | BLANK, tnode, NULL);
+                gtm_insert_row_at (model, &iter2);
+                g_signal_emit_by_name (model, "refresh_view", NULL);
             }
 
             if (get_iter (model, trans, NULL, &iter1, &iter2))
             {
 //g_print("--Change model %p trans %p\n", model, trans); //works
                 DEBUG ("change trans %p (%s)", trans, name);
-                changed_row_at (model, &iter1);
-                changed_row_at (model, &iter2);
-                g_signal_emit_by_name (model, "refresh_signal", NULL);
+                gtm_changed_row_at (model, &iter1);
+                gtm_changed_row_at (model, &iter2);
+                g_signal_emit_by_name (model, "refresh_view", NULL);
             }
 
             break;
@@ -2562,18 +2618,19 @@ gnc_tree_model_split_reg_event_handler (QofInstance *entity,
                 tnode = g_list_find (priv->tlist, priv->btrans);
                 priv->btrans = xaccMallocTransaction (priv->book);
                 tnode->data = priv->btrans;
-g_print("--Change blank trans %p\n",priv->btrans); // Not sure this is ever used
-                iter1 = make_iter (model, TROW1 | BLANK, tnode, NULL);
-                changed_row_at (model, &iter1);
-                iter2 = make_iter (model, TROW2 | BLANK, tnode, NULL);
-                changed_row_at (model, &iter2);
+//g_print("--Change blank trans %p\n",priv->btrans); // Not sure this is ever used
+                iter1 = gtm_make_iter (model, TROW1 | BLANK, tnode, NULL);
+                gtm_changed_row_at (model, &iter1);
+                iter2 = gtm_make_iter (model, TROW2 | BLANK, tnode, NULL);
+                gtm_changed_row_at (model, &iter2);
             }
             else if (get_iter (model, trans, NULL, &iter1, &iter2))
             {
 //g_print("--Delete model %p trans %p\n", model, trans); //works
                 DEBUG("destroy trans %p (%s)", trans, name);
-                delete_trans (model, trans);
-                g_signal_emit_by_name (model, "refresh_signal", NULL);
+                g_signal_emit_by_name (model, "trans_delete", trans);
+                gtm_delete_trans (model, trans);
+                g_signal_emit_by_name (model, "refresh_view", NULL);
             }
             break;
         default:
@@ -2590,18 +2647,49 @@ g_print("--Change blank trans %p\n",priv->btrans); // Not sure this is ever used
             split = (Split *) ed;
             acc = xaccSplitGetAccount (split);
             trans = xaccSplitGetParent (split);
-            if (!g_list_find (priv->tlist, trans) &&
-                ((xaccAccountHasAncestor (acc, priv->anchor) &&
-                  priv->include_subacc) || acc == priv->anchor))
+
+//g_print("displ gl is %d and subacc %d\n", priv->display_gl, priv->display_subacc);
+
+            if (!g_list_find (priv->tlist, trans) && priv->display_gl)
+            {
+//g_print("--Insert gl model %p trans %p\n", model, trans); //works
+                DEBUG("Insert trans %p (%s)", trans, name);
+                gtm_insert_trans (model, trans);
+                g_signal_emit_by_name (model, "refresh_view", NULL);
+            }
+            else if (!g_list_find (priv->tlist, trans) && ((xaccAccountHasAncestor (acc, priv->anchor) && priv->display_subacc) || acc == priv->anchor ))
             {
 //g_print("--Insert model %p trans %p\n", model, trans); //works
                 DEBUG("Insert trans %p (%s)", trans, name);
-                insert_trans (model, trans);
-                g_signal_emit_by_name (model, "refresh_signal", NULL);
+                gtm_insert_trans (model, trans);
+                g_signal_emit_by_name (model, "refresh_view", NULL);
             }
             break;
         default:
             ;
         }
+        /* Lets refresh the status bar */
+        g_signal_emit_by_name (model, "refresh_status_bar", NULL);
     }
 }
+
+
+/* Returns the parent Window of the register */
+GtkWidget *
+gnc_tree_model_split_reg_get_parent (GncTreeModelSplitReg *model)
+{
+    GncTreeModelSplitRegPrivate *priv;
+    GtkWidget *parent = NULL;
+
+    priv = model->priv;
+
+    if (priv->get_parent)
+        parent = priv->get_parent (priv->user_data);
+
+//g_print("gnc_tree_model_split_reg_get_parent %p\n", parent);
+
+    return parent;
+}
+
+
+
diff --git a/src/gnome-utils/gnc-tree-model-split-reg.h b/src/gnome-utils/gnc-tree-model-split-reg.h
index 3962958..dddd99a 100644
--- a/src/gnome-utils/gnc-tree-model-split-reg.h
+++ b/src/gnome-utils/gnc-tree-model-split-reg.h
@@ -98,10 +98,9 @@ typedef enum
     GNC_TREE_MODEL_SPLIT_REG_COL_LAST_VISIBLE = GNC_TREE_MODEL_SPLIT_REG_COL_RECN, //6
 
     /* internal hidden columns */
-    GNC_TREE_MODEL_SPLIT_REG_COL_COLOR,     //7
-    GNC_TREE_MODEL_SPLIT_REG_COL_RO,        //8
+    GNC_TREE_MODEL_SPLIT_REG_COL_RO,        //7
 
-    GNC_TREE_MODEL_SPLIT_REG_NUM_COLUMNS    //9
+    GNC_TREE_MODEL_SPLIT_REG_NUM_COLUMNS    //8
 } GncTreeModelSplitRegColumn;
 
 /* typedefs & structures */
@@ -120,31 +119,37 @@ typedef struct
 
     gboolean                     is_template;
 
-    gboolean                     do_auto_complete;      /**<FIXME Not setup - whether to use auto-competion */
     gboolean                     use_accounting_labels; /**< whether to use accounting Labels */
     gboolean                     separator_changed;     /**< whether the separator has changed */ 
     gboolean                     alt_colors_by_txn;     /**< whether to use alternative colors by transaction */ 
-    gboolean                     use_colors;            /**< whether to use theme colors */
+    gboolean                     use_theme_colors;      /**< whether to use theme colors */
 
     gboolean                     read_only;             /**< register is read only */
 
 
-
 }GncTreeModelSplitReg;
 
 
 /** The class data structure for an account tree model. */
 typedef struct
 {
-    GncTreeModelClass gnc_tree_model;   /**< The parent object data. */
+    GncTreeModelClass gnc_tree_model;                   /**< The parent object data. */
 
     /* This signal is emitted to refresh the view */
-    void (*refresh_signal) (GncTreeModelSplitReg *model, gpointer user_data);
+    void (*refresh_view) (GncTreeModelSplitReg *model, gpointer user_data);
+
+    /* This signal is emitted to refresh the status bar */
+    void (*refresh_status_bar) (GncTreeModelSplitReg *model, gpointer user_data);
+
+    /* This signal is emitted before a transaction delete, the pointer has
+       the transaction */
+    void (*trans_delete) (GncTreeModelSplitReg *model, gpointer item);
 
 } GncTreeModelSplitRegClass;
 
-/** Callback function type */
-/*FIXME Not sure if this is needed or what it is for yet*/
+
+/** Callback function type - Used to get parent window */
+/*FIXME Not sure if this is needed or what it is for yet */
 typedef GtkWidget *(*SRGetParentCallback2) (gpointer user_data);
 
 /** Get the type of split register tree plugin.
@@ -153,83 +158,92 @@ typedef GtkWidget *(*SRGetParentCallback2) (gpointer user_data);
  */
 GType gnc_tree_model_split_reg_get_type (void);
 
-
+/** Create new model and set options for register. */
 GncTreeModelSplitReg *
 gnc_tree_model_split_reg_new (SplitRegisterType2 reg_type, SplitRegisterStyle2 style,
                         gboolean use_double_line, gboolean is_template);
 
-
+/** Load the model from a slist and set default account for register. */
 void gnc_tree_model_split_reg_load (GncTreeModelSplitReg *model, GList * slist, Account *default_account);
 
+/** FIXME Not sure what this is for yet. */
 void gnc_tree_model_split_reg_set_template_account (GncTreeModelSplitReg *model, Account *template_account);
 
+/** Destroy the model. */
 void gnc_tree_model_split_reg_destroy (GncTreeModelSplitReg *model);
 
 /** Sets the user data and callback hooks for the register. */
 void gnc_tree_model_split_reg_set_data (GncTreeModelSplitReg *model, gpointer user_data,
                                   SRGetParentCallback2 get_parent);
 
+/** Returns the parent Window of the register. */
+GtkWidget * gnc_tree_model_split_reg_get_parent (GncTreeModelSplitReg *model);
+
+/** Set style and type for register. */
 void gnc_tree_model_split_reg_config (GncTreeModelSplitReg *model, SplitRegisterType2 newtype,
                                       SplitRegisterStyle2 newstyle, gboolean use_double_line);
 
+/** Return the default account for this register model. */
 Account * gnc_tree_model_split_reg_get_anchor (GncTreeModelSplitReg *model);
 
-void gnc_tree_model_split_reg_commit_split (GncTreeModelSplitReg *model, Split *split);
+/** Commit the blank split. */
+void gnc_tree_model_split_reg_commit_blank_split (GncTreeModelSplitReg *model);
+
+/** Set display general ledger and show sub accounts. */
+void gnc_tree_model_split_reg_set_display (GncTreeModelSplitReg *model, gboolean subacc, gboolean gl);
 
 /* These are to do with autocompletion */
-GtkListStore *
-gnc_tree_model_split_reg_get_description_list (GncTreeModelSplitReg *model);
+GtkListStore * gnc_tree_model_split_reg_get_description_list (GncTreeModelSplitReg *model);
 
-GtkListStore *
-gnc_tree_model_split_reg_get_notes_list (GncTreeModelSplitReg *model);
+GtkListStore * gnc_tree_model_split_reg_get_notes_list (GncTreeModelSplitReg *model);
 
-GtkListStore *
-gnc_tree_model_split_reg_get_memo_list (GncTreeModelSplitReg *model);
+GtkListStore * gnc_tree_model_split_reg_get_memo_list (GncTreeModelSplitReg *model);
 
-GtkListStore *
-gnc_tree_model_split_reg_get_numact_list (GncTreeModelSplitReg *model);
+GtkListStore * gnc_tree_model_split_reg_get_numact_list (GncTreeModelSplitReg *model);
 
-GtkListStore *
-gnc_tree_model_split_reg_get_acct_list (GncTreeModelSplitReg *model);
+GtkListStore * gnc_tree_model_split_reg_get_acct_list (GncTreeModelSplitReg *model);
 
-void
-gnc_tree_model_split_reg_get_num_list (GncTreeModelSplitReg *model);
+void gnc_tree_model_split_reg_get_num_list (GncTreeModelSplitReg *model);
 
-void
-gnc_tree_model_split_reg_get_action_list (GncTreeModelSplitReg *model);
+void gnc_tree_model_split_reg_get_action_list (GncTreeModelSplitReg *model);
 
-void
-gnc_tree_model_split_reg_update_completion (GncTreeModelSplitReg *model);
+void gnc_tree_model_split_reg_update_completion (GncTreeModelSplitReg *model);
 
 
 /* Get the split and transaction */
-gboolean
-gnc_tree_model_split_reg_get_split_and_trans (
-    GncTreeModelSplitReg *model, GtkTreeIter *iter,
-    gboolean *is_trow1, gboolean *is_trow2, gboolean *is_split,
-    gboolean *is_blank, Split **split, Transaction **trans);
+gboolean gnc_tree_model_split_reg_get_split_and_trans (
+          GncTreeModelSplitReg *model, GtkTreeIter *iter,
+          gboolean *is_trow1, gboolean *is_trow2, gboolean *is_split,
+          gboolean *is_blank, Split **split, Transaction **trans);
 
 /* Return FALSE if failure */
-gboolean 
-gnc_tree_model_split_reg_set_blank_split_parent (
-    GncTreeModelSplitReg *model, Transaction *trans);
+gboolean gnc_tree_model_split_reg_set_blank_split_parent (
+          GncTreeModelSplitReg *model, Transaction *trans);
 
 /* Return the blank split */
-Split *
-gnc_tree_model_split_get_blank_split (GncTreeModelSplitReg *model);
+Split * gnc_tree_model_split_get_blank_split (GncTreeModelSplitReg *model);
 
+/* Return the blank trans */
+Transaction * gnc_tree_model_split_get_blank_trans (GncTreeModelSplitReg *model);
 
 /* If 'trans' is NULL, use split's parent.  If 'split' is NULL, just
    get the transaction iter. */
-gboolean
-gnc_tree_model_split_reg_get_iter_from_trans_and_split (
-    GncTreeModelSplitReg *model, Transaction *trans, Split *split, 
-    GtkTreeIter *iter1, GtkTreeIter *iter2);
+gboolean gnc_tree_model_split_reg_get_iter_from_trans_and_split (
+          GncTreeModelSplitReg *model, Transaction *trans, Split *split, 
+          GtkTreeIter *iter1, GtkTreeIter *iter2);
 
+/* Return the row color for the view */
+gchar * gnc_tree_model_split_reg_get_row_color (GncTreeModelSplitReg *model, gboolean is_trow1,
+         gboolean is_trow2, gboolean is_split, gint num);
 
 /* Return the tree path, if split and trans are null, last in list returned */
-GtkTreePath *
-gnc_tree_model_split_reg_get_path_to_split_and_trans (GncTreeModelSplitReg *model, Split *split, Transaction *trans);
+GtkTreePath * gnc_tree_model_split_reg_get_path_to_split_and_trans (
+               GncTreeModelSplitReg *model, Split *split, Transaction *trans);
+
+/* Returns TRUE if iter is a blank transaction */
+gboolean gnc_tree_model_split_reg_is_blank_trans (GncTreeModelSplitReg *model, GtkTreeIter *iter);
+
+/*****************************************************************************/
 
 G_END_DECLS
 
diff --git a/src/gnome-utils/gnc-tree-view-split-reg.c b/src/gnome-utils/gnc-tree-view-split-reg.c
index 19d22a2..3532562 100644
--- a/src/gnome-utils/gnc-tree-view-split-reg.c
+++ b/src/gnome-utils/gnc-tree-view-split-reg.c
@@ -34,6 +34,8 @@
 #include "gnc-tree-view.h"
 #include "gnc-tree-view-split-reg.h"
 #include "gnc-tree-model-split-reg.h"
+#include "gnc-tree-control-split-reg.h"
+#include "gnc-ui.h"
 #include "dialog-utils.h"
 #include "gnc-gconf-utils.h"
 #include "Transaction.h"
@@ -41,6 +43,7 @@
 #include "Scrub.h"
 #include "gnc-exp-parser.h"
 #include "dialog-transfer.h"
+#include "gnc-amount-edit.h"
 
 
 /* Signal codes */
@@ -62,17 +65,22 @@ static void gnc_tree_view_split_reg_finalize (GObject *object);
 static guint gnc_tree_view_split_reg_signals[LAST_SIGNAL] = {0};
 
 static void cdf (GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model,
-                		GtkTreeIter  *iter, gpointer user_data);
+                		GtkTreeIter *iter, gpointer user_data);
+
+static void control_cdf (GtkTreeViewColumn *col, GtkCellRenderer *renderer,
+                                 GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data);
 
 static void gtv_split_reg_edited_cb (GtkCellRendererText *cell, const gchar *path_string,
                           	const gchar *new_text, gpointer _model);
 
 static void start_edit (GtkCellRenderer *cr, GtkCellEditable *editable,
-                       		const gchar *path, gpointer user_data);
+                       		const gchar *path, gpointer user_data); //FIXME This may not be needed
+
+static void gtv_begin_edit (GncTreeViewSplitReg *view, Split *split, Transaction *trans);
 
-static void begin_edit (GncTreeViewSplitReg *view, Split *split, Transaction *trans);
+static void gtv_finish_edit (GncTreeViewSplitReg *view);
 
-static void get_editable_start_editing_cb (GtkCellRenderer *cr, GtkCellEditable *editable,
+static void gtv_get_editable_start_editing_cb (GtkCellRenderer *cr, GtkCellEditable *editable,
    				const gchar *path, gpointer user_data);
 
 static void get_editable_start_editing_recn_cb (GtkCellRenderer *cr, GtkCellEditable *editable,
@@ -81,15 +89,21 @@ static void get_editable_start_editing_recn_cb (GtkCellRenderer *cr, GtkCellEdit
 static void gtv_split_reg_editing_canceled_cb (GtkCellRenderer *cr, gpointer user_data);
 
 static void gtv_split_reg_match_selected_cb (GtkEntryCompletion *widget, GtkTreeModel *model,
-                        GtkTreeIter *iter, gpointer user_data);
+                        GtkTreeIter *iter, gpointer user_data); //FIXME This may not be needed
 
 static void gtv_split_reg_changed_cb (GtkCellRendererCombo *widget, gchar *path_string,
-                        GtkTreeIter *iter, gpointer user_data);
+                        GtkTreeIter *iter, gpointer user_data); //FIXME This may not be needed
+
+static void gtv_split_reg_trans_delete_cb (GncTreeModelSplitReg *model, gpointer item, gpointer user_data);
 
 static gboolean gtv_split_reg_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data);
 
+static gboolean gtv_split_reg_focus_out_cb (GtkWidget *widget, GdkEventFocus *event, gpointer user_data);
+
 static void gtv_split_reg_motion_cb (GtkTreeSelection *sel, gpointer user_data);
 
+static void gtv_split_reg_refresh_cb (GncTreeModelSplitReg *model, gpointer user_data);
+
 static gboolean gtv_scroll_to_cell (GncTreeViewSplitReg *view);
 
 static void gtv_split_reg_double_click_cb (GtkTreeView *treeview,
@@ -97,6 +111,8 @@ static void gtv_split_reg_double_click_cb (GtkTreeView *treeview,
                                              GtkTreeViewColumn *column,
                                              gpointer           user_data);
 
+
+
 static gboolean transaction_changed_confirm (GncTreeViewSplitReg *view, Transaction *new_trans);
 
 typedef enum {
@@ -116,6 +132,7 @@ typedef enum {
     COL_CREDIT,    //13
     COL_BALANCE,   //14
     COL_STATUS,    //15
+    COL_COMM,      //16
 } ViewCol;
 
 typedef struct {
@@ -137,72 +154,76 @@ static ColDef all_tree_view_split_reg_columns[] = {
     {COL_DATE, GNC_TREE_MODEL_SPLIT_REG_COL_DATE,
      "Date", "date", "00/00/0000xxx",
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
-     gtv_split_reg_edited_cb, get_editable_start_editing_cb, NULL},
+     gtv_split_reg_edited_cb, gtv_get_editable_start_editing_cb,
+     gnc_tree_control_split_reg_sort_by_date},
 
     {COL_DUEDATE, GNC_TREE_MODEL_SPLIT_REG_COL_DUEDATE,
      "Due Date", "duedate", "00/00/0000xxx",
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
-     gtv_split_reg_edited_cb, get_editable_start_editing_cb, NULL},
+     gtv_split_reg_edited_cb, gtv_get_editable_start_editing_cb, NULL},
 
     {COL_NUMACT, GNC_TREE_MODEL_SPLIT_REG_COL_NUMACT,
-     "Num / Act", "numact", "0000xxx",
+     "Num / Act / Act", "numact", "0000xxx",
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
-     gtv_split_reg_edited_cb, get_editable_start_editing_cb, NULL},
+     gtv_split_reg_edited_cb, gtv_get_editable_start_editing_cb,
+     gnc_tree_control_split_reg_sort_by_numact},
 
     {COL_DESCNOTES, GNC_TREE_MODEL_SPLIT_REG_COL_DESCNOTES,
      "Description / Notes / Memo", "descnotes", "xxxxxxxxxxxxxxxxxxx",
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
-     gtv_split_reg_edited_cb, get_editable_start_editing_cb, NULL},
+     gtv_split_reg_edited_cb, gtv_get_editable_start_editing_cb,
+     gnc_tree_control_split_reg_sort_by_dnm},
 
-    {COL_TRANSVOID, GNC_TREE_MODEL_SPLIT_REG_COL_TRANSVOID,
+    {COL_TRANSVOID, -1,
      "Transfer / Void", "transvoid", "xxxxxxxxxxxxxxxxxxx",
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
-     gtv_split_reg_edited_cb, get_editable_start_editing_cb, NULL},
+     gtv_split_reg_edited_cb, gtv_get_editable_start_editing_cb, NULL},
 
-    {COL_RECN, -1,
+    {COL_RECN, GNC_TREE_MODEL_SPLIT_REG_COL_RECN,
      "R", "recn", "x",
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
-     gtv_split_reg_edited_cb, get_editable_start_editing_cb, NULL},
+     gtv_split_reg_edited_cb, gtv_get_editable_start_editing_cb,
+     gnc_tree_control_split_reg_sort_by_recn},
 
     {COL_TYPE, -1,
      "Type", "type", "x",
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
-     gtv_split_reg_edited_cb, get_editable_start_editing_cb, NULL},
+     gtv_split_reg_edited_cb, gtv_get_editable_start_editing_cb, NULL},
 
     {COL_VALUE, -1,
      "Value", "value", "xxxxxxxx",
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
-     gtv_split_reg_edited_cb, get_editable_start_editing_cb, NULL},
+     gtv_split_reg_edited_cb, gtv_get_editable_start_editing_cb, NULL},
 
     {COL_AMOUNT, -1,
      "Amount", "amount", "xxxxxxxx",
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
-     gtv_split_reg_edited_cb, get_editable_start_editing_cb, NULL},
+     gtv_split_reg_edited_cb, gtv_get_editable_start_editing_cb, NULL},
 
     {COL_AMTVAL, -1,
      "Amount / Value", "amtval", "xxxxxxxx",
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
-     gtv_split_reg_edited_cb, get_editable_start_editing_cb, NULL},
+     gtv_split_reg_edited_cb, gtv_get_editable_start_editing_cb, NULL},
 
     {COL_RATE, -1,
      "Rate", "rate", "xxxxxxxx",
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
-     gtv_split_reg_edited_cb, get_editable_start_editing_cb, NULL},
+     gtv_split_reg_edited_cb, gtv_get_editable_start_editing_cb, NULL},
 
     {COL_PRICE, -1,
      "Price", "price", "xxxxxxxx",
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
-     gtv_split_reg_edited_cb, get_editable_start_editing_cb, NULL},
+     gtv_split_reg_edited_cb, gtv_get_editable_start_editing_cb, NULL},
 
     {COL_DEBIT, -1,
      "Debit", "debit", "xxxxxxxx",
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
-     gtv_split_reg_edited_cb, get_editable_start_editing_cb, NULL},
+     gtv_split_reg_edited_cb, gtv_get_editable_start_editing_cb, NULL},
 
     {COL_CREDIT, -1,
      "Credit", "credit", "xxxxxxxx",
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
-     gtv_split_reg_edited_cb, get_editable_start_editing_cb, NULL},
+     gtv_split_reg_edited_cb, gtv_get_editable_start_editing_cb, NULL},
 
     {COL_BALANCE, -1,
      "Balance", "balance", "xxxxxxxx",
@@ -213,49 +234,59 @@ static ColDef all_tree_view_split_reg_columns[] = {
      " ", "status", "x",
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
      NULL, NULL, NULL},
+
+    {COL_COMM, -1,
+     "Commodity", "commodity", "xxxxxxx",
+     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
+     NULL, NULL, NULL},
 };
 
 
 struct GncTreeViewSplitRegPrivate
 {
-    gboolean         disposed;
+    gboolean             disposed;
   
-    Account         *anchor;
-    gnc_commodity   *reg_comm;
-
-    Split           *dirty_split;         // set when split is changed
-    Transaction     *dirty_trans;         // set when transaction is changed
-
-    GtkTreePath     *acct_edit_path;      // remember which row's account we're editing
+    Account             *anchor;              // The register default Account
+    gnc_commodity       *reg_comm;            // The register commodity
 
-    GtkTreePath     *current_path;        // remember what the current path is.
+    Transaction         *current_trans;       // The current highlighted transaction
+    Split               *current_split;       // The current highlighted split
+    RowDepth             current_depth;       // The current depth 1=TROW1, 2=TROW2, 3=SPLIT3
+    GtkTreeRowReference *current_ref;         // The current model path reference
 
-    GtkCellRenderer *temp_cr;             // Temp Cell Renderer reference
+    Transaction         *dirty_trans;         // Set when transaction is changed
+    GtkTreeRowReference *edit_ref;            // The model edit path reference
 
-    gboolean         has_rate;            // if set, the transfer dialog will never automatically pop-up
+    GtkCellRenderer     *temp_cr;             // Pointer to Temp Cell Renderer
+    gulong               fo_handler_id;       // Focus out callback id
 
-    gboolean         full_refresh;
-
-    gboolean         acct_short_names;
-    gboolean         double_line;
-
-
-    gboolean         default_set;          // wether default selection has been run
-    gint             row_old;              // old top level row
-    gint             row_now;              // current top level row
+    gboolean             acct_short_names;    // Use account short names
+    gboolean             double_line;         // Use double line mode
+    gboolean             expanded;            // Are we expanded to splits
 
 };
 
 
 #define SPLIT_TRANS_STR _("-- Split Transaction --")
 
+/* Define some cell colors */
 #define PINKCELL "#F8BEC6"
 #define REDCELL "#F34943"
 #define BLUECELL "#1D80DF"
 #define BLACKCELL "#CBCBD2"
+#define YELLOWCELL "#F58018"
+
 
-/* This could be a preference setting, The minimum length of characters in order to start completing */
+/* This could be a preference setting, the minimum length of characters in order to start completing */
 #define KEY_LENGTH 2
+/* This could be a preference setting, use calendar buttons in tree view */
+#define CAL_USE_BUTTONS TRUE
+/* This could be a preference setting, show currency / commodity symbols */
+#define SHOW_SYMBOL FALSE
+/* This could be a preference setting, move selection to blank split on expand */
+#define SELECTION_TO_BLANK_ON_EXPAND TRUE
+/* This could be a preference setting, display the entered date */
+#define SHOW_ENTERED_DATE FALSE
 
 #define GNC_TREE_VIEW_SPLIT_REG_GET_PRIVATE(o)  \
    (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_TREE_VIEW_SPLIT_REG, GncTreeViewSplitRegPrivate))
@@ -329,15 +360,30 @@ gnc_tree_view_split_reg_class_init(GncTreeViewSplitRegClass *klass)
 }
 
 
+/* Return the tree model from the tree view */
+static GncTreeModelSplitReg *
+get_split_reg_model_from_view (GncTreeViewSplitReg *view)
+{
+    GtkTreeModelSort *s_model = GTK_TREE_MODEL_SORT(
+        gtk_tree_view_get_model (GTK_TREE_VIEW (view)));
+    return GNC_TREE_MODEL_SPLIT_REG (gtk_tree_model_sort_get_model (s_model));
+}
+
+
 static void
 gnc_tree_view_split_reg_init (GncTreeViewSplitReg *view)
 {
     view->priv = g_new0 (GncTreeViewSplitRegPrivate, 1);
 
-    view->priv->current_path = gtk_tree_path_new_from_string ("99999");
-    view->priv->full_refresh = TRUE;
+    view->priv->current_trans = NULL;
+    view->priv->current_split = NULL;
+    view->priv->current_depth = 0;
+    view->reg_closing = FALSE;
+    view->priv->fo_handler_id = 0;
+    view->sort_depth = 1;
 
     view->priv->acct_short_names = gnc_gconf_get_bool (GCONF_GENERAL_REGISTER, "show_leaf_account_names", NULL);
+
 }
 
 
@@ -350,6 +396,9 @@ gnc_tree_view_split_reg_dispose (GObject *object)
     gnc_leave_return_if_fail (object != NULL);
     gnc_leave_return_if_fail (GNC_IS_TREE_VIEW_SPLIT_REG (object));
 //g_print("gnc_tree_view_split_reg_dispose\n");
+
+   ENTER("view split reg %p", object);
+
     view = GNC_TREE_VIEW_SPLIT_REG (object);
     priv = GNC_TREE_VIEW_SPLIT_REG_GET_PRIVATE (view);
 
@@ -357,8 +406,22 @@ gnc_tree_view_split_reg_dispose (GObject *object)
         return;
     priv->disposed = TRUE;
 
+    if(view->priv->current_ref != NULL)
+    {
+        gtk_tree_row_reference_free (view->priv->current_ref);
+        view->priv->current_ref = NULL;
+    }
+
+    if(view->priv->edit_ref != NULL)
+    {
+        gtk_tree_row_reference_free (view->priv->edit_ref);
+        view->priv->edit_ref = NULL;
+    }
+
     if (G_OBJECT_CLASS (parent_class)->dispose)
         (* G_OBJECT_CLASS (parent_class)->dispose) (object);
+
+    LEAVE(" ");
 }
 
 
@@ -370,19 +433,40 @@ gnc_tree_view_split_reg_finalize (GObject *object)
     gnc_leave_return_if_fail(object != NULL);
     gnc_leave_return_if_fail(GNC_IS_TREE_VIEW_SPLIT_REG (object));
 //g_print("gnc_tree_view_split_reg_finalize\n");
+    ENTER("view split reg %p", object);
+
     view = GNC_TREE_VIEW_SPLIT_REG (object);
 
     if (G_OBJECT_CLASS(parent_class)->finalize)
         (* G_OBJECT_CLASS(parent_class)->finalize) (object);
+
+    LEAVE(" ");
 }
 
 
-static GncTreeModelSplitReg *
-get_split_reg_model_from_view (GncTreeViewSplitReg *view)
+/* Update some settings from gconf */
+void
+gnc_tree_view_split_reg_refresh_from_gconf (GncTreeViewSplitReg *view) //FIXME Need to test and change.
 {
-    GtkTreeModelSort *s_model = GTK_TREE_MODEL_SORT(
-        gtk_tree_view_get_model (GTK_TREE_VIEW (view)));
-    return GNC_TREE_MODEL_SPLIT_REG (gtk_tree_model_sort_get_model (s_model));
+    GncTreeModelSplitReg *model;
+
+g_print("gnc_tree_view_split_reg_refresh_from_gconf\n");
+
+    model = get_split_reg_model_from_view (view);
+
+    model->use_theme_colors = gnc_gconf_get_bool(GCONF_GENERAL_REGISTER,
+                              "use_theme_colors", NULL);
+    model->use_accounting_labels = gnc_gconf_get_bool (GCONF_GENERAL,
+                               KEY_ACCOUNTING_LABELS, NULL);
+
+    model->alt_colors_by_txn = gnc_gconf_get_bool (GCONF_GENERAL_REGISTER,
+                               "alternate_color_by_transaction", NULL);
+
+//    sheet->use_horizontal_lines = gnc_gconf_get_bool(GCONF_GENERAL_REGISTER,
+//                                  "draw_horizontal_lines", NULL);
+
+//    sheet->use_vertical_lines = gnc_gconf_get_bool(GCONF_GENERAL_REGISTER,
+//                                "draw_vertical_lines", NULL);
 }
 
 
@@ -399,6 +483,7 @@ static const gchar *rc_string =
 };
 
 
+/* Define which columns are in which views */
 static ViewCol *
 gnc_tree_view_split_reg_get_colummn_list (GncTreeModelSplitReg *model)
 {
@@ -415,11 +500,19 @@ g_print("Model-type is %d\n", model->type);
     case EQUITY_REGISTER2:
     case TRADING_REGISTER2:
     case INCOME_LEDGER2:
+        {
+        static ViewCol col_list[] = {
+        COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSVOID, COL_RECN,
+        COL_STATUS, COL_COMM, COL_DEBIT, COL_CREDIT, COL_BALANCE, -1};
+        return col_list;
+        }
+        break;
+
     case GENERAL_LEDGER2:
         {
         static ViewCol col_list[] = {
         COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSVOID, COL_RECN,
-        COL_STATUS, COL_DEBIT, COL_CREDIT, COL_BALANCE, -1};
+        COL_STATUS, COL_COMM, COL_VALUE, COL_RATE, COL_AMOUNT, COL_DEBIT, COL_CREDIT, -1};
         return col_list;
         }
         break;
@@ -429,7 +522,7 @@ g_print("Model-type is %d\n", model->type);
         {
         static ViewCol col_list[] = {
         COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSVOID, COL_RECN,
-        COL_STATUS, COL_AMTVAL, COL_PRICE, COL_DEBIT, COL_CREDIT, COL_BALANCE, -1};
+        COL_STATUS, COL_COMM, COL_AMTVAL, COL_PRICE, COL_DEBIT, COL_CREDIT, COL_BALANCE, -1};
         return col_list;
         }
         break;
@@ -447,7 +540,7 @@ g_print("Model-type is %d\n", model->type);
         {
         static ViewCol col_list[] = {
         COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSVOID, COL_RECN,
-        COL_STATUS, COL_AMTVAL, COL_PRICE, COL_DEBIT, COL_CREDIT, -1};
+        COL_STATUS, COL_AMOUNT, COL_PRICE, COL_DEBIT, COL_CREDIT, -1};
         return col_list;
         }
 
@@ -520,14 +613,20 @@ gnc_tree_view_split_reg_set_cols (GncTreeViewSplitReg *view,
 
         g_object_set_data (G_OBJECT (col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
 
-        renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (col)); //FIXME I am only looking at one renderer per cell.
+        renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (col));
         g_assert (g_list_length (renderers) == 1);
         cr = g_list_nth_data (renderers, 0);
         g_list_free (renderers);
 
         /* Setup cell background color and default alignment */
         g_object_set (cr, "xalign", 1.0, NULL);
-        gtk_tree_view_column_add_attribute (col, cr, "cell-background", GNC_TREE_MODEL_SPLIT_REG_COL_COLOR);
+
+        /* Add the full title for status column to the object for menu creation */
+        if (col_list[i] == COL_STATUS)
+            g_object_set_data_full(G_OBJECT(col), REAL_TITLE, g_strdup(_("Status Bar")), g_free);
+
+        /* This sets the background of the treeview control columns */
+        gnc_tree_view_set_control_column_background (GNC_TREE_VIEW (view), 0, control_cdf);
 
         if (def.editing_started_cb) {
             //Store the position of the column in the model
@@ -536,7 +635,7 @@ gnc_tree_view_split_reg_set_cols (GncTreeViewSplitReg *view,
             g_signal_connect (G_OBJECT(cr), "editing-started", (GCallback) def.editing_started_cb, view);
         }
 
-        //Connect editing-canceled signal so that edit-cancelled can be set appropriately
+        // Connect editing-canceled signal so that edit-cancelled can be set appropriately
         g_signal_connect (G_OBJECT(cr), "editing-canceled", G_CALLBACK (gtv_split_reg_editing_canceled_cb), view);
 
         // Set Columns to be resizable default.
@@ -553,9 +652,18 @@ gnc_tree_view_split_reg_set_cols (GncTreeViewSplitReg *view,
         gtk_tree_view_column_set_cell_data_func ( col, cr, cdf, view, NULL);
         i++;
     }
-    gtk_tree_selection_set_mode(gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), GTK_SELECTION_BROWSE);
+    gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), GTK_SELECTION_BROWSE);
 
-    /* This will expand to splits on double clicking at current position */
+    // Default the sorting to date.
+    gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(gtk_tree_view_get_model (GTK_TREE_VIEW (view))),
+                                         GNC_TREE_MODEL_SPLIT_REG_COL_DATE,
+                                         GTK_SORT_ASCENDING);
+
+    // Connect a call back to update the sort settings.
+    g_signal_connect (GTK_TREE_SORTABLE (gtk_tree_view_get_model (GTK_TREE_VIEW (view))),
+        "sort-column-changed", G_CALLBACK (gnc_tree_control_split_reg_sort_changed_cb), view);
+
+    // This will expand to splits on double clicking at current position.
     g_signal_connect (GTK_TREE_VIEW (view), "row-activated", G_CALLBACK (gtv_split_reg_double_click_cb), NULL);
 
     g_signal_connect(gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), "changed", G_CALLBACK (gtv_split_reg_motion_cb), view);
@@ -563,82 +671,78 @@ gnc_tree_view_split_reg_set_cols (GncTreeViewSplitReg *view,
     //Add a data-edited property to keep track of transaction edits
     g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (FALSE));
 
+    // This is used to move the selected item if the selected transaction is deleted 
+    g_signal_connect (G_OBJECT (model), "trans_delete", G_CALLBACK (gtv_split_reg_trans_delete_cb), view);
+
+    // This will refresh the view
+    g_signal_connect (G_OBJECT (model), "refresh_view", G_CALLBACK (gtv_split_reg_refresh_cb), view);
+
+    // This should be for key navigation, tabbing...
     g_signal_connect_after (G_OBJECT (view), "key-press-event", G_CALLBACK (gtv_split_reg_key_press_cb), NULL);
+
     return view;
 }
 
 
+/* Set up the view */
 static gboolean
 gnc_tree_view_split_reg_set_format (GncTreeViewSplitReg *view)
 {
+    GncTreeViewSplitRegPrivate *priv;
     GncTreeModelSplitReg *model;
-    GtkTreePath *path;
-    RowDepth depth;
-    gint index = 0;
+    GtkTreePath *mpath, *spath;
     gint total_num = 0;
-    gint *indices;
-    gint row_now;
-    gint row_old;
 
     model = get_split_reg_model_from_view (view);
 
-    row_now = view->priv->row_now;
-    row_old = view->priv->row_old;
+    priv = view->priv;
+
     total_num = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL);
-    depth = gnc_tree_view_reg_get_selected_row_depth (view);
 
-g_print("gnc_tree_view_split_reg_set_format row_now is %d, row_old is %d, total is %d\n", row_now, row_old, total_num);
+    mpath = gtk_tree_row_reference_get_path (view->priv->current_ref);
+    spath = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (gtk_tree_view_get_model (GTK_TREE_VIEW (view))), mpath);
 
-    /* scroll the view */
-    if (row_now == total_num -1)
-        gtv_scroll_to_cell (view);
+//g_print("gnc_tree_view_split_reg_set_format total is %d\n", total_num );
 
-    if ((row_now != row_old) || (view->priv->default_set == TRUE))
-    {
-    view->priv->default_set = FALSE;
+    priv->expanded = FALSE;
 
+    {
         if (model->style == REG2_STYLE_JOURNAL)
         {
-g_print("gnc_tree_view_split_reg_set_format journal\n");
-            path = gtk_tree_path_new_first ();
-            indices = gtk_tree_path_get_indices (view->priv->current_path);
+//g_print("gnc_tree_view_split_reg_set_format journal\n");
 
-            /* we need do this when we remove the blank split from the last transaction */
-            if (indices[0] != total_num -1)
-                total_num = total_num -1;
+            gtk_tree_view_expand_all (GTK_TREE_VIEW (view));
 
-            while (index < total_num)
-            {
-                gtk_tree_path_down (path); //TROW2
-                gtk_tree_view_expand_to_path (GTK_TREE_VIEW (view), path);
-                gtk_tree_path_up (path);   //TROW1
+            priv->expanded = TRUE;
 
-                index = index + 1;
-                if (index == total_num)
-                    break;
+            /* This updates the plugin page gui */
+            if (view->moved_cb)
+                (view->moved_cb)(view, view->moved_cb_data);
 
-                gtk_tree_path_next (path); //Next Transaction
-            }
-            gtk_tree_path_free (path);
             return (FALSE);
         }
 
         if (!model->use_double_line)
         {
-g_print("gnc_tree_view_split_reg_set_format single\n");
-            path = gtk_tree_path_new_first ();
-            while (index < total_num)
-            {
-                gtk_tree_view_collapse_row (GTK_TREE_VIEW (view), path);
-                gtk_tree_path_next (path); //Next Transaction
-                index = index + 1;
-            }
-            gtk_tree_path_free (path);
+//g_print("gnc_tree_view_split_reg_set_format single\n");
+
+            gtk_tree_view_collapse_all (GTK_TREE_VIEW (view));
+
+            priv->expanded = FALSE;
+
+            /* This updates the plugin page gui */
+            if (view->moved_cb)
+                (view->moved_cb)(view, view->moved_cb_data);
+
+            return (FALSE);
         }
 
         if (model->use_double_line)
         {
-g_print("gnc_tree_view_split_reg_set_format double\n");
+            gint index = 0;
+            GtkTreePath *path;
+
+//g_print("gnc_tree_view_split_reg_set_format double\n");
             path = gtk_tree_path_new_first ();
             while (index < total_num)
             {
@@ -655,17 +759,40 @@ g_print("gnc_tree_view_split_reg_set_format double\n");
         /* This expands to split from top level auto.. */
         if ((model->style == REG2_STYLE_AUTO_LEDGER) || (model->style == REG2_STYLE_JOURNAL))
         {
-            GtkTreePath *expand_path;
-g_print("gnc_tree_view_split_reg_set_format auto\n");
-            expand_path = gtk_tree_path_new_from_indices (row_now, -1);
-            gtk_tree_view_expand_row (GTK_TREE_VIEW (view), expand_path, TRUE);
-            gtk_tree_path_free (expand_path);
+//g_print("gnc_tree_view_split_reg_set_format auto\n");
+
+            gtk_tree_view_expand_row (GTK_TREE_VIEW (view), spath, TRUE);
+
+            priv->expanded = TRUE;
         }
     }
+
+    gtk_tree_path_free (mpath);
+    gtk_tree_path_free (spath);
+
+    /* This updates the plugin page gui */
+    if (view->moved_cb)
+        (view->moved_cb)(view, view->moved_cb_data);
+
     return (FALSE);
 }
 
 
+/* Callback to update the view after transactions are added or deleted */
+static void
+gtv_split_reg_refresh_cb (GncTreeModelSplitReg *model, gpointer user_data)
+{
+    GncTreeViewSplitReg *view = user_data;
+
+//g_print("refresh model %p view %p\n", model, view);
+
+    if (view->reg_closing != TRUE)
+        /* Set the view format */
+        g_idle_add ((GSourceFunc)gnc_tree_view_split_reg_set_format, view);
+}
+
+
+/* Create a tree view from a given model */
 GncTreeViewSplitReg*
 gnc_tree_view_split_reg_new_with_model (GncTreeModelSplitReg *model)
 {
@@ -686,9 +813,11 @@ gnc_tree_view_split_reg_new_with_model (GncTreeModelSplitReg *model)
     gnc_tree_view_set_model (GNC_TREE_VIEW (view), s_model);
     g_object_unref (G_OBJECT (s_model));
 
+    /* Set the user_data for the sort callback */
+    gnc_tree_view_set_sort_user_data (GNC_TREE_VIEW (view), view);
+
     view->priv->anchor = gnc_tree_model_split_reg_get_anchor (model);
     view->priv->reg_comm = xaccAccountGetCommodity (view->priv->anchor);
-    view->priv->has_rate = TRUE; //FIXME - replace has_rate with price visibility test / from original
     view->help_text = NULL;
 
     gnc_tree_view_split_reg_set_cols (view, gnc_tree_view_split_reg_get_colummn_list (model));
@@ -737,43 +866,51 @@ void
 gnc_tree_view_split_reg_default_selection (GncTreeViewSplitReg *view)
 {
     GncTreeModelSplitReg *model;
-    GtkTreeIter iter;
-    GtkTreePath *path, *path_temp;
+    GtkTreePath *path, *mpath, *spath;
     gint *indices;
-    gint top_row;
 
     model = get_split_reg_model_from_view (view);
 
-    view->priv->default_set = TRUE;
+g_print("gnc_tree_view_split_reg_default_selection\n");
 
     /* Set the default start position to end of list */
-    if (gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, view->priv->current_path))
-    {
-        indices = gtk_tree_path_get_indices (view->priv->current_path);
-        top_row = indices[0];
-    }
-    else
+    if (view->priv->current_trans == NULL)
     {
         /* both values NULL will return last in list */
-        path_temp = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, NULL, NULL);
-        indices = gtk_tree_path_get_indices (path_temp);
-        top_row = indices[0]; // we do this because freeing the path screws the indices
-        gtk_tree_path_free (path_temp);
+        mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, NULL, NULL);
+        view->priv->current_trans = gnc_tree_control_split_reg_get_blank_trans (view);
     }
+    else
+        mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, view->priv->current_split, view->priv->current_trans);
+
+    spath = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (gtk_tree_view_get_model (GTK_TREE_VIEW (view))), mpath);
+
+    indices = gtk_tree_path_get_indices (spath);
+    path = gtk_tree_path_new_from_indices (indices[0], -1);
 
-    path = gtk_tree_path_new_from_indices (top_row, -1);
+//g_print("gnc_tree_view_split_reg_default_selection mpath is %s, spath is %s, new path is %s\n",
+// gtk_tree_path_to_string (mpath), gtk_tree_path_to_string (mpath), gtk_tree_path_to_string (path));
 
-//g_print("gnc_tree_view_split_reg_default_selection current_path is %s, new path is %s\n", gtk_tree_path_to_string (view->priv->current_path),
-//        gtk_tree_path_to_string (path));
+    view->priv->current_depth = gtk_tree_path_get_depth (path);
 
-    gtk_tree_path_free (view->priv->current_path);
-    view->priv->current_path = gtk_tree_path_copy (path);
+    if (view->priv->current_ref != NULL)
+    {
+        gtk_tree_row_reference_free (view->priv->current_ref);
+        view->priv->current_ref = NULL;
+    }
+    view->priv->current_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (model), path);
+//g_print("gnc_tree_view_split_reg_default_selection - current_ref is valid %d\n", gtk_tree_row_reference_valid (view->priv->current_ref));
 
     gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), path);
 
+    gtk_tree_path_free (mpath);
+    gtk_tree_path_free (spath);
     gtk_tree_path_free (path);
 
-    /* scroll when view is idle */
+    /* Set the view format */
+    g_idle_add ((GSourceFunc)gnc_tree_view_split_reg_set_format, view);
+
+    /* scroll window to show selection when view is idle */
     g_idle_add ((GSourceFunc)gtv_scroll_to_cell, view );
 }
 
@@ -795,32 +932,74 @@ static gboolean
 needs_exchange_rate (GncTreeViewSplitReg *view, Transaction *trans, Split *split)
 {
     gnc_commodity *split_com, *txn_curr, *reg_com;
-g_print("needs_exchange_rate - trans %p and split %p\n", trans, split);
-//    if (view->priv->has_rate) return FALSE;
+//g_print("\nneeds_exchange_rate - trans %p and split %p\n", trans, split);
 
     txn_curr = xaccTransGetCurrency (trans);
     split_com = xaccAccountGetCommodity (xaccSplitGetAccount (split));
     if (split_com && txn_curr && !gnc_commodity_equiv (split_com, txn_curr))
     {
-g_print("needs_exchange_rate split_com return TRUE\n");
+//g_print("needs_exchange_rate split_com to txn_curr return TRUE\n");
         return TRUE;
     }
 
     reg_com = view->priv->reg_comm;
-    if (reg_com && split_com && !gnc_commodity_equiv (reg_com, split_com))
+    if (split_com && reg_com && !gnc_commodity_equiv (split_com, reg_com))
     {
-g_print("needs_exchange_rate reg_com return TRUE\n");
+//g_print("needs_exchange_rate split_com and reg_com return TRUE\n");
         return TRUE;
     }
-
+//g_print("No Exchange rate needed\n");
     return FALSE;
 }
 
 
+/* Get the rate from the price db */
+static gnc_numeric
+gtv_get_rate_from_db (gnc_commodity *from, gnc_commodity *to)
+{
+    GNCPrice *prc;
+    gnc_numeric rate_split;
+    gboolean have_rate = FALSE;
+    QofBook *book = gnc_get_current_book ();
+
+//g_print("gtv_get_rate_from_db - from comm is %s and to comm is %s\n", gnc_commodity_get_printname (from), gnc_commodity_get_printname (to));
+
+    /* Do we have a rate allready */
+    prc = gnc_pricedb_lookup_latest (gnc_pricedb_get_db (book), from, to);
+    if (prc)
+    {
+        rate_split = gnc_price_get_value (prc);
+        gnc_price_unref (prc);
+        have_rate = TRUE;
+    }
+
+    /* Lets try reversing the commodities */
+    if (!have_rate)
+    {
+        prc = gnc_pricedb_lookup_latest (gnc_pricedb_get_db (book), to, from);
+        if (prc)
+        {
+            rate_split = gnc_numeric_div (gnc_numeric_create (1, 1), gnc_price_get_value (prc),
+                                 GNC_DENOM_AUTO, GNC_HOW_DENOM_REDUCE);
+
+            gnc_price_unref (prc);
+            have_rate = TRUE;
+        }
+    }
+
+    /* No rate, set to 1/1 */
+    if (!have_rate)
+        rate_split = gnc_numeric_create (1, 1);
+
+//g_print("\ngtv_get_rate_from_db - rate is %s\n", gnc_numeric_to_string (rate_split));
+    return rate_split;
+}
+
+
 /* Either sets the value and amount for split and returns TRUE, or
    does nothing and returns FALSE. */
 static gboolean
-handle_exchange_rate (GncTreeViewSplitReg *view, gnc_numeric amount, Transaction *trans, Split *split)
+handle_exchange_rate (GncTreeViewSplitReg *view, gnc_numeric amount, Transaction *trans, Split *split, gboolean force)
 {
     XferDialog *xfer;
     gboolean rate_split_ok, rate_reg_ok;
@@ -830,68 +1009,86 @@ handle_exchange_rate (GncTreeViewSplitReg *view, gnc_numeric amount, Transaction
     gnc_commodity *reg_comm = view->priv->reg_comm;
     gnc_commodity *trans_curr = xaccTransGetCurrency (trans);
     gboolean expanded;
+    gboolean have_rate;
 
-g_print("handle_exchange_rate trans %p and split %p\n", trans, split);
+
+//g_print("\nhandle_exchange_rate amount %s, trans %p and split %p force %d\n", gnc_numeric_to_string (amount), trans, split, force);
 
     /* Rate from trans-curr to split-comm */
     rate_split_ok = xaccTransGetRateForCommodity (trans, xfer_comm, split, &rate_split);
+//g_print("\nrate_split_ok is %d and is %s\n", rate_split_ok, gnc_numeric_to_string (rate_split));
 
     /* Rate from trans-curr to reg-comm */
     rate_reg_ok = xaccTransGetRateForCommodity (trans, reg_comm, split, &rate_reg);
+//g_print("\nrate_reg_ok is %d and is %s\n", rate_reg_ok, gnc_numeric_to_string (rate_reg));
+
+    /* Are we expanded */
+    expanded = view->priv->expanded;
 
-    /* Are we expnded */
-    expanded = gnc_tree_view_split_reg_current_trans_expanded (view);
+//g_print("reg_comm is %s\n", gnc_commodity_get_printname (reg_comm));
+//g_print("xfer_comm is %s\n", gnc_commodity_get_printname (xfer_comm));
+//g_print("trans_curr is %s\n", gnc_commodity_get_printname (trans_curr));
 
-    if (rate_reg_ok && rate_split_ok)
+    if (rate_reg_ok && rate_split_ok && !force)
     {
+//g_print("rate_reg_ok and rate_split_ok\n");
         value = gnc_numeric_div (amount, rate_reg, gnc_commodity_get_fraction (trans_curr), GNC_HOW_DENOM_REDUCE);
         amount = gnc_numeric_mul (value, rate_split, GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
     }
     else
     {
-        rate_split = gnc_numeric_create (1, 1);
+//g_print("xfer dialog start and expanded is %d\n", expanded);
+        if (!rate_split_ok)
+            rate_split = gtv_get_rate_from_db (reg_comm, xfer_comm);
 
-        //g_message("reg amt: %s", gnc_numeric_to_string(amount));
         /* create the exchange-rate dialog */
         xfer = gnc_xfer_dialog (NULL, NULL);
+
         gnc_xfer_dialog_is_exchange_dialog (xfer, &rate_split);
 
         /* fill in the dialog entries */
         gnc_xfer_dialog_set_description (xfer, xaccTransGetDescription (trans));
         gnc_xfer_dialog_set_memo (xfer, xaccSplitGetMemo (split));
-        /* Get per book option */
+
+        /* Get per book option */ 
         gnc_xfer_dialog_set_num (xfer, gnc_get_num_action (trans, split));
         gnc_xfer_dialog_set_date (xfer, timespecToTime64 (xaccTransRetDatePostedTS (trans)));
 
         value = amount;
-        if (gnc_xfer_dialog_run_exchange_dialog (
-                xfer, &rate_split, value, reg_acc, trans, xfer_comm, expanded))
-            return FALSE;
+        if (gnc_xfer_dialog_run_exchange_dialog (xfer, &rate_split, value, reg_acc, trans, xfer_comm, expanded))
+        {
+            if (!rate_split_ok)
+                rate_split = gnc_numeric_create (1, 1);
+            have_rate = FALSE;
+        }
+        else
+            have_rate = TRUE;
+
         amount = gnc_numeric_mul (value, rate_split, GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
     }
     xaccSplitSetAmount (split, amount);
     xaccSplitSetValue (split, value);
-    g_message ("split amt=%s; split val=%s", gnc_numeric_to_string (amount), gnc_numeric_to_string (value));
-g_print("handle_exchange_rate split amt=%s; split val=%s\n", gnc_numeric_to_string (amount), gnc_numeric_to_string (value));
-    return TRUE;
-}
-
 
+    g_message ("split %p amt=%s; split val=%s", split, gnc_numeric_to_string (amount), gnc_numeric_to_string (value));
+//g_print("handle_exchange_rate set split %p amt=%s; split val=%s\n\n", split, gnc_numeric_to_string (amount), gnc_numeric_to_string (value));
+    return have_rate;
+}
 
 
-static void
-set_value_for (GncTreeViewSplitReg *view, Transaction *trans, Split *split, gnc_numeric input)
+#define set_value_for gnc_tree_view_split_reg_set_value_for
+void
+gnc_tree_view_split_reg_set_value_for (GncTreeViewSplitReg *view, Transaction *trans, Split *split, gnc_numeric input, gboolean force)
 {
+    GtkWidget *window;
     Account *anchor = view->priv->anchor;
     Account *acct = xaccSplitGetAccount (split);
     gnc_commodity *currency;
     gnc_numeric value, amount, rate;
 
-g_print("set_value_for trans %p and split %p input %s\n", trans, split, gnc_numeric_to_string (input));
-g_print("anchor is %p and acct is %p\n", anchor, acct);
+//g_print("\nset_value_for trans %p and split %p input %s force %d\n", trans, split, gnc_numeric_to_string (input), force);
+//g_print("anchor is %p and acct is %p\n", anchor, acct);
 
-    if (xaccSplitGetAccount (split) == NULL) //FIXME this would make sure we have an account, not sure its valid.
-        xaccTransScrubOrphans (trans);
+    currency = xaccTransGetCurrency (trans);
 
     if (gnc_numeric_zero_p (input))
     {
@@ -900,22 +1097,24 @@ g_print("anchor is %p and acct is %p\n", anchor, acct);
         return;
     }
 
-    if (!xaccTransGetCurrency (trans))
-    {
-        if (anchor)
-            xaccTransSetCurrency (trans, view->priv->reg_comm);
-        else
-            xaccTransSetCurrency (trans, xaccAccountGetCommodity (acct));
-    }
-
-    currency = xaccTransGetCurrency (trans);
+    window = gnc_tree_view_split_reg_get_parent (view);
 
     if (needs_exchange_rate (view, trans, split))
     {
-        if (handle_exchange_rate (view, input, trans, split))
+        if (handle_exchange_rate (view, input, trans, split, force))
         {
+//g_print("handle_exchange_rate return true\n");
+
             ; //FIXME ??????
         }
+        else
+        {
+//g_print("handle_exchange_rate return false\n");
+
+            gnc_error_dialog (window, "%s",
+                         _("Exchange Rate Canceled, using existing rate or default 1 to 1 rate if this is a new transaction."));
+
+        }
         return;
     }
 
@@ -927,35 +1126,41 @@ g_print("anchor is %p and acct is %p\n", anchor, acct);
     {
         gnc_commodity *reg_com = view->priv->reg_comm;
         gnc_commodity *split_com = xaccAccountGetCommodity (acct);
-        /* Convert from the anchor account's commodity to
-           trans currency */
-        //xaccSplitSetAmount (split, input);
+//g_print("set_value_for with anchor\n");
+        /* Convert from the anchor account's commodity to trans currency */
         if (gnc_commodity_equiv (currency, reg_com))
             value = input;
         else 
-       {
+        {
             if (!xaccTransGetRateForCommodity (trans, reg_com, NULL, &rate))
                 return;
-            //rate = xaccTransGetAccountConvRate(trans, anchor);
+
             if (gnc_numeric_zero_p (rate))
             {
-                // FIXME: probably wrong.
+//g_print("set_value_for with anchor zero rate\n");
                 xaccTransSetCurrency (trans, reg_com);
                 value = input;
             }
             else
+            {
+//g_print("set_value_for with anchor non zero rate\n");
                 value = gnc_numeric_div (
                     input, rate,
                     GNC_DENOM_AUTO, //?
                     //gnc_commodity_get_fraction(currency),
                     GNC_HOW_RND_ROUND);
+            }
         }
         xaccSplitSetValue (split, value);
-        //return;
+
         if (gnc_commodity_equiv (split_com, reg_com))
+        {
+//g_print("set_value_for with anchor comm equiv\n");
             amount = input;
+        }
         else
         {
+//g_print("set_value_for with anchor comm not equiv\n");
             rate = xaccTransGetAccountConvRate (trans, acct);
             amount = gnc_numeric_mul (value, rate, xaccAccountGetCommoditySCU (acct), GNC_HOW_RND_ROUND);
         }
@@ -963,13 +1168,10 @@ g_print("anchor is %p and acct is %p\n", anchor, acct);
     }
     else
     {
-        //FIXME: untested; assumes entry in the trans currency
-        //gnc_commodity *split_com = xaccAccountGetCommodity(acct);
+//g_print("\nset_value_for without anchor\n");
         value = input;
         xaccSplitSetValue (split, value);
-        //g_assert (split_com == currency);
-        //FIXME: obsolete
-        /* For a split belonging to another account */
+
         rate = xaccTransGetAccountConvRate (trans, acct);
         amount = gnc_numeric_mul (value, rate, xaccAccountGetCommoditySCU (acct), GNC_HOW_RND_ROUND);
         if (gnc_numeric_check (amount) == GNC_ERROR_OK)
@@ -987,11 +1189,11 @@ get_value_for (GncTreeViewSplitReg *view, Transaction *trans, Split *split, gboo
     gnc_commodity *currency = xaccTransGetCurrency (trans);
     gnc_numeric total;
 
-// g_print("get_value_for trans %p and split %p is_blank %d\n", trans, split, is_blank);
+//g_print("get_value_for trans %p and split %p is_blank %d\n", trans, split, is_blank);
 
     total = xaccSplitGetValue (split);
 
-    if (is_blank && gnc_numeric_zero_p (total))
+    if (is_blank && gnc_numeric_zero_p (total)) //blank split and total zero
     {
         gnc_numeric rate;
         total = gnc_numeric_neg (xaccTransGetImbalanceValue (trans));
@@ -1012,96 +1214,19 @@ get_value_for (GncTreeViewSplitReg *view, Transaction *trans, Split *split, gboo
         {
             /* if needs conversion? */
             gnc_commodity *commodity = view->priv->reg_comm;
-            if (commodity && !gnc_commodity_equiv (commodity, currency))
-                total = xaccSplitConvertAmount (split, view->priv->anchor);
+            if (commodity && gnc_commodity_is_currency (view->priv->reg_comm)) //test for a currency register
+            {
+                if (!gnc_commodity_equiv (commodity, currency))
+                {
+                    total = xaccSplitConvertAmount (split, view->priv->anchor);
+                }
+            }
         }
     }
     return total;
 }
 
 
-static void
-set_amount_for (GncTreeViewSplitReg *view, Transaction *trans, Split *split, gnc_numeric input)
-{
-    Account *acct = xaccSplitGetAccount (split);
-    gnc_commodity *split_com = xaccAccountGetCommodity (acct);
-    gnc_commodity *currency = xaccTransGetCurrency (trans);
-
-g_print("set_amount_for trans %p and split %p and input is %s\n", trans, split, gnc_numeric_to_string (input));
-
-    xaccSplitSetAmount (split, input);
-    if (gnc_commodity_equiv (currency, split_com))
-        xaccSplitSetValue (split, input);
-
-    return;
-}
-
-
-static gnc_numeric
-get_rate_for (GncTreeViewSplitReg *view, Transaction *trans, Split *split, gboolean is_blank)
-{
-    gnc_numeric num;
-
-//g_print("get_rate_for trans %p and split %p is_blank %d\n", trans, split, is_blank);
-
-    num = get_value_for (view, trans, split, is_blank);
-//g_print("get_rate_for get_value_for is %s\n", gnc_numeric_to_string (num));
-    num = gnc_numeric_div ( xaccSplitGetAmount (split), num, GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
-//g_print("get_rate_for return is %s\n", gnc_numeric_to_string (num));
-    return num;
-}
-
-
-static void
-set_rate_for (GncTreeViewSplitReg *view, Transaction *trans, Split *split, gnc_numeric input, gboolean is_blank)
-{
-    gnc_commodity *split_comm;
-
-    gnc_numeric old_rate = get_rate_for (view, trans, split, is_blank);
-    gnc_numeric factor = gnc_numeric_div (input, old_rate, GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
-    split_comm = xaccAccountGetCommodity (xaccSplitGetAccount (split));
-/*FIXME     xaccTransAdjustRateForCommodity (trans, split_comm, factor); */
-
-//g_print("set_rate_for trans %p and split %p is_blank %d\n", trans, split, is_blank);
-
-#if JUNK
-    // This is from original 
-    reg_comm = view->priv->reg_comm;
-    if (xaccTransGetRateForCommodity (trans, reg_comm, split, &reg_rate))
-    {
-        input = gnc_numeric_div (input, reg_rate, GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
-        /* input is now the rate from the transaction currency to the
-           split_com */
-    }
-
-    if (gnc_numeric_zero_p (val) && gnc_numeric_zero_p (amt))
-    {
-        gnc_numeric one = gnc_numeric_create (1, 1);
-        xaccSplitSetAmount (split, one);
-        amt = one;
-    }
-
-    if (gnc_numeric_zero_p (val))
-    {
-        val = gnc_numeric_div (input, amt, GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
-    }
-    else
-    {
-        amt = gnc_numeric_mul (input, val, GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
-    }
-
-    amt = gnc_numeric_mul (get_value_for(view, trans, split, FALSE /*FIXME*/),
-                          input,
-                          GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
-    set_amount_for (view, trans, split, amt);
-
-    //xaccSplitSetValue (split, val);
-    //xaccSplitSetAmount (split, amt);
-
-#endif
-}
-
-
 /* Returns the other Split based on the current Account */
 /* Only used with two split transactions */
 static Split *
@@ -1135,89 +1260,385 @@ get_this_split (GncTreeViewSplitReg *view, Transaction *trans)
 }
 
 
-/* The returned Splits may be newly created and not yet belong to trans. */
-static gboolean
-get_split_pair (GncTreeViewSplitReg *view, Transaction *trans, Split **osplit, Split **split)
+/* Returns the value denom */
+static int
+gnc_tree_view_split_reg_get_value_denom (Split *split)
 {
-    QofBook       *book; //do we have this
-
-    gint count = xaccTransCountSplits (trans);
-    Account *anchor = view->priv->anchor;
+    gnc_commodity *currency;
+    int denom;
 
-//FIXME Probably needs more work 
+    currency = xaccTransGetCurrency (xaccSplitGetParent (split));
+    denom = gnc_commodity_get_fraction (currency);
+    if (denom == 0)
+    {
+        gnc_commodity *commodity = gnc_default_currency ();
+        denom = gnc_commodity_get_fraction (commodity);
+        if (denom == 0)
+            denom = 100;
+    }
+    return denom;
+}
 
-    book = gnc_get_current_book();
 
-g_print("get_split_pair trans is %p, osplit is %p and split is %p and count is %d\n", trans, *osplit, *split, count);
+/* Returns the amount denom */
+static int
+gnc_tree_view_split_reg_get_amount_denom (Split *split)
+{
+    int denom;
 
-    if (count == 0)
+    denom = xaccAccountGetCommoditySCU (xaccSplitGetAccount (split));
+    if (denom == 0)
     {
-        *split = xaccMallocSplit (book);
-        xaccSplitSetAccount (*split, anchor);
-        xaccSplitSetParent (*split, trans);
-        *osplit = xaccMallocSplit (book);
-        xaccSplitSetParent (*osplit, trans);
+        gnc_commodity *commodity = gnc_default_currency ();
+        denom = gnc_commodity_get_fraction (commodity);
+        if (denom == 0)
+            denom = 100;
     }
-    else if (count == 2)
-    {
-        int i;
-        Split *s;
+    return denom;
+}
 
-        for (i = 0; (s = xaccTransGetSplit (trans, i)); i++)
+
+/* Takes the input with column and sets the price / amount / value so they are consistent */  
+static void
+set_number_for_input (GncTreeViewSplitReg *view, Transaction *trans, Split *split, gnc_numeric input, gint viewcol)
+{
+    gnc_numeric  price;
+    gnc_numeric  amount;
+    gnc_numeric  value;
+
+    gboolean price_changed = FALSE;   // Price of each share
+    gboolean value_changed = FALSE;   // Total value of shares
+    gboolean amount_changed = FALSE;  // No of shares
+
+    gboolean recalc_amount = FALSE;
+    gboolean recalc_price = FALSE;
+    gboolean recalc_value = FALSE;
+    int denom;
+
+//g_print("set_number_for_input trans %p and split %p and input is %s and viewcol is %d\n", trans, split, gnc_numeric_to_string (input), viewcol);
+
+    if (gnc_numeric_zero_p (input))
+    {
+        xaccSplitSetValue (split, input);
+        xaccSplitSetAmount (split, input);
+        return;
+    }
+
+    amount = xaccSplitGetAmount (split);
+    value = xaccSplitGetValue (split);
+
+//g_print("set_number_for_input amount is %s\n", gnc_numeric_to_string (amount));
+//g_print("set_number_for_input value is %s\n", gnc_numeric_to_string (value));
+
+    if (viewcol == COL_AMTVAL && !view->priv->expanded)
+    {
+        value_changed = TRUE;
+        if (gnc_numeric_zero_p (amount))
         {
-            if (anchor == xaccSplitGetAccount (s))
+            xaccSplitSetValue (split, input);
+            xaccSplitSetAmount (split, input);
+            return;
+        }
+    }
+    else if (viewcol == COL_AMTVAL && view->priv->expanded)
+    {
+        amount_changed = TRUE;
+        if (gnc_numeric_zero_p (value))
+        {
+            xaccSplitSetValue (split, input);
+            xaccSplitSetAmount (split, input);
+            return;
+        }
+    }
+
+    if (viewcol == COL_PRICE)
+    {
+        price_changed = TRUE;
+        if (gnc_numeric_zero_p (value))
+        {
+            amount = gnc_numeric_create (1,1);
+            value = gnc_numeric_mul (input, amount, GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
+            xaccSplitSetValue (split, input);
+            xaccSplitSetAmount (split, amount);
+            return;
+        }
+    }
+
+    if (viewcol == COL_CREDIT || viewcol == COL_DEBIT)
+    {
+        amount_changed = TRUE;
+        if (gnc_numeric_zero_p (value))
+        {
+            xaccSplitSetValue (split, input);
+            xaccSplitSetAmount (split, input);
+            return;
+        }
+    }
+
+//g_print("value_changed %d, price_changed %d, amount_changed %d\n", value_changed, price_changed, amount_changed);
+
+    {
+        int choice;
+        int default_value;
+        GList *node;
+        GList *radio_list = NULL;
+        const char *title = _("Recalculate Transaction");
+        const char *message = _("The values entered for this transaction "
+                                "are inconsistent. Which value would you "
+                                "like to have recalculated?");
+
+        if (amount_changed)
+            radio_list = g_list_append (radio_list,
+                                        g_strdup_printf ("%s (%s)",
+                                                _("_Shares"), _("Changed")));
+        else
+            radio_list = g_list_append (radio_list, g_strdup (_("_Shares")));
+
+        if (price_changed)
+            radio_list = g_list_append (radio_list,
+                                        g_strdup_printf ("%s (%s)",
+                                                _("_Price"), _("Changed")));
+        else
+            radio_list = g_list_append (radio_list, g_strdup (_("_Price")));
+
+        if (value_changed)
+            radio_list = g_list_append (radio_list,
+                                        g_strdup_printf ("%s (%s)",
+                                                _("_Value"), _("Changed")));
+        else
+            radio_list = g_list_append (radio_list, g_strdup (_("_Value")));
+
+        if (price_changed)
+            default_value = 0;  /* change the amount / shares */
+        else
+            default_value = 1;  /* change the value */
+
+        choice = gnc_choose_radio_option_dialog
+                 (gnc_tree_view_split_reg_get_parent (view),
+                  title,
+                  message,
+                  _("_Recalculate"),
+                  default_value,
+                  radio_list);
+
+        for (node = radio_list; node; node = node->next)
+            g_free (node->data);
+
+        g_list_free (radio_list);
+
+        switch (choice)
+        {
+        case 0: /* Modify number of shares */
+            recalc_amount = TRUE;
+            break;
+        case 1: /* Modify the share price */
+            recalc_price = TRUE;
+            break;
+        case 2: /* Modify total value */
+            recalc_value = TRUE;
+            break;
+        default: /* Cancel */
+            return;
+        }
+    }
+
+//g_print("recalc_value %d, recalc_price %d, recalc_amount %d\n", recalc_value, recalc_price, recalc_amount);
+
+    if (recalc_amount)
+    {
+        denom = gnc_tree_view_split_reg_get_amount_denom (split);
+
+        if (amount_changed)
+            return;
+
+        if (price_changed)
+            price = input;
+        else
+            price = gnc_numeric_div (value, amount, GNC_DENOM_AUTO, GNC_HOW_DENOM_EXACT);
+
+        if (value_changed)
+        {
+            xaccSplitSetValue (split, input);
+            amount = gnc_numeric_div (input, price, denom, GNC_HOW_RND_ROUND_HALF_UP);
+            xaccSplitSetAmount (split, amount);
+        }
+        else
+        {
+            amount = gnc_numeric_div (value, price, denom, GNC_HOW_RND_ROUND_HALF_UP);
+            xaccSplitSetAmount (split, amount);
+        }
+    }
+
+    if (recalc_price)
+    {
+        if (price_changed)
+            return;
+
+        if (amount_changed)
+        {
+            xaccSplitSetAmount (split, input);
+            xaccSplitSetValue (split, value);
+        }
+
+        if (value_changed)
+        {
+            xaccSplitSetValue (split, input);
+            xaccSplitSetAmount (split, amount);
+        }
+    }
+
+    if (recalc_value)
+    {
+        denom = gnc_tree_view_split_reg_get_value_denom (split);
+
+        if (value_changed)
+            return;
+
+        if (price_changed)
+            price = input;
+        else
+            price = gnc_numeric_div (value, amount, GNC_DENOM_AUTO, GNC_HOW_DENOM_EXACT);
+
+        if (amount_changed)
+        {
+            xaccSplitSetAmount (split, input);
+            value = gnc_numeric_mul (input, price, denom, GNC_HOW_RND_ROUND_HALF_UP);
+            xaccSplitSetValue (split, value);
+        }
+        else
+        {
+            value = gnc_numeric_mul (amount, price, denom, GNC_HOW_RND_ROUND_HALF_UP);
+            xaccSplitSetValue (split, value);
+        }
+
+        /* If the number of splits is two, change other split to balance */
+        if ((xaccTransCountSplits (trans) == 2) && view->priv->expanded)
+        {
+            Split *osplit;
+            gnc_commodity *split_com;
+
+            osplit = get_other_split (view, trans);
+
+            split_com = xaccAccountGetCommodity (xaccSplitGetAccount (osplit));
+
+            if (gnc_commodity_is_currency (split_com))
             {
-                *split = s;
-                break;
+                if (gnc_numeric_negative_p (value))
+                {
+                    xaccSplitSetValue (osplit, gnc_numeric_neg (value));
+                    xaccSplitSetAmount (osplit, gnc_numeric_neg (value));
+                }
+                else
+                {
+                    xaccSplitSetValue (osplit, value);
+                    xaccSplitSetAmount (osplit, value);
+                }
             }
         }
-        //*split = get_this_split (view, trans);
-        g_assert (*split);
-        *osplit = get_other_split (view, trans);
-        g_assert (*osplit);
     }
-    else
-        return FALSE;
-g_print("get_split_pair return - trans is %p, osplit is %p and split %p is set to anchor %p\n", trans, *osplit, *split, anchor);
-    return TRUE;
 }
 
 
-/* poor name: really means: If this is the blank split, it may now
-   eventually graduate to a real split. The trans must already be
-   opened for editing because the split will be added to the
-   transaction if hasn't been already. */
+/* Set the value for the given input amount */
 static void
-mark_split_dirty (GncTreeViewSplitReg *view, Transaction *trans, Split *split)
+set_value_for_amount (GncTreeViewSplitReg *view, Transaction *trans, Split *split, gnc_numeric input)
 {
-g_print("mark_split_dirty trans %p and split %p\n", trans, split);
-//    if (split != view->priv->dirty_split && view->priv->dirty_split)
-  
+    gnc_numeric  split_rate;
+    gnc_numeric  amount;
+    gnc_numeric  value, new_value;
+    int denom;
+
+//g_print("set_value_for_amount trans %p and split %p and input is %s\n", trans, split, gnc_numeric_to_string (input));
 
-    if (split != view->priv->dirty_split)
+    if (gnc_numeric_zero_p (input))
     {
-g_print("mark_split_dirty1\n");
-        if ((view->priv->dirty_split) && (xaccSplitGetAccount (view->priv->dirty_split) != NULL))
-//        if (view->priv->dirty_split)
-        {
-g_print("mark_split_dirty2\n");
-            gnc_tree_model_split_reg_commit_split (get_split_reg_model_from_view (view), view->priv->dirty_split);
-        }
+        xaccSplitSetValue (split, input);
+        xaccSplitSetAmount (split, input);
+        return;
     }
 
-    if (split && trans && xaccSplitGetParent (split) != trans)
+    amount = xaccSplitGetAmount (split);
+    value = xaccSplitGetValue (split);
+
+    denom = gnc_tree_view_split_reg_get_value_denom (split);
+
+    split_rate = gnc_numeric_div (value, amount, GNC_DENOM_AUTO, GNC_HOW_DENOM_EXACT);
+    if (gnc_numeric_check (split_rate) != GNC_ERROR_OK)
+        split_rate = gnc_numeric_create (1,1);
+
+//g_print("set_value_for_amount amount is %s\n", gnc_numeric_to_string (amount));
+//g_print("set_value_for_amount value is %s\n", gnc_numeric_to_string (value));
+//g_print("set_value_for_amount split_rate is %s\n", gnc_numeric_to_string (split_rate));
+
+    new_value = gnc_numeric_mul (input, split_rate, denom, GNC_HOW_RND_ROUND_HALF_UP);
+
+//g_print("set_value_for_amount new_value is %s\n", gnc_numeric_to_string (new_value));
+
+    xaccSplitSetValue (split, new_value);
+    xaccSplitSetAmount (split, input);
+
+}
+
+
+/* Get the rate */
+static gnc_numeric
+get_rate_for (GncTreeViewSplitReg *view, Transaction *trans, Split *split, gboolean is_blank)
+{
+    gnc_numeric num;
+
+//g_print("\nget_rate_for trans %p and split %p is_blank %d\n", trans, split, is_blank);
+
+    num = get_value_for (view, trans, split, is_blank);
+//g_print("get_rate_for get_value_for is %s\n", gnc_numeric_to_string (num));
+    num = gnc_numeric_div ( xaccSplitGetAmount (split), num, GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
+//g_print("get_rate_for split amount is %s and return num is %s\n", gnc_numeric_to_string (xaccSplitGetAmount (split)), gnc_numeric_to_string (num));
+    return num;
+}
+
+
+/* The returned Splits may be newly created and not yet belong to trans. */
+static gboolean
+get_split_pair (GncTreeViewSplitReg *view, Transaction *trans, Split **osplit, Split **split)
+{
+    QofBook       *book; //do we have this
+
+    gint count = xaccTransCountSplits (trans);
+    Account *anchor = view->priv->anchor;
+
+    book = gnc_get_current_book();
+
+//g_print("get_split_pair trans is %p, osplit is %p and split is %p and count is %d\n", trans, *osplit, *split, count);
+
+    if (count == 0)
+    {
+        *split = xaccMallocSplit (book);
+        xaccSplitSetAccount (*split, anchor);
+        xaccSplitSetParent (*split, trans);
+        *osplit = xaccMallocSplit (book);
+        xaccSplitSetParent (*osplit, trans);
+    }
+    else if (count == 2)
     {
-g_print("mark_split_dirty3\n");
+        int i;
+        Split *s;
 
-        if ((xaccTransCountSplits (trans) == 0) && (view->priv->anchor != NULL))
+        for (i = 0; (s = xaccTransGetSplit (trans, i)); i++)
         {
-g_print("mark_split_dirty4\n");
-            xaccSplitSetAccount (split, view->priv->anchor);
+            if (anchor == xaccSplitGetAccount (s))
+            {
+                *split = s;
+                break;
+            }
         }
-        xaccSplitSetParent (split, trans);
+        //*split = get_this_split (view, trans);
+        g_assert (*split);
+        *osplit = get_other_split (view, trans);
+        g_assert (*osplit);
     }
-
-    view->priv->dirty_split = split;
+    else
+        return FALSE;
+//g_print("get_split_pair return - trans is %p, osplit is %p and split %p is set to anchor %p\n", trans, *osplit, *split, anchor);
+    return TRUE;
 }
 
 
@@ -1244,6 +1665,7 @@ get_imbalance (Transaction *trans)
 }
 
 
+/* Get the model iter from the view path string */
 static gboolean
 get_model_iter_from_view_string (GncTreeViewSplitReg *view,
                                 const gchar *path_string, GtkTreeIter *iter)
@@ -1263,6 +1685,7 @@ get_model_iter_from_view_string (GncTreeViewSplitReg *view,
 }
 
 
+/* Get the model iter from the selection */
 static gboolean
 get_model_iter_from_selection (GncTreeViewSplitReg *view,
                               GtkTreeSelection *sel, GtkTreeIter *iter)
@@ -1279,31 +1702,78 @@ get_model_iter_from_selection (GncTreeViewSplitReg *view,
 }
 
 
+/* Only allow changes to values if we have valid split accounts */
 static gboolean
-gtv_have_account (GncTreeViewSplitReg *view, RowDepth depth, gboolean expanded, Transaction *trans, Split *split)
+have_account (GncTreeViewSplitReg *view, RowDepth depth, gboolean expanded, Transaction *trans, Split *split)
 {
-    gboolean have_account = TRUE;
+    gboolean have_account = FALSE;
+
+//g_print("have_account trans %p, split %p, expanded %d, depth %d\n", trans, split, expanded, depth);
 
-    /* Only allow changes to values if we have a valid split accounts */
-    if ((depth == TRANS1) && !expanded && (xaccTransCountSplits (trans) == 2))
+    if ((depth == TRANS1) && !expanded && (xaccTransCountSplits (trans) == 2)) // normal trans
     {
-        if (xaccSplitGetAccount (get_other_split (view, trans)) == NULL)
-            have_account = FALSE;
+        if (xaccSplitGetAccount (get_other_split (view, trans)) != NULL)
+            have_account = TRUE;
     }
 
-    if ((depth == TRANS1) && !expanded && (xaccTransCountSplits (trans) == 0))
-            have_account = FALSE;
+    if ((depth == SPLIT3) && (xaccTransCountSplits (trans) == 0)) // blank trans, blank split
+        have_account = TRUE;
 
-    if ((depth == SPLIT3) && (xaccTransCountSplits (trans) != 0))
+    if (depth == SPLIT3) // normal split
     {
-        if (xaccSplitGetAccount (split) == NULL)
-            have_account = FALSE;
+        if (xaccSplitGetAccount (split) != NULL)
+            have_account = TRUE;
     }
-    
+
     return have_account;
 }
 
 
+/* This cellDataFunc is to set the cell-background property of the control columns. */
+static void
+control_cdf (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
+    GtkTreeIter *s_iter, gpointer user_data)
+{
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    GncTreeModelSplitReg *model;
+    GtkTreeIter iter;
+    GtkTreePath *mpath, *spath;
+    Transaction *trans;
+    Split *split;
+    gboolean is_split, is_blank, is_trow1, is_trow2;
+    const gchar *row_color;
+
+    gint *indices;
+
+    ENTER("");
+
+    model = get_split_reg_model_from_view (view);
+
+    gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model), &iter, s_iter);
+
+    g_return_if_fail (gnc_tree_model_split_reg_get_split_and_trans (
+                         GNC_TREE_MODEL_SPLIT_REG (model), &iter,
+                          &is_trow1, &is_trow2, &is_split, &is_blank,
+                          &split, &trans));
+
+    mpath = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &iter);
+
+    spath = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (gtk_tree_view_get_model (GTK_TREE_VIEW (view))), mpath);
+
+    indices = gtk_tree_path_get_indices (spath);
+
+    row_color = gnc_tree_model_split_reg_get_row_color (model, is_trow1, is_trow2, is_split, indices[0]);
+
+    gtk_tree_path_free (spath);
+    gtk_tree_path_free (mpath);
+
+    /* Set the background color / this works for sorting and deleting transactions */
+    g_object_set (cell, "cell-background", row_color, (gchar*)NULL);
+
+    LEAVE("");
+}
+
+
 /* Instead of setting a different cellDataFunc for each column, we just
    collect everything here and use this one func. */
 static void
@@ -1313,16 +1783,18 @@ cdf (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
     GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
     GncTreeModelSplitReg *model;
     GtkTreeIter iter;
-    GtkTreePath *path, *temp_path;
+    GtkTreePath *path, *mpath, *spath;
     ViewCol viewcol;
     Transaction *trans;
     Split *split;
     gboolean is_split, is_blank, is_trow1, is_trow2;
     gboolean editable = FALSE, expanded = FALSE;
     gboolean read_only = FALSE;
+    gboolean open_edited = FALSE;
     gint num_of_splits = 0;
     gnc_numeric num;
     const gchar *s = "";
+    const gchar *row_color;
 
     RowDepth depth;
 
@@ -1343,18 +1815,24 @@ cdf (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
                           &is_trow1, &is_trow2, &is_split, &is_blank,
                           &split, &trans));
 
-    temp_path = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &iter);
+    mpath = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &iter);
 
-    depth = gtk_tree_path_get_depth (temp_path);
+    spath = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (gtk_tree_view_get_model (GTK_TREE_VIEW (view))), mpath);
 
-    indices = gtk_tree_path_get_indices (temp_path);
+    depth = gtk_tree_path_get_depth (spath);
 
-    gtk_tree_path_free (temp_path);
+    indices = gtk_tree_path_get_indices (spath);
+
+    row_color = gnc_tree_model_split_reg_get_row_color (model, is_trow1, is_trow2, is_split, indices[0]);
+
+    gtk_tree_path_free (spath);
+    gtk_tree_path_free (mpath);
 
-// g_print("cdf split %p, trans %p, is_trow1 = %d, is_trow2 = %d, is_split = %d, is_blank = %d\n",
-//                                        split, trans, is_trow1, is_trow2, is_split, is_blank);
+// g_print("cdf split %p, trans %p, is_trow1 = %d, is_trow2 = %d, is_split = %d, is_blank = %d, depth is %d\n",
+//                                        split, trans, is_trow1, is_trow2, is_split, is_blank, depth);
 
-//g_print(" cdf depth is %d\n", depth);
+    /* Set the background color / this works for sorting and deleting of transactions */
+    g_object_set (cell, "cell-background", row_color, (gchar*)NULL);
 
     /* Get the read only model setting */
     gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, GNC_TREE_MODEL_SPLIT_REG_COL_RO, &read_only, -1);
@@ -1363,7 +1841,16 @@ cdf (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
     if (xaccTransHasSplitsInState (trans, VREC))
         read_only = TRUE;
 
-//g_print(" cdf path is %s\n", gtk_tree_path_to_string (gtk_tree_model_get_path (GTK_TREE_MODEL (model), &iter)));
+    /* This may be wrong but I thought it was mentioned on news list that you should not change these */
+    if (model->type == RECEIVABLE_REGISTER2 || model->type == PAYABLE_REGISTER2)
+        read_only = TRUE;
+
+    /* Are we being edited in other register */
+    if (xaccTransIsOpen (trans) && (view->priv->dirty_trans != trans))
+    {
+        read_only = TRUE;
+        open_edited = TRUE;
+    }
 
     /* Lets see if the splits are expanded and count them */
     if (is_trow1 || is_trow2)
@@ -1375,11 +1862,16 @@ cdf (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
         expanded = gtk_tree_view_row_expanded (GTK_TREE_VIEW (view), path);
         gtk_tree_path_free (path);
     }
+    else
+    {
+        num_of_splits = xaccTransCountSplits (trans);
+        expanded = TRUE;
+    }
 
     switch (viewcol) {
     case COL_DATE:
         /* Column is DATE */
-        if (is_split)
+        if (is_split || (is_trow2 && SHOW_ENTERED_DATE))
             g_object_set (cell, "cell-background", "white", (gchar*)NULL);
 
         if (is_trow1) {
@@ -1396,6 +1888,20 @@ cdf (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
             s = gnc_print_date(ts);
             editable = TRUE;
         }
+        else if (is_trow2 && SHOW_ENTERED_DATE) {
+            Timespec ts = {0,0};
+            xaccTransGetDateEnteredTS (trans, &ts);
+            //If the time returned by xaccTransGetDateEnteredTS is 0 then assume it
+            //is a new transaction and set the time to current time to show current
+            //date on new transactions
+            if (ts.tv_sec == 0)
+            {
+                ts.tv_sec = gnc_time (NULL);
+                //xaccTransSetDateEnteredSecs(trans, ts.tv_sec);
+            }//if
+            s = gnc_print_date(ts);
+            editable = FALSE;
+        }
         else {
             s = "";
             editable = FALSE;
@@ -1403,8 +1909,8 @@ cdf (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
 
         editable = (read_only == TRUE) ? FALSE : editable;
 
-        /*FIXME This will remove the calander buttons if FALSE, preference may be ? */
-        g_object_set (cell, "use_buttons", TRUE, NULL ); 
+        /* This will remove the calander buttons if FALSE */
+        g_object_set (cell, "use_buttons", CAL_USE_BUTTONS, NULL ); 
         g_object_set (cell, "text", s, "editable", editable, NULL);
         break;
 
@@ -1444,15 +1950,18 @@ cdf (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
         editable = TRUE;
 
         if (is_trow1)
-            /* Get per book option */
+            /* Get per book option */ 
             s = gnc_get_num_action (trans, get_this_split (view, trans));
-        else if (is_trow2 && !expanded)
-            /* Get per book option */
+        else if (is_trow2 && (qof_book_use_split_action_for_num_field (gnc_get_current_book())))
+            /* Get per book option */ 
+            s = gnc_get_action_num (trans, get_this_split (view, trans));
+        else if (is_trow2 && !expanded && (!qof_book_use_split_action_for_num_field (gnc_get_current_book())))
+            /* Get per book option */ 
             s = gnc_get_action_num (trans, get_this_split (view, trans));
         else if (is_split)
-            /* Get split-action with gnc_get_num_action which is the same as
-             * xaccSplitGetAction with these arguments */
-            s = gnc_get_num_action (NULL, split);
+            /* Get split-action with gnc_get_num_action which is the same as 
+             * xaccSplitGetAction with these arguments */ 
+            s = gnc_get_num_action (NULL, split); 
         else
         {
             s = "";
@@ -1553,7 +2062,7 @@ cdf (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
         /* Column is RECN */
         if (is_trow1 && !expanded) {
             char rec = xaccSplitGetReconcile (get_this_split (view, trans));
-            if (rec == VREC || rec == FREC || rec == YREC)
+            if (rec == VREC || rec == FREC)
                 editable = FALSE;
             else
                 editable = TRUE;
@@ -1573,7 +2082,7 @@ cdf (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
 
         if (is_split) {
             char rec = xaccSplitGetReconcile (split);
-            if (rec == VREC || rec == FREC || rec == YREC)
+            if (rec == VREC || rec == FREC)
                 editable = FALSE;
             else
                 editable = TRUE;
@@ -1621,9 +2130,12 @@ cdf (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
         /* Column is VALUE */
         if (is_split)
         {
-            gnc_numeric amt = xaccSplitGetValue (split);
-            s = xaccPrintAmount (amt, gnc_commodity_print_info (xaccTransGetCurrency (trans), FALSE));
-            editable = TRUE;
+            gnc_numeric val = xaccSplitGetValue (split);
+            s = xaccPrintAmount (val, gnc_commodity_print_info (xaccTransGetCurrency (trans), SHOW_SYMBOL));
+            editable = FALSE;
+
+            if (get_imbalance (trans))
+                g_object_set (cell, "cell-background", PINKCELL, (gchar*)NULL);
         }
         else
         {
@@ -1631,10 +2143,6 @@ cdf (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
             editable = FALSE;
         }
 
-        /* Only allow changes to values if we have a valid split accounts */
-        if (!(gtv_have_account (view, depth, expanded, trans, split)))
-            editable = FALSE;
-
         editable = (read_only == TRUE) ? FALSE : editable;
 
         g_object_set (cell, "text", s, "editable", editable, NULL);
@@ -1651,23 +2159,21 @@ cdf (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
         {
             gnc_commodity *split_com = xaccAccountGetCommodity (xaccSplitGetAccount (split));
             num = get_rate_for (view, trans, split, is_blank);
-            if (gnc_numeric_check(num) == GNC_ERROR_OK)
+            if (gnc_numeric_check (num) == GNC_ERROR_OK)
             {
-                s = xaccPrintAmount (num, gnc_split_amount_print_info (split, FALSE));
-                editable = !gnc_numeric_zero_p (num) &&
-                    gnc_commodity_equiv (split_com, view->priv->reg_comm);
-g_print("zero %d and equiv %d\n", gnc_numeric_zero_p (num), gnc_commodity_equiv (split_com, view->priv->reg_comm));
+                s = xaccPrintAmount (num, gnc_split_amount_print_info (split, SHOW_SYMBOL));
+                editable = !gnc_numeric_zero_p (num) && gnc_commodity_equiv (split_com, view->priv->reg_comm);
+                editable = FALSE;
             }
             else
             {
                 s = "";
                 editable = FALSE;
             }
-        }
 
-        /* Only allow changes to values if we have a valid split accounts */
-        if (!(gtv_have_account (view, depth, expanded, trans, split)))
-            editable = FALSE;
+            if (get_imbalance (trans))
+                g_object_set (cell, "cell-background", PINKCELL, (gchar*)NULL);
+        }
 
         editable = (read_only == TRUE) ? FALSE : editable;
 
@@ -1676,11 +2182,29 @@ g_print("zero %d and equiv %d\n", gnc_numeric_zero_p (num), gnc_commodity_equiv
 
     case COL_AMOUNT:
         /* Column is AMOUNT */
-       if (is_split)
-       {
+        if (is_split && (anchor == NULL))
+        {
             gnc_numeric amt = xaccSplitGetAmount (split);
-            s = xaccPrintAmount (amt, gnc_account_print_info (xaccSplitGetAccount (split), FALSE));
-            editable = TRUE;
+            s = xaccPrintAmount (amt, gnc_account_print_info (xaccSplitGetAccount (split), SHOW_SYMBOL));
+            editable = FALSE;
+
+            if (get_imbalance (trans))
+                g_object_set (cell, "cell-background", PINKCELL, (gchar*)NULL);
+        }
+        else if (is_split && (anchor))
+        {
+            gnc_commodity *split_comm;
+            split_comm = xaccAccountGetCommodity (xaccSplitGetAccount (split));
+
+            if (!gnc_commodity_is_currency (split_comm) || (is_blank))
+            {
+                gnc_numeric amt = xaccSplitGetAmount (split);
+                s = xaccPrintAmount (amt, gnc_account_print_info (xaccSplitGetAccount (split), SHOW_SYMBOL));
+                editable = FALSE;
+            }
+
+            if (get_imbalance (trans))
+                g_object_set (cell, "cell-background", PINKCELL, (gchar*)NULL);
         }
         else
         {
@@ -1688,10 +2212,6 @@ g_print("zero %d and equiv %d\n", gnc_numeric_zero_p (num), gnc_commodity_equiv
             editable = FALSE;
         }
 
-        /* Only allow changes to values if we have a valid split accounts */
-        if (!(gtv_have_account (view, depth, expanded, trans, split)))
-            editable = FALSE;
-
         editable = (read_only == TRUE) ? FALSE : editable;
 
         g_object_set (cell, "text", s, "editable", editable, NULL);
@@ -1708,12 +2228,12 @@ g_print("zero %d and equiv %d\n", gnc_numeric_zero_p (num), gnc_commodity_equiv
         {
             if (anchor)
             {
-                gnc_numeric amt = xaccSplitGetValue (get_this_split (view, trans));
+                gnc_numeric val = xaccSplitGetValue (get_this_split (view, trans));
                 editable = !expanded && (num_of_splits < 3);
-                if(expanded)
+                if (expanded)
                     s = "";
                 else
-                    s = xaccPrintAmount (amt, gnc_commodity_print_info( xaccTransGetCurrency (trans), FALSE));
+                    s = xaccPrintAmount (val, gnc_commodity_print_info (xaccTransGetCurrency (trans), SHOW_SYMBOL));
             }
             else
             {
@@ -1724,24 +2244,36 @@ g_print("zero %d and equiv %d\n", gnc_numeric_zero_p (num), gnc_commodity_equiv
 
         if (is_split)
         {
-            if (split == get_this_split (view, trans))
+            if (anchor == NULL)
             {
                 gnc_numeric amt = xaccSplitGetAmount (split);
-                s = xaccPrintAmount (amt, gnc_account_print_info (xaccSplitGetAccount (split), FALSE));
+                s = xaccPrintAmount (amt, gnc_account_print_info (xaccSplitGetAccount (split), SHOW_SYMBOL));
                 editable = TRUE;
             }
+            else if (anchor)
+            {
+                gnc_commodity *split_comm;
+                split_comm = xaccAccountGetCommodity (xaccSplitGetAccount (split));
+
+                if (!gnc_commodity_is_currency (split_comm) || (is_blank))
+                {
+                    gnc_numeric amt = xaccSplitGetAmount (split);
+                    s = xaccPrintAmount (amt, gnc_account_print_info (xaccSplitGetAccount (split), SHOW_SYMBOL));
+                    editable = TRUE;
+                }
+            }
             else
             {
                 s = "";
                 editable = FALSE;
             }
+
             if (get_imbalance (trans))
                 g_object_set (cell, "cell-background", PINKCELL, (gchar*)NULL);
         }
 
         /* Only allow changes to values if we have a valid split accounts */
-        if (!(gtv_have_account (view, depth, expanded, trans, split)))
-            editable = FALSE;
+        editable = have_account (view, depth, expanded, trans, split);
 
         editable = (read_only == TRUE) ? FALSE : editable;
 
@@ -1767,7 +2299,7 @@ g_print("zero %d and equiv %d\n", gnc_numeric_zero_p (num), gnc_commodity_equiv
                 {
                     if (gnc_numeric_check (num) == GNC_ERROR_OK)
                     {
-                        s = xaccPrintAmount (num, gnc_split_amount_print_info (split, FALSE));
+                        s = xaccPrintAmount (num, gnc_split_amount_print_info (split, SHOW_SYMBOL));
                     }
                     else
                     {
@@ -1785,13 +2317,16 @@ g_print("zero %d and equiv %d\n", gnc_numeric_zero_p (num), gnc_commodity_equiv
 
         if (is_split)
         {
-            if (split == get_this_split (view, trans))
+            gnc_commodity *split_comm;
+            split_comm = xaccAccountGetCommodity (xaccSplitGetAccount (split));
+
+            if (!gnc_commodity_is_currency (split_comm) || (is_blank))
             {
                 num = xaccSplitGetSharePrice (split);
 
                 if (gnc_numeric_check (num) == GNC_ERROR_OK)
                 {
-                    s = xaccPrintAmount (num, gnc_split_amount_print_info (split, FALSE));
+                    s = xaccPrintAmount (num, gnc_split_amount_print_info (split, SHOW_SYMBOL));
                     editable = TRUE;
                 }
                 else
@@ -1805,13 +2340,13 @@ g_print("zero %d and equiv %d\n", gnc_numeric_zero_p (num), gnc_commodity_equiv
                 s = "";
                 editable = FALSE;
             }
+
             if (get_imbalance (trans))
                 g_object_set(cell, "cell-background", PINKCELL, (gchar*)NULL);
         }
 
         /* Only allow changes to values if we have a valid split accounts */
-        if (!(gtv_have_account (view, depth, expanded, trans, split)))
-            editable = FALSE;
+        editable = have_account (view, depth, expanded, trans, split);
 
         editable = (read_only == TRUE) ? FALSE : editable;
 
@@ -1856,16 +2391,15 @@ g_print("zero %d and equiv %d\n", gnc_numeric_zero_p (num), gnc_commodity_equiv
         }
         else
         {
-            if (expanded)
+            if ((is_trow1 || is_trow2) && expanded)
                 s = "";
             else
                 s = xaccPrintAmount (gnc_numeric_abs (num),
-                                gnc_account_print_info (anchor, FALSE));
+                                gnc_account_print_info (anchor, SHOW_SYMBOL));
         }
 
         /* Only allow changes to values if we have a valid split accounts */
-        if (!(gtv_have_account (view, depth, expanded, trans, split)))
-            editable = FALSE;
+        editable = have_account (view, depth, expanded, trans, split);
 
         editable = (read_only == TRUE) ? FALSE : editable;
 
@@ -1895,12 +2429,34 @@ g_print("zero %d and equiv %d\n", gnc_numeric_zero_p (num), gnc_commodity_equiv
 
     case COL_STATUS:
         /* Column is STATUS */
-        if (read_only)
+        if (read_only && !open_edited)
             g_object_set(cell, "cell-background", REDCELL, (gchar*)NULL);
+        else if (read_only && open_edited)
+            g_object_set(cell, "cell-background", YELLOWCELL, (gchar*)NULL);
         else if (xaccTransInFutureByPostedDate (trans))
             g_object_set(cell, "cell-background", BLUECELL, (gchar*)NULL);
         else
             g_object_set(cell, "cell-background", BLACKCELL, (gchar*)NULL);
+        break;
+
+    case COL_COMM:
+        /* Column COMMODITY */
+        if (is_split)
+        {
+            gnc_commodity *split_com, *txn_com;
+
+            split_com = xaccAccountGetCommodity (xaccSplitGetAccount(split));
+            txn_com = xaccTransGetCurrency (trans);
+            if ( split_com == txn_com)
+               s = g_strconcat (gnc_commodity_get_printname (split_com), "*", NULL);
+            else
+               s = gnc_commodity_get_printname (split_com);
+        }
+        else
+            s = "";
+
+        g_object_set (cell, "text", s, "editable", FALSE, NULL);
+        break;
 
     default:
         break;
@@ -1918,27 +2474,43 @@ start_edit (GtkCellRenderer *cr, GtkCellEditable *editable,
            const gchar *path_string, gpointer user_data)
 {
     GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    GncTreeModelSplitReg *model;
+    GtkTreePath         *path;
 g_print("\n\nstart_edit\n");
 /*FIXME Not sure if this is required, leave for now ? */
-    get_editable_start_editing_cb (cr, editable, path_string, user_data);
+
+    model = get_split_reg_model_from_view (view);
+
+    gtv_get_editable_start_editing_cb (cr, editable, path_string, user_data);
 /*    g_signal_connect(G_OBJECT(editable), "editing-done", (GCallback) editing_done_cb, view); */
-    view->priv->acct_edit_path = gtk_tree_path_new_from_string (path_string);
+
+//FIXME this could be the sort path instead of model path / check !!
+    path = gtk_tree_path_new_from_string (path_string);
+
+    if(view->priv->edit_ref != NULL)
+    {
+        gtk_tree_row_reference_free (view->priv->edit_ref);
+        view->priv->edit_ref = NULL;
+    }
+    view->priv->edit_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (model), path);
+
+    gtk_tree_path_free (path);
 
     return;
 }
 
 
-/* means: open trans for editing, unless we're editing a Split (split
-   != NULL) AND split doesn't belong to the trans (because it is the
-   blank split) */
+
+//FIXME I am not sure if we need the split here at all ???????
+/* Open Transaction for editing and set the default currency */
 static void
-begin_edit (GncTreeViewSplitReg *view, Split *split, Transaction *trans)
+gtv_begin_edit (GncTreeViewSplitReg *view, Split *split, Transaction *trans)
 {
-g_print("\n\nbegin_edit split %p and trans %p\n", split, trans);
+g_print("\n\ngtv_begin_edit split %p and trans %p\n", split, trans);
 
     if (split && trans != xaccSplitGetParent (split))
     {
-g_print("begin_edit - blank split, return\n");
+//g_print("gtv_begin_edit - blank split, return\n");
         return;
     }
 
@@ -1950,14 +2522,20 @@ g_print("begin_edit - blank split, return\n");
         xaccTransBeginEdit (trans);
         view->priv->dirty_trans = trans;
 
-g_print("begin_edit - xaccTransBeginEdit trans %p\n", trans);
+//g_print("gtv_begin_edit - xaccTransBeginEdit trans %p\n", trans);
 
         if (!xaccTransGetCurrency (trans))
         {
-            if (view->priv->anchor)
+            if (gnc_commodity_is_currency (view->priv->reg_comm))
+            {
+//g_print("gtv_begin_edit - set currency for anchor, trans %p\n", trans);
                 xaccTransSetCurrency (trans, view->priv->reg_comm);
+            }
             else
-                xaccTransSetCurrency (trans, xaccAccountGetCommodity (xaccSplitGetAccount (split)));
+            {
+//g_print("gtv_begin_edit - set currency to default currency, trans %p\n", trans);
+                xaccTransSetCurrency (trans, gnc_default_currency());
+            }
         }
 
         if (ts.tv_sec == 0)
@@ -1967,12 +2545,13 @@ g_print("begin_edit - xaccTransBeginEdit trans %p\n", trans);
             //date on new transactions
 
             ts.tv_sec = gnc_time (NULL);
-            xaccTransSetDatePostedSecs(trans, ts.tv_sec);
+            xaccTransSetDatePostedSecs (trans, ts.tv_sec);
         }
     }
 }
 
 
+/* Call back to remove date widget */
 static void
 remove_edit_date (GtkCellEditable *ce, gpointer user_data)
 {
@@ -1984,41 +2563,45 @@ remove_edit_date (GtkCellEditable *ce, gpointer user_data)
     char string[1024];
     time64 tt;
 
-    //These strings are used to determine if cell data was altered so that keynav works better
-g_print("\nremove edit date\n");
+//g_print("\nremove edit date and temp cell rend %p\n", view->priv->temp_cr);
 
-    popup_entry = GNC_POPUP_ENTRY (g_object_get_data (G_OBJECT (view->priv->temp_cr), "cell-editable"));
+    if (view->priv->temp_cr != NULL)
+    {
+        //These strings are used to determine if cell data was altered so that keynav works better
+        popup_entry = GNC_POPUP_ENTRY (g_object_get_data (G_OBJECT (view->priv->temp_cr), "cell-editable"));
 
-    new_string = g_strdup (gtk_entry_get_text (GTK_ENTRY (popup_entry->entry)));
+        new_string = g_strdup (gtk_entry_get_text (GTK_ENTRY (popup_entry->entry)));
 //g_print("New String is '%s'\n", new_string);	
 
-    current_string = g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-string");
+        current_string = g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-string");
 //g_print("Current String is '%s'\n", current_string);
 
-    //If editing wasn't canceled and strings don't match then cell data was edited
-    if (!GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view->priv->temp_cr), "edit-canceled")) 
+        //If editing wasn't canceled and strings don't match then cell data was edited
+        if (!GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view->priv->temp_cr), "edit-canceled")) 
              && g_ascii_strcasecmp (new_string, current_string))
-    {
-        g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (TRUE));
-    }
+        {
+            g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (TRUE));
+        }
 
-    /* Lets update the help text */
-    g_date_set_parse (&date, new_string);
-    if (g_date_valid (&date))
-    {
-	struct tm tm;
-	memset (&tm, 0, sizeof (tm));
-        g_date_to_struct_tm (&date, &tm);
-        qof_strftime (string, sizeof (string), "%A %d %B %Y", &tm);
-    }
-    view->help_text = g_strdup (string);
-    g_signal_emit_by_name (view, "help_signal", NULL);
+        /* Lets update the help text */
+        g_date_set_parse (&date, new_string);
+        if (g_date_valid (&date))
+        {
+            struct tm tm; 
+            memset (&tm, 0, sizeof (tm)); 
+            g_date_to_struct_tm (&date, &tm); 
+            qof_strftime (string, sizeof (string), "%A %d %B %Y", &tm); 
+        }
+        view->help_text = g_strdup (string);
+        g_signal_emit_by_name (view, "help_signal", NULL);
 
-    g_object_set_data (G_OBJECT (view->priv->temp_cr), "cell-editable", NULL);
-    view->priv->temp_cr = NULL;
+        g_object_set_data (G_OBJECT (view->priv->temp_cr), "cell-editable", NULL);
+        view->priv->temp_cr = NULL;
+    }
 }
 
 
+/* Call back to remove combo widget */
 static void
 remove_edit_combo (GtkCellEditable *ce, gpointer user_data)
 {
@@ -2027,29 +2610,33 @@ remove_edit_combo (GtkCellEditable *ce, gpointer user_data)
     const gchar *new_string; 
     const gchar *current_string;
 
-    //These strings are used to determine if cell data was altered so that keynav works better
-g_print("\nremove edit combo\n");
+//g_print("\nremove edit combo and temp cell rend %p\n", view->priv->temp_cr);
 
-    entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (g_object_get_data (G_OBJECT (view->priv->temp_cr), "cell-editable"))));
+    if (view->priv->temp_cr != NULL)
+    {
+        //These strings are used to determine if cell data was altered so that keynav works better
+        entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (g_object_get_data (G_OBJECT (view->priv->temp_cr), "cell-editable"))));
 
-    new_string = gtk_entry_get_text (GTK_ENTRY (entry));
+        new_string = gtk_entry_get_text (GTK_ENTRY (entry));
 //g_print("New String is '%s'\n", new_string);	
 
-    current_string = g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-string");
+        current_string = g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-string");
 //g_print("Current String is '%s'\n", current_string);
 
-    //If editing wasn't canceled and strings don't match then cell data was edited
-    if (!GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view->priv->temp_cr), "edit-canceled"))
+        //If editing wasn't canceled and strings don't match then cell data was edited
+        if (!GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view->priv->temp_cr), "edit-canceled"))
              && g_ascii_strcasecmp (new_string, current_string))
-    {
-        g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (TRUE));
-    }
+        {
+            g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (TRUE));
+        }
 
-    g_object_set_data (G_OBJECT (view->priv->temp_cr), "cell-editable", NULL);
-    view->priv->temp_cr = NULL;
+        g_object_set_data (G_OBJECT (view->priv->temp_cr), "cell-editable", NULL);
+        view->priv->temp_cr = NULL;
+    }
 }
 
 
+/* Call back to remove entry widget */
 static void
 remove_edit_entry (GtkCellEditable *ce, gpointer user_data)
 {
@@ -2057,28 +2644,30 @@ remove_edit_entry (GtkCellEditable *ce, gpointer user_data)
     const gchar *new_string; 
     const gchar *current_string; 
 
-g_print("\nremove edit entry\n");
+//g_print("\nremove edit entry and temp cell rend %p\n", view->priv->temp_cr);
 
-    //These strings are used to determine if cell data was altered so that keynav works better
-    new_string = gtk_entry_get_text (GTK_ENTRY (g_object_get_data (G_OBJECT (view->priv->temp_cr), "cell-editable")));
+    if (view->priv->temp_cr != NULL)
+    {
+        //These strings are used to determine if cell data was altered so that keynav works better
+        new_string = gtk_entry_get_text (GTK_ENTRY (g_object_get_data (G_OBJECT (view->priv->temp_cr), "cell-editable")));
 //g_print("New String is '%s'\n", new_string);
 
-    current_string = g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-string");
+        current_string = g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-string");
 //g_print("Current String is '%s'\n", current_string);
 
-    //If editing wasn't canceled and strings don't match then cell data was edited
-    if (!GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view->priv->temp_cr), "edit-canceled")) 
+        //If editing wasn't canceled and strings don't match then cell data was edited
+        if (!GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view->priv->temp_cr), "edit-canceled")) 
              && g_ascii_strcasecmp (new_string, current_string))
-    {
-        g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (TRUE));
-    }
+        {
+            g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (TRUE));
+        }
 
-    g_object_set_data (G_OBJECT (view->priv->temp_cr), "cell-editable", NULL);
-    view->priv->temp_cr = NULL;
+        g_object_set_data (G_OBJECT (view->priv->temp_cr), "cell-editable", NULL);
+        view->priv->temp_cr = NULL;
+    }
 }
 
 
-
 /* Explain: GtkEntry has a cursor that blinks upon
    g_timeout_dispatch().  It complains if it blinks after the GtkEntry
    loses focus.  So, we can't pop up any dialogs while the blinking
@@ -2086,35 +2675,120 @@ g_print("\nremove edit entry\n");
    finished before raising the dialog.  That finalizes the
    gtkcelleditable. */
 static void
-finish_edit (GtkTreeViewColumn *col)
+gtv_finish_edit (GncTreeViewSplitReg *view)
 {
-    GList *renderers;
-    GtkCellRenderer *cr;
     GtkCellEditable *ce;
-g_print("\n\nfinish_edit\n");
+ 
+//g_print("\n\ngtv_finish_edit - view is %p\n", view);
 
-    if (!col)
+    if (view->priv->temp_cr == NULL)
         return;
-g_print("finish_edit column title is %s\n", gtk_tree_view_column_get_title (col));
-    renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (col)); //FIXME I am only looking at one renderer per cell.
-    g_assert (g_list_length (renderers) == 1);
-    cr = g_list_nth_data (renderers, 0);
-    g_list_free (renderers);
 
-    if ((ce = GTK_CELL_EDITABLE (g_object_get_data (G_OBJECT (cr), "cell-editable"))))
+//g_print("gtv_finish_edit temp_cr is %p\n", view->priv->temp_cr);
+
+    if ((ce = GTK_CELL_EDITABLE (g_object_get_data (G_OBJECT (view->priv->temp_cr), "cell-editable"))))
     {
-g_print("finish_edit - editing_done\n");
+//g_print("gtv_finish_edit - editing_done\n");
         gtk_cell_editable_editing_done (ce);
+
         gtk_cell_editable_remove_widget (ce);
     }
 }
 
 
+/* This is used in g_idle_add to finish an edit */
+static gboolean
+gtv_idle_finish_edit (GncTreeViewSplitReg *view)
+{
+   gtv_finish_edit (view);
+   return FALSE;
+}
+
+
+/* Returns TRUE if dialog was canceled or discarded.
+   Does nothing if 'new_trans' is the dirty trans. */
+static gboolean
+transaction_changed_confirm (GncTreeViewSplitReg *view,
+                            Transaction *new_trans)
+{
+    GtkWidget *dialog, *window;
+    gint response;
+    const char *title = _("Save the changed transaction?");
+    const char *message = _(
+        "The current transaction has changed.  Would you like to "
+        "record the changes, or discard the changes?");
+
+    if (!view->priv->dirty_trans || view->priv->dirty_trans == new_trans)
+        return FALSE;
+
+//g_print(" ** transaction_changed_confirm **\n");
+
+    window = gnc_tree_view_split_reg_get_parent (view);
+    dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                    GTK_MESSAGE_QUESTION,
+                                    GTK_BUTTONS_NONE,
+                                    "%s", title);
+    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                                             "%s", message);
+    gtk_dialog_add_buttons(
+        GTK_DIALOG(dialog),_("_Discard Changes"), GTK_RESPONSE_REJECT,
+        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+        _("_Record Changes"), GTK_RESPONSE_ACCEPT, NULL);
+    response = gnc_dialog_run (GTK_DIALOG (dialog), "transaction_changed");
+    gtk_widget_destroy (dialog);
+
+    switch (response)
+    {
+    case GTK_RESPONSE_ACCEPT:
+        g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (FALSE));
+        xaccTransCommitEdit (view->priv->dirty_trans);
+        if(view->priv->edit_ref != NULL)
+        {
+            gtk_tree_row_reference_free (view->priv->edit_ref);
+            view->priv->edit_ref = NULL;
+        }
+        view->priv->dirty_trans = NULL;
+        view->change_allowed = FALSE;
+        return FALSE;
+        break;
+
+    case GTK_RESPONSE_REJECT:
+        if (view->priv->dirty_trans && xaccTransIsOpen (view->priv->dirty_trans))
+        {
+            GncTreeModelSplitReg *model;
+            Split                *split;
+
+            model = get_split_reg_model_from_view (view);
+
+            g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (FALSE));
+            xaccTransRollbackEdit (view->priv->dirty_trans);
+            view->priv->dirty_trans = NULL;
+
+            split = gnc_tree_model_split_get_blank_split (model);
+            xaccSplitReinit (split); // Clear the blank split
+            view->change_allowed = FALSE;
+        }
+        return TRUE;
+        break;
+
+    case GTK_RESPONSE_CANCEL:
+        return TRUE;
+        break;
+
+    default:
+        return FALSE;
+    }
+
+    return FALSE;
+}
+
 
 /*####################################################################
           ^^^^^    edit function call backs      ^^^^^
           vvvvvv   gtv function call backs       vvvvv
 #####################################################################*/
+/* Set the column titles based on register type and depth */
 static void
 gtv_split_reg_titles (GncTreeViewSplitReg *view, RowDepth depth)
 {
@@ -2125,7 +2799,7 @@ gtv_split_reg_titles (GncTreeViewSplitReg *view, RowDepth depth)
     GList  *column;
     gint i;
 
-//g_print("title depth is %d\n", depth);
+//g_print("title depth is %d and sort_depth %d, sort_col is %d\n", depth, view->sort_depth, view->sort_col);
 
     model = get_split_reg_model_from_view (view);
     columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (view));
@@ -2139,21 +2813,31 @@ gtv_split_reg_titles (GncTreeViewSplitReg *view, RowDepth depth)
 
         /*FIXME ## Do we need to look for multiple renderers ?
           We only have one renderer per cell now */
-        renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (tvc)); //FIXME I am only looking at one renderer per cell.
+        renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (tvc));
         g_assert (g_list_length (renderers) == 1);
         cr = g_list_nth_data (renderers, 0);
         g_list_free (renderers);
 
         viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT(cr), "view_column"));
 
+//g_print("viewcol is %d\n", viewcol);
+
         switch(viewcol)
         {
         case COL_DATE:
             switch(model->type)
             {
             default: //FIXME These if statements may not be required
-                if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
-                    gtk_tree_view_column_set_title (tvc, _("Date"));
+                /* Display arrows if we are sorting on this row */
+                if (view->sort_depth == depth && view->sort_col == viewcol)
+                    gtk_tree_view_column_set_sort_indicator (tvc, TRUE);
+                else
+                    gtk_tree_view_column_set_sort_indicator (tvc, FALSE);
+
+                if(depth == TRANS1 || depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Date Posted"));
+                else if(depth == TRANS2)
+                    gtk_tree_view_column_set_title (tvc, _("Date Entered"));
                 break;
             }
             break;
@@ -2173,7 +2857,7 @@ gtv_split_reg_titles (GncTreeViewSplitReg *view, RowDepth depth)
             {
             case RECEIVABLE_REGISTER2:
             case PAYABLE_REGISTER2:
-                if(depth == TRANS1)
+                if (depth == TRANS1)
                     gtk_tree_view_column_set_title (tvc, _("Reference"));
                 else if (depth == TRANS2)
                     gtk_tree_view_column_set_title (tvc, _("Action"));
@@ -2185,9 +2869,17 @@ gtv_split_reg_titles (GncTreeViewSplitReg *view, RowDepth depth)
 
 
             default:
-                if(depth == TRANS1)
+                /* Display arrows if we are sorting on this row */
+                if (view->sort_depth == depth && view->sort_col == viewcol)
+                    gtk_tree_view_column_set_sort_indicator (tvc, TRUE);
+                else
+                    gtk_tree_view_column_set_sort_indicator (tvc, FALSE);
+
+                if (depth == TRANS1)
                     gtk_tree_view_column_set_title (tvc, _("Number"));
-                else if (depth == TRANS2)
+                else if (depth == TRANS2 && (qof_book_use_split_action_for_num_field (gnc_get_current_book())))
+                    gtk_tree_view_column_set_title (tvc, _("T-Number"));
+                else if (depth == TRANS2 && (!qof_book_use_split_action_for_num_field (gnc_get_current_book())))                    
                     gtk_tree_view_column_set_title (tvc, _("Action"));
                 else if (depth == SPLIT3)
                     gtk_tree_view_column_set_title (tvc, _("Action"));
@@ -2208,7 +2900,7 @@ gtv_split_reg_titles (GncTreeViewSplitReg *view, RowDepth depth)
                 else if (depth == SPLIT3)
                     gtk_tree_view_column_set_title (tvc, _("Memo"));
                 else
-                    gtk_tree_view_column_set_title (tvc, _("Customer / Memo "));
+                    gtk_tree_view_column_set_title (tvc, _("Customer / Memo"));
                 break;
 
             case PAYABLE_REGISTER2:
@@ -2219,11 +2911,17 @@ gtv_split_reg_titles (GncTreeViewSplitReg *view, RowDepth depth)
                 else if (depth == SPLIT3)
                     gtk_tree_view_column_set_title (tvc, _("Memo"));
                 else
-                    gtk_tree_view_column_set_title (tvc, _("Vendor / Memo "));
+                    gtk_tree_view_column_set_title (tvc, _("Vendor / Memo"));
                 break;
 
 
             default:
+                /* Display arrows if we are sorting on this row */
+                if (view->sort_depth == depth && view->sort_col == viewcol)
+                    gtk_tree_view_column_set_sort_indicator (tvc, TRUE);
+                else
+                    gtk_tree_view_column_set_sort_indicator (tvc, FALSE);
+
                 if(depth == TRANS1)
                     gtk_tree_view_column_set_title (tvc, _("Description"));
                 else if (depth == TRANS2)
@@ -2318,6 +3016,16 @@ gtv_split_reg_titles (GncTreeViewSplitReg *view, RowDepth depth)
             }
             break;
 
+        case COL_COMM:
+            switch(model->type)
+            {
+            default: //FIXME These if statements may not be required
+                if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Commodity"));
+                break;
+            }
+            break;
+
         case COL_RATE:
             switch(model->type)
             {
@@ -2502,6 +3210,7 @@ g_list_free (columns);
 }
 
 
+/* Update the help text */
 static void
 gtv_split_reg_help (GncTreeViewSplitReg *view, GtkCellRenderer *cr, ViewCol viewcol, RowDepth depth)
 {
@@ -2528,9 +3237,9 @@ gtv_split_reg_help (GncTreeViewSplitReg *view, GtkCellRenderer *cr, ViewCol view
                 g_date_set_parse (&date, current_string);
                 if (g_date_valid (&date))
                 {
-		    struct tm tm;
-		    memset (&tm, 0, sizeof (tm));
-                    g_date_to_struct_tm (&date, &tm);
+                    struct tm tm; 
+                    memset (&tm, 0, sizeof (tm)); 
+                    g_date_to_struct_tm (&date, &tm); 
                     qof_strftime (string, sizeof (string), "%A %d %B %Y", &tm);
                 }
                 help = g_strdup (string);
@@ -2669,6 +3378,16 @@ gtv_split_reg_help (GncTreeViewSplitReg *view, GtkCellRenderer *cr, ViewCol view
         }
         break;
 
+    case COL_COMM:
+        switch(model->type)
+        {
+        default: //FIXME These if statements may not be required
+            if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                help = _("* Indicates the transaction Commodity.");
+            break;
+        }
+        break;
+
     case COL_RATE:
         switch(model->type)
         {
@@ -2718,6 +3437,37 @@ gtv_split_reg_help (GncTreeViewSplitReg *view, GtkCellRenderer *cr, ViewCol view
     g_signal_emit_by_name (view, "help_signal", NULL);
 }
 
+
+/* Move the selection to the blank split when expanded */
+static gboolean
+gtv_selection_to_blank (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *bpath, *spath;
+    Split *bsplit;
+
+//g_print("gtv_selection_to_blank\n");
+
+    /* Make sure we have expanded splits */
+    if (view->priv->expanded == FALSE)
+        return FALSE;
+
+    model = get_split_reg_model_from_view (view);
+
+    bsplit = gnc_tree_model_split_get_blank_split (model);
+    bpath =  gnc_tree_model_split_reg_get_path_to_split_and_trans (model, bsplit, NULL);
+
+    spath = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (gtk_tree_view_get_model (GTK_TREE_VIEW (view))), bpath);
+
+    gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), spath);
+
+    gtk_tree_path_free (bpath);
+    gtk_tree_path_free (spath);
+
+    return FALSE;
+}
+
+
 /* Callback for double click */
 void
 gtv_split_reg_double_click_cb (GtkTreeView *treeview, GtkTreePath *path,
@@ -2730,14 +3480,14 @@ gtv_split_reg_double_click_cb (GtkTreeView *treeview, GtkTreePath *path,
 
 //g_print("gtv_split_reg_double_click_cb\n\n");
 
-    /* this does work on non editable cells like void, balance */
+    /* this works on non editable cells like void, balance */
 
     if (model->style != REG2_STYLE_JOURNAL)
     {
-        if (gnc_tree_view_split_reg_current_trans_expanded (view))
-            gnc_tree_view_split_reg_expand_current_trans (view, FALSE);
+        if (view->priv->expanded)
+            gnc_tree_view_split_reg_collapse_trans (view, NULL);
         else
-            gnc_tree_view_split_reg_expand_current_trans (view, TRUE);
+            gnc_tree_view_split_reg_expand_trans (view, NULL);
 
         /* This updates the plugin page gui */
         if (view->moved_cb)
@@ -2746,6 +3496,37 @@ gtv_split_reg_double_click_cb (GtkTreeView *treeview, GtkTreePath *path,
 }
 
 
+/* Call back for when a Transaction is deleted so we can move selection out of way */
+static void
+gtv_split_reg_trans_delete_cb (GncTreeModelSplitReg *model, gpointer item, gpointer user_data)
+{
+    GncTreeViewSplitReg *view = user_data;
+    Transaction *trans = item;
+
+//g_print("gtv_split_reg_trans_delete_cb model %p trans %p view %p\n", model, trans, view);
+
+//g_print("gtv_split_reg_trans_delete_cb current_trans %p trans %p\n", view->priv->current_trans, trans);
+
+    /* if same, lets get out of the way so move */
+    if (trans == view->priv->current_trans)
+        gnc_tree_control_split_reg_goto_rel_trans_row (view, 1);
+}
+
+
+/* Call back for focus out evnt so we can finish edit */
+static gboolean
+gtv_split_reg_focus_out_cb (GtkWidget *widget, GdkEventFocus *event, gpointer user_data)
+{
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+
+//g_print("gtv_split_reg_focus_out_cb\n");
+
+    gnc_tree_view_split_reg_finish_edit (view);
+
+    return FALSE;
+}
+
+
 /* For handling keynav */
 static gboolean
 gtv_split_reg_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
@@ -2788,7 +3569,7 @@ g_print("\ngtvt_key_press_cb\n");
     if (!path)
         return TRUE;
 
-    finish_edit (col);
+    gnc_tree_view_split_reg_finish_edit (view);
 
 
 
@@ -2816,8 +3597,8 @@ if (tabbed == TRUE)
 
         g_object_get (G_OBJECT (cell), "editable", &editable, NULL);
 
-//g_print("key nav - Path is '%s' edit path is '%s' and viewcol is %d and editable is %d and cell pointer is %p\n", gtk_tree_path_to_string (path),
-//                  (view->priv->acct_edit_path == NULL) ? "NULL" : gtk_tree_path_to_string (view->priv->acct_edit_path), viewcol, editable, cell);
+//g_print("key nav - Path is '%s' and viewcol is %d and editable is %d and cell pointer is %p\n", gtk_tree_path_to_string (path),
+//                   viewcol, editable, cell);
 
 
 
@@ -2847,191 +3628,131 @@ g_print( "end of key nav\n");
 }
 
 
-void
-gnc_tree_view_split_reg_cancel_edit (GncTreeViewSplitReg *view)
+/* Callback for selection move */
+static void
+gtv_split_reg_motion_cb (GtkTreeSelection *sel, gpointer user_data)
 {
-    GncTreeModelSplitReg *model;
-    GtkTreePath       *path;
-    GtkTreeViewColumn *col_current;
-    Transaction *trans = view->priv->dirty_trans;
-    Split *split;
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    GncTreeModelSplitReg *model; 
+    Split *split = NULL;
+    Transaction *trans = NULL;
+    Transaction *old_trans;
+    gboolean is_trow1, is_trow2, is_split, is_blank;
+    RowDepth depth = 0;
+    GtkTreeIter iter;
+    GtkTreePath *mpath;
+    GtkTreePath *spath;
 
-    model = get_split_reg_model_from_view (view);
+g_print ("\ngtv_split_reg_motion_cb\n");
 
-    gtk_tree_view_get_cursor (GTK_TREE_VIEW (view), &path, &col_current);
+    model = get_split_reg_model_from_view (view);
 
-g_print("cancel column title is %s\n", gtk_tree_view_column_get_title (col_current));
+g_print("Motion - ** model is %p and view is %p dirty_trans is %p **\n", model, view, view->priv->dirty_trans);
+g_print("Motion - ** o_trans is %p o_split is %p o_depth %d **\n", view->priv->current_trans, view->priv->current_split, view->priv->current_depth);
 
-    /* Make sure we have stopped editing */
-    if (col_current != NULL)
-        finish_edit (col_current);
+    /* Reset help text */
+    view->help_text = " ";
+    g_signal_emit_by_name (view, "help_signal", NULL);
 
-    if (trans && xaccTransIsOpen (trans))
+    if (get_model_iter_from_selection (view, sel, &iter))
     {
-        view->priv->acct_edit_path = NULL;
-        g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (FALSE));
-        xaccTransRollbackEdit (view->priv->dirty_trans);
-        view->priv->dirty_trans = NULL;
+        mpath = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &iter);
 
-        split = gnc_tree_model_split_get_blank_split (model);
-        xaccSplitReinit (split);
-    }
+        spath = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (gtk_tree_view_get_model (GTK_TREE_VIEW (view))), mpath);
 
-    /* this just refreshes the view */
-    gtk_tree_selection_unselect_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), path);
-    gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), path);
+g_print ("Motion - mpath is %s spath is %s\n\n", gtk_tree_path_to_string (mpath), gtk_tree_path_to_string (spath));
 
-    gtk_tree_path_free (path);
-}
+//g_print("Motion - current_ref is valid %d edit_ref is %d\n", gtk_tree_row_reference_valid (view->priv->current_ref),
+//                                                             gtk_tree_row_reference_valid (view->priv->edit_ref));
 
-
-/* Returns TRUE if dialog was canceled. Does nothing if 'new_trans'
-   is the dirty trans. */
-static gboolean
-transaction_changed_confirm (GncTreeViewSplitReg *view,
-                            Transaction *new_trans)
-{
-    GtkWidget *dialog;
-    gint response;
-    const char *title = _("Save the changed transaction?");
-    const char *message = _(
-        "The current transaction has changed.  Would you like to "
-        "record the changes, or discard the changes?");
-
-    if (!view->priv->dirty_trans || view->priv->dirty_trans == new_trans)
-        return FALSE;
-
-g_print(" ** transaction_changed_confirm **\n");
-    dialog = gtk_message_dialog_new(NULL,
-                                    GTK_DIALOG_DESTROY_WITH_PARENT,
-                                    GTK_MESSAGE_QUESTION,
-                                    GTK_BUTTONS_NONE,
-                                    "%s", title);
-    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-                                             "%s", message);
-    gtk_dialog_add_buttons(
-        GTK_DIALOG(dialog),_("_Discard Changes"), GTK_RESPONSE_REJECT,
-        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-        _("_Record Changes"), GTK_RESPONSE_ACCEPT, NULL);
-    response = gnc_dialog_run (GTK_DIALOG (dialog), "transaction_changed");
-    gtk_widget_destroy (dialog);
-
-    switch (response)
-    {
-    case GTK_RESPONSE_ACCEPT:
-        g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (FALSE));
-        xaccTransCommitEdit (view->priv->dirty_trans);
-        view->priv->acct_edit_path = NULL;
-        view->priv->dirty_trans = NULL;
-        break;
-
-    case GTK_RESPONSE_REJECT:
-        gnc_tree_view_split_reg_cancel_edit (view);
-        break;
-    case GTK_RESPONSE_CANCEL:
-    default:
-        return TRUE;
-    }
-
-    return FALSE;
-}
-
-
-
-/* Callback for selection move */
-static void
-gtv_split_reg_motion_cb (GtkTreeSelection *sel, gpointer user_data)
-{
-
-    GtkTreeIter iter;
-    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-    GncTreeModelSplitReg *model; 
-    Split *split = NULL;
-    Transaction *trans = NULL;
-    gboolean is_trow1, is_trow2, is_split, is_blank;
-    RowDepth depth = 0;
-    const gchar *path_string;
-    GtkTreePath *path;
-    gint *indices_old, *indices_now;
-    gint row_old, row_now;
-
-    model = get_split_reg_model_from_view (view);
-
-g_print ("\ngtv_split_reg_motion_cb\n");
-
-g_print("Motion - dirty_trans is %p and dirty_split is %p\n", view->priv->dirty_trans, view->priv->dirty_split);
-
-    /* Reset help text */
-    view->help_text = " ";
-    g_signal_emit_by_name (view, "help_signal", NULL);
-
-    mark_split_dirty (view, NULL, NULL);
-
-    if (get_model_iter_from_selection (view, sel, &iter))
-    {
-
-        path = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &iter);
-
-//g_print("Motion - Current Path is '%s' and edit path is '%s'\n", gtk_tree_path_to_string (view->priv->current_path),
-//                                                                 (view->priv->acct_edit_path == NULL) ? "NULL" :
-//                                                                  gtk_tree_path_to_string (view->priv->acct_edit_path));
-
-        indices_old = gtk_tree_path_get_indices (view->priv->current_path);
-        indices_now = gtk_tree_path_get_indices (path);
-
-        row_old = indices_old[0];
-        row_now = indices_now[0];
-
-g_print ("Motion - row old is %d and now %d\n", row_old, row_now);
-
-        view->priv->row_old = row_old;
-        view->priv->row_now = row_now;
+if(gtk_tree_row_reference_valid (view->priv->current_ref))
+    g_print("Motion - Old Current Path is '%s'\n", gtk_tree_path_to_string (gtk_tree_row_reference_get_path (view->priv->current_ref)));
+if(gtk_tree_row_reference_valid (view->priv->edit_ref))
+    g_print("Motion - Old Edit path is '%s'\n", gtk_tree_path_to_string (gtk_tree_row_reference_get_path (view->priv->edit_ref)));
 
         /* save the current path */
-        gtk_tree_path_free (view->priv->current_path);
-        view->priv->current_path = gtk_tree_path_copy (path);
+        if(view->priv->current_ref != NULL)
+        {
+            gtk_tree_row_reference_free (view->priv->current_ref);
+            view->priv->current_ref = NULL;
+        }
+        view->priv->current_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (model), mpath);
 
         /* Use depth to determine if it is a split or transaction */
-        depth = gtk_tree_path_get_depth (path);
+        depth = gtk_tree_path_get_depth (mpath);
 
         /* Update the tree view titles */
         gtv_split_reg_titles (view, depth);
 
-        gtk_tree_path_free (path);
-
-//g_print("Motion - New Current Path is '%s' and edit path is '%s'\n", gtk_tree_path_to_string (view->priv->current_path),
-//                                                                 (view->priv->acct_edit_path == NULL) ? "NULL" :
-//                                                                  gtk_tree_path_to_string (view->priv->acct_edit_path));
+        gtk_tree_path_free (mpath);
 
+if(gtk_tree_row_reference_valid (view->priv->current_ref))
+    g_print("Motion - Current Path is '%s'\n", gtk_tree_path_to_string (gtk_tree_row_reference_get_path (view->priv->current_ref)));
+if(gtk_tree_row_reference_valid (view->priv->edit_ref))
+    g_print("Motion - Edit path is '%s'\n", gtk_tree_path_to_string (gtk_tree_row_reference_get_path (view->priv->edit_ref)));
 
-        /*FIXME Not sure if will need this here, leave till end */
         gnc_tree_model_split_reg_get_split_and_trans (
                 GNC_TREE_MODEL_SPLIT_REG (model), &iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
 
-g_print("Motion - row_now is %d, split %p, trans %p, is_split %d, is_blank %d\n", row_now, split, trans, is_split, is_blank);
+g_print("Motion - split %p, trans %p, is_split %d, is_blank %d\n", split, trans, is_split, is_blank);
+
 
         //Ask for confirmation if data has been edited, transaction_changed_confirm return TRUE if canceled
         if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view), "data-edited")) && transaction_changed_confirm (view, trans))
         {
-            /* Restore position - Cancel */
-            gtk_tree_path_free (view->priv->current_path);
-            view->priv->current_path = gtk_tree_path_copy (view->priv->acct_edit_path);
+//g_print("Restore position - Cancel / Discard\n");
+            /* Restore position - Cancel / Discard */
+            if(view->priv->current_ref != NULL)
+            {
+                gtk_tree_row_reference_free (view->priv->current_ref);
+                view->priv->current_ref = NULL;
+            }
+            view->priv->current_ref = gtk_tree_row_reference_copy (view->priv->edit_ref);
 
             gnc_tree_view_split_reg_default_selection (view);
+            return;
         }
         else
         {
-            /* Discard, commit and skip */
+//g_print("Commit and skip\n");
+            /* Commit and skip */
 
             /* Move the blank split */ 
             gnc_tree_model_split_reg_set_blank_split_parent (model, trans);
         }
 
-g_print ("Motion - depth is %d row old is %d and now %d\n", depth, row_old, row_now);
+        old_trans = view->priv->current_trans;
+        view->priv->current_trans = trans;
+        view->priv->current_split = split;
+        view->priv->current_depth = depth;
 
-        /* Set the view format */
-        g_idle_add ((GSourceFunc)gnc_tree_view_split_reg_set_format, view);
+g_print("Motion - ** c_trans is %p c_split is %p depth %d **\n\n", view->priv->current_trans, view->priv->current_split, view->priv->current_depth);
 
+        /* Auto expand transaction and collapse previous transaction */
+        if (old_trans != trans)
+        {
+            /* Reset allow changes for reconciled transctions */
+            view->change_allowed = FALSE;
+
+            if (model->style != REG2_STYLE_JOURNAL)
+            {
+                if (gnc_tree_view_split_reg_trans_expanded (view, old_trans))
+                    gnc_tree_view_split_reg_collapse_trans (view, old_trans);
+            }
+            else
+                gnc_tree_view_split_reg_expand_trans (view, NULL);
+
+            if (model->style == REG2_STYLE_AUTO_LEDGER)
+            {
+                gtk_tree_view_expand_row (GTK_TREE_VIEW (view), spath, TRUE);
+
+                view->priv->expanded = TRUE;
+
+                if (SELECTION_TO_BLANK_ON_EXPAND)
+                    g_idle_add ((GSourceFunc)gtv_selection_to_blank, view);
+            }
+        }
+        gtk_tree_path_free (spath);
     }
     else
     {
@@ -3044,7 +3765,6 @@ g_print("Not valid selection\n");
 
         /* Set the default selection start position */
         gnc_tree_view_split_reg_default_selection (view);
-
     }
 
     /* This updates the plugin page gui */
@@ -3061,6 +3781,7 @@ gtv_split_reg_edited_cb (GtkCellRendererText *cell, const gchar *path_string,
 {
     GncTreeViewSplitReg  *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
     GncTreeModelSplitReg *model;
+    GtkCellEditable      *editable;
     GtkTreeIter           iter;
     Split                *split;
     Transaction          *trans;
@@ -3069,7 +3790,19 @@ gtv_split_reg_edited_cb (GtkCellRendererText *cell, const gchar *path_string,
     char                 *error_loc = NULL;
     Account              *anchor = view->priv->anchor;
 
-g_print("\ngtv_split_reg_edited_cb\n");
+//g_print("\ngtv_split_reg_edited_cb\n");
+
+    editable = g_object_get_data (G_OBJECT (cell), "cell-editable");
+
+//g_print("cell is %p editable pointer is %p and id %lu\n", cell, editable, view->priv->fo_handler_id);
+
+    /* Remove the focus out cb if one exists */
+    if (view->priv->fo_handler_id != 0)
+    {
+        if (g_signal_handler_is_connected (G_OBJECT (editable), view->priv->fo_handler_id))
+            g_signal_handler_disconnect (G_OBJECT (editable), view->priv->fo_handler_id);
+    }
+    view->priv->fo_handler_id = 0;
 
     if (g_strcmp0 (g_object_get_data (G_OBJECT (cell), "current-string"), new_text) == 0) // No change, return
         return;
@@ -3084,7 +3817,7 @@ g_print("\ngtv_split_reg_edited_cb\n");
     gnc_tree_model_split_reg_get_split_and_trans (
         model, &iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
 
-g_print("gtv_split_reg_edited_cb New Text is '%s'\n", new_text);
+//g_print("gtv_split_reg_edited_cb New Text is '%s'\n", new_text);
 
     switch (viewcol) {
     case COL_DATE:
@@ -3095,7 +3828,7 @@ g_print("gtv_split_reg_edited_cb New Text is '%s'\n", new_text);
             g_date_set_parse (&date, new_text);
             if (g_date_valid (&date))
             {
-                begin_edit (view, split, trans);
+                gtv_begin_edit (view, NULL, trans);
                 xaccTransSetDate (trans, g_date_get_day (&date), g_date_get_month (&date), g_date_get_year (&date));
             }
             else
@@ -3107,99 +3840,44 @@ g_print("gtv_split_reg_edited_cb New Text is '%s'\n", new_text);
 
     case COL_NUMACT:
         /* Column is NUM / ACT */
-        begin_edit (view, split, trans);
+        gtv_begin_edit (view, NULL, trans);
         if (is_trow1)
         {
-            /* set per book option */
-            gnc_set_num_action (trans, get_this_split (view, trans),
-                                                                new_text, NULL);
+            /* set per book option */ 
+            gnc_set_num_action (trans, get_this_split (view, trans), 
+                                                                new_text, NULL); 
         }
         if (is_trow2)
         {
-            /* set per book option */
-            gnc_set_num_action (trans, get_this_split (view, trans),
-                                                                NULL, new_text);
+            /* set per book option */ 
+            gnc_set_num_action (trans, get_this_split (view, trans), 
+                                                                NULL, new_text); 
         }
         if (is_split)
         {
-            /* Set split-action with gnc_set_num_action which is the same as
-             * xaccSplitSetAction with these arguments */
-            gnc_set_num_action(NULL, split, NULL, new_text);
+            /* Set split-action with gnc_set_num_action which is the same as 
+             * xaccSplitSetAction with these arguments */ 
+            gnc_set_num_action (NULL, split, NULL, new_text); 
         }
         break;
 
     case COL_DESCNOTES:
         /* Column is DESCRIPTION / NOTES / MEMO */
-        begin_edit (view, split, trans);
+        gtv_begin_edit (view, NULL, trans);
         if (is_trow1)
-        {
             xaccTransSetDescription (trans, new_text);
-        }
+
         if (is_trow2)
-        {
             xaccTransSetNotes (trans, new_text);
-        }
+
         if (is_split)
-        {
             xaccSplitSetMemo (split, new_text);
-        }
-        break;
-
-    case COL_TRANSVOID:
-        /* Column is TRANSFER / VOID (Only updated from menu.) */
-        {
-            Split         *osplit = NULL;
-            QofBook       *book; //do we have this
-            Account       *root; // do we have this
-            Account       *new_acct;
-            gint           num_of_splits;
-            gnc_numeric    num;
-
-            begin_edit (view, split, trans);
-
-            if (!is_split && anchor)
-            {
-                if (!get_split_pair (view, trans, &osplit, &split))
-                {
-                    PERR("couldn't get split pair");
-                    break;
-                }
-            }
-
-//FIXME Probably needs more work 
-
-            book = gnc_get_current_book();
-            root = gnc_book_get_root_account (book);
-
-            num_of_splits = xaccTransCountSplits (trans);
 
-g_print("num_of_splits is %d\n", num_of_splits);
-
-            if (view->priv->acct_short_names)
-                new_acct = gnc_account_lookup_by_name (root, new_text);
-            else
-                new_acct = gnc_account_lookup_by_full_name (root, new_text);
-
-            if (new_acct != NULL && is_split)
-                xaccSplitSetAccount (split, new_acct);
-            else
-                xaccSplitSetAccount (osplit, new_acct);
-
-            mark_split_dirty (view, trans, split);
-
-            num = get_value_for (view, trans, split, is_blank);
-
-g_print("number is %s\n", gnc_numeric_to_string (num));
-
-            if (!gnc_numeric_zero_p (num))
-                set_value_for (view, trans, split, num);
-
-        }
         break;
 
     case COL_RECN:
         /* Column is RECONCILE */
-        begin_edit (view, split, trans);
+        gtv_begin_edit (view, NULL, trans);
 
         if (new_text != NULL)
         {
@@ -3227,27 +3905,30 @@ g_print("number is %s\n", gnc_numeric_to_string (num));
 
         break;
 
-    case COL_VALUE:
-    case COL_AMOUNT:
-    case COL_RATE:
+    case COL_TRANSVOID:
     case COL_AMTVAL:
     case COL_PRICE:
     case COL_DEBIT:
     case COL_CREDIT:
         {
 
-            Account *acct;
-            gnc_numeric input;
-            Split *osplit = NULL;
+            Account       *acct, *old_acct;
+            gnc_numeric    input;
+            Split         *osplit = NULL;
+            QofBook       *book; //do we have this
+            Account       *root; // do we have this
+            gboolean       valid_input = FALSE;
+            gboolean       force = FALSE;
+            gboolean       input_used = FALSE;
 
-g_print("rest\n");
+            book = gnc_get_current_book();
+            root = gnc_book_get_root_account (book);
 
-            if (!gnc_exp_parser_parse (new_text, &input, &error_loc))
-                break;
+            gtv_begin_edit (view, NULL, trans);
 
+            /* Get the split pair if anchored to a register */
             if (!is_split && anchor)
             {
-g_print("rest1\n");
                 if (!get_split_pair (view, trans, &osplit, &split))
                 {
                     PERR("couldn't get split pair");
@@ -3255,16 +3936,43 @@ g_print("rest1\n");
                 }
             }
 
-            begin_edit (view, NULL, trans); // open trans even if split not a child
-            mark_split_dirty (view, trans, split);
+            /* Setup the account field */
+            if (viewcol == COL_TRANSVOID)
+            {
+                if (view->priv->acct_short_names)
+                    acct = gnc_account_lookup_by_name (root, new_text);
+                else
+                    acct = gnc_account_lookup_by_full_name (root, new_text);
 
+                if (acct != NULL && is_split)
+                {
+                    old_acct = xaccSplitGetAccount (split);
+                    xaccSplitSetAccount (split, acct);
+                    if (!gnc_commodity_equiv (xaccAccountGetCommodity (old_acct), xaccAccountGetCommodity (acct)))
+                        force = TRUE;
+                }
+                else
+                {
+                    old_acct = xaccSplitGetAccount (osplit);
+                    xaccSplitSetAccount (osplit, acct);
+                    if (!gnc_commodity_equiv (xaccAccountGetCommodity (old_acct), xaccAccountGetCommodity (acct)))
+                        force = TRUE;
+                }
+            }
+            else
+            {
+                if (!gnc_exp_parser_parse (new_text, &input, &error_loc))
+                    break;
+                else
+                    valid_input = TRUE;
+            }
+
+            /* Get the account for this split */
             acct = xaccSplitGetAccount (split);
             if (!acct)
             {
-g_print("rest2\n");
                 if (anchor)
                 {
-g_print("rest3\n");
                     xaccSplitSetAccount (split, anchor);
                     acct = xaccSplitGetAccount (split);
                 }
@@ -3274,44 +3982,77 @@ g_print("rest3\n");
                 }
             }
 
+            /* Set the transaction currency if not set or if this is a non currency register,
+                 this should be same as first currency split */
+            if (!xaccTransGetCurrency (trans) || !gnc_commodity_is_currency (view->priv->reg_comm))
+            {
+                gnc_commodity *split_commodity;
+                split_commodity = xaccAccountGetCommodity (xaccSplitGetAccount (split));
+
+                if (gnc_commodity_is_currency (split_commodity))
+                    xaccTransSetCurrency (trans, xaccAccountGetCommodity (xaccSplitGetAccount (split)));
+            }
+
+            /* This computes the value if we just commit the split after entering account */
+            if (!valid_input)
+                input = get_value_for (view, trans, split, is_blank);
+
+            // Negate the input if COL_CREDIT
             if (viewcol == COL_CREDIT)
                 input = gnc_numeric_neg (input);
 
-//FIXME 
-            if (viewcol == COL_AMOUNT)
+            // Set the split parent trans
+            xaccSplitSetParent (split, trans);
+
+            // If we are at trasaction level, column is value, split level is amount
+            if (viewcol == COL_AMTVAL)
             {
-                set_amount_for (view, trans, split, input);
-                break;
+                set_number_for_input (view, trans, split, input, COL_AMTVAL);
+                input_used = TRUE;
             }
 
-            if (viewcol == COL_RATE)
+            // The price of stock / shares
+            if (viewcol == COL_PRICE)
             {
-                set_rate_for (view, trans, split, input, is_blank);
-                break;
+                set_number_for_input (view, trans, split, input, COL_PRICE);
+                input_used = TRUE;
             }
-//FIXME
 
-
-            if ((viewcol == COL_AMTVAL) && is_split)
+            // Check if this is a stock / share amount
+            if (viewcol == COL_CREDIT || viewcol == COL_DEBIT)
             {
-                set_amount_for (view, trans, split, input);
-                break;
+                if (!gnc_commodity_is_currency (xaccAccountGetCommodity (acct)))
+                {
+                    set_number_for_input (view, trans, split, input, viewcol);
+                    input_used = TRUE;
+                }
             }
 
-            if ((viewcol == COL_AMTVAL) && is_trow1)
+            // This is used in transaction mode, two splits
+            if (input_used == FALSE)
             {
-                set_value_for (view, trans, split, input);
-                break;
+                if (gnc_commodity_is_currency (xaccAccountGetCommodity (acct)))
+                    set_value_for (view, trans, split, input, force);
+                else
+                    set_value_for_amount (view, trans, split, input);
             }
-//End FIXME
 
-            set_value_for (view, trans, split, input);
+            // If this is the blank split, promote it.
+            if (is_blank)
+            {
+                /*FIXME May be this should be a signal - Promote the blank split to a real split */
+                g_idle_add ((GSourceFunc)gnc_tree_model_split_reg_commit_blank_split, get_split_reg_model_from_view (view));
+            }
 
+            // In transaction mode, two splits only, set up the other split.
             if (osplit)
             {
-g_print("rest4\n");
                 xaccSplitSetParent (osplit, trans);
-                set_value_for (view, trans, osplit, gnc_numeric_neg (input));
+
+                if (gnc_commodity_is_currency (xaccAccountGetCommodity (acct)))
+                    set_value_for (view, trans, osplit, gnc_numeric_neg (input), force);
+                else
+                    set_value_for_amount (view, trans, osplit, gnc_numeric_neg (xaccSplitGetValue (split)));
             }
         }
         break;
@@ -3323,6 +4064,7 @@ g_print("rest4\n");
 }
 
 
+/* Callback for changing reconcile setting with space bar */
 static void
 gtv_split_reg_recn_cb (GtkEntry    *entry,
                           const gchar *text,
@@ -3398,12 +4140,13 @@ gtv_split_reg_recn_cb (GtkEntry    *entry,
 
 /* The main Start Editing Call back for the TEXT columns */
 static void
-get_editable_start_editing_cb (GtkCellRenderer *cr, GtkCellEditable *editable,
+gtv_get_editable_start_editing_cb (GtkCellRenderer *cr, GtkCellEditable *editable,
                               const gchar *path_string, gpointer user_data)
 {
     GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
     GncTreeModelSplitReg *model;
-    GtkTreePath *path;
+    GtkTreeModel     *smodel;
+    GtkTreePath *path, *mpath;
     ViewCol viewcol;
 
     GtkListStore *description_list;
@@ -3415,30 +4158,31 @@ get_editable_start_editing_cb (GtkCellRenderer *cr, GtkCellEditable *editable,
     RowDepth depth;
 
     ENTER(" ");
-g_print("\n\nget_editable_start_editing_cb\n");
+//g_print("\n\ngtv_get_editable_start_editing_cb Path string is '%s'\n", path_string);
 
     model = get_split_reg_model_from_view (view);
 
+    smodel = gtk_tree_view_get_model (GTK_TREE_VIEW (view));
+
     /* Description / Notes / Memo / Accounts Completion Lists */
     description_list = gnc_tree_model_split_reg_get_description_list (model);
     notes_list = gnc_tree_model_split_reg_get_notes_list (model);
     memo_list = gnc_tree_model_split_reg_get_memo_list (model);
     acct_list = gnc_tree_model_split_reg_get_acct_list (model);
 
-//g_print("editable Path string is '%s'\n", path_string);
-
-    //Use depth to determine if it is a split or transaction
+    // Use depth to determine if it is a split or transaction
     path = gtk_tree_path_new_from_string (path_string);
     depth = gtk_tree_path_get_depth (path);
 
     viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT(cr), "view_column"));
 
-g_print("editable Depth is %u and ViewCol is %d\n", depth, viewcol);
+//g_print("editable Depth is %u and ViewCol is %d\n", depth, viewcol);
 
     /* DATE COLUMN */
     if (viewcol == COL_DATE)
     {
         g_object_set_data (G_OBJECT (cr), "cell-editable", editable);
+
         //Copy the string in the GtkEntry for later comparison
         g_object_set_data (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (GTK_ENTRY (GNC_POPUP_ENTRY (editable)->entry))));
 
@@ -3469,14 +4213,15 @@ g_print("editable Depth is %u and ViewCol is %d\n", depth, viewcol);
         gtk_entry_completion_set_inline_selection (completion, TRUE);
         gtk_entry_completion_set_popup_set_width (completion, FALSE);
         gtk_entry_completion_set_minimum_key_length (completion, KEY_LENGTH);
-/*??        g_signal_connect(G_OBJECT(completion), "match-selected", (GCallback)gtv_split_reg_match_selected_cb, view); */
+/*??        g_signal_connect(G_OBJECT(completion), "match-selected", (GCallback) gtv_split_reg_match_selected_cb, view); */
         g_object_unref (completion);
 
         g_object_set_data (G_OBJECT (cr), "cell-editable", editable);
+
         //Copy the string in the GtkEntry for later comparison
         g_object_set_data(G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)));
 
-        g_signal_connect (G_OBJECT (cr), "changed", (GCallback)gtv_split_reg_changed_cb, view);
+//        g_signal_connect (G_OBJECT (cr), "changed", (GCallback) gtv_split_reg_changed_cb, view);
         g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) remove_edit_combo, view);
 
 //g_print("Current String tv is '%s'\n", g_strdup(gtk_entry_get_text (entry)));
@@ -3502,10 +4247,11 @@ g_print("editable Depth is %u and ViewCol is %d\n", depth, viewcol);
         entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (editable)));
 
         g_object_set_data (G_OBJECT (cr), "cell-editable", editable);
+
         //Copy the string in the GtkEntry for later comparison
         g_object_set_data (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)));
 
-/*??        g_signal_connect (G_OBJECT (cr), "changed", (GCallback)gtv_split_reg_changed_cb, view); */
+/*??        g_signal_connect (G_OBJECT (cr), "changed", (GCallback) gtv_split_reg_changed_cb, view); */
         g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) remove_edit_combo, view);
 
 //g_print("Current String na is '%s'\n", g_strdup (gtk_entry_get_text (entry)));
@@ -3540,13 +4286,18 @@ g_print("editable Depth is %u and ViewCol is %d\n", depth, viewcol);
         gtk_entry_completion_set_popup_completion (completion, TRUE);
         gtk_entry_completion_set_inline_selection (completion, TRUE);
         gtk_entry_completion_set_minimum_key_length (completion, KEY_LENGTH);
-/*??        g_signal_connect (G_OBJECT (completion), "match-selected", (GCallback)gtv_split_reg_match_selected_cb, view); */
+/*??        g_signal_connect (G_OBJECT (completion), "match-selected", (GCallback) gtv_split_reg_match_selected_cb, view); */
 
         g_object_unref (completion);
 
         g_object_set_data (G_OBJECT (cr), "cell-editable", editable);
+
         //Copy the string in the GtkEntry for later comparison
         g_object_set_data (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (GTK_ENTRY(editable))));
+
+        view->priv->fo_handler_id = g_signal_connect (G_OBJECT (editable), "focus-out-event", (GCallback) gtv_split_reg_focus_out_cb, view);
+//g_print("editable pointer dsn is %p and id %lu\n", editable, view->priv->fo_handler_id);
+
         g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) remove_edit_entry, view);
 
 //g_print("Current String dnm is '%s'\n", g_strdup (gtk_entry_get_text (GTK_ENTRY(editable))));
@@ -3560,13 +4311,19 @@ g_print("editable Depth is %u and ViewCol is %d\n", depth, viewcol);
 
         entry = GTK_ENTRY (editable);
 
-        g_object_set_data (G_OBJECT (cr), "cell-editable", editable);
+         g_object_set_data (G_OBJECT (cr), "cell-editable", editable);
+
         //Copy the string in the GtkEntry for later comparison
         g_object_set_data (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)));
+
         g_signal_connect (G_OBJECT (GTK_ENTRY (editable)), "insert_text", (GCallback)gtv_split_reg_recn_cb, view);
+
+        view->priv->fo_handler_id = g_signal_connect (G_OBJECT (editable), "focus-out-event", (GCallback) gtv_split_reg_focus_out_cb, view);
+//g_print("editable pointer recn is %p and id %lu\n", editable, view->priv->fo_handler_id);
+
         g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) remove_edit_entry, view);
 
-/*??        g_signal_connect (G_OBJECT (cr), "changed", (GCallback)gtv_split_reg_changed_cb, view); */
+/*??        g_signal_connect (G_OBJECT (cr), "changed", (GCallback) gtv_split_reg_changed_cb, view); */
 //g_print("Current String recn is '%s'\n", g_strdup (gtk_entry_get_text (entry)));
     }
 
@@ -3579,9 +4336,13 @@ g_print("editable Depth is %u and ViewCol is %d\n", depth, viewcol);
         entry = GTK_ENTRY (editable);
 
         g_object_set_data (G_OBJECT (cr), "cell-editable", editable);
+
         //Copy the string in the GtkEntry for later comparison
         g_object_set_data (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)));
-//        g_signal_connect (G_OBJECT (GTK_ENTRY (editable)), "insert_text", (GCallback)gtv_split_reg_recn_cb, view);
+
+        view->priv->fo_handler_id = g_signal_connect (G_OBJECT (editable), "focus-out-event", (GCallback) gtv_split_reg_focus_out_cb, view);
+//g_print("editable pointer rest is %p and id %lu\n", editable, view->priv->fo_handler_id);
+
         g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) remove_edit_entry, view);
 
 /*??        g_signal_connect (G_OBJECT (cr), "changed", (GCallback)gtv_split_reg_changed_cb, view); */
@@ -3591,28 +4352,77 @@ g_print("editable Depth is %u and ViewCol is %d\n", depth, viewcol);
 
     gtv_split_reg_help (view, cr, viewcol, depth);
 
-    gtk_tree_path_free (view->priv->acct_edit_path);
-    view->priv->acct_edit_path = gtk_tree_path_copy (path);
-//g_print("edit_path is %s\n", gtk_tree_path_to_string (view->priv->acct_edit_path));
+    mpath = gtk_tree_model_sort_convert_path_to_child_path (GTK_TREE_MODEL_SORT (smodel), path);
+
+    if(view->priv->edit_ref != NULL)
+    {
+        gtk_tree_row_reference_free (view->priv->edit_ref);
+        view->priv->edit_ref = NULL;
+    }
+    view->priv->edit_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (model), mpath);
+
+//g_print("edit_path is %s\n", gtk_tree_path_to_string (gtk_tree_row_reference_get_path (view->priv->edit_ref)));
     gtk_tree_path_free (path);
+    gtk_tree_path_free (mpath);
+
     view->priv->temp_cr = cr;
+
+//g_print("Temp Cell Rend %p\n", view->priv->temp_cr);
+
     //Add edit-canceled property to cr so we can distinguish between
     //cancelled and actual changes
     g_object_set_data (G_OBJECT (cr), "edit-canceled", GINT_TO_POINTER (FALSE));
 
+
+    /*******************************************************************/
+    /*            Test function before edit started                    */
+    /*******************************************************************/
+
+    /* Test for change of RECN COLUMN setting from reconciled */
+    if (viewcol == COL_RECN)
+    {
+       /* Are we trying to change the reconcile setting */
+        if (gnc_tree_control_split_reg_recn_change (view))
+        {
+//g_print("true\n");
+            /* Make sure we have stopped editing */
+            g_idle_add( (GSourceFunc)gtv_idle_finish_edit, view ); //FIXME Not sure if this is ok.  
+        }
+        else
+        {
+//g_print("false\n");
+            /* Make sure we have stopped editing */
+            g_idle_add( (GSourceFunc)gtv_idle_finish_edit, view ); //FIXME Not sure if this is ok. 
+        }
+    }
+
+    /* Ask, are we allowed to change reconciled values other than 'description / notes / memo' 
+       which we can change always */
+    if (viewcol != COL_DESCNOTES && viewcol != COL_RECN)
+    {
+        if (gnc_tree_control_split_reg_recn_test (view))
+        {
+//g_print("true\n");
+        }
+        else
+        {
+//g_print("false\n");
+            /* Make sure we have stopped editing */
+            g_idle_add( (GSourceFunc)gtv_idle_finish_edit, view ); //FIXME Not sure if this is ok. 
+        }
+    }
+
     LEAVE(" ");
 }
 
 
-//Handle the "match-selected" signal
+// Handle the "match-selected" signal
 static void
 gtv_split_reg_match_selected_cb (GtkEntryCompletion *widget, GtkTreeModel *model,
                         GtkTreeIter *iter, gpointer user_data)
 {
     GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
 
-    gboolean is_trow1, is_trow2, is_split, is_blank;
-
 g_print("gtv_split_reg_match_selected_cb\n\n");
 
 /* Not sure what I am going to put in here yet */
@@ -3620,32 +4430,35 @@ g_print("gtv_split_reg_match_selected_cb\n\n");
 }
 
 
-//Handle the "changed" signal
+// Handle the "changed" signal
 static void
 gtv_split_reg_changed_cb (GtkCellRendererCombo *widget, gchar *path_string,
                         GtkTreeIter *iter, gpointer user_data)
 {
     GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
 
-    gboolean is_trow1, is_trow2, is_split, is_blank;
-
 g_print("gtv_split_reg_changed_cb path string is '%s'\n\n", path_string);
 
-
 /* Not sure what I am going to put in here yet */
 
 }
 
 
-//Handle the "editing-canceled" signal
+// Handle the "editing-canceled" signal
 static void
 gtv_split_reg_editing_canceled_cb (GtkCellRenderer *cr, gpointer user_data)
 {
     GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
-g_print("gtv_split_reg_editing_canceled_cb\n\n");
+//g_print("gtv_split_reg_editing_canceled_cb\n\n");
 
-    if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view), "data-edited")) == FALSE) // None edited, reset edit path
-        view->priv->acct_edit_path = NULL;
+    if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view), "data-edited")) == FALSE) // Not edited, reset edit path
+    {
+        if(view->priv->edit_ref != NULL)
+        {
+            gtk_tree_row_reference_free (view->priv->edit_ref);
+            view->priv->edit_ref = NULL;
+        }
+    }
 
     /* Reset Help text */
     view->help_text = " ";
@@ -3655,207 +4468,172 @@ g_print("gtv_split_reg_editing_canceled_cb\n\n");
     g_object_set_data (G_OBJECT (cr), "edit-canceled", GINT_TO_POINTER (TRUE));	
 }
 
-/*####################################################################
-          ^^^^   gtv function call backs    ^^^^
-#####################################################################*/
 
-void
-gnc_tree_view_split_reg_void_current_trans (GncTreeViewSplitReg *view, const char *reason)
+/* Scroll the view to show selected row based on sort direction */
+static gboolean
+gtv_scroll_to_cell (GncTreeViewSplitReg *view)
 {
-    Transaction *trans;
-    Split *blank_split;
-    Split *split;
-
-    if (!view) return;
-
-    blank_split = gnc_tree_view_split_reg_get_blank_split (view);
-
-    /* get the current split based on cursor position */
-    split = gnc_tree_view_split_reg_get_current_split (view);
-    if (split == NULL)
-        return;
+    GncTreeModelSplitReg *model;
+    GtkTreePath *mpath, *spath;
 
-    /* Bail if trying to void the blank split. */
-    if (split == blank_split)
-        return;
+//g_print("gtv_scroll_to_cell\n");
 
-    /* already voided. */
-    if (xaccSplitGetReconcile (split) == VREC)
-        return;
+    model = get_split_reg_model_from_view (view);
 
-    trans = xaccSplitGetParent (split);
-    xaccTransVoid (trans, reason);
+    mpath = gnc_tree_view_split_reg_get_current_path (view);
+    spath = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (gtk_tree_view_get_model (GTK_TREE_VIEW (view))), mpath);
 
-    if (xaccTransIsOpen (trans))
+   
+    if (view->sort_direction == 1)
+        gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), spath, NULL, TRUE, 0.0, 0.0);
+    else
     {
-        PERR("We should not be voiding an open transaction.");
-        xaccTransCommitEdit (trans);
+        if (model->use_double_line)
+        {
+            gtk_tree_path_down (spath); // move to the second row of transaction
+            gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), spath, NULL, TRUE, 1.0, 0.0);
+            gtk_tree_path_up (spath); // back to first row of transaction
+        }
+        else
+            gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), spath, NULL, TRUE, 1.0, 0.0);
     }
+    gtk_tree_path_free (mpath);
+    gtk_tree_path_free (spath);
+    return (FALSE);
 }
 
 
-void
-gnc_tree_view_split_reg_unvoid_current_trans (GncTreeViewSplitReg *view)
-{
-    Transaction *trans;
-    Split *blank_split;
-    Split *split;
+/*####################################################################
+          ^^^^   gtv function call backs    ^^^^
+#####################################################################*/
 
-    if (!view) return;
+/* Returns the Transaction at the current selected position */
+Transaction * 
+gnc_tree_view_split_reg_get_current_trans (GncTreeViewSplitReg *view)
+{
+    return view->priv->current_trans;
+}
 
-    blank_split = gnc_tree_view_split_reg_get_blank_split (view);
 
-    /* get the current split based on cursor position */
-    split = gnc_tree_view_split_reg_get_current_split (view);
-    if (split == NULL)
-        return;
+/* Returns the Split at the current selected position or NULL */
+Split * 
+gnc_tree_view_split_reg_get_current_split (GncTreeViewSplitReg *view)
+{
+    return view->priv->current_split;
+}
 
-    /* Bail if trying to unvoid the blank split. */
-    if (split == blank_split)
-        return;
 
-    /* not voided. */
-    if (xaccSplitGetReconcile (split) != VREC)
-        return;
+/* Returns the depth of the selected row */
+RowDepth
+gnc_tree_view_reg_get_selected_row_depth (GncTreeViewSplitReg *view)
+{
+    return view->priv->current_depth;
+}
 
-    trans = xaccSplitGetParent (split);
 
-    xaccTransUnvoid (trans);
+/* Returns the dirty_trans or NULL */
+Transaction *
+gnc_tree_view_split_reg_get_dirty_trans (GncTreeViewSplitReg *view)
+{
+    return view->priv->dirty_trans;
 }
 
 
-/* Reinit transaction / delete the splits */
+/* Sets dirty_trans to trans or NULL to clear */
 void
-gnc_tree_view_split_reg_reinit_trans (GncTreeViewSplitReg *view)
+gnc_tree_view_split_reg_set_dirty_trans (GncTreeViewSplitReg *view, Transaction *trans)
 {
     GncTreeModelSplitReg *model;
-    GtkTreeIter iter;
-    Split *split = NULL;
-    Transaction *trans = NULL;
-    gboolean is_trow1, is_trow2, is_split, is_blank;
 
-g_print("gnc_tree_view_split_reg_reinit_trans\n");
     model = get_split_reg_model_from_view (view);
 
-    /* Lets get out of the way, move the selection to the transaction */
-    gnc_tree_view_split_reg_goto_rel_trans_row (view, 0);
-
-    gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, view->priv->current_path);
-
-    gnc_tree_model_split_reg_get_split_and_trans (
-            GNC_TREE_MODEL_SPLIT_REG (model), &iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
-
-    if (trans && (is_trow1 || is_trow2))
+    if (trans == NULL)
     {
-        Split *s;
-        int i = 0;
-        
-        begin_edit (view, NULL, trans);        
-        while ((s = xaccTransGetSplit(trans, i)) != NULL)
+        if(view->priv->edit_ref != NULL)
         {
-            if (xaccTransGetRateForCommodity (trans, view->priv->reg_comm, s, NULL))
-                xaccSplitDestroy(s);
-            else i++;
+            gtk_tree_row_reference_free (view->priv->edit_ref);
+            view->priv->edit_ref = NULL;
         }
-    g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (TRUE));
-    view->priv->dirty_trans = trans;
+        g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (FALSE));
+        view->priv->dirty_trans = NULL;
+    }
+    else
+    {
+        if(view->priv->edit_ref != NULL)
+        {
+            gtk_tree_row_reference_free (view->priv->edit_ref);
+            view->priv->edit_ref = NULL;
+        }
+        view->priv->edit_ref = gtk_tree_row_reference_copy (view->priv->current_ref);
+        g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (TRUE));
+        view->priv->dirty_trans = trans;
     }
 }
 
 
-/* Jump to the Blank transaction, i.e. last in list */
-void
-gnc_tree_view_split_reg_jump_to_blank (GncTreeViewSplitReg *view)
-{
-    GncTreeModelSplitReg *model;
-    GtkTreePath *path;
-
-g_print("gnc_tree_view_split_reg_jump_to_blank\n");
-    model = get_split_reg_model_from_view (view);
-
-    path = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, NULL, NULL);
-
-    gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), path);
-
-    /* Scroll the window to show selection */
-    if (model->use_double_line)
-       gtk_tree_path_down (path); // show the second row of transaction
-
-    /* scroll when view idle */
-    g_idle_add ((GSourceFunc)gtv_scroll_to_cell, view );
-
-    gtk_tree_path_free (path);
-}
-
-
-static gboolean
-gtv_scroll_to_cell (GncTreeViewSplitReg *view)
+/* Returns the current path */
+GtkTreePath *
+gnc_tree_view_split_reg_get_current_path (GncTreeViewSplitReg *view)
 {
-    GncTreeModelSplitReg *model;
-    GtkTreePath *path;
-
-    model = get_split_reg_model_from_view (view);
-
-    path = view->priv->current_path;
-   
-    gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), path, NULL, TRUE, 0.5, 0.0);
-
-   return (FALSE);
+    return gtk_tree_row_reference_get_path (view->priv->current_ref);
 }
 
 
-/* Jump to split */
+/* Set the Current path to path */
 void
-gnc_tree_view_split_reg_jump_to_split (GncTreeViewSplitReg *view, Split *split)
+gnc_tree_view_split_reg_set_current_path (GncTreeViewSplitReg *view, GtkTreePath *path)
 {
     GncTreeModelSplitReg *model;
-    GtkTreePath *path;
-
-g_print("gnc_tree_view_split_reg_jump_to_split and split is %p\n", split);
 
     model = get_split_reg_model_from_view (view);
 
-    path = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, split, NULL);
-
-    gtk_tree_path_free (view->priv->current_path);
-
-    view->priv->current_path = gtk_tree_path_copy (path);
-
-    gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), path);
-
-    gtk_tree_path_free (path);
+    if(view->priv->current_ref != NULL)
+    {
+        gtk_tree_row_reference_free (view->priv->current_ref);
+        view->priv->current_ref = NULL;
+    }
+    view->priv->current_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (model), path);
 
-    /* scroll when view is idle */
-    g_idle_add ((GSourceFunc)gtv_scroll_to_cell, view );
+    view->priv->current_trans = gnc_tree_view_split_reg_get_current_trans (view);
+    view->priv->current_split = gnc_tree_view_split_reg_get_current_split (view);
+    view->priv->current_depth = gnc_tree_view_reg_get_selected_row_depth (view);
 }
 
 
-/* Move to the relative transaction */
+/* Reinit transaction / delete the splits */
 void
-gnc_tree_view_split_reg_goto_rel_trans_row (GncTreeViewSplitReg *view, gint relative)
+gnc_tree_view_split_reg_reinit_trans (GncTreeViewSplitReg *view)
 {
+    Transaction           *trans;
+    RowDepth               depth;
 
-    GncTreeModelSplitReg *model;
-    GtkTreePath *path;
-    gint *indices;
-
-g_print("gnc_tree_view_split_reg_goto_rel_trans_row\n");
+//g_print("gnc_tree_view_split_reg_reinit_trans\n");
 
-//FIXME Need to do some checks on relative -1,0,1
-    model = get_split_reg_model_from_view (view);
-
-    indices = gtk_tree_path_get_indices (view->priv->current_path);
+    /* Make sure we have stopped editing */
+    gnc_tree_view_split_reg_finish_edit (view);
 
-    path = gtk_tree_path_new_from_indices (indices[0] + relative, -1);
+    trans = view->priv->current_trans;
 
-    gtk_tree_path_free (view->priv->current_path);
+    /* Lets get out of the way, move the selection to the transaction */
+    gnc_tree_control_split_reg_goto_rel_trans_row (view, 0);
 
-    view->priv->current_path = gtk_tree_path_copy (path);
+    depth = view->priv->current_depth;
 
-    gtk_tree_selection_unselect_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), path);
-    gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), path);
+    if (trans && (depth != SPLIT3))
+    {
+        Split *s;
+        int i = 0;
 
-    gtk_tree_path_free (path);
+        gtv_begin_edit (view, NULL, trans);  
+        gnc_tree_view_split_reg_set_dirty_trans (view, trans);
+       
+        while ((s = xaccTransGetSplit (trans, i)) != NULL)
+        {
+            if (xaccTransGetRateForCommodity (trans, view->priv->reg_comm, s, NULL))
+                xaccSplitDestroy (s);
+            else i++;
+        }
+    }
 }
 
 
@@ -3863,41 +4641,28 @@ g_print("gnc_tree_view_split_reg_goto_rel_trans_row\n");
 void
 gnc_tree_view_split_reg_delete_current_split (GncTreeViewSplitReg *view)
 {
-    GncTreeModelSplitReg  *model;
-    GtkTreeIter            iter;
-    GtkTreePath           *path;
-    GtkTreeViewColumn     *col_current;
-    Split                 *split = NULL;
-    Transaction           *trans = NULL;
-    gboolean               is_trow1, is_trow2, is_split, is_blank;
-
-g_print("gnc_tree_view_split_reg_delete_current_split\n");
-
-    model = get_split_reg_model_from_view (view);
+    Transaction           *trans;
+    Split                 *split;
+    gboolean               was_open;
 
-    gtk_tree_view_get_cursor (GTK_TREE_VIEW (view), &path, &col_current);
+//g_print("gnc_tree_view_split_reg_delete_current_split\n");
 
     /* Make sure we have stopped editing */
-    if (col_current != NULL)
-        finish_edit (col_current);
+    gnc_tree_view_split_reg_finish_edit (view);
 
-    gtk_tree_path_free (path);
+    trans = view->priv->current_trans;
+    split = view->priv->current_split;
 
-    gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, view->priv->current_path);
+    gtv_begin_edit (view, NULL, trans);
 
-    gnc_tree_model_split_reg_get_split_and_trans (
-            GNC_TREE_MODEL_SPLIT_REG (model), &iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
+    gnc_tree_view_split_reg_set_dirty_trans (view, trans);
 
     /* Lets get out of the way, move the selection to the transaction */
-    gnc_tree_view_split_reg_goto_rel_trans_row (view, 0);
+    gnc_tree_control_split_reg_goto_rel_trans_row (view, 0);
 
-    begin_edit (view, split, trans);
-
-    if (is_split)
-    {
+    was_open = xaccTransIsOpen (trans);
+    if (was_open)
         xaccSplitDestroy (split);
-        xaccTransCommitEdit (trans);
-    }
 }
 
 
@@ -3905,35 +4670,23 @@ g_print("gnc_tree_view_split_reg_delete_current_split\n");
 void
 gnc_tree_view_split_reg_delete_current_trans (GncTreeViewSplitReg *view)
 {
-    GncTreeModelSplitReg  *model;
-    GtkTreeIter            iter;
-    GtkTreePath           *path;
-    GtkTreeViewColumn     *col_current;
-    Split                 *split = NULL;
-    Transaction           *trans = NULL;
-    gboolean               is_trow1, is_trow2, is_split, is_blank;
+    Transaction           *trans;
     gboolean               was_open;
 
-g_print("gnc_tree_view_split_reg_delete_current_trans\n");
-    model = get_split_reg_model_from_view (view);
+//g_print("gnc_tree_view_split_reg_delete_current_trans\n");
 
-    gtk_tree_view_get_cursor (GTK_TREE_VIEW (view), &path, &col_current);
+    /* We do not use the normal confirmation with this one as we have 
+       all ready asked the user to confirm delete */
 
     /* Make sure we have stopped editing */
-    if (col_current != NULL)
-        finish_edit (col_current);
+    gnc_tree_view_split_reg_finish_edit (view);
 
-    gtk_tree_path_free (path);
-
-    gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, view->priv->current_path);
-
-    gnc_tree_model_split_reg_get_split_and_trans (
-            GNC_TREE_MODEL_SPLIT_REG (model), &iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
+    trans = view->priv->current_trans;
 
-    begin_edit (view, split, trans);
+    /* We need to go back one to select the next transaction */
+    gnc_tree_control_split_reg_goto_rel_trans_row (view, 1);
 
-    /* Lets get out of the way, move the selection to the next transaction */
-    gnc_tree_view_split_reg_goto_rel_trans_row (view, 1);
+    gtv_begin_edit (view, NULL, trans);
 
     was_open = xaccTransIsOpen (trans);
 
@@ -3943,209 +4696,237 @@ g_print("gnc_tree_view_split_reg_delete_current_trans\n");
         DEBUG("committing");
         xaccTransCommitEdit (trans);
     }
-
     view->priv->dirty_trans = NULL;
-
-    /* We need to go back one to select the next transaction */
-    gnc_tree_view_split_reg_goto_rel_trans_row (view, -1);
 }
 
 
-/* Returns whether the splits are revealed at the current position */ 
+/* Record changes */
 gboolean
-gnc_tree_view_split_reg_current_trans_expanded (GncTreeViewSplitReg *view)
+gnc_tree_view_split_reg_enter (GncTreeViewSplitReg *view)
 {
-    GtkTreePath *path;
-    gint *indices;
-    gboolean expanded = FALSE;
-
-    indices = gtk_tree_path_get_indices (view->priv->current_path);
 
-    path = gtk_tree_path_new_from_indices (indices[0], 0, -1);
+//g_print("gnc_tree_view_split_reg_enter\n");
 
-    expanded = gtk_tree_view_row_expanded (GTK_TREE_VIEW (view), path);
+    /* Make sure we have stopped editing */
+    gnc_tree_view_split_reg_finish_edit (view);
 
-    gtk_tree_path_free(path);
-    return expanded;
+    /* Ask for confirmation if data has been edited, transaction_changed_confirm return TRUE if canceled */
+    if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view), "data-edited")) && transaction_changed_confirm (view, NULL))
+    {
+        return FALSE;
+    }
+    return TRUE;
 }
 
 
-/* Returns the depth of the selected row */
-RowDepth
-gnc_tree_view_reg_get_selected_row_depth (GncTreeViewSplitReg *view)
+/* Cancel the edit and rollback changes */
+void
+gnc_tree_view_split_reg_cancel_edit (GncTreeViewSplitReg *view, gboolean reg_closing)
 {
-    gint depth;
+    GncTreeModelSplitReg *model;
+    GtkTreePath          *path;
+    Transaction          *trans = view->priv->dirty_trans;
+    Split                *split;
+
+//g_print("gnc_tree_view_split_reg_cancel_edit view is %p and reg_closing is %d\n", view, reg_closing);
+
+    model = get_split_reg_model_from_view (view);
 
-    depth = gtk_tree_path_get_depth (view->priv->current_path);
+    path = gnc_tree_view_split_reg_get_current_path (view);
 
-    return depth;
+    if (trans && xaccTransIsOpen (trans))
+    {
+        gnc_tree_control_split_reg_goto_rel_trans_row (view, 0);
+
+        g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (FALSE));
+        xaccTransRollbackEdit (view->priv->dirty_trans);
+        view->priv->dirty_trans = NULL;
+
+        split = gnc_tree_model_split_get_blank_split (model);
+        xaccSplitReinit (split); // Clear the blank split
+
+        if (view->priv->edit_ref != NULL)
+        {
+            gtk_tree_row_reference_free (view->priv->edit_ref);
+            view->priv->edit_ref = NULL;
+        }
+    }
+
+    view->change_allowed = FALSE;
+    gtk_tree_path_free (path);
 }
 
 
-/* Returns the Blank Split */
-Split * 
-gnc_tree_view_split_reg_get_blank_split (GncTreeViewSplitReg *view)
+/* Make sure we have stopped editing */ 
+void
+gnc_tree_view_split_reg_finish_edit (GncTreeViewSplitReg *view)
 {
-    GncTreeModelSplitReg *model;
+//g_print("gnc_tree_view_split_reg_finish_edit - view is %p\n", view);
 
-//g_print("gnc_tree_view_split_reg_get_blank_split\n");
-    model = get_split_reg_model_from_view (view);
+    gtv_finish_edit (view);
 
-    return gnc_tree_model_split_get_blank_split (model);
+    /* give gtk+ a chance to handle pending events */
+    while (gtk_events_pending ())
+       gtk_main_iteration ();
 }
 
 
-/* Return the Split for the current Transaction */
-Split *
-gnc_tree_view_reg_get_current_trans_split (GncTreeViewSplitReg *view)
+/* Returns whether the splits are revealed for the transaction or current position
+   if transaction is NULL */ 
+gboolean
+gnc_tree_view_split_reg_trans_expanded (GncTreeViewSplitReg *view, Transaction *trans)
 {
     GncTreeModelSplitReg *model;
-    GtkTreeIter iter;
-    Split *split = NULL;
-    Transaction *trans = NULL;
-    gboolean is_trow1, is_trow2, is_split, is_blank;
+    GtkTreePath  *mpath, *spath;
+    gboolean expanded;
 
-//g_print("gnc_tree_view_reg_get_current_trans_split\n");
-    model = get_split_reg_model_from_view (view);
+//g_print("\ngnc_tree_view_split_reg_trans_expanded and trans is %p\n", trans);
 
-    gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, view->priv->current_path);
+    /* if trans is NULL use priv->expanded */
+    if (trans == NULL)
+        expanded = view->priv->expanded;
+    else
+    {
+        model = get_split_reg_model_from_view (view);
 
-    gnc_tree_model_split_reg_get_split_and_trans (
-            GNC_TREE_MODEL_SPLIT_REG (model), &iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
+        mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, NULL, trans);
 
-    split = get_this_split (view, trans);
+        spath = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (gtk_tree_view_get_model (GTK_TREE_VIEW (view))), mpath);
 
-//g_print("gnc_tree_view_reg_get_current_trans_split %p\n", split);
+        gtk_tree_path_down (spath); /* Move the path down to trow2 */
+        expanded = gtk_tree_view_row_expanded (GTK_TREE_VIEW (view), spath);
 
-    return split;
+        gtk_tree_path_free (mpath);
+        gtk_tree_path_free (spath);
+
+    }
+    return expanded;
 }
 
 
-/* Returns the Split at the current selected position */
-Split * 
-gnc_tree_view_split_reg_get_current_split (GncTreeViewSplitReg *view)
+/* Collapse the transaction, if trans is NULL,  use current_ref */
+void
+gnc_tree_view_split_reg_collapse_trans (GncTreeViewSplitReg *view, Transaction *trans)
 {
     GncTreeModelSplitReg *model;
-    GtkTreeIter iter;
-    Split *split = NULL;
-    Transaction *trans = NULL;
-    gboolean is_trow1, is_trow2, is_split, is_blank;
+    GtkTreePath *temp_path, *mpath, *spath;
+    gint *indices;
+    RowDepth depth;
+
+//g_print("\ngnc_tree_view_split_reg_collapse_trans and trans is %p\n", trans);
 
-//g_print("gnc_tree_view_split_reg_get_current_split\n");
     model = get_split_reg_model_from_view (view);
 
-    gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, view->priv->current_path);
+    /* Make sure we have stopped editing */
+    gnc_tree_view_split_reg_finish_edit (view);
 
-    gnc_tree_model_split_reg_get_split_and_trans (
-            GNC_TREE_MODEL_SPLIT_REG (model), &iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
+    /* if trans is NULL use current_ref */
+    if (trans == NULL)
+        mpath = gtk_tree_row_reference_get_path (view->priv->current_ref);
+    else
+        mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, NULL, trans);
 
-//g_print("gnc_tree_view_split_reg_get_current_split %p\n", split);
-    return split;
-}
+    spath = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (gtk_tree_view_get_model (GTK_TREE_VIEW (view))), mpath);
 
+    /* Collapse the view back to the transaction */
+    indices = gtk_tree_path_get_indices (spath);
+    depth = gtk_tree_path_get_depth (spath);
 
-/* Returns the Transaction at the current selected position */
-Transaction * 
-gnc_tree_view_split_reg_get_current_trans (GncTreeViewSplitReg *view)
-{
-    GncTreeModelSplitReg *model;
-    GtkTreeIter iter;
-    Split *split = NULL;
-    Transaction *trans = NULL;
-    gboolean is_trow1, is_trow2, is_split, is_blank;
+    if (model->use_double_line)
+        temp_path = gtk_tree_path_new_from_indices (indices[0], 0, -1);
+    else
+        temp_path = gtk_tree_path_new_from_indices (indices[0], -1);
 
-//g_print("gnc_tree_view_split_reg_get_current_trans\n");
-    model = get_split_reg_model_from_view (view);
+    /* if trans is NULL, collapse and update current_ref */
+    if (trans == NULL)
+    {
+        GtkTreePath *path;
 
-    gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, view->priv->current_path);
+        gnc_tree_view_split_reg_block_selection (view, TRUE);
 
-    gnc_tree_model_split_reg_get_split_and_trans (
-            GNC_TREE_MODEL_SPLIT_REG (model), &iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
+        /* Change the selection to last available row of transaction - double */
+        if ((model->use_double_line) && (depth == SPLIT3))
+            gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), temp_path);
 
-//g_print("gnc_tree_view_split_reg_get_current_trans %p\n", trans);
+        /* Change the selection to last available row of transaction - single */
+        if ((!model->use_double_line) && (depth != TRANS1))
+            gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), temp_path);
 
-    return trans;
-}
+        gtk_tree_view_collapse_row (GTK_TREE_VIEW (view), temp_path);
 
+        if (view->priv->current_ref != NULL)
+        {
+            gtk_tree_row_reference_free (view->priv->current_ref);
+            view->priv->current_ref = NULL;
+        }
 
-/* Record changes */
-gboolean
-gnc_tree_view_split_reg_enter (GncTreeViewSplitReg *view)
-{
-    GtkTreePath       *path;
-    GtkTreeViewColumn *col_current;
+        path = gtk_tree_model_sort_convert_path_to_child_path (GTK_TREE_MODEL_SORT (gtk_tree_view_get_model (GTK_TREE_VIEW (view))), temp_path);
 
-    gtk_tree_view_get_cursor (GTK_TREE_VIEW (view), &path, &col_current);
+        view->priv->current_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (model), path);
 
-g_print("gnc_tree_view_split_reg_enter column title is %s\n", gtk_tree_view_column_get_title (col_current));
+        gnc_tree_view_split_reg_block_selection (view, FALSE);
 
-    /* Make sure we have stopped editing */
-    if (col_current != NULL)
-        finish_edit (col_current);
+        gtk_tree_path_free (path);
+    }
+    else
+        gtk_tree_view_collapse_row (GTK_TREE_VIEW (view), temp_path);
 
-    gtk_tree_path_free (path);
+    gtk_tree_path_free (temp_path);
+    gtk_tree_path_free (mpath);
+    gtk_tree_path_free (spath);
 
-    //Ask for confirmation if data has been edited, transaction_changed_confirm return TRUE if canceled
-    if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view), "data-edited")) && transaction_changed_confirm (view, NULL))
-    {
-        return FALSE;
-    }
-    return TRUE;
+    view->priv->expanded = FALSE;
 }
 
 
-/* Expands or collapse the current transaction */
+/* Expands the transaction or the current transaction if NULL */
 void
-gnc_tree_view_split_reg_expand_current_trans (GncTreeViewSplitReg *view, gboolean expand)
+gnc_tree_view_split_reg_expand_trans (GncTreeViewSplitReg *view, Transaction *trans)
 {
     GncTreeModelSplitReg *model;
-    GtkTreePath *path;
-    gint *indices;
-    RowDepth depth;
+    GtkTreePath *mpath, *spath;
 
-g_print("\ngnc_tree_view_split_reg_expand_current_trans and expand is %d\n", expand);
+//g_print("\ngnc_tree_view_split_reg_expand_trans and trans is %p\n", trans);
 
     model = get_split_reg_model_from_view (view);
 
-    if (expand)
-        gtk_tree_view_expand_row (GTK_TREE_VIEW (view), view->priv->current_path, TRUE);
-    else
-    {
-        /* Colapse the view back to the transaction */
-        indices = gtk_tree_path_get_indices (view->priv->current_path);
-        depth = gtk_tree_path_get_depth (view->priv->current_path);
-
-        gnc_tree_view_split_reg_block_selection (view, TRUE);
+    /* Make sure we have stopped editing */
+    gnc_tree_view_split_reg_finish_edit (view);
 
-        if (model->use_double_line)
-            path =  gtk_tree_path_new_from_indices (indices[0], 0, -1);
-        else
-            path = gtk_tree_path_new_from_indices (indices[0], -1);
+    if (trans == NULL)
+        mpath = gtk_tree_row_reference_get_path (view->priv->current_ref);
+    else
+        mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, NULL, trans);
 
-        gtk_tree_view_collapse_row (GTK_TREE_VIEW (view), path);
+    spath = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (gtk_tree_view_get_model (GTK_TREE_VIEW (view))), mpath);
 
-        gtk_tree_path_free (path);
+    gtk_tree_view_expand_row (GTK_TREE_VIEW (view), spath, TRUE);
 
-        gnc_tree_view_split_reg_block_selection (view, FALSE);
+    view->priv->expanded = TRUE;
 
-        /* Change the selection to last available row of transaction */
-        if ((model->use_double_line) && (depth != TRANS1))
-            path =  gtk_tree_path_new_from_indices (indices[0], 0, -1);
-        else
-            path = gtk_tree_path_new_from_indices (indices[0], -1);
+    if (SELECTION_TO_BLANK_ON_EXPAND && (model->style != REG2_STYLE_JOURNAL))
+    {
+        gtv_selection_to_blank (view);
+    }
 
-        gtk_tree_path_free (view->priv->current_path);
-        view->priv->current_path = gtk_tree_path_copy (path);
+    gtk_tree_path_free (mpath);
+    gtk_tree_path_free (spath);
+}
 
-        gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), path);
 
-        gtk_tree_path_free (path);
-    }
+/* Returns the parent Window */
+GtkWidget *
+gnc_tree_view_split_reg_get_parent (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    model = get_split_reg_model_from_view (view);
+    return gnc_tree_model_split_reg_get_parent (model);
 }
 
 
 /* This sets up the page gui update from the tree view motion callback */
-void gnc_tree_view_split_reg_moved_cb (GncTreeViewSplitReg *view, GFunc cb, gpointer cb_data)
+void
+gnc_tree_view_split_reg_moved_cb (GncTreeViewSplitReg *view, GFunc cb, gpointer cb_data)
 {
     view->moved_cb = cb;
     view->moved_cb_data = cb_data;
diff --git a/src/gnome-utils/gnc-tree-view-split-reg.h b/src/gnome-utils/gnc-tree-view-split-reg.h
index 04bc8c8..68bc29b 100644
--- a/src/gnome-utils/gnc-tree-view-split-reg.h
+++ b/src/gnome-utils/gnc-tree-view-split-reg.h
@@ -48,14 +48,20 @@ typedef struct GncTreeViewSplitRegPrivate GncTreeViewSplitRegPrivate;
 
 typedef struct
 {
-    GncTreeView gnc_tree_view;
+    GncTreeView                 gnc_tree_view;
     GncTreeViewSplitRegPrivate *priv;
-    int stamp;
+    int                         stamp;
 
-    GFunc moved_cb;
-    gpointer moved_cb_data;
+    GtkWidget                  *window;                   // Parent Window.
+    GFunc                       moved_cb;                 // Used for page gui update
+    gpointer                    moved_cb_data;            // Used for page gui update
 
-    gchar *help_text;
+    gchar                      *help_text;                // This is the help text to be displayed.
+    gint                        sort_depth;               // This is the row the sort direction is based on.
+    gint                        sort_col;                 // This is the column the sort direction is based on.
+    gint                        sort_direction;           // This is the direction of sort, 1 for ascending or -1 rest
+    gboolean                    reg_closing;              // This is set when closing the register.
+    gboolean                    change_allowed;           // This is set when we allow the reconciled split to change.
 
 } GncTreeViewSplitReg;
 
@@ -78,6 +84,7 @@ typedef enum {
     SPLIT3, //3
 }RowDepth;
 
+
 /* Standard g_object type */
 GType gnc_tree_view_split_reg_get_type (void);
 
@@ -89,43 +96,54 @@ void gnc_tree_view_split_reg_default_selection (GncTreeViewSplitReg *view);
 
 void gnc_tree_view_split_reg_set_read_only (GncTreeViewSplitReg *view, gboolean read_only);
 
-/*************************************************************************************/
+void gnc_tree_view_split_reg_set_value_for (GncTreeViewSplitReg *view, Transaction *trans, Split *split, gnc_numeric input, gboolean force);
+
+void gnc_tree_view_split_reg_set_dirty_trans (GncTreeViewSplitReg *view, Transaction *trans);
+
+Transaction * gnc_tree_view_split_reg_get_current_trans (GncTreeViewSplitReg *view);
 
 Split * gnc_tree_view_split_reg_get_current_split (GncTreeViewSplitReg *view);
 
-Split * gnc_tree_view_split_reg_get_blank_split (GncTreeViewSplitReg *view);
+Transaction * gnc_tree_view_split_reg_get_dirty_trans (GncTreeViewSplitReg *view);
+
+void gnc_tree_view_split_reg_set_current_path (GncTreeViewSplitReg *view, GtkTreePath *path);
 
-Split * gnc_tree_view_reg_get_current_trans_split (GncTreeViewSplitReg *view);
+GtkTreePath * gnc_tree_view_split_reg_get_current_path (GncTreeViewSplitReg *view);
 
 RowDepth gnc_tree_view_reg_get_selected_row_depth (GncTreeViewSplitReg *view);
 
-void gnc_tree_view_split_reg_delete_current_split (GncTreeViewSplitReg *view);
+void gnc_tree_view_split_reg_moved_cb (GncTreeViewSplitReg *view, GFunc cb, gpointer cb_data);
 
-void gnc_tree_view_split_reg_delete_current_trans (GncTreeViewSplitReg *view);
+void gnc_tree_view_split_reg_refresh_from_gconf (GncTreeViewSplitReg *view);
 
-void gnc_tree_view_split_reg_jump_to_blank (GncTreeViewSplitReg *view);
+GtkWidget * gnc_tree_view_split_reg_get_parent (GncTreeViewSplitReg *view);
 
-void gnc_tree_view_split_reg_jump_to_split (GncTreeViewSplitReg *view, Split *split);
+gboolean gnc_tree_view_split_reg_trans_expanded (GncTreeViewSplitReg *view, Transaction *trans);
 
-void gnc_tree_view_split_reg_reinit_trans (GncTreeViewSplitReg *view);
+void gnc_tree_view_split_reg_expand_trans (GncTreeViewSplitReg *view, Transaction *trans);
+
+void gnc_tree_view_split_reg_collapse_trans (GncTreeViewSplitReg *view, Transaction *trans);
 
-void gnc_tree_view_split_reg_goto_rel_trans_row (GncTreeViewSplitReg *view, gint relative);
+
+/*************************************************************************************/
+
+void gnc_tree_view_split_reg_delete_current_split (GncTreeViewSplitReg *view);
+
+void gnc_tree_view_split_reg_delete_current_trans (GncTreeViewSplitReg *view);
+
+void gnc_tree_view_split_reg_reinit_trans (GncTreeViewSplitReg *view);
 
 gboolean gnc_tree_view_split_reg_enter (GncTreeViewSplitReg *view);
 
-gboolean gnc_tree_view_split_reg_current_trans_expanded (GncTreeViewSplitReg *view);
+void gnc_tree_view_split_reg_cancel_edit (GncTreeViewSplitReg *view, gboolean reg_closing);
+
+void gnc_tree_view_split_reg_finish_edit (GncTreeViewSplitReg *view);
 
-Transaction * gnc_tree_view_split_reg_get_current_trans (GncTreeViewSplitReg *view);
 
-void gnc_tree_view_split_reg_cancel_edit (GncTreeViewSplitReg *view);
 
-void gnc_tree_view_split_reg_expand_current_trans (GncTreeViewSplitReg *view, gboolean expand);
 
-void gnc_tree_view_split_reg_moved_cb (GncTreeViewSplitReg *view, GFunc cb, gpointer cb_data);
 
-void gnc_tree_view_split_reg_void_current_trans (GncTreeViewSplitReg *view, const char *reason);
 
-void gnc_tree_view_split_reg_unvoid_current_trans (GncTreeViewSplitReg *view);
 
 G_END_DECLS
 
diff --git a/src/gnome-utils/gnc-tree-view.c b/src/gnome-utils/gnc-tree-view.c
index 383cca1..d21415e 100644
--- a/src/gnome-utils/gnc-tree-view.c
+++ b/src/gnome-utils/gnc-tree-view.c
@@ -111,6 +111,9 @@ typedef struct GncTreeViewPrivate
     GtkWidget         *column_menu;
     gboolean           show_column_menu;
 
+    /* Sort callback user_data */
+    gpointer           sort_user_data;
+
     /* Gconf related values */
     gchar             *gconf_section;
     gboolean           seen_gconf_visibility;
@@ -235,6 +238,7 @@ gnc_tree_view_init (GncTreeView *view, GncTreeViewClass *klass)
     priv = GNC_TREE_VIEW_GET_PRIVATE(view);
     priv->column_menu = NULL;
     priv->show_column_menu = FALSE;
+    priv->sort_user_data = NULL;
     priv->gconf_section = NULL;
     priv->seen_gconf_visibility = FALSE;
     priv->columns_changed_cb_id = 0;
@@ -954,6 +958,7 @@ gnc_tree_view_set_sort_column (GncTreeView *view,
     if (!gtk_tree_sortable_get_sort_column_id(GTK_TREE_SORTABLE(s_model),
             &current, &order))
         order = GTK_SORT_ASCENDING;
+
     g_signal_handler_block(s_model, priv->sort_column_changed_cb_id);
     gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(s_model),
                                          model_column, order);
@@ -1053,6 +1058,7 @@ gnc_tree_view_gconf_changed (GConfClient *client,
     priv = GNC_TREE_VIEW_GET_PRIVATE(view);
     key = gconf_entry_get_key(entry);
     value = gconf_entry_get_value(entry);
+
     if (!value)
     {
         /* Values can be unset */
@@ -1601,11 +1607,70 @@ void gnc_tree_view_expand_columns (GncTreeView *view,
     va_end (args);
 
     gtk_tree_view_column_set_visible (priv->spacer_column, !hide_spacer);
-    gtk_tree_view_column_set_visible (priv->selection_column, !hide_spacer);
 
     LEAVE(" ");
 }
 
+
+/* Links the cell backgrounds of the two control columns to the model or 
+   cell data function */
+static void
+update_control_cell_renderers_background (GncTreeView *view, GtkTreeViewColumn *col, gint column, GtkTreeCellDataFunc func )
+{
+    GList *renderers;
+    GtkCellRenderer *cell;
+    GList *node;
+
+    renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (col));
+
+    /* Update the cell background in the list of renderers */
+    for (node = renderers; node; node = node->next)
+    {
+        cell = node->data;
+        if (func == NULL)
+            gtk_tree_view_column_add_attribute (col, cell, "cell-background", column);
+        else
+            gtk_tree_view_column_set_cell_data_func (col, cell, func, view, NULL);
+    }
+    g_list_free (renderers);
+}
+
+
+/* This function links the cell backgrounds of the two control columns to a column
+   in the model that has color strings or a cell data function */
+void
+gnc_tree_view_set_control_column_background (GncTreeView *view, gint column, GtkTreeCellDataFunc func )
+{
+    GncTreeViewPrivate *priv;
+
+    g_return_if_fail (GNC_IS_TREE_VIEW (view));
+
+    ENTER("view %p, column %d, func %p", view, column, func);
+    priv = GNC_TREE_VIEW_GET_PRIVATE (view);
+
+    update_control_cell_renderers_background (view, priv->spacer_column, column, func);
+    update_control_cell_renderers_background (view, priv->selection_column, column, func);
+
+    LEAVE(" ");
+}
+
+
+/* This set the user_data value used in the sort callback */
+void
+gnc_tree_view_set_sort_user_data (GncTreeView *view, gpointer user_data)
+{
+    GncTreeViewPrivate *priv;
+
+    g_return_if_fail (GNC_IS_TREE_VIEW (view));
+
+    ENTER("view %p, user_data %p", view, user_data);
+    priv = GNC_TREE_VIEW_GET_PRIVATE (view);
+
+    priv->sort_user_data = user_data;
+    LEAVE(" ");
+}
+
+
 /** This function is called to set the "show-column-menu" property on
  *  this view.  This function has no visible effect if the
  *  "gconf-section" property has not been set.
@@ -1838,7 +1903,14 @@ gnc_tree_view_column_properties (GncTreeView *view,
         gtk_tree_view_column_set_sort_column_id (column, data_column);
         if (column_sort_fn)
         {
-            gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE(s_model),
+            priv = GNC_TREE_VIEW_GET_PRIVATE(view);
+            if (priv->sort_user_data != NULL)
+                gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE(s_model),
+                                             data_column, column_sort_fn,
+                                             priv->sort_user_data,
+                                             NULL /* destroy fn */);
+            else
+                gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE(s_model),
                                              data_column, column_sort_fn,
                                              GINT_TO_POINTER(data_column),
                                              NULL /* destroy fn */);
diff --git a/src/gnome-utils/gnc-tree-view.h b/src/gnome-utils/gnc-tree-view.h
index 3a5c352..5b78eb8 100644
--- a/src/gnome-utils/gnc-tree-view.h
+++ b/src/gnome-utils/gnc-tree-view.h
@@ -383,10 +383,41 @@ void gnc_tree_view_set_gconf_section (GncTreeView *view,
  */
 const gchar *gnc_tree_view_get_gconf_section (GncTreeView *view);
 
+/** This function set the columns that will be allocated the free space
+ *  in the view.
+ *
+ *  @param view The tree view.
+ *
+ *  @param list of column names.
+ */
 void gnc_tree_view_expand_columns (GncTreeView *view,
                                    gchar *first_column_name,
                                    ...);
 
+/** This function links the cell backgrounds of the two control columns
+ *  to a column in the model that has color strings or a cell data function
+ *  that sets the "cell-background" property.
+ *
+ *  @param view The tree view.
+ *
+ *  @param column The column in the model containg color strings.
+ *
+ *  @param func This is a cell data function that sets the "cell-background".
+ */
+void
+gnc_tree_view_set_control_column_background (GncTreeView *view, gint column,
+                                             GtkTreeCellDataFunc func);
+
+
+/** This function sets the user_data value used in the sort callback
+ *
+ *  @param view The tree view.
+ *
+ *  @param user_data pointer to the user_data to be used.
+ */
+void
+gnc_tree_view_set_sort_user_data (GncTreeView *view, gpointer user_data);
+
 /** This function is called to set the "show-column-menu" property on
  *  this view.  This function has no visible effect if the
  *  "gconf-section" property has not been set.
diff --git a/src/gnome/gnc-plugin-page-register2.c b/src/gnome/gnc-plugin-page-register2.c
index 958db41..6ab7e48 100644
--- a/src/gnome/gnc-plugin-page-register2.c
+++ b/src/gnome/gnc-plugin-page-register2.c
@@ -1,5 +1,5 @@
 /**********************************************************************
- * gnc-plugin-page-register2.c -- register page functions              *
+ * gnc-plugin-page-register2.c -- register page functions             *
  *                                                                    *
  * Copyright (C) 2003 Jan Arne Petersen <jpetersen@uni-bonn.de>       *
  * Copyright (C) 2003,2005,2006 David Hampton <hampton@employees.org> *
@@ -49,6 +49,7 @@
 #include "gnc-tree-view.h"
 #include "gnc-tree-view-split-reg.h"
 #include "gnc-tree-model-split-reg.h"
+#include "gnc-tree-control-split-reg.h"
 
 #include "dialog-account.h"
 #include "dialog-find-transactions.h"
@@ -97,28 +98,30 @@ static GncPluginPage *gnc_plugin_page_register2_recreate_page (GtkWidget *window
 static void gnc_plugin_page_register2_update_edit_menu (GncPluginPage *page, gboolean hide);
 static gboolean gnc_plugin_page_register2_finish_pending (GncPluginPage *page);
 
+static gboolean gnc_plugin_page_register2_button_press_cb (GtkWidget *widget, GdkEventButton *event, GncPluginPage *page);
+
 static gchar *gnc_plugin_page_register2_get_tab_name (GncPluginPage *plugin_page);
 static gchar *gnc_plugin_page_register2_get_tab_color (GncPluginPage *plugin_page);
 static gchar *gnc_plugin_page_register2_get_long_name (GncPluginPage *plugin_page);
 
-static void gnc_plugin_page_register2_summarybar_position_changed(GConfEntry *entry, gpointer user_data);
+static void gnc_plugin_page_register2_summarybar_position_changed (GConfEntry *entry, gpointer user_data);
 
 /* Callbacks for the "Sort By" dialog */
-void gnc_plugin_page_register2_sort_button_cb(GtkToggleButton *button, GncPluginPageRegister2 *page);
-void gnc_plugin_page_register2_sort_response_cb(GtkDialog *dialog, gint response, GncPluginPageRegister2 *plugin_page);
-void gnc_plugin_page_register2_sort_order_save_cb(GtkToggleButton *button, GncPluginPageRegister2 *page);
+void gnc_plugin_page_register2_sort_button_cb (GtkToggleButton *button, GncPluginPageRegister2 *page);
+void gnc_plugin_page_register2_sort_response_cb (GtkDialog *dialog, gint response, GncPluginPageRegister2 *plugin_page);
+void gnc_plugin_page_register2_sort_order_save_cb (GtkToggleButton *button, GncPluginPageRegister2 *page);
 
 static gchar *gnc_plugin_page_register2_get_sort_order (GncPluginPage *plugin_page);
 void gnc_plugin_page_register2_set_sort_order (GncPluginPage *plugin_page, const gchar *sort_order);
 
 /* Callbacks for the "Filter By" dialog */
-void gnc_plugin_page_register2_filter_select_range_cb(GtkRadioButton *button, GncPluginPageRegister2 *page);
-void gnc_plugin_page_register2_filter_start_cb(GtkWidget *radio, GncPluginPageRegister2 *page);
-void gnc_plugin_page_register2_filter_end_cb(GtkWidget *radio, GncPluginPageRegister2 *page);
-void gnc_plugin_page_register2_filter_response_cb(GtkDialog *dialog, gint response, GncPluginPageRegister2 *plugin_page);
-void gnc_plugin_page_register2_filter_status_all_cb(GtkButton *button, GncPluginPageRegister2 *plugin_page);
-void gnc_plugin_page_register2_filter_status_one_cb(GtkToggleButton *button, GncPluginPageRegister2 *page);
-void gnc_plugin_page_register2_filter_save_cb(GtkToggleButton *button, GncPluginPageRegister2 *page);
+void gnc_plugin_page_register2_filter_select_range_cb (GtkRadioButton *button, GncPluginPageRegister2 *page);
+void gnc_plugin_page_register2_filter_start_cb (GtkWidget *radio, GncPluginPageRegister2 *page);
+void gnc_plugin_page_register2_filter_end_cb (GtkWidget *radio, GncPluginPageRegister2 *page);
+void gnc_plugin_page_register2_filter_response_cb (GtkDialog *dialog, gint response, GncPluginPageRegister2 *plugin_page);
+void gnc_plugin_page_register2_filter_status_all_cb (GtkButton *button, GncPluginPageRegister2 *plugin_page);
+void gnc_plugin_page_register2_filter_status_one_cb (GtkToggleButton *button, GncPluginPageRegister2 *page);
+void gnc_plugin_page_register2_filter_save_cb (GtkToggleButton *button, GncPluginPageRegister2 *page);
 
 static time64 gnc_plugin_page_register2_filter_dmy2time (char *date_string);
 static gchar *gnc_plugin_page_register2_filter_time2dmy (time64 raw_time);
@@ -167,7 +170,7 @@ static void gnc_plugin_page_register2_cmd_scrub_current (GtkAction *action, GncP
 static void gnc_plugin_page_register2_cmd_account_report (GtkAction *action, GncPluginPageRegister2 *plugin_page);
 static void gnc_plugin_page_register2_cmd_transaction_report (GtkAction *action, GncPluginPageRegister2 *plugin_page);
 
-static void gnc_plugin_page_help_changed_cb( GNCSplitReg2 *gsr, GncPluginPageRegister2 *register_page );
+static void gnc_plugin_page_help_changed_cb (GNCSplitReg2 *gsr, GncPluginPageRegister2 *register_page );
 static void gnc_plugin_page_register2_refresh_cb (GHashTable *changes, gpointer user_data);
 static void gnc_plugin_page_register2_close_cb (gpointer user_data);
 
@@ -237,8 +240,8 @@ static GtkActionEntry gnc_plugin_page_register2_actions [] =
         G_CALLBACK (gnc_plugin_page_register2_cmd_paste_transaction)
     },
     {
-        "DuplicateTransactionAction", GTK_STOCK_COPY, N_("Dup_licate Transaction"), "",
-        N_("Make a copy of the current transaction"),
+        "DuplicateTransactionAction", GTK_STOCK_COPY, N_("Dup_licate Selection"), "",
+        N_("Make a copy of the current selected item"),
         G_CALLBACK (gnc_plugin_page_register2_cmd_duplicate_transaction)
     },
     {
@@ -797,7 +800,7 @@ gnc_plugin_page_register2_ui_update (gpointer various, GncPluginPageRegister2 *p
     model = gnc_ledger_display2_get_split_model_register (priv->ledger);
     view = gnc_ledger_display2_get_split_view_register (priv->ledger);
 
-    expanded = gnc_tree_view_split_reg_current_trans_expanded (view);
+    expanded = gnc_tree_view_split_reg_trans_expanded (view, NULL);
 
     action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
                                          "SplitTransactionAction");
@@ -835,7 +838,7 @@ gnc_plugin_page_register2_ui_update (gpointer various, GncPluginPageRegister2 *p
 }
 
 static void
-gnc_plugin_page_register2_ui_initial_state (GncPluginPageRegister2 *page)
+gnc_plugin_page_register2_ui_initial_state (GncPluginPageRegister2 *page) /* Working */
 {
     GncPluginPageRegister2Private *priv ;
     GtkActionGroup *action_group;
@@ -898,14 +901,13 @@ gnc_plugin_page_register2_create_widget (GncPluginPage *plugin_page)
     guint numRows;
     GtkWidget *gsr;
 
+    GncTreeViewSplitReg *view;
     GncTreeModelSplitReg *model;
     Account *acct;
     gchar **filter;
     gchar *order;
     int filter_changed = 0;
 
-g_print("Register New Create\n");
-
     ENTER("page %p", plugin_page);
     page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
@@ -914,7 +916,8 @@ g_print("Register New Create\n");
         LEAVE("existing widget %p", priv->widget);
         return priv->widget;
     }
-g_print("Register New Create - page %p\n", page);
+//g_print("Register New Create - page %p\n", page);
+
     priv->widget = gtk_vbox_new (FALSE, 0);
     gtk_widget_show (priv->widget);
 
@@ -935,6 +938,12 @@ g_print("Register New Create - page %p\n", page);
                       G_CALLBACK ( gnc_plugin_page_help_changed_cb ),
                       page );
 
+    view = gnc_split_reg2_get_register (priv->gsr);
+
+    // Callback for right mouse events
+    g_signal_connect (G_OBJECT (GTK_TREE_VIEW (view)), "button-press-event",
+                      G_CALLBACK (gnc_plugin_page_register2_button_press_cb), page);
+
     model = gnc_ledger_display2_get_split_model_register (priv->ledger);
 
     gnc_tree_model_split_reg_config (model, model->type, model->style, model->use_double_line);
@@ -949,11 +958,11 @@ g_print("Register New Create - page %p\n", page);
     {
         /* Set the sort order for the split register and status of save order button */
         priv->sd.save_order = FALSE;
-        order = gnc_plugin_page_register2_get_sort_order(plugin_page);
+        order = gnc_plugin_page_register2_get_sort_order (plugin_page);
 
         PINFO("Loaded Sort order is %s", order);
 
-        gnc_split_reg2_set_sort_type(priv->gsr, SortTypefromString(order));
+        gnc_split_reg2_set_sort_type (priv->gsr, SortTypefromString (order));
 
         if (order && (g_strcmp0 (order, DEFAULT_SORT_ORDER) != 0))
             priv->sd.save_order = TRUE;
@@ -964,11 +973,11 @@ g_print("Register New Create - page %p\n", page);
         /* Set the filter for the split register and status of save filter button */
         priv->fd.save_filter = FALSE;
 
-        filter = g_strsplit(gnc_plugin_page_register2_get_filter(plugin_page), ",", -1);
+        filter = g_strsplit(gnc_plugin_page_register2_get_filter (plugin_page), ",", -1);
 
         PINFO("Loaded Filter Status is %s", filter[0]);
 
-        priv->fd.cleared_match = (gint)g_ascii_strtoll( filter[0], NULL, 16 );
+        priv->fd.cleared_match = (gint)g_ascii_strtoll (filter[0], NULL, 16 );
 
         if (filter[0] && (g_strcmp0 (filter[0], DEFAULT_FILTER) != 0))
             filter_changed = filter_changed + 1;
@@ -977,16 +986,16 @@ g_print("Register New Create - page %p\n", page);
         {
             PINFO("Loaded Filter Start Date is %s", filter[1]);
 
-            priv->fd.start_time = gnc_plugin_page_register2_filter_dmy2time ( filter[1] );
-            priv->fd.start_time = gnc_time64_get_day_start(priv->fd.start_time);
+            priv->fd.start_time = gnc_plugin_page_register2_filter_dmy2time (filter[1]);
+            priv->fd.start_time = gnc_time64_get_day_start (priv->fd.start_time);
             filter_changed = filter_changed + 1;
 
             if (filter[2] && (g_strcmp0 (filter[2], "0") != 0 ))
             {
                 PINFO("Loaded Filter End Date is %s", filter[2]);
 
-                priv->fd.end_time = gnc_plugin_page_register2_filter_dmy2time ( filter[2] );
-                priv->fd.end_time = gnc_time64_get_day_end(priv->fd.end_time);
+                priv->fd.end_time = gnc_plugin_page_register2_filter_dmy2time (filter[2]);
+                priv->fd.end_time = gnc_time64_get_day_end (priv->fd.end_time);
                 filter_changed = filter_changed + 1;
             }
         }
@@ -995,7 +1004,7 @@ g_print("Register New Create - page %p\n", page);
             priv->fd.save_filter = TRUE;
 
         priv->fd.original_save_filter = priv->fd.save_filter;
-        g_strfreev(filter);
+        g_strfreev (filter);
 
         /* Update Query with Filter Status and Dates */
         gnc_ppr_update_status_query (page, FALSE);
@@ -1041,6 +1050,32 @@ g_print("Register New Create - page %p\n", page);
 /*#################################################################################*/
 
 
+/** This button press handler calls the common button press handler
+ *  for all pages.  The GtkTreeView eats all button presses and
+ *  doesn't pass them up the widget tree, even when doesn't do
+ *  anything with them.  The only way to get access to the button
+ *  presses in an account tree page is here on the tree view widget.
+ *  Button presses on all other pages are caught by the signal
+ *  registered in gnc-main-window.c. */
+static gboolean
+gnc_plugin_page_register2_button_press_cb (GtkWidget *widget,
+        GdkEventButton *event,
+        GncPluginPage *page)
+{
+
+    g_return_val_if_fail(GNC_IS_PLUGIN_PAGE(page), FALSE);
+
+    ENTER("widget %p, event %p, page %p", widget, event, page);
+    gnc_main_window_button_press_cb (widget, event, page);
+    LEAVE(" ");
+
+    /* Always return FALSE.  This will let the tree view callback run as
+     * well which will select the item under the cursor.  By the time
+     * the user sees the menu both callbacks will have run and the menu
+     * actions will operate on the just-selected account. */
+    return FALSE;
+}
+
 
 
 
@@ -1086,20 +1121,23 @@ gnc_plugin_page_register2_destroy_widget (GncPluginPage *plugin_page)
 
     gtk_widget_hide (priv->widget);
 
+    if (priv->ledger)
+    {
+        gnc_ledger_display2_close (priv->ledger);
+        priv->ledger = NULL;
+    }
+
     if (priv->widget)
     {
         g_object_unref (G_OBJECT(priv->widget));
         priv->widget = NULL;
     }
-
-    gnc_ledger_display2_close (priv->ledger);
-    priv->ledger = NULL;
     LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_register2_window_changed (GncPluginPage *plugin_page,
-        GtkWidget *window)
+        GtkWidget *window) //this works
 {
     GncPluginPageRegister2 *page;
     GncPluginPageRegister2Private *priv;
@@ -1109,9 +1147,11 @@ gnc_plugin_page_register2_window_changed (GncPluginPage *plugin_page,
     page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
 
-/*    priv->gsr->window =
+    priv->gsr->window =
         GTK_WIDGET(gnc_window_get_gtk_window (GNC_WINDOW (window)));
-*/
+
+//g_print("## gnc_plugin_page_register2_window_changed %p ##\n", priv->gsr->window);
+
 }
 
 static const gchar *style_names[] =
@@ -1155,18 +1195,18 @@ gnc_plugin_page_register2_save_page (GncPluginPage *plugin_page,
     GncTreeModelSplitReg *model;
     Account *leader;
 
-    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
     g_return_if_fail (key_file != NULL);
     g_return_if_fail (group_name != NULL);
 
     ENTER("page %p, key_file %p, group_name %s", plugin_page, key_file,
           group_name);
 
-    page = GNC_PLUGIN_PAGE_REGISTER2(plugin_page);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
+    page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
 
-    model = gnc_ledger_display2_get_split_model_register(priv->ledger);
-    ledger_type = gnc_ledger_display2_type(priv->ledger);
+    model = gnc_ledger_display2_get_split_model_register (priv->ledger);
+    ledger_type = gnc_ledger_display2_type (priv->ledger);
     if (ledger_type > LD2_GL)
     {
         LEAVE("Unsupported ledger type");
@@ -1177,20 +1217,20 @@ gnc_plugin_page_register2_save_page (GncPluginPage *plugin_page,
         const gchar *label;
         gchar* name;
         label = (ledger_type == LD2_SINGLE) ? LABEL_ACCOUNT : LABEL_SUBACCOUNT;
-        leader = gnc_ledger_display2_leader(priv->ledger);
-        g_key_file_set_string(key_file, group_name, KEY_REGISTER_TYPE, label);
-        name = gnc_account_get_full_name(leader);
-        g_key_file_set_string(key_file, group_name, KEY_ACCOUNT_NAME, name);
-        g_free(name);
+        leader = gnc_ledger_display2_leader (priv->ledger);
+        g_key_file_set_string (key_file, group_name, KEY_REGISTER_TYPE, label);
+        name = gnc_account_get_full_name (leader);
+        g_key_file_set_string (key_file, group_name, KEY_ACCOUNT_NAME, name);
+        g_free (name);
     }
     else if (model->type == GENERAL_LEDGER2)
     {
-        g_key_file_set_string(key_file, group_name, KEY_REGISTER_TYPE,
+        g_key_file_set_string (key_file, group_name, KEY_REGISTER_TYPE,
                               LABEL_GL);
     }
     else if (model->type == SEARCH_LEDGER2)
     {
-        g_key_file_set_string(key_file, group_name, KEY_REGISTER_TYPE,
+        g_key_file_set_string (key_file, group_name, KEY_REGISTER_TYPE,
                               LABEL_SEARCH);
     }
     else
@@ -1199,8 +1239,8 @@ gnc_plugin_page_register2_save_page (GncPluginPage *plugin_page,
         return;
     }
 
-    g_key_file_set_string(key_file, group_name, KEY_REGISTER_STYLE, style_names[model->style]);
-    g_key_file_set_boolean(key_file, group_name, KEY_DOUBLE_LINE, model->use_double_line);
+    g_key_file_set_string (key_file, group_name, KEY_REGISTER_STYLE, style_names[model->style]);
+    g_key_file_set_boolean (key_file, group_name, KEY_DOUBLE_LINE, model->use_double_line);
 
     LEAVE(" ");
 }
@@ -1231,35 +1271,35 @@ gnc_plugin_page_register2_restore_edit_menu (GncPluginPage *page,
     gboolean use_double_line;
 
     ENTER(" ");
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
 
     /* Convert the style name to an index */
-    style_name = g_key_file_get_string(key_file, group_name,
+    style_name = g_key_file_get_string (key_file, group_name,
                                        KEY_REGISTER_STYLE, &error);
     for (i = 0 ; style_names[i]; i++)
     {
-        if (g_ascii_strcasecmp(style_name, style_names[i]) == 0)
+        if (g_ascii_strcasecmp (style_name, style_names[i]) == 0)
         {
             DEBUG("Found match for style name: %s", style_name);
             break;
         }
     }
-    g_free(style_name);
+    g_free (style_name);
 
     /* Update the style menu action for this page */
     if (i <= REG2_STYLE_JOURNAL)
     {
         DEBUG("Setting style: %d", i);
-        action = gnc_plugin_page_get_action(page, radio_entries_2[i].name);
-        gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE);
+        action = gnc_plugin_page_get_action (page, radio_entries_2[i].name);
+        gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
     }
 
-    /* Update the  double line action on this page */
+    /* Update the double line action on this page */
     use_double_line =
-        g_key_file_get_boolean(key_file, group_name, KEY_DOUBLE_LINE, &error);
+        g_key_file_get_boolean (key_file, group_name, KEY_DOUBLE_LINE, &error);
     DEBUG("Setting double_line_mode: %d", use_double_line);
-    action = gnc_plugin_page_get_action(page, "ViewStyleDoubleLineAction");
-    gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), use_double_line);
+    action = gnc_plugin_page_get_action (page, "ViewStyleDoubleLineAction");
+    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), use_double_line);
 
     LEAVE(" ");
 }
@@ -1286,53 +1326,53 @@ gnc_plugin_page_register2_recreate_page (GtkWidget *window,
     QofBook *book;
     gboolean include_subs;
 
-    g_return_val_if_fail(key_file, NULL);
-    g_return_val_if_fail(group_name, NULL);
+    g_return_val_if_fail (key_file, NULL);
+    g_return_val_if_fail (group_name, NULL);
     ENTER("key_file %p, group_name %s", key_file, group_name);
 
     /* Create the new page. */
-    reg_type = g_key_file_get_string(key_file, group_name,
+    reg_type = g_key_file_get_string (key_file, group_name,
                                      KEY_REGISTER_TYPE, &error);
     DEBUG("Page type: %s", reg_type);
-    if ((g_ascii_strcasecmp(reg_type, LABEL_ACCOUNT) == 0) ||
-            (g_ascii_strcasecmp(reg_type, LABEL_SUBACCOUNT) == 0))
+    if ((g_ascii_strcasecmp (reg_type, LABEL_ACCOUNT) == 0) ||
+            (g_ascii_strcasecmp (reg_type, LABEL_SUBACCOUNT) == 0))
     {
         include_subs = (g_ascii_strcasecmp(reg_type, LABEL_SUBACCOUNT) == 0);
         DEBUG("Include subs: %d", include_subs);
-        acct_name = g_key_file_get_string(key_file, group_name,
+        acct_name = g_key_file_get_string (key_file, group_name,
                                           KEY_ACCOUNT_NAME, &error);
-        book = qof_session_get_book(gnc_get_current_session());
-        account = gnc_account_lookup_by_full_name(gnc_book_get_root_account(book),
+        book = qof_session_get_book (gnc_get_current_session());
+        account = gnc_account_lookup_by_full_name (gnc_book_get_root_account(book),
                   acct_name);
-        g_free(acct_name);
+        g_free (acct_name);
         if (account == NULL)
         {
             LEAVE("Bad account name");
-            g_free(reg_type);
+            g_free (reg_type);
             return NULL;
         }
         page = gnc_plugin_page_register2_new (account, include_subs);
     }
-    else if (g_ascii_strcasecmp(reg_type, LABEL_GL) == 0)
+    else if (g_ascii_strcasecmp (reg_type, LABEL_GL) == 0)
     {
-        page = gnc_plugin_page_register2_new_gl();
+        page = gnc_plugin_page_register2_new_gl ();
     }
     else
     {
         LEAVE("Bad ledger type");
-        g_free(reg_type);
+        g_free (reg_type);
         return NULL;
     }
-    g_free(reg_type);
+    g_free (reg_type);
 
     /* Recreate page in given window */
-    gnc_plugin_page_set_use_new_window(page, FALSE);
+    gnc_plugin_page_set_use_new_window (page, FALSE);
 
     /* Install it now so we can them manipulate the created widget */
-    gnc_main_window_open_page(GNC_MAIN_WINDOW(window), page);
+    gnc_main_window_open_page (GNC_MAIN_WINDOW (window), page);
 
     /* Now update the page to the last state it was in */
-    gnc_plugin_page_register2_restore_edit_menu(page, key_file, group_name);
+    gnc_plugin_page_register2_restore_edit_menu (page, key_file, group_name);
     LEAVE(" ");
     return page;
 }
@@ -1349,10 +1389,10 @@ gnc_plugin_page_register2_update_edit_menu (GncPluginPage *page, gboolean hide)
     GtkAction *action;
     gboolean can_copy = FALSE, can_cut = FALSE, can_paste = FALSE;
     gboolean has_selection;
-    gboolean is_readwrite = !qof_book_is_readonly(gnc_get_current_book());
+    gboolean is_readwrite = !qof_book_is_readonly (gnc_get_current_book());
 //g_print("gnc_plugin_page_register2_update_edit_menu\n");
-    reg_page = GNC_PLUGIN_PAGE_REGISTER2(page);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(reg_page);
+    reg_page = GNC_PLUGIN_PAGE_REGISTER2 (page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (reg_page);
 /*FIXME    has_selection = gnucash_register_has_selection (priv->gsr->reg); */
     has_selection = FALSE;
 
@@ -1373,25 +1413,30 @@ gnc_plugin_page_register2_update_edit_menu (GncPluginPage *page, gboolean hide)
 
 
 static gboolean
-gnc_plugin_page_register2_finish_pending (GncPluginPage *page)
+gnc_plugin_page_register2_finish_pending (GncPluginPage *page) //this works
 {
     GncPluginPageRegister2Private *priv;
     GncPluginPageRegister2 *reg_page;
-    GncTreeModelSplitReg *model;
+    GncTreeViewSplitReg *view;
     GtkWidget *dialog, *window;
     const gchar *name;
     gint response;
 
-    reg_page = GNC_PLUGIN_PAGE_REGISTER2(page);
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(reg_page);
-    model = gnc_ledger_display2_get_split_model_register(priv->ledger);
+    reg_page = GNC_PLUGIN_PAGE_REGISTER2 (page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (reg_page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+
+//g_print("gnc_plugin_page_register2_finish_pending\n");
 
-/*FIXME    if (!model || !gnc_split_register_changed (model)) */
+    /* Make sure we have stopped editing */
+    gnc_tree_view_split_reg_finish_edit (view);
+
+    if (!view || (gnc_tree_view_split_reg_get_dirty_trans (view) == NULL))
         return TRUE;
 
-    name = gnc_plugin_page_register2_get_tab_name(page);
-    window = gnc_plugin_page_get_window(page);
-    dialog = gtk_message_dialog_new(GTK_WINDOW(window),
+    name = gnc_plugin_page_register2_get_tab_name (page);
+    window = gnc_plugin_page_get_window (page);
+    dialog = gtk_message_dialog_new (GTK_WINDOW (window),
                                     GTK_DIALOG_DESTROY_WITH_PARENT,
                                     GTK_MESSAGE_WARNING,
                                     GTK_BUTTONS_NONE,
@@ -1399,30 +1444,28 @@ gnc_plugin_page_register2_finish_pending (GncPluginPage *page)
                                        of the tab page */
                                     _("Save changes to %s?"), name);
     gtk_message_dialog_format_secondary_text
-    (GTK_MESSAGE_DIALOG(dialog),
+    (GTK_MESSAGE_DIALOG (dialog),
      "%s",
      _("This register has pending changes to a transaction.  "
        "Would you like to save the changes to this transaction, "
        "discard the transaction, or cancel the operation?"));
-    gnc_gtk_dialog_add_button(dialog, _("_Discard Transaction"),
+    gnc_gtk_dialog_add_button (dialog, _("_Discard Transaction"),
                               GTK_STOCK_DELETE, GTK_RESPONSE_REJECT);
-    gtk_dialog_add_button(GTK_DIALOG(dialog),
+    gtk_dialog_add_button (GTK_DIALOG (dialog),
                           GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
-    gnc_gtk_dialog_add_button(dialog, _("_Save Transaction"),
+    gnc_gtk_dialog_add_button (dialog, _("_Save Transaction"),
                               GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT);
 
-    response = gtk_dialog_run(GTK_DIALOG(dialog));
-    gtk_widget_destroy(dialog);
+    response = gtk_dialog_run (GTK_DIALOG (dialog));
+    gtk_widget_destroy (dialog);
 
     switch (response)
     {
     case GTK_RESPONSE_ACCEPT:
-/*FIXME        gnc_split_register_save (model, TRUE); */
-        return TRUE;
+        return (gnc_tree_control_split_reg_save (view, TRUE));
 
     case GTK_RESPONSE_REJECT:
-/*FIXME        gnc_split_register_cancel_cursor_trans_changes (model); */
-/*FIXME        gnc_split_register_save (model, TRUE); */
+        gnc_tree_control_split_reg_cancel_edit (view, TRUE);
         return TRUE;
 
     default:
@@ -2022,16 +2065,16 @@ get_filter_times(GncPluginPageRegister2 *page)
     GtkWidget *button, *today, *gde;
     time64 time_val;
 
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_choose)))
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.start_date_choose)))
     {
-        time_val = gnc_date_edit_get_date(GNC_DATE_EDIT(priv->fd.start_date));
-        time_val = gnc_time64_get_day_start(time_val);
+        time_val = gnc_date_edit_get_date (GNC_DATE_EDIT (priv->fd.start_date));
+        time_val = gnc_time64_get_day_start (time_val);
         priv->fd.start_time = time_val;
     }
     else
     {
-        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_today)))
+        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.start_date_today)))
         {
             priv->fd.start_time = gnc_time64_get_today_start();
         }
@@ -2041,15 +2084,15 @@ get_filter_times(GncPluginPageRegister2 *page)
         }
     }
 
-    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.end_date_choose)))
+    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.end_date_choose)))
     {
-        time_val = gnc_date_edit_get_date(GNC_DATE_EDIT(priv->fd.end_date));
-        time_val = gnc_time64_get_day_end(time_val);
+        time_val = gnc_date_edit_get_date (GNC_DATE_EDIT (priv->fd.end_date));
+        time_val = gnc_time64_get_day_end (time_val);
         priv->fd.end_time = time_val;
     }
     else
     {
-        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_today)))
+        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->fd.start_date_today)))
         {
             priv->fd.end_time = gnc_time64_get_today_end();
         }
@@ -2414,12 +2457,12 @@ report_helper (GNCLedgerDisplay2 *ledger, Split *split, Query *query)
     func = scm_c_eval_string ("gnc:register-report-create");
     g_return_val_if_fail (scm_is_procedure (func), -1);
 
-    tmp = gnc_split_register_get_credit_string (reg);
+    tmp = gnc_split_register_get_credit_string (reg); 
     arg = scm_from_locale_string (tmp ? tmp : _("Credit"));
     args = scm_cons (arg, args);
 
-    tmp = gnc_split_register_get_debit_string (reg);
-    arg = scm_from_locale_string (tmp ? tmp : _("Debit"));
+    tmp = gnc_split_register_get_debit_string (reg); 
+    arg = scm_from_locale_string (tmp ? tmp : _("Debit")); 
     args = scm_cons (arg, args);
 
     str = gnc_reg_get_name (ledger, FALSE);
@@ -2428,10 +2471,10 @@ report_helper (GNCLedgerDisplay2 *ledger, Split *split, Query *query)
     g_free (str);
 
     arg = SCM_BOOL (reg->use_double_line);
-    args = scm_cons (arg, args);
+    args = scm_cons (arg, args); 
 
-    arg = SCM_BOOL (reg->type == GENERAL_LEDGER || reg->type == INCOME_LEDGER
-                                                || reg->type == SEARCH_LEDGER);
+    arg = SCM_BOOL (reg->type == GENERAL_LEDGER || reg->type == INCOME_LEDGER 
+                                                || reg->type == SEARCH_LEDGER); 
     args = scm_cons (arg, args);
 
     arg = SCM_BOOL (reg->style == REG_STYLE_JOURNAL);
@@ -2744,7 +2787,7 @@ gnc_plugin_page_register2_cmd_void_transaction (GtkAction *action,
         reason = gtk_entry_get_text (GTK_ENTRY (entry));
         if (reason == NULL)
             reason = "";
-        gnc_tree_view_split_reg_void_current_trans (view, reason);
+        gnc_tree_control_split_reg_void_current_trans (view, reason);
     }
 
     /* All done. Get rid of it. */
@@ -2770,59 +2813,35 @@ gnc_plugin_page_register2_cmd_unvoid_transaction (GtkAction *action,
     trans = gnc_tree_view_split_reg_get_current_trans (view);
     if (!xaccTransHasSplitsInState (trans, VREC))
         return;
-    gnc_tree_view_split_reg_unvoid_current_trans (view);
+    gnc_tree_control_split_reg_unvoid_current_trans (view);
     LEAVE(" ");
 }
 
 
 static void
 gnc_plugin_page_register2_cmd_reverse_transaction (GtkAction *action,
-        GncPluginPageRegister2 *page)
+        GncPluginPageRegister2 *page) //this works
 {
     GncPluginPageRegister2Private *priv;
-    SplitRegister *reg;
-    GNCSplitReg2 *gsr;
-    Transaction *trans, *new_trans;
+    GncTreeViewSplitReg *view;
 
     ENTER("(action %p, page %p)", action, page);
 
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
-
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-    reg = gnc_ledger_display2_get_split_register(priv->ledger);
-    trans = gnc_split_register_get_current_trans(reg);
-    if (trans == NULL)
-        return;
-
-    if (xaccTransGetReversedBy(trans))
-    {
-        gnc_error_dialog(gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(page)), "%s",
-                         _("A reversing entry has already been created for this transaction."));
-        return;
-    }
-
-    qof_event_suspend();
-    new_trans = xaccTransReverse(trans);
-
-    /* Clear transaction level info */
-    xaccTransSetDatePostedSecs(new_trans, gnc_time (NULL));
-    xaccTransSetDateEnteredSecs(new_trans, gnc_time (NULL));
-
-    qof_event_resume();
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
 
-    /* Now jump to new trans */
-    gsr = gnc_plugin_page_register2_get_gsr(GNC_PLUGIN_PAGE(page));
-    gnc_split_reg2_jump_to_split(gsr, xaccTransGetSplit(new_trans, 0));
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+ 
+    gnc_tree_control_split_reg_reverse_current (view);
     LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_register2_cmd_shift_transaction_forward (GtkAction *action,
-        GncPluginPageRegister2 *page)
+        GncPluginPageRegister2 *page) //this works
 {
     GncPluginPageRegister2Private *priv;
-    SplitRegister *reg;
-    GNCSplitReg2 *gsr;
+    GncTreeViewSplitReg *view;
     Transaction *trans, *new_trans;
     Timespec entered;
 
@@ -2831,15 +2850,15 @@ gnc_plugin_page_register2_cmd_shift_transaction_forward (GtkAction *action,
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-    reg = gnc_ledger_display2_get_split_register(priv->ledger);
-    trans = gnc_split_register_get_current_trans(reg);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    trans = gnc_tree_view_split_reg_get_current_trans (view);
     if (trans == NULL)
         return;
 
     qof_event_suspend();
 
-    xaccTransGetDatePostedTS(trans, &entered);
-    xaccTransSetDatePostedSecs(trans, entered.tv_sec + 1);
+    xaccTransGetDatePostedTS (trans, &entered);
+    xaccTransSetDatePostedSecs (trans, entered.tv_sec + 1);
 
     qof_event_resume();
 
@@ -2998,13 +3017,13 @@ gnc_plugin_page_register2_cmd_view_filter_by (GtkAction *action,
                 sensitive = TRUE;
             }
         }
-        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
         priv->fd.start_date = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE);
-        hbox = GTK_WIDGET(gtk_builder_get_object (builder, "start_date_hbox"));
+        hbox = GTK_WIDGET (gtk_builder_get_object (builder, "start_date_hbox"));
         gtk_box_pack_start (GTK_BOX (hbox), priv->fd.start_date, TRUE, TRUE, 0);
         gtk_widget_show (priv->fd.start_date);
-        gtk_widget_set_sensitive(GTK_WIDGET(priv->fd.start_date), sensitive);
-        gnc_date_edit_set_time (GNC_DATE_EDIT(priv->fd.start_date), time_val);
+        gtk_widget_set_sensitive (GTK_WIDGET (priv->fd.start_date), sensitive);
+        gnc_date_edit_set_time (GNC_DATE_EDIT (priv->fd.start_date), time_val);
         g_signal_connect (G_OBJECT (priv->fd.start_date), "date-changed",
                           G_CALLBACK (gnc_plugin_page_register2_filter_gde_changed_cb),
                           page);
@@ -3035,11 +3054,11 @@ gnc_plugin_page_register2_cmd_view_filter_by (GtkAction *action,
         }
         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
         priv->fd.end_date = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE);
-        hbox = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_hbox"));
+        hbox = GTK_WIDGET (gtk_builder_get_object (builder, "end_date_hbox"));
         gtk_box_pack_start (GTK_BOX (hbox), priv->fd.end_date, TRUE, TRUE, 0);
         gtk_widget_show (priv->fd.end_date);
-        gtk_widget_set_sensitive(GTK_WIDGET(priv->fd.end_date), sensitive);
-        gnc_date_edit_set_time (GNC_DATE_EDIT(priv->fd.end_date), time_val);
+        gtk_widget_set_sensitive (GTK_WIDGET (priv->fd.end_date), sensitive);
+        gnc_date_edit_set_time (GNC_DATE_EDIT (priv->fd.end_date), time_val);
         g_signal_connect (G_OBJECT (priv->fd.end_date), "date-changed",
                           G_CALLBACK (gnc_plugin_page_register2_filter_gde_changed_cb),
                           page);
@@ -3202,13 +3221,17 @@ gnc_plugin_page_register2_cmd_enter_transaction (GtkAction *action,
         GncPluginPageRegister2 *plugin_page) //this works
 {
     GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
 
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
 
     g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
-    gnc_split_reg2_enter (priv->gsr, FALSE);
+
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+
+    gnc_tree_control_split_reg_enter (view, FALSE);
     LEAVE(" ");
 }
 
@@ -3227,7 +3250,7 @@ gnc_plugin_page_register2_cmd_cancel_transaction (GtkAction *action,
 
     view = gnc_ledger_display2_get_split_view_register (priv->ledger);
 
-    gnc_tree_view_split_reg_cancel_edit (view);
+    gnc_tree_control_split_reg_cancel_edit (view, FALSE);
 
     LEAVE(" ");
 }
@@ -3237,14 +3260,16 @@ gnc_plugin_page_register2_cmd_delete_transaction (GtkAction *action,
         GncPluginPageRegister2 *plugin_page) //this works
 {
     GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
 
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
 
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
 
-    gsr2_default_delete_handler (priv->gsr, NULL);
+    gnc_tree_control_split_reg_delete (view, NULL);
     LEAVE(" ");
 
 }
@@ -3263,23 +3288,24 @@ gnc_plugin_page_register2_cmd_blank_transaction (GtkAction *action,
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
     view = gnc_ledger_display2_get_split_view_register (priv->ledger);
 
-    gnc_tree_view_split_reg_jump_to_blank (view);
+    gnc_tree_control_split_reg_jump_to_blank (view);
     LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_register2_cmd_duplicate_transaction (GtkAction *action,
-        GncPluginPageRegister2 *plugin_page)
+        GncPluginPageRegister2 *plugin_page) //this works
 {
     GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
 
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
 
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
 
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    gnc_split_register_duplicate_current
-    (gnc_ledger_display2_get_split_register(priv->ledger));
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    gnc_tree_control_split_reg_duplicate_current (view);
     LEAVE(" ");
 }
 
@@ -3288,13 +3314,15 @@ gnc_plugin_page_register2_cmd_reinitialize_transaction (GtkAction *action,
         GncPluginPageRegister2 *plugin_page) //this works
 {
     GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
 
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
 
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
-    gsr2_default_reinit_handler (priv->gsr, NULL);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    gnc_tree_control_split_reg_reinit (view, NULL);
     LEAVE(" ");
 }
 
@@ -3312,40 +3340,44 @@ gnc_plugin_page_register2_cmd_expand_transaction (GtkToggleAction *action,
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
     view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+
     expand = gtk_toggle_action_get_active (action);
-    gnc_tree_view_split_reg_expand_current_trans (view, expand);
+    if (expand)
+        gnc_tree_view_split_reg_expand_trans (view, NULL);
+    else
+        gnc_tree_view_split_reg_collapse_trans (view, NULL);
+
     LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_register2_cmd_exchange_rate (GtkAction *action,
-        GncPluginPageRegister2 *plugin_page)
+        GncPluginPageRegister2 *plugin_page) //this works
 {
     GncPluginPageRegister2Private *priv;
-    SplitRegister *reg;
+    GncTreeViewSplitReg *view;
 
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
 
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
 
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    reg = gnc_ledger_display2_get_split_register (priv->ledger);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
 
-    /* XXX Ignore the return value -- we don't care if this succeeds */
-    (void)gnc_split_register_handle_exchange (reg, TRUE);
+    gnc_tree_control_split_reg_exchange_rate (view);
     LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_register2_cmd_jump (GtkAction *action,
-                                   GncPluginPageRegister2 *plugin_page) //this works
+        GncPluginPageRegister2 *plugin_page) //this works
 {
     GncPluginPageRegister2Private *priv;
     GncPluginPage *new_page;
     GncPluginPageRegister2 *new_reg_page;
     GtkWidget *window;
-    GNCSplitReg2 *gsr;
-    GncTreeViewSplitReg *view;
+    GNCLedgerDisplay2 *ld;
+    GncTreeViewSplitReg *view, *new_view;
     Account *account;
     Account *leader;
     Split *split;
@@ -3371,7 +3403,7 @@ gnc_plugin_page_register2_cmd_jump (GtkAction *action,
         return;
     }
 
-    if (!gnc_tree_view_split_reg_current_trans_expanded (view))
+    if (!gnc_tree_view_split_reg_trans_expanded (view, NULL))
     {
         Transaction *trans = xaccSplitGetParent (split);
         if (xaccTransCountSplits (trans) > 2)
@@ -3382,7 +3414,7 @@ gnc_plugin_page_register2_cmd_jump (GtkAction *action,
     }
 
     depth = gnc_tree_view_reg_get_selected_row_depth (view);
-    if (gnc_tree_view_split_reg_current_trans_expanded (view) && depth != SPLIT3)
+    if (gnc_tree_view_split_reg_trans_expanded (view, NULL) && depth != SPLIT3)
     {
         LEAVE("expanded but no split selected");
         return;
@@ -3427,8 +3459,10 @@ gnc_plugin_page_register2_cmd_jump (GtkAction *action,
     }
 
     gnc_main_window_open_page (GNC_MAIN_WINDOW (window), new_page);
-    gsr = gnc_plugin_page_register2_get_gsr (new_page);
-    gnc_split_reg2_jump_to_split (gsr, split);
+
+    ld = gnc_plugin_page_register2_get_ledger (new_page);
+    new_view = gnc_ledger_display2_get_split_view_register (ld);
+    gnc_tree_control_split_reg_jump_to_split (new_view, split);
     LEAVE(" ");
 }
 
@@ -3615,6 +3649,20 @@ gnc_plugin_page_register2_get_gsr (GncPluginPage *plugin_page)
     return priv->gsr;
 }
 
+
+GNCLedgerDisplay2 *
+gnc_plugin_page_register2_get_ledger (GncPluginPage *plugin_page)
+{
+    GncPluginPageRegister2 *page;
+    GncPluginPageRegister2Private *priv;
+
+    g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page), NULL);
+
+    page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
+
+    return priv->ledger;
+}
 static void
 gnc_plugin_page_help_changed_cb (GNCSplitReg2 *gsr, GncPluginPageRegister2 *register_page) //this works
 {
@@ -3641,14 +3689,17 @@ gnc_plugin_page_help_changed_cb (GNCSplitReg2 *gsr, GncPluginPageRegister2 *regi
 }
 
 static void
-gnc_plugin_page_register2_refresh_cb (GHashTable *changes, gpointer user_data)
+gnc_plugin_page_register2_refresh_cb (GHashTable *changes, gpointer user_data) //FIXME does not work ?
 {
     GncPluginPageRegister2 *page = user_data;
     GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
 
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
 //g_print("gnc_plugin_page_register2_refresh_cb\n");
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+//g_print("gnc_plugin_page_register2_refresh_cb 0\n");
     if (changes)
     {
         const EventInfo* ei;
@@ -3670,12 +3721,10 @@ gnc_plugin_page_register2_refresh_cb (GHashTable *changes, gpointer user_data)
     {
 //g_print("gnc_plugin_page_register2_refresh_cb 2\n");
         /* Force updates */
-
-/*FIXME        gnucash_register_refresh_from_gconf (priv->gsr->reg); */
-        gtk_widget_queue_draw(priv->widget);
+        gnc_tree_view_split_reg_refresh_from_gconf (view);
+        gtk_widget_queue_draw (priv->widget);
     }
-
-    gnc_plugin_page_register2_ui_update(NULL, page);
+    gnc_plugin_page_register2_ui_update (NULL, page);
 }
 
 static void
diff --git a/src/gnome/gnc-plugin-page-register2.h b/src/gnome/gnc-plugin-page-register2.h
index 5d5ad31..98ea5ee 100644
--- a/src/gnome/gnc-plugin-page-register2.h
+++ b/src/gnome/gnc-plugin-page-register2.h
@@ -133,6 +133,14 @@ GNCSplitReg2 *
 gnc_plugin_page_register2_get_gsr (GncPluginPage *plugin_page);
 
 
+/** Get the GNCLedgerDisplay data structure associated with this register page.
+ *
+ *  @param plugin_page A "register" page.
+ */
+GNCLedgerDisplay2 *
+gnc_plugin_page_register2_get_ledger (GncPluginPage *plugin_page);
+
+
 /** Get the Account associated with this register page.
  *
  *  @param page A "register" page.
diff --git a/src/gnome/gnc-split-reg2.c b/src/gnome/gnc-split-reg2.c
index ac67996..f95113a 100644
--- a/src/gnome/gnc-split-reg2.c
+++ b/src/gnome/gnc-split-reg2.c
@@ -54,12 +54,12 @@
 #include "table-allgui.h"
 
 #include "gnc-tree-view-split-reg.h"
+#include "gnc-tree-control-split-reg.h"
 
 #include "dialog-utils.h"
 
 #define GCONF_SECTION "window/pages/register2"
 
-// static QofLogModule log_module = GNC_MOD_SX;
 static QofLogModule log_module = GNC_MOD_GUI;
 
 /***** PROTOTYPES ***************************************************/
@@ -98,24 +98,15 @@ static void gnc_split_reg2_ld_destroy( GNCLedgerDisplay2 *ledger );
 static Transaction* create_balancing_transaction(QofBook *book, Account *account,
         time64 statement_date, gnc_numeric balancing_amount);
 
-void gsr2_default_enter_handler    ( GNCSplitReg2 *w, gpointer ud );
-void gsr2_default_cancel_handler   ( GNCSplitReg2 *w, gpointer ud );
-void gsr2_default_delete_handler   ( GNCSplitReg2 *w, gpointer ud );
-void gsr2_default_reinit_handler   ( GNCSplitReg2 *w, gpointer ud );
-void gsr2_default_dup_handler      ( GNCSplitReg2 *w, gpointer ud );
+
 void gsr2_default_schedule_handler ( GNCSplitReg2 *w, gpointer ud );
-void gsr2_default_expand_handler   ( GNCSplitReg2 *w, gpointer ud );
-void gsr2_default_blank_handler    ( GNCSplitReg2 *w, gpointer ud );
-void gsr2_default_jump_handler     ( GNCSplitReg2 *w, gpointer ud );
+
 void gsr2_default_cut_handler      ( GNCSplitReg2 *w, gpointer ud );
 void gsr2_default_cut_txn_handler  ( GNCSplitReg2 *w, gpointer ud );
 void gsr2_default_copy_handler     ( GNCSplitReg2 *w, gpointer ud );
 void gsr2_default_copy_txn_handler ( GNCSplitReg2 *w, gpointer ud );
 void gsr2_default_paste_handler    ( GNCSplitReg2 *w, gpointer ud );
 void gsr2_default_paste_txn_handler( GNCSplitReg2 *w, gpointer ud );
-void gsr2_default_void_txn_handler ( GNCSplitReg2 *w, gpointer ud );
-void gsr2_default_unvoid_txn_handler  ( GNCSplitReg2 *w, gpointer ud );
-void gsr2_default_reverse_txn_handler ( GNCSplitReg2 *w, gpointer ud );
 
 static void gsr2_emit_simple_signal( GNCSplitReg2 *gsr, const char *sigName );
 static void gsr2_emit_help_changed (GncTreeViewSplitReg *view, gpointer user_data);
@@ -128,28 +119,20 @@ void gnc_split_reg2_paste_cb(GtkWidget *w, gpointer data);
 void gnc_split_reg2_cut_trans_cb(GtkWidget *w, gpointer data);
 void gnc_split_reg2_copy_trans_cb(GtkWidget *w, gpointer data);
 void gnc_split_reg2_paste_trans_cb(GtkWidget *w, gpointer data);
-void gnc_split_reg2_void_trans_cb(GtkWidget *w, gpointer data);
-void gnc_split_reg2_unvoid_trans_cb(GtkWidget *w, gpointer data);
-void gnc_split_reg2_reverse_trans_cb(GtkWidget *w, gpointer data);
+
 
 /*FIXME void gnc_split_reg2_record_cb (GncTreeViewSplitReg *view, gpointer data); */
-void gnc_split_reg2_reinitialize_trans_cb(GtkWidget *w, gpointer data);
-void gnc_split_reg2_delete_trans_cb(GtkWidget *w, gpointer data);
-void gnc_split_reg2_duplicate_trans_cb(GtkWidget *w, gpointer data);
+
 void gnc_split_reg2_recur_cb(GtkWidget *w, gpointer data);
 void gnc_split_reg2_record_trans_cb(GtkWidget *w, gpointer data);
-void gnc_split_reg2_cancel_trans_cb(GtkWidget *w, gpointer data);
 
-void gnc_split_reg2_expand_trans_menu_cb(GtkWidget *widget, gpointer data);
-void gnc_split_reg2_expand_trans_toolbar_cb(GtkWidget *widget, gpointer data);
-void gnc_split_reg2_new_trans_cb(GtkWidget *widget, gpointer data);
-void gnc_split_reg2_jump_cb(GtkWidget *widget, gpointer data);
 
 void gnc_split_reg2_style_ledger_cb (GtkWidget *w, gpointer data);
 void gnc_split_reg2_style_auto_ledger_cb (GtkWidget *w, gpointer data);
 void gnc_split_reg2_style_journal_cb (GtkWidget *w, gpointer data);
 void gnc_split_reg2_double_line_cb (GtkWidget *w, gpointer data);
 
+
 void gnc_split_reg2_sort_standard_cb (GtkWidget *w, gpointer data);
 void gnc_split_reg2_sort_date_cb (GtkWidget *w, gpointer data);
 void gnc_split_reg2_sort_date_entered_cb (GtkWidget *w, gpointer data);
@@ -161,21 +144,15 @@ void gnc_split_reg2_sort_desc_cb (GtkWidget *w, gpointer data);
 void gnc_split_reg2_sort_action_cb (GtkWidget *w, gpointer data);
 void gnc_split_reg2_sort_notes_cb (GtkWidget *w, gpointer data);
 
-void gnc_split_reg2_destroy_cb(GtkWidget *widget, gpointer data);
-void gnc_split_reg2_size_allocate( GtkWidget *widget,
-                                  GtkAllocation *allocation,
-                                  gpointer user_data );
-
+void gnc_split_reg2_destroy_cb (GtkWidget *widget, gpointer data);
 
-void gnc_split_reg2_handle_exchange_cb (GtkWidget *w, gpointer data);
-
-static void gnc_split_reg2_class_init( GNCSplitReg2Class *class );
-static void gnc_split_reg2_init( GNCSplitReg2 *gsr );
-static void gnc_split_reg2_init2( GNCSplitReg2 *gsr );
+static void gnc_split_reg2_class_init (GNCSplitReg2Class *class);
+static void gnc_split_reg2_init (GNCSplitReg2 *gsr);
+static void gnc_split_reg2_init2 (GNCSplitReg2 *gsr);
 
 #ifdef SKIP
-FROM_STRING_FUNC(SortType, ENUM_LIST_SORTTYPE)
-AS_STRING_FUNC(SortType, ENUM_LIST_SORTTYPE)
+FROM_STRING_FUNC (SortType, ENUM_LIST_SORTTYPE)
+AS_STRING_FUNC (SortType, ENUM_LIST_SORTTYPE)
 #endif
 
 GType
@@ -198,7 +175,7 @@ gnc_split_reg2_get_type( void )
             (GInstanceInitFunc)gnc_split_reg2_init,
         };
 
-        gnc_split_reg2_type = g_type_register_static( GTK_TYPE_VBOX,
+        gnc_split_reg2_type = g_type_register_static (GTK_TYPE_VBOX,
                              "GNCSplitReg2",
                              &type_info, 0 );
     }
@@ -209,24 +186,17 @@ gnc_split_reg2_get_type( void )
 /* SIGNALS */
 enum gnc_split_reg2_signal_enum
 {
-    ENTER_ENT_SIGNAL,
-    CANCEL_ENT_SIGNAL,
-    DELETE_ENT_SIGNAL,
-    REINIT_ENT_SIGNAL,
-    DUP_ENT_SIGNAL,
+
     SCHEDULE_ENT_SIGNAL,
-    EXPAND_ENT_SIGNAL,
-    BLANK_SIGNAL,
-    JUMP_SIGNAL,
+
     CUT_SIGNAL,
     CUT_TXN_SIGNAL,
     COPY_SIGNAL,
     COPY_TXN_SIGNAL,
     PASTE_SIGNAL,
     PASTE_TXN_SIGNAL,
-    VOID_TXN_SIGNAL,
-    UNVOID_TXN_SIGNAL,
-    REVERSE_TXN_SIGNAL,
+
+
     HELP_CHANGED_SIGNAL,
     INCLUDE_DATE_SIGNAL,
     LAST_SIGNAL
@@ -246,24 +216,20 @@ gnc_split_reg2_class_init( GNCSplitReg2Class *class )
         guint defaultOffset;
     } signals[] =
     {
-        { ENTER_ENT_SIGNAL,    "enter_ent",    G_STRUCT_OFFSET( GNCSplitReg2Class, enter_ent_cb ) },
-        { CANCEL_ENT_SIGNAL,   "cancel_ent",   G_STRUCT_OFFSET( GNCSplitReg2Class, cancel_ent_cb ) },
-        { DELETE_ENT_SIGNAL,   "delete_ent",   G_STRUCT_OFFSET( GNCSplitReg2Class, delete_ent_cb ) },
-        { REINIT_ENT_SIGNAL,   "reinit_ent",   G_STRUCT_OFFSET( GNCSplitReg2Class, reinit_ent_cb ) },
-        { DUP_ENT_SIGNAL,      "dup_ent",      G_STRUCT_OFFSET( GNCSplitReg2Class, dup_ent_cb ) },
+
+
         { SCHEDULE_ENT_SIGNAL, "schedule_ent", G_STRUCT_OFFSET( GNCSplitReg2Class, schedule_ent_cb ) },
-        { EXPAND_ENT_SIGNAL,   "expand_ent",   G_STRUCT_OFFSET( GNCSplitReg2Class, expand_ent_cb ) },
-        { BLANK_SIGNAL,        "blank",        G_STRUCT_OFFSET( GNCSplitReg2Class, blank_cb ) },
-        { JUMP_SIGNAL,         "jump",         G_STRUCT_OFFSET( GNCSplitReg2Class, jump_cb ) },
+
+
+
         { CUT_SIGNAL,          "cut",          G_STRUCT_OFFSET( GNCSplitReg2Class, cut_cb ) },
         { CUT_TXN_SIGNAL,      "cut_txn",      G_STRUCT_OFFSET( GNCSplitReg2Class, cut_txn_cb ) },
         { COPY_SIGNAL,         "copy",         G_STRUCT_OFFSET( GNCSplitReg2Class, copy_cb ) },
         { COPY_TXN_SIGNAL,     "copy_txn",     G_STRUCT_OFFSET( GNCSplitReg2Class, copy_txn_cb ) },
         { PASTE_SIGNAL,        "paste",        G_STRUCT_OFFSET( GNCSplitReg2Class, paste_cb ) },
         { PASTE_TXN_SIGNAL,    "paste_txn",    G_STRUCT_OFFSET( GNCSplitReg2Class, paste_txn_cb ) },
-        { VOID_TXN_SIGNAL,     "void_txn",     G_STRUCT_OFFSET( GNCSplitReg2Class, void_txn_cb ) },
-        { UNVOID_TXN_SIGNAL,   "unvoid_txn",   G_STRUCT_OFFSET( GNCSplitReg2Class, unvoid_txn_cb ) },
-        { REVERSE_TXN_SIGNAL,  "reverse_txn",  G_STRUCT_OFFSET( GNCSplitReg2Class, reverse_txn_cb ) },
+
+
         { HELP_CHANGED_SIGNAL, "help-changed", G_STRUCT_OFFSET( GNCSplitReg2Class, help_changed_cb ) },
         { INCLUDE_DATE_SIGNAL, "include-date", G_STRUCT_OFFSET( GNCSplitReg2Class, include_date_cb ) },
         { LAST_SIGNAL, NULL, 0 }
@@ -296,24 +262,17 @@ gnc_split_reg2_class_init( GNCSplitReg2Class *class )
     g_assert( i == LAST_SIGNAL );
 
     /* Setup the default handlers. */
-    class->enter_ent_cb    = gsr2_default_enter_handler;
-    class->cancel_ent_cb   = gsr2_default_cancel_handler;
-    class->delete_ent_cb   = gsr2_default_delete_handler;
-    class->reinit_ent_cb   = gsr2_default_reinit_handler;
-    class->dup_ent_cb      = gsr2_default_dup_handler;
+
     class->schedule_ent_cb = gsr2_default_schedule_handler;
-    class->expand_ent_cb   = gsr2_default_expand_handler;
-    class->blank_cb        = gsr2_default_blank_handler;
-    class->jump_cb         = gsr2_default_jump_handler;
+
     class->cut_cb          = gsr2_default_cut_handler;
     class->cut_txn_cb      = gsr2_default_cut_txn_handler;
     class->copy_cb         = gsr2_default_copy_handler;
     class->copy_txn_cb     = gsr2_default_copy_txn_handler;
     class->paste_cb        = gsr2_default_paste_handler;
     class->paste_txn_cb    = gsr2_default_paste_txn_handler;
-    class->void_txn_cb     = gsr2_default_void_txn_handler;
-    class->unvoid_txn_cb   = gsr2_default_unvoid_txn_handler;
-    class->reverse_txn_cb  = gsr2_default_reverse_txn_handler;
+
+
 
     class->help_changed_cb = NULL;
     class->include_date_cb = NULL;
@@ -385,12 +344,13 @@ gsr2_setup_table( GNCSplitReg2 *gsr )
 /*FIXME    gnc_split_register_show_present_divider( model, TRUE ); */
 
     /* events should be sufficient to redraw this */
-    /* gnc_ledger_display2_refresh( gsr->ledger ); */
-    gnc_split_reg2_refresh_toolbar( gsr );
+    /* gnc_ledger_display2_refresh (gsr->ledger); */
+    gnc_split_reg2_refresh_toolbar (gsr);
 
     LEAVE(" ");
 }
 
+
 static
 void
 gsr2_create_table( GNCSplitReg2 *gsr )
@@ -400,28 +360,35 @@ gsr2_create_table( GNCSplitReg2 *gsr )
     GncTreeModelSplitReg *model;
     GtkWidget *scrolled_window;
     GtkTreeViewColumn *col;
+    GNCLedgerDisplay2Type ledger_type;
 
     gchar *gconf_key;
     const GncGUID * guid;
     Account * account;
+    const gchar *gconf_section;
+    
     
     account = gnc_ledger_display2_leader (gsr->ledger);
     guid = xaccAccountGetGUID (account);
     /* Used for saving different register column widths under seperate keys */
-    gconf_key = g_strconcat (GCONF_SECTION,"/", (gchar*)guid_to_string (guid), NULL); 
+    gconf_key = g_strconcat (GCONF_SECTION,"/", (gchar*)guid_to_string (guid), NULL);
 
     ENTER("gsr=%p", gsr);
-g_print("gsr2_create_table\n");
+//g_print("gsr2_create_table\n");
     gnc_ledger_display2_set_user_data (gsr->ledger, (gpointer)gsr );
     gnc_ledger_display2_set_handlers (gsr->ledger,
                                      gnc_split_reg2_ld_destroy,
                                      gnc_split_reg2_get_parent );
 
+    ledger_type = gnc_ledger_display2_type (gsr->ledger);
+
     model = gnc_ledger_display2_get_split_model_register (gsr->ledger );
     view = gnc_tree_view_split_reg_new_with_model (model);
 
     g_object_unref(G_OBJECT(model));
 
+    gnc_tree_model_split_reg_set_display (model, ((ledger_type == LD2_SUBACCOUNT)?TRUE:FALSE), ((ledger_type == LD2_GL)?TRUE:FALSE));
+
     scrolled_window = gtk_scrolled_window_new (NULL, NULL);
     gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
                                    GTK_POLICY_AUTOMATIC,
@@ -431,24 +398,30 @@ g_print("gsr2_create_table\n");
 
     gnc_ledger_display2_set_split_view_register (gsr->ledger, view);
 
+    /* Restore the sort depth from gconf */
+    view->sort_depth = gnc_gconf_get_int (gconf_key, "sort_depth", NULL);
+
     g_object_set (G_OBJECT (view), "gconf-section", gconf_key, 
-                 "show-column-menu", TRUE, NULL);
+                 "show-column-menu", FALSE, NULL);
 
     gnc_tree_view_configure_columns (GNC_TREE_VIEW (view));
 
-    gnc_tree_view_set_show_column_menu (GNC_TREE_VIEW (view), FALSE);
+    if (ledger_type == LD2_GL)
+        gnc_tree_view_set_show_column_menu (GNC_TREE_VIEW (view), TRUE);
+    else
+        gnc_tree_view_set_show_column_menu (GNC_TREE_VIEW (view), FALSE);
 
     /* This column gets all the free space */
     gnc_tree_view_expand_columns (GNC_TREE_VIEW (view), "descnotes", NULL);
 
     /*FIXME is this OK ? - Set the Reconcile column width */
-    col = gnc_tree_view_find_column_by_name (GNC_TREE_VIEW (view), "recn");
-    if (col != NULL)
-        g_object_set (G_OBJECT(col),
-                     "resizable", FALSE,
-                     "sizing",      GTK_TREE_VIEW_COLUMN_FIXED,
-                     "fixed-width", 15,
-                     NULL);
+//    col = gnc_tree_view_find_column_by_name (GNC_TREE_VIEW (view), "recn");
+//    if (col != NULL)
+//        g_object_set (G_OBJECT(col),
+//                     "resizable", FALSE,
+//                     "sizing",      GTK_TREE_VIEW_COLUMN_FIXED,
+//                     "fixed-width", 15,
+//                     NULL);
 
     /* This sets the right color column, 4 is the minimum */
     col = gnc_tree_view_find_column_by_name (GNC_TREE_VIEW (view), "status");
@@ -461,6 +434,7 @@ g_print("gsr2_create_table\n");
 
     gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), TRUE);
     gtk_widget_show (GTK_WIDGET (view));
+
     gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (view));
     gtk_widget_show (GTK_WIDGET (gsr));
 
@@ -470,16 +444,15 @@ g_print("gsr2_create_table\n");
     /* This tells the ledger that we have a valid tree view */
     gnc_ledger_display2_set_split_view_refresh (gsr->ledger, TRUE);
 
-/*
+/*FIXME Not sure if this will be required 
     g_signal_connect (gsr->reg, "activate_cursor",
                       G_CALLBACK(gnc_split_reg2_record_cb), gsr); */
 
-/*FIXME This triggers the update of the summary bar, we need to connect this to some thing
-
-    g_signal_connect (gsr->reg, "redraw_all",
-                      G_CALLBACK(gsr2_redraw_all_cb), gsr); */
-
+    /* This triggers the update of the summary bar */
+    g_signal_connect_after (model, "refresh_status_bar",
+                      G_CALLBACK(gsr2_redraw_all_cb), gsr); //this works
 
+    /* This triggers the update of the help text */
     g_signal_connect (view, "help_signal",
                       G_CALLBACK (gsr2_emit_help_changed), gsr); // this works
 
@@ -767,7 +740,7 @@ gnc_split_reg2_refresh_toolbar( GNCSplitReg2 *gsr )
 }
 
 static void
-gnc_split_reg2_ld_destroy( GNCLedgerDisplay2 *ledger )
+gnc_split_reg2_ld_destroy (GNCLedgerDisplay2 *ledger)
 {
     GNCSplitReg2 *gsr = gnc_ledger_display2_get_user_data( ledger );
     
@@ -775,6 +748,8 @@ gnc_split_reg2_ld_destroy( GNCLedgerDisplay2 *ledger )
     const GncGUID * guid;
     Account * account;
     
+//g_print("gnc_split_reg2_ld_destroy\n");
+
     account = gnc_ledger_display2_leader(ledger);
     guid = xaccAccountGetGUID(account);
     gconf_key = (gchar*)guid_to_string (guid);
@@ -900,374 +875,6 @@ gnc_split_reg2_paste_trans_cb (GtkWidget *w, gpointer data)
     gsr2_emit_simple_signal( gsr, "paste_txn" );*/
 }
 
-/********************************************************************\
- * gnc_split_reg2_void_trans_cb                                      *
- *                                                                  *
- * Args:   widget - the widget that called us                       *
- *         data   - the data struct for this register               *
- * Return: none                                                     *
-\********************************************************************/
-void
-gsr2_default_void_txn_handler (GNCSplitReg2 *gsr, gpointer data)
-{
-    // Override this function.
-}
-
-void
-gnc_split_reg2_void_trans_cb (GtkWidget *w, gpointer data)
-{
-/*FIXME    GNCSplitReg2 *gsr = data;
-    gsr2_emit_simple_signal( gsr, "void_txn" );*/
-}
-
-/********************************************************************\
- * gnc_split_reg2_unvoid_trans_cb                                      *
- *                                                                  *
- * Args:   widget - the widget that called us                       *
- *         data   - the data struct for this register               *
- * Return: none                                                     *
-\********************************************************************/
-void
-gsr2_default_unvoid_txn_handler (GNCSplitReg2 *gsr, gpointer data)
-{
-    // Override this function.
-}
-
-void
-gnc_split_reg2_unvoid_trans_cb (GtkWidget *w, gpointer data)
-{
-/*FIXME    GNCSplitReg2 *gsr = data;
-    gsr2_emit_simple_signal( gsr, "unvoid_txn" );*/
-}
-
-/********************************************************************\
- * gnc_split_reg2_reverse_trans_cb                                   *
- *                                                                  *
- * Args:   widget - the widget that called us                       *
- *         data   - the data struct for this register               *
- * Return: none                                                     *
-\********************************************************************/
-void
-gsr2_default_reverse_txn_handler (GNCSplitReg2 *gsr, gpointer data)
-{
-/*FIXME*/
-#ifdef skip
-    SplitRegister *reg;
-    Transaction *trans, *new_trans;
-
-    reg = gnc_ledger_display2_get_split_register( gsr->ledger );
-    trans = gnc_split_register_get_current_trans (reg);
-    if (trans == NULL)
-        return;
-
-    if (xaccTransGetReversedBy(trans))
-    {
-        gnc_error_dialog(gsr->window, "%s",
-                         _("A reversing entry has already been created for this transaction."));
-        return;
-    }
-
-    new_trans = xaccTransReverse(trans);
-
-    /* Clear transaction level info */
-    xaccTransSetDatePostedSecs(new_trans, gnc_time (NULL));
-    xaccTransSetDateEnteredSecs(new_trans, gnc_time (NULL));
-
-    /* Now jump to new trans */
-    gnc_split_reg2_jump_to_split(gsr, xaccTransGetSplit(new_trans, 0));
-#endif
-}
-
-void
-gnc_split_reg2_reverse_trans_cb (GtkWidget *w, gpointer data)
-{
-/*FIXME    GNCSplitReg2 *gsr = data;
-    gsr2_emit_simple_signal( gsr, "reverse_txn" ); */
-}
-
-
-static gboolean
-is_trans_readonly_and_warn (const Transaction *trans) //this works
-{
-    GtkWidget *dialog;
-    const gchar *reason;
-    const gchar *title = _("Cannot modify or delete this transaction.");
-    const gchar *message =
-        _("This transaction is marked read-only with the comment: '%s'");
-
-    if (!trans) return FALSE;
-
-    if (xaccTransIsReadonlyByPostedDate (trans))
-    {
-        dialog = gtk_message_dialog_new (NULL,
-                                        0,
-                                        GTK_MESSAGE_ERROR,
-                                        GTK_BUTTONS_OK,
-                                        "%s", title);
-        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                "%s", _("The date of this transaction is older than the \"Read-Only Threshold\" set for this book.  "
-                        "This setting can be changed in File -> Properties -> Accounts."));
-        gtk_dialog_run (GTK_DIALOG (dialog));
-        gtk_widget_destroy (dialog);
-        return TRUE;
-    }
-
-    reason = xaccTransGetReadOnly (trans);
-    if (reason)
-    {
-        dialog = gtk_message_dialog_new (NULL,
-                                        0,
-                                        GTK_MESSAGE_ERROR,
-                                        GTK_BUTTONS_OK,
-                                        "%s", title);
-        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                message, reason);
-        gtk_dialog_run (GTK_DIALOG (dialog));
-        gtk_widget_destroy (dialog);
-        return TRUE;
-    }
-    return FALSE;
-}
-
-
-void
-gsr2_default_reinit_handler ( GNCSplitReg2 *gsr, gpointer data ) //this works
-{
-    GncTreeViewSplitReg *view;
-    Transaction *trans;
-    Split *split;
-    GtkWidget *dialog;
-    gint response;
-    const gchar *warning;
-
-    const char *title = _("Remove the splits from this transaction?");
-    const char *recn_warn = _("This transaction contains reconciled splits. "
-                              "Modifying it is not a good idea because that will "
-                              "cause your reconciled balance to be off.");
-
-    view = gnc_ledger_display2_get_split_view_register ( gsr->ledger );
-
-    trans = gnc_tree_view_split_reg_get_current_trans (view);
-    if (is_trans_readonly_and_warn (trans))
-        return;
-    dialog = gtk_message_dialog_new (GTK_WINDOW (gsr->window),
-                                    GTK_DIALOG_DESTROY_WITH_PARENT,
-                                    GTK_MESSAGE_WARNING,
-                                    GTK_BUTTONS_NONE,
-                                    "%s", title);
-    if (xaccTransHasReconciledSplits (trans))
-    {
-        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                "%s", recn_warn);
-        warning = "register_remove_all_splits2";
-    }
-    else
-    {
-        warning = "register_remove_all_splits";
-    }
-
-    gtk_dialog_add_button (GTK_DIALOG (dialog),
-                          GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
-    gnc_gtk_dialog_add_button(dialog, _("_Remove Splits"),
-                              GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT);
-    response = gnc_dialog_run (GTK_DIALOG(dialog), warning);
-    gtk_widget_destroy (dialog);
-    if (response != GTK_RESPONSE_ACCEPT)
-        return;
-
-    gnc_tree_view_split_reg_reinit_trans (view);
-}
-
-/**
- * "Reinitializes" the current transaction.
- **/
-void
-gnc_split_reg2_reinitialize_trans_cb(GtkWidget *widget, gpointer data)
-{
-/*FIXME    GNCSplitReg2 *gsr = data;
-    gsr2_emit_simple_signal( gsr, "reinit_ent" ); */
-}
-
-void
-gsr2_default_delete_handler (GNCSplitReg2 *gsr, gpointer data) //this works
-{
-    GncTreeViewSplitReg *view;
-    RowDepth depth;
-    Transaction *trans;
-    Split *split;
-    GtkWidget *dialog;
-    gint response;
-    const gchar *warning;
-
-    view = gnc_ledger_display2_get_split_view_register (gsr->ledger);
-
-    /* get the current split based on cursor position */
-    split = gnc_tree_view_split_reg_get_current_split (view);
-    if (split == NULL)
-    {
-        return;
-    }
-
-    trans = xaccSplitGetParent (split);
-    depth = gnc_tree_view_reg_get_selected_row_depth (view);
-
-    /* Deleting the blank split just cancels */
-    {
-        Split *blank_split = gnc_tree_view_split_reg_get_blank_split (view);
-
-        if (split == blank_split)
-        {
-            return;
-        }
-    }
-
-    if (is_trans_readonly_and_warn (trans))
-        return;
-
-    /* On a split cursor, just delete the one split. */
-    if (depth == SPLIT3)
-    {
-        const char *format = _("Delete the split '%s' from the transaction '%s'?");
-        const char *recn_warn = _("You would be deleting a reconciled split! "
-                                  "This is not a good idea as it will cause your "
-                                  "reconciled balance to be off.");
-        const char *anchor_error = _("You cannot delete this split.");
-        const char *anchor_split = _("This is the split anchoring this transaction "
-                                     "to the register. You may not delete it from "
-                                     "this register window.  You may delete the "
-                                     "entire transaction from this window, or you "
-                                     "may navigate to a register that shows "
-                                     "another side of this same transaction and "
-                                     "delete the split from that register.");
-        char *buf = NULL;
-        const char *memo;
-        const char *desc;
-        char recn;
-
-        if (split == gnc_tree_view_reg_get_current_trans_split (view))
-        {
-            dialog = gtk_message_dialog_new (GTK_WINDOW (gsr->window),
-                                            GTK_DIALOG_MODAL
-                                            | GTK_DIALOG_DESTROY_WITH_PARENT,
-                                            GTK_MESSAGE_ERROR,
-                                            GTK_BUTTONS_OK,
-                                            "%s", anchor_error);
-            gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                    "%s", anchor_split);
-            gtk_dialog_run (GTK_DIALOG (dialog));
-            gtk_widget_destroy (dialog);
-            return;
-        }
-
-        memo = xaccSplitGetMemo (split);
-        memo = (memo && *memo) ? memo : _("(no memo)");
-
-        desc = xaccTransGetDescription (trans);
-        desc = (desc && *desc) ? desc : _("(no description)");
-
-        /* ask for user confirmation before performing permanent damage */
-        buf = g_strdup_printf (format, memo, desc);
-        dialog = gtk_message_dialog_new (GTK_WINDOW (gsr->window),
-                                        GTK_DIALOG_MODAL
-                                        | GTK_DIALOG_DESTROY_WITH_PARENT,
-                                        GTK_MESSAGE_QUESTION,
-                                        GTK_BUTTONS_NONE,
-                                        "%s", buf);
-        g_free(buf);
-        recn = xaccSplitGetReconcile (split);
-        if (recn == YREC || recn == FREC)
-        {
-            gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                    "%s", recn_warn);
-            warning = "register_delete_split2";
-        }
-        else
-        {
-            warning = "register_delete_split";
-        }
-
-        gtk_dialog_add_button (GTK_DIALOG (dialog),
-                              GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
-        gnc_gtk_dialog_add_button (dialog, _("_Delete Split"),
-                                  GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT);
-        response = gnc_dialog_run (GTK_DIALOG (dialog), warning);
-        gtk_widget_destroy (dialog);
-        if (response != GTK_RESPONSE_ACCEPT)
-            return;
-
-        gnc_tree_view_split_reg_delete_current_split (view);
-        return;
-    }
-
-    g_return_if_fail (depth == TRANS1 || depth == TRANS2);
-
-    /* On a transaction cursor with 2 or fewer splits in single or double
-     * mode, we just delete the whole transaction, kerblooie */
-    {
-        const char *title = _("Delete the current transaction?");
-        const char *recn_warn = _("You would be deleting a transaction "
-                                  "with reconciled splits! "
-                                  "This is not a good idea as it will cause your "
-                                  "reconciled balance to be off.");
-
-        dialog = gtk_message_dialog_new (GTK_WINDOW (gsr->window),
-                                        GTK_DIALOG_MODAL
-                                        | GTK_DIALOG_DESTROY_WITH_PARENT,
-                                        GTK_MESSAGE_WARNING,
-                                        GTK_BUTTONS_NONE,
-                                        "%s", title);
-        if (xaccTransHasReconciledSplits (trans))
-        {
-            gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                    "%s", recn_warn);
-            warning = "register_delete_trans2";
-        }
-        else
-        {
-            warning = "register_delete_trans";
-        }
-        gtk_dialog_add_button (GTK_DIALOG (dialog),
-                              GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
-        gnc_gtk_dialog_add_button (dialog, _("_Delete Transaction"),
-                                  GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT);
-        response =  gnc_dialog_run (GTK_DIALOG (dialog), warning);
-        gtk_widget_destroy (dialog);
-        if (response != GTK_RESPONSE_ACCEPT)
-            return;
-
-        gnc_tree_view_split_reg_delete_current_trans (view);
-        return;
-    }
-}
-
-/**
- * Deletes the current transaction.
- **/
-void
-gnc_split_reg2_delete_trans_cb(GtkWidget *widget, gpointer data)
-{
-/*FIXME    GNCSplitReg2 *gsr = data;
-    gsr2_emit_simple_signal( gsr, "delete_ent" );*/
-}
-
-
-void
-gsr2_default_dup_handler( GNCSplitReg2 *gsr, gpointer data )
-{
-/*FIXME    gnc_split_register_duplicate_current
-    (gnc_ledger_display2_get_split_register( gsr->ledger ));*/
-}
-
-
-/**
- * Duplicates the current transaction in the register.
- **/
-void
-gnc_split_reg2_duplicate_trans_cb(GtkWidget *w, gpointer data)
-{
-/*FIXME    GNCSplitReg2 *gsr = data;
-    gsr2_emit_simple_signal( gsr, "dup_ent" );*/
-}
 
 /**
  * Schedules the current transaction for recurring-entry.
@@ -1340,137 +947,6 @@ gnc_split_reg2_record_trans_cb (GtkWidget *w, gpointer data)
     gsr2_emit_simple_signal( gsr, "enter_ent" );*/
 }
 
-void
-gsr2_default_cancel_handler( GNCSplitReg2 *gsr, gpointer data )
-{
-/*FIXME    gnc_split_register_cancel_cursor_trans_changes
-    (gnc_ledger_display2_get_split_register( gsr->ledger ));*/
-}
-
-/**
- * Cancels the edits of the currently-selected transaction.
- **/
-void
-gnc_split_reg2_cancel_trans_cb(GtkWidget *w, gpointer data)
-{
-/*FIXME    GNCSplitReg2 *gsr = data;
-    gsr2_emit_simple_signal( gsr, "cancel_ent" );*/
-}
-
-void
-gsr2_default_expand_handler( GNCSplitReg2 *gsr, gpointer data )
-{
-/*FIXME*/
-#ifdef skip
-    gint activeCount;
-    gboolean expand;
-    SplitRegister *reg;
-
-    if (!gsr)
-        return;
-
-    reg = gnc_ledger_display2_get_split_register (gsr->ledger);
-
-    /* These should all be in agreement. */
-    activeCount =
-        ( ( GTK_CHECK_MENU_ITEM(gsr->split_menu_check)->active ? 1 : -1 )
-          + ( GTK_CHECK_MENU_ITEM(gsr->split_popup_check)->active ? 1 : -1 )
-          + ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(gsr->split_button) )
-              ? 1 : -1 ) );
-
-    /* If activeCount > 0, then there's more active than inactive; otherwise,
-     * more inactive than active.  Both determine which state the user is
-     * attempting to get to. */
-    expand = ( activeCount < 0 );
-
-    /* The ledger's invocation of 'redraw_all' will force the agreement in the
-     * other split state widgets, so we neglect doing it here.  */
-    gnc_split_register_expand_current_trans (reg, expand);
-#endif
-}
-
-void
-gnc_split_reg2_expand_trans_menu_cb (GtkWidget *widget, gpointer data)
-{
-/*FIXME    GNCSplitReg2 *gsr = data;
-    gsr2_emit_simple_signal( gsr, "expand_ent" );*/
-}
-
-void
-gnc_split_reg2_expand_trans_toolbar_cb (GtkWidget *widget, gpointer data)
-{
-/*FIXME    GNCSplitReg2 *gsr = data;
-    gsr2_emit_simple_signal( gsr, "expand_ent" );*/
-}
-
-/**
- * move the cursor to the split, if present in register
-**/
-void
-gnc_split_reg2_jump_to_split (GNCSplitReg2 *gsr, Split *split) //this works
-{
-    GncTreeViewSplitReg *view;
-
-//FIXME maybe collapse this back to plugin-page-register
-
-    view = gnc_ledger_display2_get_split_view_register (gsr->ledger);
-
-    gnc_tree_view_split_reg_jump_to_split (view, split);
-
-}
-
-
-/**
- * Move the cursor to the split in the non-blank amount column.
- **/
-void
-gnc_split_reg2_jump_to_split_amount(GNCSplitReg2 *gsr, Split *split)
-{
-/*FIXME*/
-#ifdef skip
-    VirtualLocation virt_loc;
-    SplitRegister *reg;
-    Transaction *trans;
-
-    if (!gsr) return;
-
-    trans = xaccSplitGetParent(split);
-    gsr2_emit_include_date_signal( gsr, xaccTransGetDate(trans) );
-
-    reg = gnc_ledger_display2_get_split_register (gsr->ledger);
-
-    if (gnc_split_register_get_split_amount_virt_loc (reg, split, &virt_loc))
-        gnucash_register_goto_virt_loc (gsr->reg, virt_loc);
-
-    gnc_ledger_display2_refresh (gsr->ledger);
-#endif
-}
-
-void
-gnc_split_reg2_jump_to_blank (GNCSplitReg2 *gsr)
-{
-/*FIXME*/
-#ifdef skip
-    SplitRegister *reg = gnc_ledger_display2_get_split_register (gsr->ledger);
-    VirtualCellLocation vcell_loc;
-    Split *blank;
-
-    ENTER("gsr=%p", gsr);
-
-    blank = gnc_split_register_get_blank_split (reg);
-    if (blank == NULL)
-    {
-        LEAVE("no blank split");
-        return;
-    }
-
-    if (gnc_split_register_get_split_virt_loc (reg, blank, &vcell_loc))
-        gnucash_register_goto_virt_cell (gsr->reg, vcell_loc);
-
-    gnc_ledger_display2_refresh (gsr->ledger);
-    LEAVE(" ");
-#endif
-}
 
 void
 gnc_split_reg2_balancing_entry(GNCSplitReg2 *gsr, Account *account,
@@ -1482,117 +958,72 @@ gnc_split_reg2_balancing_entry(GNCSplitReg2 *gsr, Account *account,
     Split *split;
 
     // create transaction
-    transaction = create_balancing_transaction(gnc_get_current_book(),
+    transaction = create_balancing_transaction (gnc_get_current_book(),
                   account, statement_date, balancing_amount);
 
     // jump to transaction
-    split = xaccTransFindSplitByAccount(transaction, account);
+    split = xaccTransFindSplitByAccount (transaction, account);
     if (split == NULL)
     {
         // default behaviour: jump to blank split
         g_warning("create_balancing_transaction failed");
-        gnc_split_reg2_jump_to_blank(gsr);
+        gnc_split_reg2_jump_to_blank (gsr);
     }
     else
     {
         // goto balancing transaction
-        gnc_split_reg2_jump_to_split(gsr, split );
+        gnc_split_reg2_jump_to_split (gsr, split );
     }
 #endif
 }
 
 static Transaction*
-create_balancing_transaction(QofBook *book, Account *account,
+create_balancing_transaction (QofBook *book, Account *account,
                              time64 statement_date, gnc_numeric balancing_amount)
 {
-/*FIXME*/
-#ifdef skip
     Transaction *trans;
     Split *split;
 
     if (!account)
         return NULL;
-    if (gnc_numeric_zero_p(balancing_amount))
+    if (gnc_numeric_zero_p (balancing_amount))
         return NULL;
 
-    xaccAccountBeginEdit(account);
+    xaccAccountBeginEdit (account);
 
-    trans = xaccMallocTransaction(book);
+    trans = xaccMallocTransaction (book);
 
-    xaccTransBeginEdit(trans);
+    xaccTransBeginEdit (trans);
 
     // fill Transaction
-    xaccTransSetCurrency(trans, xaccAccountGetCommodity(account));
-    xaccTransSetDatePostedSecs(trans, statement_date);
-    xaccTransSetDescription(trans, _("Balancing entry from reconcilation"));
+    xaccTransSetCurrency (trans, xaccAccountGetCommodity (account));
+    xaccTransSetDatePostedSecs (trans, statement_date);
+    xaccTransSetDescription (trans, _("Balancing entry from reconcilation"));
 
     // 1. Split
-    split = xaccMallocSplit(book);
-    xaccTransAppendSplit(trans, split);
-    xaccAccountInsertSplit(account, split);
-    xaccSplitSetAmount(split, balancing_amount);
-    xaccSplitSetValue(split, balancing_amount);
+    split = xaccMallocSplit (book);
+    xaccTransAppendSplit (trans, split);
+    xaccAccountInsertSplit  (account, split);
+    xaccSplitSetAmount (split, balancing_amount);
+    xaccSplitSetValue (split, balancing_amount);
 
     // 2. Split (no account is defined: split goes to orphan account)
-    split = xaccMallocSplit(book);
-    xaccTransAppendSplit(trans, split);
+    split = xaccMallocSplit (book);
+    xaccTransAppendSplit (trans, split);
 
-    balancing_amount = gnc_numeric_neg(balancing_amount);
-    xaccSplitSetAmount(split, balancing_amount);
-    xaccSplitSetValue(split, balancing_amount);
+    balancing_amount = gnc_numeric_neg (balancing_amount);
+    xaccSplitSetAmount (split, balancing_amount);
+    xaccSplitSetValue (split, balancing_amount);
 
-    xaccTransCommitEdit(trans);
-    xaccAccountCommitEdit(account);
+    xaccTransCommitEdit (trans);
+    xaccAccountCommitEdit (account);
     return trans;
-#endif
-return NULL;
 }
 
-void
-gsr2_default_blank_handler( GNCSplitReg2 *gsr, gpointer data )
-{
-/*FIXME*/
-#ifdef skip
-    SplitRegister *reg;
-
-    ENTER("gsr=%p, gpointer=%p", gsr, data);
-
-    reg = gnc_ledger_display2_get_split_register (gsr->ledger);
-
-    if (gnc_split_register_save (reg, TRUE))
-        gnc_split_register_redraw (reg);
 
-    gnc_split_reg2_jump_to_blank (gsr);
-    LEAVE(" ");
-#endif
-}
-
-void
-gnc_split_reg2_new_trans_cb (GtkWidget *widget, gpointer data)
-{
-/*FIXME   GNCSplitReg2 *gsr = data;
-    gsr2_emit_simple_signal( gsr, "blank" );*/
-}
-
-void
-gsr2_default_jump_handler( GNCSplitReg2 *gsr, gpointer data )
-{
- /*FIXME   g_assert_not_reached();*/
-}
-
-void
-gnc_split_reg2_jump_cb( GtkWidget *widget, gpointer data )
-{
-/*FIXME    GNCSplitReg2 *gsr = data;
-    gsr2_emit_simple_signal( gsr, "jump" ); */
-}
 
 /* ###### End Handlers ##### */
 
-
-
-
-
 void
 gnc_split_reg2_change_style (GNCSplitReg2 *gsr, SplitRegisterStyle2 style)
 {
@@ -1610,7 +1041,7 @@ gnc_split_reg2_style_ledger_cb (GtkWidget *w, gpointer data)
 {
     GNCSplitReg2 *gsr = data;
 
-    if (!GTK_CHECK_MENU_ITEM(w)->active)
+    if (!GTK_CHECK_MENU_ITEM (w)->active)
         return;
 
     gnc_split_reg2_change_style (gsr, REG2_STYLE_LEDGER);
@@ -1621,7 +1052,7 @@ gnc_split_reg2_style_auto_ledger_cb (GtkWidget *w, gpointer data)
 {
     GNCSplitReg2 *gsr = data;
 
-    if (!GTK_CHECK_MENU_ITEM(w)->active)
+    if (!GTK_CHECK_MENU_ITEM (w)->active)
         return;
 
     gnc_split_reg2_change_style (gsr, REG2_STYLE_AUTO_LEDGER);
@@ -1632,7 +1063,7 @@ gnc_split_reg2_style_journal_cb (GtkWidget *w, gpointer data)
 {
     GNCSplitReg2 *gsr = data;
 
-    if (!GTK_CHECK_MENU_ITEM(w)->active)
+    if (!GTK_CHECK_MENU_ITEM (w)->active)
         return;
 
     gnc_split_reg2_change_style (gsr, REG2_STYLE_JOURNAL);
@@ -1645,18 +1076,18 @@ gnc_split_reg2_double_line_cb (GtkWidget *w, gpointer data)
     GncTreeModelSplitReg *model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
     gboolean use_double_line;
 
-    use_double_line = GTK_CHECK_MENU_ITEM(w)->active;
-    if ( use_double_line == model->use_double_line )
+    use_double_line = GTK_CHECK_MENU_ITEM (w)->active;
+    if (use_double_line == model->use_double_line)
         return;
 
-    gnc_tree_model_split_reg_config( model, model->type, model->style, use_double_line );
-    gnc_ledger_display2_refresh( gsr->ledger );
+    gnc_tree_model_split_reg_config (model, model->type, model->style, use_double_line);
+    gnc_ledger_display2_refresh (gsr->ledger);
 }
 
 static void
-gnc_split_reg2_sort( GNCSplitReg2 *gsr, SortType sort_code )
+gnc_split_reg2_sort (GNCSplitReg2 *gsr, SortType sort_code)
 {
-    Query *query = gnc_ledger_display2_get_query( gsr->ledger );
+    Query *query = gnc_ledger_display2_get_query (gsr->ledger);
     gboolean show_present_divider = FALSE;
     GSList *p1 = NULL, *p2 = NULL, *p3 = NULL, *standard;
     GncTreeModelSplitReg *model;
@@ -1664,7 +1095,7 @@ gnc_split_reg2_sort( GNCSplitReg2 *gsr, SortType sort_code )
     if (gsr->sort_type == sort_code)
         return;
 
-    standard = g_slist_prepend( NULL, QUERY_DEFAULT_SORT );
+    standard = g_slist_prepend (NULL, QUERY_DEFAULT_SORT);
 
     switch (sort_code)
     {
@@ -1721,99 +1152,82 @@ gnc_split_reg2_sort( GNCSplitReg2 *gsr, SortType sort_code )
         break;
     }
 
-    qof_query_set_sort_order( query, p1, p2, p3 );
-    model = gnc_ledger_display2_get_split_model_register( gsr->ledger );
-/*FIXME    gnc_split_register_show_present_divider( model, show_present_divider ); */
+    qof_query_set_sort_order (query, p1, p2, p3);
+    model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
     gsr->sort_type = sort_code;
-    gnc_ledger_display2_refresh( gsr->ledger );
-}
-
-void
-gnc_split_reg2_sort_standard_cb(GtkWidget *w, gpointer data)
-{
-    GNCSplitReg2 *gsr = data;
-    gnc_split_reg2_sort(gsr, BY_STANDARD);
+    gnc_ledger_display2_refresh (gsr->ledger);
 }
 
 void
-gnc_split_reg2_sort_date_cb(GtkWidget *w, gpointer data)
+gnc_split_reg2_sort_standard_cb (GtkWidget *w, gpointer data)
 {
     GNCSplitReg2 *gsr = data;
-    gnc_split_reg2_sort(gsr, BY_DATE);
+    gnc_split_reg2_sort (gsr, BY_STANDARD);
 }
 
 void
-gnc_split_reg2_sort_date_entered_cb(GtkWidget *w, gpointer data)
+gnc_split_reg2_sort_date_cb (GtkWidget *w, gpointer data)
 {
     GNCSplitReg2 *gsr = data;
-    gnc_split_reg2_sort(gsr, BY_DATE_ENTERED);
+    gnc_split_reg2_sort (gsr, BY_DATE);
 }
 
 void
-gnc_split_reg2_sort_date_reconciled_cb(GtkWidget *w, gpointer data)
+gnc_split_reg2_sort_date_entered_cb (GtkWidget *w, gpointer data)
 {
     GNCSplitReg2 *gsr = data;
-    gnc_split_reg2_sort(gsr, BY_DATE_RECONCILED);
+    gnc_split_reg2_sort (gsr, BY_DATE_ENTERED);
 }
 
 void
-gnc_split_reg2_sort_num_cb(GtkWidget *w, gpointer data)
+gnc_split_reg2_sort_date_reconciled_cb (GtkWidget *w, gpointer data)
 {
     GNCSplitReg2 *gsr = data;
-    gnc_split_reg2_sort(gsr, BY_NUM);
+    gnc_split_reg2_sort (gsr, BY_DATE_RECONCILED);
 }
 
 void
-gnc_split_reg2_sort_amount_cb(GtkWidget *w, gpointer data)
+gnc_split_reg2_sort_num_cb (GtkWidget *w, gpointer data)
 {
     GNCSplitReg2 *gsr = data;
-    gnc_split_reg2_sort(gsr, BY_AMOUNT);
+    gnc_split_reg2_sort (gsr, BY_NUM);
 }
 
 void
-gnc_split_reg2_sort_memo_cb(GtkWidget *w, gpointer data)
+gnc_split_reg2_sort_amount_cb (GtkWidget *w, gpointer data)
 {
     GNCSplitReg2 *gsr = data;
-    gnc_split_reg2_sort(gsr, BY_MEMO);
+    gnc_split_reg2_sort (gsr, BY_AMOUNT);
 }
 
 void
-gnc_split_reg2_sort_desc_cb(GtkWidget *w, gpointer data)
+gnc_split_reg2_sort_memo_cb (GtkWidget *w, gpointer data)
 {
     GNCSplitReg2 *gsr = data;
-    gnc_split_reg2_sort(gsr, BY_DESC);
+    gnc_split_reg2_sort (gsr, BY_MEMO);
 }
 
 void
-gnc_split_reg2_sort_action_cb(GtkWidget *w, gpointer data)
+gnc_split_reg2_sort_desc_cb (GtkWidget *w, gpointer data)
 {
     GNCSplitReg2 *gsr = data;
-    gnc_split_reg2_sort(gsr, BY_ACTION);
+    gnc_split_reg2_sort (gsr, BY_DESC);
 }
 
 void
-gnc_split_reg2_sort_notes_cb(GtkWidget *w, gpointer data)
+gnc_split_reg2_sort_action_cb (GtkWidget *w, gpointer data)
 {
     GNCSplitReg2 *gsr = data;
-    gnc_split_reg2_sort(gsr, BY_NOTES);
+    gnc_split_reg2_sort (gsr, BY_ACTION);
 }
 
-
-
 void
-gnc_split_reg2_handle_exchange_cb (GtkWidget *w, gpointer data)
+gnc_split_reg2_sort_notes_cb (GtkWidget *w, gpointer data)
 {
-/*FIXME*/
-#ifdef skip
     GNCSplitReg2 *gsr = data;
-    SplitRegister *reg = gnc_ledger_display2_get_split_register (gsr->ledger);
-
-    /* XXX Ignore the return value -- we don't care if this succeeds */
-    (void)gnc_split_register_handle_exchange (reg, TRUE);
-#endif
+    gnc_split_reg2_sort (gsr, BY_NOTES);
 }
 
-
 static void
 gnc_split_reg2_record (GNCSplitReg2 *gsr)
 {
@@ -1873,66 +1287,6 @@ gnc_split_reg2_goto_next_trans_row (GNCSplitReg2 *gsr)
 #endif
 }
 
-void
-gnc_split_reg2_enter (GNCSplitReg2 *gsr, gboolean next_transaction) //this works
-{
-    GncTreeViewSplitReg *view = gnc_ledger_display2_get_split_view_register (gsr->ledger);
-    GncTreeModelSplitReg *model;
-    gboolean goto_blank;
-
-    ENTER("gsr=%p, next_transaction=%s", gsr, next_transaction ? "TRUE" : "FALSE");
-
-    model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
-
-    goto_blank = gnc_gconf_get_bool (GCONF_GENERAL_REGISTER,
-                                    "enter_moves_to_end", NULL);
-
-    /* If we are in single or double line mode and we hit enter
-     * on the blank split, go to the blank split instead of the
-     * next row. This prevents the cursor from jumping around
-     * when you are entering transactions. */
-    if ( !goto_blank && !next_transaction )
-    {
-        SplitRegisterStyle2 style = model->style;
-
-        if (style == REG2_STYLE_LEDGER)
-        {
-            Split *blank_split;
-
-            blank_split = gnc_tree_view_split_reg_get_blank_split (view);
-            if (blank_split != NULL)
-            {
-                Split *current_split;
-
-                current_split = gnc_tree_view_split_reg_get_current_split (view);
-
-                if (blank_split == current_split)
-                    goto_blank = TRUE;
-            }
-        }
-    }
-
-    /* First record the transaction */
-    if (gnc_tree_view_split_reg_enter (view))
-    {
-        if (!goto_blank && next_transaction)
-            gnc_tree_view_split_reg_expand_current_trans (view, FALSE);
-
-        /* Now move. */
-        if (goto_blank)
-            gnc_tree_view_split_reg_jump_to_blank (view);
-        else if (next_transaction)
-            gnc_tree_view_split_reg_goto_rel_trans_row (view, 1);
-    }
-    LEAVE(" ");
-}
-
-void
-gsr2_default_enter_handler( GNCSplitReg2 *gsr, gpointer data )
-{
-/*FIXME    gnc_split_reg2_enter( gsr, FALSE );*/
-}
-
 
 #ifdef skip
 void
@@ -1942,17 +1296,6 @@ gnc_split_reg2_record_cb (GnucashRegister *reg, gpointer data)
 }
 #endif
 
-
-void
-gnc_split_reg2_size_allocate (GtkWidget *widget,
-                             GtkAllocation *allocation,
-                             gpointer user_data)
-{
-    GNCSplitReg2 *gsr = user_data;
-    gsr->width = allocation->width;
-    gtk_window_set_default_size( GTK_WINDOW(gsr->window), gsr->width, 0 );
-}
-
 static
 GtkWidget*
 add_summary_label (GtkWidget *summarybar, const char *label_str)
@@ -1975,7 +1318,7 @@ add_summary_label (GtkWidget *summarybar, const char *label_str)
 }
 
 GtkWidget *
-gsr2_create_summary_bar( GNCSplitReg2 *gsr )
+gsr2_create_summary_bar (GNCSplitReg2 *gsr)
 {
     GtkWidget *summarybar;
 
@@ -1987,7 +1330,7 @@ gsr2_create_summary_bar( GNCSplitReg2 *gsr )
     gsr->shares_label     = NULL;
     gsr->value_label      = NULL;
 
-    if ( gnc_ledger_display2_type(gsr->ledger) >= LD2_SUBACCOUNT )
+    if (gnc_ledger_display2_type (gsr->ledger) >= LD2_SUBACCOUNT)
     {
         gsr->summarybar = NULL;
         return NULL;
@@ -2024,7 +1367,7 @@ gsr2_create_summary_bar( GNCSplitReg2 *gsr )
  **/
 static
 GNCPlaceholderType
-gnc_split_reg2_get_placeholder( GNCSplitReg2 *gsr )
+gnc_split_reg2_get_placeholder (GNCSplitReg2 *gsr)
 {
     Account *leader;
     GncTreeModelSplitReg *model;
@@ -2033,7 +1376,7 @@ gnc_split_reg2_get_placeholder( GNCSplitReg2 *gsr )
     if (gsr == NULL)
         return PLACEHOLDER_NONE;
 
-    model = gnc_ledger_display2_get_split_model_register( gsr->ledger );
+    model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
 
     switch (model->type)
     {
@@ -2048,17 +1391,17 @@ gnc_split_reg2_get_placeholder( GNCSplitReg2 *gsr )
         break;
     }
 
-    leader = gnc_ledger_display2_leader( gsr->ledger );
+    leader = gnc_ledger_display2_leader (gsr->ledger);
 
     if (leader == NULL)
         return PLACEHOLDER_NONE;
     if (single_account)
     {
-        if (xaccAccountGetPlaceholder( leader ))
+        if (xaccAccountGetPlaceholder (leader))
             return PLACEHOLDER_THIS;
         return PLACEHOLDER_NONE;
     }
-    return xaccAccountGetDescendantPlaceholder( leader );
+    return xaccAccountGetDescendantPlaceholder (leader);
 }
 
 /**
@@ -2083,16 +1426,16 @@ gtk_callback_bug_workaround (gpointer argp)
     const gchar *read_only = _("This account register is read-only.");
     GtkWidget *dialog;
 
-    dialog = gtk_message_dialog_new(GTK_WINDOW(args->gsr->window),
+    dialog = gtk_message_dialog_new (GTK_WINDOW(args->gsr->window),
                                     GTK_DIALOG_DESTROY_WITH_PARENT,
                                     GTK_MESSAGE_WARNING,
                                     GTK_BUTTONS_CLOSE,
                                     "%s", read_only);
-    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
             "%s", args->string);
-    gnc_dialog_run(GTK_DIALOG(dialog), "register_read_only");
-    gtk_widget_destroy(dialog);
-    g_free(args);
+    gnc_dialog_run (GTK_DIALOG (dialog), "register_read_only");
+    gtk_widget_destroy (dialog);
+    g_free (args);
     return FALSE;
 }
 
@@ -2101,9 +1444,9 @@ gtk_callback_bug_workaround (gpointer argp)
  **/
 static
 void
-gnc_split_reg2_determine_read_only( GNCSplitReg2 *gsr )
+gnc_split_reg2_determine_read_only (GNCSplitReg2 *gsr) //this works
 {
-    dialog_args *args = g_malloc(sizeof(dialog_args));
+    dialog_args *args = g_malloc (sizeof (dialog_args));
     GncTreeViewSplitReg *view;
 
     if (qof_book_is_readonly (gnc_get_current_book()))
@@ -2147,10 +1490,10 @@ gnc_split_reg2_determine_read_only( GNCSplitReg2 *gsr )
 
 static
 GtkWidget *
-gnc_split_reg2_get_parent( GNCLedgerDisplay2 *ledger )
+gnc_split_reg2_get_parent (GNCLedgerDisplay2 *ledger)
 {
     GNCSplitReg2 *gsr =
-        GNC_SPLIT_REG2(gnc_ledger_display2_get_user_data( ledger ));
+        GNC_SPLIT_REG2 (gnc_ledger_display2_get_user_data (ledger));
 
     if (gsr == NULL)
         return NULL;
@@ -2160,7 +1503,7 @@ gnc_split_reg2_get_parent( GNCLedgerDisplay2 *ledger )
 
 static
 void
-gsr2_emit_help_changed (GncTreeViewSplitReg *view, gpointer user_data ) //this works
+gsr2_emit_help_changed (GncTreeViewSplitReg *view, gpointer user_data) //this works
 {
     gsr2_emit_simple_signal ((GNCSplitReg2*)user_data, "help-changed" );
 }
@@ -2174,7 +1517,7 @@ gsr2_emit_include_date_signal( GNCSplitReg2 *gsr, time64 date )
 
 static
 void
-gsr2_emit_simple_signal( GNCSplitReg2 *gsr, const char *sigName ) //this works
+gsr2_emit_simple_signal (GNCSplitReg2 *gsr, const char *sigName) //this works
 {
     g_signal_emit_by_name( gsr, sigName, NULL );
 }
@@ -2189,35 +1532,35 @@ gnc_split_reg2_get_register (GNCSplitReg2 *gsr )
 }
 
 SortType
-gnc_split_reg2_get_sort_type( GNCSplitReg2 *gsr )
+gnc_split_reg2_get_sort_type (GNCSplitReg2 *gsr)
 {
-    g_assert( gsr );
+    g_assert (gsr);
     return gsr->sort_type;
 }
 
 void
-gnc_split_reg2_set_sort_type( GNCSplitReg2 *gsr, SortType t )
+gnc_split_reg2_set_sort_type (GNCSplitReg2 *gsr, SortType t)
 {
-    gnc_split_reg2_sort( gsr, t );
+    gnc_split_reg2_sort (gsr, t);
 }
 
 GtkWidget*
-gnc_split_reg2_get_summarybar( GNCSplitReg2 *gsr )
+gnc_split_reg2_get_summarybar (GNCSplitReg2 *gsr)
 {
-    if ( !gsr ) return NULL;
+    if (!gsr) return NULL;
     return gsr->summarybar;
 }
 
 gboolean
-gnc_split_reg2_get_read_only( GNCSplitReg2 *gsr )
+gnc_split_reg2_get_read_only (GNCSplitReg2 *gsr)
 {
-    g_assert( gsr );
+    g_assert (gsr);
     return gsr->read_only;
 }
 
 void
-gnc_split_reg2_set_moved_cb( GNCSplitReg2 *gsr, GFunc cb, gpointer cb_data ) //this works
+gnc_split_reg2_set_moved_cb (GNCSplitReg2 *gsr, GFunc cb, gpointer cb_data ) //this works
 {
-g_print("gnc_split_reg2_set_moved_cb\n");
+//g_print("gnc_split_reg2_set_moved_cb\n");
     gnc_tree_view_split_reg_moved_cb (gnc_ledger_display2_get_split_view_register(gsr->ledger), cb, cb_data);
 }
diff --git a/src/gnome/gnc-split-reg2.h b/src/gnome/gnc-split-reg2.h
index 98fd416..fd9a391 100644
--- a/src/gnome/gnc-split-reg2.h
+++ b/src/gnome/gnc-split-reg2.h
@@ -95,24 +95,16 @@ struct _GNCSplitReg2Class
     GtkVBoxClass parent_class;
 
     /* Signal defaults */
-    void (*enter_ent_cb)    ( GNCSplitReg2 *w, gpointer user_data );
-    void (*cancel_ent_cb)   ( GNCSplitReg2 *w, gpointer user_data );
-    void (*delete_ent_cb)   ( GNCSplitReg2 *w, gpointer user_data );
-    void (*reinit_ent_cb)   ( GNCSplitReg2 *w, gpointer user_data );
-    void (*dup_ent_cb)      ( GNCSplitReg2 *w, gpointer user_data );
+
     void (*schedule_ent_cb) ( GNCSplitReg2 *w, gpointer user_data );
-    void (*expand_ent_cb)   ( GNCSplitReg2 *w, gpointer user_data );
-    void (*blank_cb)        ( GNCSplitReg2 *w, gpointer user_data );
-    void (*jump_cb)         ( GNCSplitReg2 *w, gpointer user_data );
+
     void (*cut_cb)          ( GNCSplitReg2 *w, gpointer user_data );
     void (*cut_txn_cb)      ( GNCSplitReg2 *w, gpointer user_data );
     void (*copy_cb)         ( GNCSplitReg2 *w, gpointer user_data );
     void (*copy_txn_cb)     ( GNCSplitReg2 *w, gpointer user_data );
     void (*paste_cb)        ( GNCSplitReg2 *w, gpointer user_data );
     void (*paste_txn_cb)    ( GNCSplitReg2 *w, gpointer user_data );
-    void (*void_txn_cb)     ( GNCSplitReg2 *w, gpointer user_data );
-    void (*unvoid_txn_cb)   ( GNCSplitReg2 *w, gpointer user_data );
-    void (*reverse_txn_cb)  ( GNCSplitReg2 *w, gpointer user_data );
+
     void (*help_changed_cb) ( GNCSplitReg2 *w, gpointer user_data );
     void (*include_date_cb) ( GNCSplitReg2 *w, time64 date, gpointer user_data );
 };
@@ -120,15 +112,8 @@ struct _GNCSplitReg2Class
 #ifdef skip // Coming from original gnc-split-reg.h
 typedef enum
 {
-    ENTER,
-    CANCEL,
-    DELETE,
-    REINIT,
-    DUPLICATE,
     SCHEDULE,
     SPLIT,
-    BLANK,
-    JUMP,
     CUT,
     CUT_TXN,
     COPY,
@@ -212,13 +197,6 @@ void gnc_split_reg2_change_style (GNCSplitReg2 *gsr, SplitRegisterStyle2 style);
  **/
 GtkWidget *gnc_split_reg2_get_summarybar (GNCSplitReg2 *gsr );
 
-/**
- * These will manipulate the in-GNCSplitReg state-reflecting widgets as
- * appropriate.
- **/
-void gnc_split_reg2_set_split_state (GNCSplitReg2 *gsr, gboolean split );
-void gnc_split_reg2_set_double_line (GNCSplitReg2 *gsr, gboolean doubleLine );
-
 void gnc_split_reg2_raise (GNCSplitReg2 *gsr );
 
 /**
@@ -229,13 +207,6 @@ void gnc_split_reg2_raise (GNCSplitReg2 *gsr );
 gboolean gnc_split_reg2_get_read_only (GNCSplitReg2 *gsr );
 
 /*
- * Function to jump to various places in the register
- */
-void gnc_split_reg2_jump_to_blank (GNCSplitReg2 *gsr);
-void gnc_split_reg2_jump_to_split (GNCSplitReg2 *gsr, Split *split);
-void gnc_split_reg2_jump_to_split_amount (GNCSplitReg2 *gsr, Split *split);
-
-/*
  * Create a transaction entry with given amount and date. One account is
  * specified, the other is undefined i.e. it defaults to orphan account.
  * Jump to the transaction entry in the register.
@@ -245,11 +216,6 @@ void gnc_split_reg2_jump_to_split_amount (GNCSplitReg2 *gsr, Split *split);
 void gnc_split_reg2_balancing_entry (GNCSplitReg2 *gsr, Account *account,
                                     time64 statement_date, gnc_numeric balancing_amount);
 
-void gsr2_default_delete_handler (GNCSplitReg2 *gsr, gpointer data );
-void gnc_split_reg2_enter (GNCSplitReg2 *gsr, gboolean next_transaction );
-void gsr2_default_delete_handler (GNCSplitReg2 *gsr, gpointer data );
-void gsr2_default_reinit_handler (GNCSplitReg2 *gsr, gpointer data );
-void gsr2_default_expand_handler (GNCSplitReg2 *gsr, gpointer data );
 void gsr2_default_schedule_handler (GNCSplitReg2 *gsr, gpointer data );
 
 void gnc_split_reg2_set_moved_cb (GNCSplitReg2 *gsr, GFunc cb, gpointer cb_data );
diff --git a/src/register/ledger-core/gnc-ledger-display2.c b/src/register/ledger-core/gnc-ledger-display2.c
index 5eccd73..0036605 100644
--- a/src/register/ledger-core/gnc-ledger-display2.c
+++ b/src/register/ledger-core/gnc-ledger-display2.c
@@ -625,6 +625,8 @@ close_handler (gpointer user_data)
 {
     GNCLedgerDisplay2 *ld = user_data;
 
+
+    ENTER(" ");
     if (!ld)
         return;
 //g_print("ledger close_handler\n");
@@ -640,6 +642,7 @@ close_handler (gpointer user_data)
     qof_query_destroy (ld->query);
     ld->query = NULL;
 
+    LEAVE(" ");
     g_free (ld);
 }
 
@@ -822,8 +825,8 @@ gnc_ledger_display2_internal (Account *lead_account, Query *q,
 
     gnc_tree_model_split_reg_set_data (ld->model, ld, gnc_ledger_display2_parent);
 
-    g_signal_connect (G_OBJECT (ld->model), "refresh_signal",
-                      G_CALLBACK ( gnc_ledger_display2_refresh_cb ), ld );
+//    g_signal_connect (G_OBJECT (ld->model), "refresh_signal",
+//                      G_CALLBACK ( gnc_ledger_display2_refresh_cb ), ld );
 
     splits = qof_query_run (ld->query);
 
diff --git a/src/gnome-utils/gnc-tree-control-split-reg.c b/src/gnome-utils/gnc-tree-control-split-reg.c
new file mode 100644
index 0000000..79a9a73
--- /dev/null
+++ b/src/gnome-utils/gnc-tree-control-split-reg.c
@@ -0,0 +1,1636 @@
+/********************************************************************\
+ * gnc-tree-control-split-reg.c -- GtkTreeView implementation       *
+ *                     to display registers in a GtkTreeView.       *
+ *                                                                  *
+ * Copyright (C) 2012 Robert Fewell                                 *
+ * Copyright (C) 2006-2007 Chris Shoemaker <c.shoemaker@cox.net>    *
+ *                                                                  *
+ * This program is free software; you can redistribute it and/or    *
+ * modify it under the terms of the GNU General Public License as   *
+ * published by the Free Software Foundation; either version 2 of   *
+ * the License, or (at your option) any later version.              *
+ *                                                                  *
+ * This program is distributed in the hope that it will be useful,  *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
+ * GNU General Public License for more details.                     *
+ *                                                                  *
+ * You should have received a copy of the GNU General Public License*
+ * along with this program; if not, contact:                        *
+ *                                                                  *
+ * Free Software Foundation           Voice:  +1-617-542-5942       *
+ * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
+ * Boston, MA  02110-1301,  USA       gnu@gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#include <libguile.h>
+#include <string.h>
+
+#include "gnc-tree-control-split-reg.h"
+#include "gnc-tree-model-split-reg.h"
+#include "gnc-tree-view-split-reg.h"
+#include "gnc-component-manager.h"
+#include "gnc-ui.h"
+#include "gnc-gconf-utils.h"
+#include "gnc-gdate-utils.h"
+#include "dialog-utils.h"
+#include "guile-util.h"
+#include "dialog-dup-trans.h"
+
+#include "Transaction.h"
+#include "engine-helpers.h"
+
+/** Static Globals *******************************************************/
+static QofLogModule log_module = GNC_MOD_LEDGER;
+
+static gboolean gtc_scroll_to_cell (GncTreeViewSplitReg *view);
+static GncTreeModelSplitReg *gtc_get_model_split_reg_from_view (GncTreeViewSplitReg *view);
+
+static SCM copied_item = SCM_UNDEFINED;
+
+/** implementations *******************************************************/
+
+/* Uses the scheme split copying routines */
+static void
+gtc_copy_split_onto_split (Split *from, Split *to, gboolean use_cut_semantics)
+{
+    SCM split_scm;
+
+    if ((from == NULL) || (to == NULL))
+        return;
+
+    split_scm = gnc_copy_split(from, use_cut_semantics);
+    if (split_scm == SCM_UNDEFINED)
+        return;
+
+    gnc_copy_split_scm_onto_split (split_scm, to, gnc_get_current_book ());
+}
+
+/* Uses the scheme transaction copying routines */
+static void
+gtc_copy_trans_onto_trans (Transaction *from, Transaction *to,
+                          gboolean use_cut_semantics,
+                          gboolean do_commit)
+{
+    SCM trans_scm;
+
+    if ((from == NULL) || (to == NULL))
+        return;
+
+    trans_scm = gnc_copy_trans(from, use_cut_semantics);
+    if (trans_scm == SCM_UNDEFINED)
+        return;
+
+    gnc_copy_trans_scm_onto_trans (trans_scm, to, do_commit,
+                                  gnc_get_current_book ());
+}
+
+
+/*************************************************************************/
+//FIXME For convienience, these functions are duplicates, needs changing 
+
+static GncTreeModelSplitReg *
+gtc_get_model_split_reg_from_view (GncTreeViewSplitReg *view)
+{
+    GtkTreeModelSort *s_model = GTK_TREE_MODEL_SORT(
+        gtk_tree_view_get_model (GTK_TREE_VIEW (view)));
+    return GNC_TREE_MODEL_SPLIT_REG (gtk_tree_model_sort_get_model (s_model));
+}
+
+
+/* Scroll the view to show selected row based on sort direction */
+static gboolean
+gtc_scroll_to_cell (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *mpath, *spath;
+
+//g_print("gtc_scroll_to_cell\n");
+
+    model = gtc_get_model_split_reg_from_view (view);
+
+    mpath = gnc_tree_view_split_reg_get_current_path (view);
+    spath = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (gtk_tree_view_get_model (GTK_TREE_VIEW (view))), mpath);
+   
+    if (view->sort_direction == 1)
+        gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), spath, NULL, TRUE, 0.0, 0.0);
+    else
+    {
+        if (model->use_double_line)
+        {
+            gtk_tree_path_down (spath); // move to the second row of transaction
+            gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), spath, NULL, TRUE, 1.0, 0.0);
+            gtk_tree_path_up (spath); // back to first row of transaction
+        }
+        else
+            gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), spath, NULL, TRUE, 1.0, 0.0);
+    }
+    gtk_tree_path_free (mpath);
+    gtk_tree_path_free (spath);
+    return (FALSE);
+}
+
+
+/* Returns a Split that matches the current Account */
+static Split *
+gtc_get_this_split (GncTreeViewSplitReg *view, Transaction *trans)
+{
+    GncTreeModelSplitReg *model;
+    int i;
+    Split *split = NULL;
+    Account *anchor;
+
+    model = gtc_get_model_split_reg_from_view (view);
+
+    anchor = gnc_tree_model_split_reg_get_anchor (model);
+
+    for (i = 0; (split = xaccTransGetSplit (trans, i)); i++) {
+        if (anchor == xaccSplitGetAccount (split))
+            return split;
+    }
+    return NULL;
+}
+
+
+/*********************************************************************************/
+
+/* Read only dialoue */
+static gboolean
+gtc_is_trans_readonly_and_warn (const Transaction *trans)
+{
+    GtkWidget *dialog;
+    const gchar *reason;
+    const gchar *title = _("Cannot modify or delete this transaction.");
+    const gchar *message =
+        _("This transaction is marked read-only with the comment: '%s'");
+
+    if (!trans) return FALSE;
+
+    if (xaccTransIsReadonlyByPostedDate (trans))
+    {
+        dialog = gtk_message_dialog_new (NULL,
+                                        0,
+                                        GTK_MESSAGE_ERROR,
+                                        GTK_BUTTONS_OK,
+                                        "%s", title);
+        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                "%s", _("The date of this transaction is older than the \"Read-Only Threshold\" set for this book.  "
+                        "This setting can be changed in File -> Properties -> Accounts."));
+        gtk_dialog_run (GTK_DIALOG (dialog));
+        gtk_widget_destroy (dialog);
+        return TRUE;
+    }
+
+    reason = xaccTransGetReadOnly (trans);
+    if (reason)
+    {
+        dialog = gtk_message_dialog_new (NULL,
+                                        0,
+                                        GTK_MESSAGE_ERROR,
+                                        GTK_BUTTONS_OK,
+                                        "%s", title);
+        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                message, reason);
+        gtk_dialog_run (GTK_DIALOG (dialog));
+        gtk_widget_destroy (dialog);
+        return TRUE;
+    }
+    return FALSE;
+}
+
+
+/* Cancel the edit and Rollback */
+void
+gnc_tree_control_split_reg_cancel_edit (GncTreeViewSplitReg *view, gboolean reg_closing)
+{
+//g_print("gnc_tree_control_split_reg_cancel_edit\n");
+    /* Make sure we have stopped editing */
+    gnc_tree_view_split_reg_finish_edit (view);
+
+    gnc_tree_view_split_reg_cancel_edit (view, reg_closing);
+}
+
+
+/* Amend the Exchange Rate of the transaction */
+void
+gnc_tree_control_split_reg_exchange_rate (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkWidget *window;
+    Account *anchor;
+    Transaction *trans;
+    Split *split = NULL;
+    Split *osplit = NULL;
+    gnc_numeric value;
+    gboolean expanded;
+    gint depth;
+    gint num_splits;
+    const char *message;
+    gnc_commodity *txn_com;
+
+//g_print("gnc_tree_control_split_reg_exchange_rate\n");
+
+    model = gtc_get_model_split_reg_from_view (view);
+
+    trans = gnc_tree_view_split_reg_get_current_trans (view);
+    expanded = gnc_tree_view_split_reg_trans_expanded (view, NULL);
+    depth = gnc_tree_view_reg_get_selected_row_depth (view);
+    num_splits = xaccTransCountSplits (trans);
+    anchor = gnc_tree_model_split_reg_get_anchor (model);
+    txn_com = xaccTransGetCurrency (trans);
+
+//g_print("anchor %p no_splits %d expanded %d and depth is %d\n", anchor, num_splits, expanded, depth);
+
+    if (gtc_is_trans_readonly_and_warn (trans))
+        return;
+
+    if (num_splits < 2)
+        return;
+
+    window = gnc_tree_view_split_reg_get_parent (view);
+
+    /* If the anchor commodity is not a currency, cancel */
+    if (anchor && !gnc_commodity_is_currency (xaccAccountGetCommodity (anchor)))
+    {
+        message = _("This register does not support editing exchange rates.");
+        gnc_error_dialog (window, "%s", message);
+        return;
+    }
+
+    /* If we're not expanded AND number of splits greater than two, nothing to do */
+    if ((num_splits > 2) && !expanded)
+    {
+        message = _("You need to expand the transaction in order to modify its "
+                    "exchange rates.");
+        gnc_error_dialog (window, "%s", message);
+        return;
+    }
+
+    if (num_splits == 2 && anchor != NULL && !expanded)
+    {
+        split = gnc_tree_control_split_reg_get_current_trans_split (view);
+        osplit = xaccSplitGetOtherSplit (split);
+
+        value = xaccSplitGetValue (split);
+
+        xaccTransBeginEdit (trans);
+        gnc_tree_view_split_reg_set_dirty_trans (view, trans);
+
+        if (txn_com == xaccAccountGetCommodity (xaccSplitGetAccount(split)))
+           gnc_tree_view_split_reg_set_value_for (view, trans, osplit, gnc_numeric_neg (value), TRUE);
+        else
+           gnc_tree_view_split_reg_set_value_for (view, trans, split, value, TRUE);
+
+        xaccTransCommitEdit (trans);
+        gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
+    }
+
+    if (num_splits > 1 && expanded && depth == 3)
+    {
+        split = gnc_tree_view_split_reg_get_current_split (view);
+
+        value = xaccSplitGetValue (split);
+
+        if (txn_com == xaccAccountGetCommodity (xaccSplitGetAccount(split)))
+        {
+            message = _("The two currencies involved equal each other.");
+            gnc_error_dialog (window, "%s", message);
+            return;
+        }
+        else
+        {
+            gnc_tree_view_split_reg_set_dirty_trans (view, trans);
+            xaccTransBeginEdit (trans);
+
+            gnc_tree_view_split_reg_set_value_for (view, trans, split, value, TRUE);
+
+            xaccTransCommitEdit (trans);
+            gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
+        }
+    }
+}
+
+
+/* Void current transaction */
+void
+gnc_tree_control_split_reg_void_current_trans (GncTreeViewSplitReg *view, const char *reason)
+{
+    Transaction *trans;
+    Split *blank_split;
+    Split *split;
+
+    if (!view) return;
+
+//g_print("gnc_tree_control_split_reg_void_current_trans\n");
+
+    blank_split = gnc_tree_control_split_reg_get_blank_split (view);
+
+    /* get the current split based on cursor position */
+    split = gnc_tree_view_split_reg_get_current_split (view);
+    if (split == NULL)
+        return;
+
+    /* Bail if trying to void the blank split. */
+    if (split == blank_split)
+        return;
+
+    /* already voided. */
+    if (xaccSplitGetReconcile (split) == VREC)
+        return;
+
+    trans = xaccSplitGetParent (split);
+
+    gnc_tree_view_split_reg_set_dirty_trans (view, trans);
+
+    xaccTransVoid (trans, reason);
+
+    if (xaccTransIsOpen (trans))
+    {
+        PERR("We should not be voiding an open transaction.");
+        xaccTransCommitEdit (trans);
+    }
+    gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
+}
+
+
+/* Unvoid current transaction */
+void
+gnc_tree_control_split_reg_unvoid_current_trans (GncTreeViewSplitReg *view)
+{
+    Transaction *trans;
+    Split *blank_split;
+    Split *split;
+
+    if (!view) return;
+
+//g_print("gnc_tree_control_split_reg_unvoid_current_trans\n");
+
+    blank_split = gnc_tree_control_split_reg_get_blank_split (view);
+
+    /* get the current split based on cursor position */
+    split = gnc_tree_view_split_reg_get_current_split (view);
+    if (split == NULL)
+        return;
+
+    /* Bail if trying to unvoid the blank split. */
+    if (split == blank_split)
+        return;
+
+    /* not voided. */
+    if (xaccSplitGetReconcile (split) != VREC)
+        return;
+
+    trans = xaccSplitGetParent (split);
+
+    gnc_tree_view_split_reg_set_dirty_trans (view, trans);
+
+    xaccTransUnvoid (trans);
+
+    gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
+}
+
+
+/* Jump to the Blank transaction, i.e. last in list */
+void
+gnc_tree_control_split_reg_jump_to_blank (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *mpath, *spath;
+
+//g_print("gnc_tree_control_split_reg_jump_to_blank\n");
+    model = gtc_get_model_split_reg_from_view (view);
+
+    mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, NULL, NULL);
+    spath = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (gtk_tree_view_get_model (GTK_TREE_VIEW (view))), mpath);
+
+    gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), spath);
+
+    gtk_tree_path_free (spath);
+    gtk_tree_path_free (mpath);
+
+    /* scroll when view idle */
+    g_idle_add ((GSourceFunc)gtc_scroll_to_cell, view );
+}
+
+
+/* Jump to split */
+void
+gnc_tree_control_split_reg_jump_to_split (GncTreeViewSplitReg *view, Split *split)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *mpath, *spath;
+
+//g_print("gnc_tree_control_split_reg_jump_to_split and split is %p\n", split);
+
+    model = gtc_get_model_split_reg_from_view (view);
+
+    mpath = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, split, NULL);
+    spath = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (gtk_tree_view_get_model (GTK_TREE_VIEW (view))), mpath);
+
+    gnc_tree_view_split_reg_set_current_path (view, spath);
+
+    gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), spath);
+
+    gtk_tree_path_free (spath);
+    gtk_tree_path_free (mpath);
+
+    /* scroll when view idle */
+    g_idle_add ((GSourceFunc)gtc_scroll_to_cell, view );
+}
+
+
+/* Returns the Blank Transaction */
+Transaction * 
+gnc_tree_control_split_reg_get_blank_trans (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+
+//g_print("gnc_tree_control_split_reg_get_blank_trans\n");
+    model = gtc_get_model_split_reg_from_view (view);
+
+    return gnc_tree_model_split_get_blank_trans (model);
+}
+
+
+/* Return the Split for the current Transaction */
+Split *
+gnc_tree_control_split_reg_get_current_trans_split (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *path;
+    GtkTreeIter iter;
+    Split *split = NULL;
+    Transaction *trans = NULL;
+    gboolean is_trow1, is_trow2, is_split, is_blank;
+
+//g_print("gnc_tree_control_reg_get_current_trans_split\n");
+    model = gtc_get_model_split_reg_from_view (view);
+
+    path = gnc_tree_view_split_reg_get_current_path (view);
+
+    gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, path);
+
+    gnc_tree_model_split_reg_get_split_and_trans (
+            GNC_TREE_MODEL_SPLIT_REG (model), &iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
+
+    split = gtc_get_this_split (view, trans);
+
+    gtk_tree_path_free (path);
+
+//g_print("gnc_tree_control_reg_get_current_trans_split %p\n", split);
+
+    return split;
+}
+
+
+/* Returns the Blank Split */
+Split * 
+gnc_tree_control_split_reg_get_blank_split (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+
+//g_print("gnc_tree_view_split_reg_get_blank_split\n");
+    model = gtc_get_model_split_reg_from_view (view);
+
+    return gnc_tree_model_split_get_blank_split (model);
+}
+
+
+/* Move to the relative transaction */
+void
+gnc_tree_control_split_reg_goto_rel_trans_row (GncTreeViewSplitReg *view, gint relative)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *mpath, *spath;
+    GtkTreePath *new_path;
+    gint *indices;
+
+//g_print("gnc_tree_control_split_reg_goto_rel_trans_row %d\n", relative);
+//FIXME Do we need to do some checks on relative maybe  -1,0,1 ??
+
+    model = gtc_get_model_split_reg_from_view (view);
+
+    mpath = gnc_tree_view_split_reg_get_current_path (view);
+//g_print("mpath is %s\n", gtk_tree_path_to_string (mpath));
+    spath = gtk_tree_model_sort_convert_child_path_to_path (GTK_TREE_MODEL_SORT (gtk_tree_view_get_model (GTK_TREE_VIEW (view))), mpath);
+//g_print("spath is %s\n", gtk_tree_path_to_string (spath));
+
+//g_print("sort_direction is %d\n", view->sort_direction);
+
+    indices = gtk_tree_path_get_indices (spath);
+
+    new_path = gtk_tree_path_new_from_indices (indices[0] + (relative * view->sort_direction), -1);
+
+//g_print("new_path is %s\n", gtk_tree_path_to_string (new_path));
+
+    gnc_tree_view_split_reg_set_current_path (view, new_path);
+
+    gnc_tree_view_split_reg_block_selection (view, TRUE);
+    gtk_tree_selection_unselect_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), spath);
+    gnc_tree_view_split_reg_block_selection (view, FALSE);
+    gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), new_path);
+
+    gtk_tree_path_free (new_path);
+    gtk_tree_path_free (spath);
+    gtk_tree_path_free (mpath);
+}
+
+
+/* Enter the transaction */
+void
+gnc_tree_control_split_reg_enter (GncTreeViewSplitReg *view, gboolean next_transaction)
+{
+    GncTreeModelSplitReg *model;
+    gboolean goto_blank;
+
+    ENTER("view=%p, next_transaction=%s", view, next_transaction ? "TRUE" : "FALSE");
+//g_print("gnc_tree_control_split_reg_enter\n");
+
+    model = gtc_get_model_split_reg_from_view (view);
+
+    goto_blank = gnc_gconf_get_bool (GCONF_GENERAL_REGISTER,
+                                    "enter_moves_to_end", NULL);
+
+    /* If we are in single or double line mode and we hit enter
+     * on the blank split, go to the blank split instead of the
+     * next row. This prevents the cursor from jumping around
+     * when you are entering transactions. */
+    if ( !goto_blank && !next_transaction )
+    {
+        SplitRegisterStyle2 style = model->style;
+
+        if (style == REG2_STYLE_LEDGER)
+        {
+            Split *blank_split;
+
+            blank_split = gnc_tree_control_split_reg_get_blank_split (view);
+            if (blank_split != NULL)
+            {
+                Split *current_split;
+
+                current_split = gnc_tree_view_split_reg_get_current_split (view);
+
+                if (blank_split == current_split)
+                    goto_blank = TRUE;
+            }
+        }
+    }
+
+    /* First record the transaction */
+    if (gnc_tree_view_split_reg_enter (view))
+    {
+        if (!goto_blank && next_transaction)
+            gnc_tree_view_split_reg_collapse_trans (view, NULL);
+
+        /* Now move. */
+        if (goto_blank)
+            gnc_tree_control_split_reg_jump_to_blank (view);
+        else if (next_transaction)
+            gnc_tree_control_split_reg_goto_rel_trans_row (view, 1);
+    }
+    LEAVE(" ");
+}
+
+
+/* Reinit the transaction */
+void
+gnc_tree_control_split_reg_reinit (GncTreeViewSplitReg *view, gpointer data)
+{
+    Transaction *trans;
+    Split *split;
+    GtkWidget *dialog, *window;
+    gint response;
+    const gchar *warning;
+
+    const char *title = _("Remove the splits from this transaction?");
+    const char *recn_warn = _("This transaction contains reconciled splits. "
+                              "Modifying it is not a good idea because that will "
+                              "cause your reconciled balance to be off.");
+
+//g_print("gnc_tree_control_split_reg_reinit\n");
+
+
+    trans = gnc_tree_view_split_reg_get_current_trans (view);
+    if (gtc_is_trans_readonly_and_warn (trans))
+        return;
+
+    window = gnc_tree_view_split_reg_get_parent (view);
+
+    dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                    GTK_MESSAGE_WARNING,
+                                    GTK_BUTTONS_NONE,
+                                    "%s", title);
+    if (xaccTransHasReconciledSplits (trans))
+    {
+        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                "%s", recn_warn);
+        warning = "register_remove_all_splits2";
+    }
+    else
+    {
+        warning = "register_remove_all_splits";
+    }
+
+    gtk_dialog_add_button (GTK_DIALOG (dialog),
+                          GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+    gnc_gtk_dialog_add_button(dialog, _("_Remove Splits"),
+                              GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT);
+    response = gnc_dialog_run (GTK_DIALOG(dialog), warning);
+    gtk_widget_destroy (dialog);
+    if (response != GTK_RESPONSE_ACCEPT)
+        return;
+
+    gnc_tree_view_split_reg_reinit_trans (view);
+}
+
+
+/* Delete the currently selected item */
+void
+gnc_tree_control_split_reg_delete (GncTreeViewSplitReg *view, gpointer data)
+{
+    RowDepth depth;
+    Transaction *trans;
+    Split *split;
+    GtkWidget *dialog, *window;
+    gint response;
+    const gchar *warning;
+
+//g_print("gnc_tree_control_split_reg_delete\n");
+
+    /* get the current split based on cursor position */
+    split = gnc_tree_view_split_reg_get_current_split (view);
+    if (split == NULL)
+    {
+        return;
+    }
+
+    trans = xaccSplitGetParent (split);
+    depth = gnc_tree_view_reg_get_selected_row_depth (view);
+
+    /* Deleting the blank split just cancels */
+    {
+        Split *blank_split = gnc_tree_control_split_reg_get_blank_split (view);
+
+        if (split == blank_split)
+        {
+            return;
+        }
+    }
+
+    if (gtc_is_trans_readonly_and_warn (trans))
+        return;
+
+    window = gnc_tree_view_split_reg_get_parent (view);
+
+    /* On a split cursor, just delete the one split. */
+    if (depth == SPLIT3)
+    {
+        const char *format = _("Delete the split '%s' from the transaction '%s'?");
+        const char *recn_warn = _("You would be deleting a reconciled split! "
+                                  "This is not a good idea as it will cause your "
+                                  "reconciled balance to be off.");
+        const char *anchor_error = _("You cannot delete this split.");
+        const char *anchor_split = _("This is the split anchoring this transaction "
+                                     "to the register. You may not delete it from "
+                                     "this register window.  You may delete the "
+                                     "entire transaction from this window, or you "
+                                     "may navigate to a register that shows "
+                                     "another side of this same transaction and "
+                                     "delete the split from that register.");
+        char *buf = NULL;
+        const char *memo;
+        const char *desc;
+        char recn;
+
+        if (split == gnc_tree_control_split_reg_get_current_trans_split (view))
+        {
+            dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                                            GTK_DIALOG_MODAL
+                                            | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                            GTK_MESSAGE_ERROR,
+                                            GTK_BUTTONS_OK,
+                                            "%s", anchor_error);
+            gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                    "%s", anchor_split);
+            gtk_dialog_run (GTK_DIALOG (dialog));
+            gtk_widget_destroy (dialog);
+            return;
+        }
+
+        memo = xaccSplitGetMemo (split);
+        memo = (memo && *memo) ? memo : _("(no memo)");
+
+        desc = xaccTransGetDescription (trans);
+        desc = (desc && *desc) ? desc : _("(no description)");
+
+        /* ask for user confirmation before performing permanent damage */
+        buf = g_strdup_printf (format, memo, desc);
+        dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                                        GTK_DIALOG_MODAL
+                                        | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                        GTK_MESSAGE_QUESTION,
+                                        GTK_BUTTONS_NONE,
+                                        "%s", buf);
+        g_free(buf);
+        recn = xaccSplitGetReconcile (split);
+        if (recn == YREC || recn == FREC)
+        {
+            gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                    "%s", recn_warn);
+            warning = "register_delete_split2";
+        }
+        else
+        {
+            warning = "register_delete_split";
+        }
+
+        gtk_dialog_add_button (GTK_DIALOG (dialog),
+                              GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+        gnc_gtk_dialog_add_button (dialog, _("_Delete Split"),
+                                  GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT);
+        response = gnc_dialog_run (GTK_DIALOG (dialog), warning);
+        gtk_widget_destroy (dialog);
+        if (response != GTK_RESPONSE_ACCEPT)
+            return;
+
+        gnc_tree_view_split_reg_delete_current_split (view);
+        return;
+    }
+
+    g_return_if_fail (depth == TRANS1 || depth == TRANS2);
+
+    /* On a transaction cursor with 2 or fewer splits in single or double
+     * mode, we just delete the whole transaction, kerblooie */
+    {
+        const char *title = _("Delete the current transaction?");
+        const char *recn_warn = _("You would be deleting a transaction "
+                                  "with reconciled splits! "
+                                  "This is not a good idea as it will cause your "
+                                  "reconciled balance to be off.");
+
+        dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                                        GTK_DIALOG_MODAL
+                                        | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                        GTK_MESSAGE_WARNING,
+                                        GTK_BUTTONS_NONE,
+                                        "%s", title);
+        if (xaccTransHasReconciledSplits (trans))
+        {
+            gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                    "%s", recn_warn);
+            warning = "register_delete_trans2";
+        }
+        else
+        {
+            warning = "register_delete_trans";
+        }
+        gtk_dialog_add_button (GTK_DIALOG (dialog),
+                              GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+        gnc_gtk_dialog_add_button (dialog, _("_Delete Transaction"),
+                                  GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT);
+        response =  gnc_dialog_run (GTK_DIALOG (dialog), warning);
+        gtk_widget_destroy (dialog);
+        if (response != GTK_RESPONSE_ACCEPT)
+            return;
+
+        gnc_tree_view_split_reg_delete_current_trans (view);
+        return;
+    }
+}
+
+
+/* Add Reverse Transaction */
+void
+gnc_tree_control_split_reg_reverse_current (GncTreeViewSplitReg *view)
+{
+    GtkWidget *window;
+    Transaction *trans = NULL, *new_trans = NULL;
+
+//g_print("gnc_tree_control_split_reg_reverse_current\n");
+
+    trans = gnc_tree_view_split_reg_get_current_trans (view);
+
+    if (trans == NULL)
+        return;
+
+//FIXME Need same tests as duplicate ?????
+
+    window = gnc_tree_view_split_reg_get_parent (view);
+
+    /* Make sure we have stopped editing */
+    gnc_tree_view_split_reg_finish_edit (view);
+
+    /* See if we were asked to reverse a blank trans. */
+    if (trans == gnc_tree_control_split_reg_get_blank_trans (view))
+    {
+        LEAVE("skip blank trans");
+        return;
+    }
+
+    if (xaccTransGetReversedBy (trans))
+    {
+        gnc_error_dialog (window, "%s",
+                         _("A reversing entry has already been created for this transaction."));
+        return;
+    }
+
+    xaccTransBeginEdit (trans);
+
+    gnc_tree_view_split_reg_set_dirty_trans (view, trans);
+
+    new_trans = xaccTransReverse (trans);
+
+    /* Clear transaction level info */
+    xaccTransSetDatePostedSecs (new_trans, gnc_time (NULL));
+    xaccTransSetDateEnteredSecs (new_trans, gnc_time (NULL));
+
+    xaccTransCommitEdit (trans);
+
+    gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
+
+    /* Now jump to new trans */
+    gnc_tree_control_split_reg_jump_to_split (view, xaccTransGetSplit (new_trans, 0));
+}
+
+
+/* Duplicate the current selection */
+gboolean
+gnc_tree_control_split_reg_duplicate_current (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkWidget *window;
+    RowDepth depth;
+    Transaction *trans;
+    Split *blank_split;
+    Split *split, *trans_split;
+    gboolean changed = FALSE;
+
+    ENTER("");
+
+//g_print("gnc_tree_control_split_reg_duplicate_current\n");
+
+    model = gtc_get_model_split_reg_from_view (view);
+
+    blank_split = gnc_tree_control_split_reg_get_blank_split (view);
+    split = gnc_tree_view_split_reg_get_current_split (view);
+    trans_split = gnc_tree_control_split_reg_get_current_trans_split (view);
+    trans = gnc_tree_view_split_reg_get_current_trans (view);
+    depth = gnc_tree_view_reg_get_selected_row_depth (view);
+
+    /* This shouldn't happen, but be paranoid. */
+    if (trans == NULL)
+    {
+        LEAVE("no transaction");
+        return FALSE;
+    }
+
+    if (gtc_is_trans_readonly_and_warn (trans))
+        return FALSE;
+
+    /* Make sure we have stopped editing */
+    gnc_tree_view_split_reg_finish_edit (view);
+
+    /* See if we are editing this transcation all ready */
+    if (trans == gnc_tree_view_split_reg_get_dirty_trans (view))
+        changed = TRUE;
+
+    /* See if we were asked to duplicate a blank split. */
+    if (split == gnc_tree_control_split_reg_get_blank_split (view))
+    {
+        LEAVE("skip blank split");
+        return FALSE;
+    }
+
+    /* See if we were asked to duplicate a blank trans. */
+    if (trans == gnc_tree_control_split_reg_get_blank_trans (view))
+    {
+        LEAVE("skip blank trans");
+        return FALSE;
+    }
+
+    gnc_suspend_gui_refresh ();
+
+    window = gnc_tree_view_split_reg_get_parent (view);
+
+    /* If the cursor has been edited, we are going to have to commit
+     * it before we can duplicate. Make sure the user wants to do that. */
+    if (changed)
+    {
+        GtkWidget *dialog;
+        gint response;
+        const char *title = _("Save transaction before duplicating?");
+        const char *message =
+            _("The current transaction has been changed. Would you like to "
+              "record the changes before duplicating the transaction, or "
+              "cancel the duplication?");
+
+        dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                                        GTK_DIALOG_DESTROY_WITH_PARENT,
+                                        GTK_MESSAGE_QUESTION,
+                                        GTK_BUTTONS_CANCEL,
+                                        "%s", title);
+        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                "%s", message);
+        gtk_dialog_add_button (GTK_DIALOG (dialog),
+                              _("_Record"), GTK_RESPONSE_ACCEPT);
+        response = gnc_dialog_run (GTK_DIALOG (dialog), "transaction_duplicated");
+        gtk_widget_destroy (dialog);
+
+        if (response != GTK_RESPONSE_ACCEPT)
+        {
+            gnc_resume_gui_refresh ();
+            LEAVE("save cancelled");
+            return FALSE;
+        }
+
+//FIXME is this ok, was - gnc_split_register_save (reg, TRUE);
+
+        xaccTransCommitEdit (trans);
+        gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
+    }
+
+    /* Ok, we are now ready to make the copy. */
+
+    if (depth == SPLIT3)
+    {
+        Split *new_split;
+
+        /* We are on a split in an expanded transaction.
+         * Just copy the split and add it to the transaction. */
+
+        if (split != trans_split)
+        {
+            new_split = xaccMallocSplit (gnc_get_current_book ());
+
+            xaccTransBeginEdit (trans);
+            xaccSplitSetParent (new_split, trans);
+            gtc_copy_split_onto_split (split, new_split, FALSE);
+            xaccTransCommitEdit (trans);
+        }
+        else
+        {
+            gnc_error_dialog (window, "%s",
+                         _("This is the split anchoring this transaction to the register."
+                           " You can not duplicate it from this register window."));
+            return FALSE;
+        }
+    }
+    else
+    {
+        Transaction *new_trans;
+        const char *in_num = NULL;
+        const char *in_tnum = NULL;
+        char *out_num;
+        char *out_tnum;
+        time64 date;
+        gboolean use_autoreadonly = qof_book_uses_autoreadonly (gnc_get_current_book());
+        gboolean use_split_action_for_num_field = qof_book_use_split_action_for_num_field
+                           (gnc_get_current_book());
+
+        /* We are on a transaction row. Copy the whole transaction. */
+
+        date = time (0);
+        if (gnc_strisnum (xaccTransGetNum (trans)))
+        {
+            Account *account = gnc_tree_model_split_reg_get_anchor (model);
+            if (account)
+                in_num = xaccAccountGetLastNum (account);
+            else
+                in_num = xaccTransGetNum (trans);
+            in_tnum = (use_split_action_for_num_field
+                                        ? NULL
+                                        : gnc_get_num_action (trans, NULL)); //FIXME is this right way round ?
+        }
+
+        if (!gnc_dup_trans_dialog (window, NULL, TRUE,
+                                   &date, in_num, &out_num, in_tnum, &out_tnum))
+        {
+            gnc_resume_gui_refresh ();
+            LEAVE("dup cancelled");
+            return FALSE;
+        }
+
+        if (use_autoreadonly)
+        {
+            GDate d;
+            GDate *readonly_threshold = qof_book_get_autoreadonly_gdate (gnc_get_current_book());
+            gnc_gdate_set_time64 (&d, date);
+            if (g_date_compare (&d, readonly_threshold) < 0)
+            {
+                GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                                    0,
+                                    GTK_MESSAGE_ERROR,
+                                    GTK_BUTTONS_OK,
+                                    "%s", _("Cannot store a transaction at this date"));
+                gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                        "%s", _("The entered date of the duplicated transaction is older than the \"Read-Only Threshold\" set for this book.  "
+                                "This setting can be changed in File -> Properties -> Accounts."));
+                gtk_dialog_run (GTK_DIALOG (dialog));
+                gtk_widget_destroy (dialog);
+
+                g_date_free (readonly_threshold);
+                return FALSE;
+            }
+            g_date_free (readonly_threshold);
+        }
+
+        new_trans = xaccMallocTransaction (gnc_get_current_book ());
+
+        xaccTransBeginEdit (new_trans);
+        gtc_copy_trans_onto_trans (trans, new_trans, FALSE, FALSE);
+        xaccTransSetDatePostedSecs (new_trans, date);
+        xaccTransSetNum (new_trans, out_num);
+        xaccTransCommitEdit (new_trans);
+
+    }
+
+    /* Refresh the GUI. */
+    gnc_resume_gui_refresh ();
+
+    LEAVE(" ");
+    return TRUE;
+}
+
+
+/* Save any open edited transactions on closing register */
+gboolean
+gnc_tree_control_split_reg_save (GncTreeViewSplitReg *view, gboolean reg_closing)
+{
+    GncTreeModelSplitReg *model;
+    RowDepth depth;
+    Transaction *pending_trans;
+    Transaction *blank_trans;
+    Transaction *trans;
+    Account *account;
+    Split *blank_split;
+    const char *memo;
+    const char *desc;
+    Split *split, *current_trans_split;
+
+    ENTER("view=%p, reg_closing=%s", view, reg_closing ? "TRUE" : "FALSE");
+
+//g_print("gnc_tree_control_split_reg_save reg_closing is %d\n", reg_closing);
+
+    if (!view)
+    {
+        LEAVE("no view");
+        return FALSE;
+    }
+
+    /* Make sure we have stopped editing */
+    gnc_tree_view_split_reg_finish_edit (view);
+
+    if (reg_closing)
+        view->reg_closing = TRUE;
+
+    model = gtc_get_model_split_reg_from_view (view);
+
+    blank_split = gnc_tree_control_split_reg_get_blank_split (view);
+    pending_trans = gnc_tree_view_split_reg_get_dirty_trans (view);
+    blank_trans = gnc_tree_control_split_reg_get_blank_trans (view);
+
+    /* get the handle to the current split and transaction */
+    split = gnc_tree_view_split_reg_get_current_split (view);
+    trans = gnc_tree_view_split_reg_get_current_trans (view);
+
+    current_trans_split = gnc_tree_control_split_reg_get_current_trans_split (view);
+
+    if (trans == NULL)
+    {
+        LEAVE("no transaction");
+        return FALSE;
+    }
+
+    if (!xaccTransIsOpen (trans))
+    {
+        LEAVE("transaction not open");
+        return FALSE;
+    }
+
+    if (trans == pending_trans )
+    {
+        if (trans != blank_trans)
+        {
+           /* Existing Transaction, we are going to commit. */
+
+            PINFO("committing trans (%p)", trans);
+//g_print("Save trans (%p)\n", trans);
+            xaccTransCommitEdit (trans);
+            gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
+
+            LEAVE("Existing Transaction committed");
+            return TRUE;
+        }
+        else
+        {
+           /* Blank Transaction, we are going to commit. */
+
+            PINFO("start committing blank trans (%p)", trans);
+//g_print("Save blank trans (%p)\n", trans);
+//FIXME More stuff ?
+
+            if (xaccTransCountSplits (trans) == 0)
+            {
+                GtkWidget *dialog, *window;
+                gint response;
+                const char *title = _("Not enough information for Blank Transaction?");
+                const char *message =
+                    _("The blank transaction does not have enough information to save it. Would you like to "
+                      "return to the transaction to update, or cancel the save?");
+                window = gnc_tree_view_split_reg_get_parent (view);
+                dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                                        GTK_DIALOG_DESTROY_WITH_PARENT,
+                                        GTK_MESSAGE_QUESTION,
+                                        GTK_BUTTONS_CANCEL,
+                                        "%s", title);
+                gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                        "%s", message);
+                gtk_dialog_add_button (GTK_DIALOG (dialog),
+                              _("_Return"), GTK_RESPONSE_ACCEPT);
+
+                gtk_widget_grab_focus (gtk_dialog_get_widget_for_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT));
+
+                response = gtk_dialog_run (GTK_DIALOG (dialog));
+//                response = gnc_dialog_run (GTK_DIALOG (dialog), "transaction_incomplete");
+                gtk_widget_destroy (dialog);
+
+                if (response != GTK_RESPONSE_ACCEPT)
+                {
+                    LEAVE("save cancelled");
+                    return TRUE;
+                }
+
+                return FALSE;
+            }
+
+            xaccTransCommitEdit (trans);
+            gnc_tree_view_split_reg_set_dirty_trans (view, NULL);
+
+            LEAVE("Blank Transaction committed");
+            return TRUE;
+        }
+    }
+
+    LEAVE(" ");
+    return TRUE;
+}
+
+
+/* Allow the reconcile flag to be changed */
+gboolean
+gnc_tree_control_split_reg_recn_change (GncTreeViewSplitReg *view)
+{
+    GtkWidget *dialog, *window;
+    gint response;
+    Transaction *trans;
+    Split *split;
+    RowDepth depth;
+    char rec;
+    const gchar *title = _("Mark split as unreconciled?");
+    const gchar *message =
+        _("You are about to mark a reconciled split as unreconciled.  Doing "
+          "so might make future reconciliation difficult!  Continue "
+          "with this change?");
+
+//g_print("gnc_tree_control_split_reg_recn_change\n");
+
+    ENTER(" ");
+
+    depth = gnc_tree_view_reg_get_selected_row_depth (view);
+
+    if (depth == SPLIT3)
+        split = gnc_tree_view_split_reg_get_current_split (view);
+    else
+        split = gnc_tree_control_split_reg_get_current_trans_split (view);
+
+    rec = xaccSplitGetReconcile (split);
+
+    if (rec != YREC)
+    {
+        LEAVE("Not reconciled");
+        return TRUE;
+    }
+
+//g_print("gnc_tree_control_split_reg_recn_change - split %p, depth is %d\n", split, depth);
+
+    /* Does the user want to be warned? */
+    window = gnc_tree_view_split_reg_get_parent (view);
+    dialog =
+        gtk_message_dialog_new (GTK_WINDOW (window),
+                               GTK_DIALOG_DESTROY_WITH_PARENT,
+                               GTK_MESSAGE_WARNING,
+                               GTK_BUTTONS_CANCEL,
+                               "%s", title);
+    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+            "%s", message);
+    gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Unreconcile"),
+                          GTK_RESPONSE_YES);
+    response = gnc_dialog_run (GTK_DIALOG (dialog), "mark_split_unreconciled");
+    gtk_widget_destroy (dialog);
+
+    if (response == GTK_RESPONSE_YES)
+    {
+        char rec = 'n';
+        trans = xaccSplitGetParent (split);
+
+        gnc_tree_view_split_reg_set_dirty_trans (view, trans);
+        xaccTransBeginEdit (trans);
+
+        xaccSplitSetReconcile (split, rec);
+
+        LEAVE("mark split unreconciled");
+        return FALSE;
+    }
+    LEAVE("Canceled split unreconciled");
+    return TRUE;
+}
+
+
+/* Test for splits being reconciled and decide to allow changes */
+gboolean
+gnc_tree_control_split_reg_recn_test (GncTreeViewSplitReg *view)
+{
+    Transaction *trans;
+    Split *split;
+    RowDepth depth;
+    char recn;
+
+//g_print("gnc_tree_control_split_reg_recn_test\n");
+    ENTER(" ");
+
+    /* This assumes we reset the flag whenever we change splits. */
+    if (view->change_allowed)
+        return TRUE;
+
+    depth = gnc_tree_view_reg_get_selected_row_depth (view);
+
+    if (depth == SPLIT3)
+        split = gnc_tree_view_split_reg_get_current_split (view);
+    else
+        split = gnc_tree_control_split_reg_get_current_trans_split (view);
+
+    if (!split)
+        return TRUE;
+
+    trans = xaccSplitGetParent (split);
+
+    recn = xaccSplitGetReconcile (split);
+
+    if (recn == YREC || xaccTransHasReconciledSplits (trans))
+    {
+        GtkWidget *dialog, *window;
+        gint response;
+        const gchar *title;
+        const gchar *message;
+
+        if(recn == YREC)
+        {
+            title = _("Change reconciled split?");
+            message =
+             _("You are about to change a reconciled split.  Doing so might make "
+               "future reconciliation difficult!  Continue with this change?");
+        }
+        else
+        {
+            title = _("Change split linked to a reconciled split?");
+            message =
+            _("You are about to change a split that is linked to a reconciled split.  "
+              "Doing so might make future reconciliation difficult!  Continue with this change?");
+        }
+
+        /* Does the user want to be warned? */
+        window = gnc_tree_view_split_reg_get_parent (view);
+        dialog =
+            gtk_message_dialog_new (GTK_WINDOW (window),
+                                   GTK_DIALOG_DESTROY_WITH_PARENT,
+                                   GTK_MESSAGE_WARNING,
+                                   GTK_BUTTONS_CANCEL,
+                                   "%s", title);
+        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                "%s", message);
+        gtk_dialog_add_button (GTK_DIALOG (dialog), _("Chan_ge Split"),
+                              GTK_RESPONSE_YES);
+        response = gnc_dialog_run (GTK_DIALOG (dialog), "change_reconciled_split");
+        gtk_widget_destroy (dialog);
+
+        if (response != GTK_RESPONSE_YES)
+            return FALSE;
+    }
+    view->change_allowed = TRUE;
+    return TRUE;
+}
+
+
+/*****************************************************************************/
+
+/* Sort changed callback */
+void
+gnc_tree_control_split_reg_sort_changed_cb (GtkTreeSortable *sortable, gpointer user_data)
+{
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    GtkSortType   type;
+    gint          sortcol;
+    gint          sort_depth;
+    const gchar  *gconf_section;
+
+    gtk_tree_sortable_get_sort_column_id (sortable, &sortcol, &type);
+//g_print("gnc_tree_control_split_reg_sort_changed_cb, sortcol is %d \n", sortcol);
+
+    sort_depth = gnc_tree_view_reg_get_selected_row_depth (view);
+    if (sort_depth != 0)  
+        view->sort_depth = sort_depth;
+
+    view->sort_col = sortcol - 1;
+
+    if (type == GTK_SORT_ASCENDING)
+        view->sort_direction = 1;
+    else
+        view->sort_direction = -1;
+
+    /* Save the sort depth to gconf */
+    gconf_section = gnc_tree_view_get_gconf_section (GNC_TREE_VIEW (view));
+    gnc_gconf_set_int (gconf_section, "sort_depth", view->sort_depth, NULL);
+
+//g_print("sort_col %d, sort_direction is %d  sort_depth is %d\n", view->sort_col, view->sort_direction, view->sort_depth );
+
+}
+
+
+/* Sort function for Date column */
+gint
+gnc_tree_control_split_reg_sort_by_date (GtkTreeModel *tm, GtkTreeIter *a, GtkTreeIter *b,
+                  gpointer user_data)
+{
+    GncTreeModelSplitReg *model  = GNC_TREE_MODEL_SPLIT_REG (tm);
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    GList *tnode;
+    Transaction *transa, *transb;
+    int depth;
+    time64 i, j;
+    int retval;
+
+//g_print("date view is %p\n", view);
+
+    if (gnc_tree_model_split_reg_is_blank_trans (model, a)) return 1;
+    if (gnc_tree_model_split_reg_is_blank_trans (model, b)) return -1;
+
+    tnode = a->user_data2;
+    transa = tnode->data;
+
+    tnode = b->user_data2;
+    transb = tnode->data;
+
+    depth = view->sort_depth;
+//g_print("depth is %d\n", depth);
+    switch (depth) {
+        case 1: // Date Posted
+        retval = xaccTransOrder (transa, transb);
+        if (retval)
+           return retval;
+
+        break;
+        case 2: // Date Entered
+        i = xaccTransGetDateEntered (transa);
+        j = xaccTransGetDateEntered (transb);
+
+        if ((gint)(i - j) == 0)
+        {
+            i = xaccTransGetDate (transb);
+            j = xaccTransGetDate (transa);
+        }
+
+        return (gint)(i - j);
+        break;
+    }
+    return 0;
+}
+
+
+/* Sort function for Number / Action column */
+gint
+gnc_tree_control_split_reg_sort_by_numact (GtkTreeModel *tm, GtkTreeIter *a, GtkTreeIter *b,
+                  gpointer user_data)
+{
+    GncTreeModelSplitReg *model  = GNC_TREE_MODEL_SPLIT_REG (tm);
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    GList *tnode;
+    Transaction *transa, *transb;
+    Account *anchor;
+    int depth;
+    time64 i, j;
+    int na, nb, retval;
+    const char *ca, *cb;
+
+//g_print("numact view is %p\n", view);
+
+    if (gnc_tree_model_split_reg_is_blank_trans (model, a)) return 1;
+    if (gnc_tree_model_split_reg_is_blank_trans (model, b)) return -1;
+
+    tnode = a->user_data2;
+    transa = tnode->data;
+
+    tnode = b->user_data2;
+    transb = tnode->data;
+
+    depth = view->sort_depth;
+//g_print("depth is %d\n", depth);
+    switch (depth) {
+        case 1: // Number
+
+        na = atoi (xaccTransGetNum (transa)); 
+        nb = atoi (xaccTransGetNum (transb)); 
+
+        if (na < nb) return -1;
+        if (na > nb) return +1;
+
+        break;
+        case 2: // Action
+//FIXME this may be needed for this one (!qof_book_use_split_action_for_num_field (gnc_get_current_book()))
+
+        anchor = gnc_tree_model_split_reg_get_anchor (model);
+
+        if (anchor != NULL)
+        {
+            ca = xaccSplitGetAction (xaccTransFindSplitByAccount (transa, anchor))
+               ? xaccSplitGetAction (xaccTransFindSplitByAccount (transa, anchor)) : "";
+            cb = xaccSplitGetAction (xaccTransFindSplitByAccount (transb, anchor))
+               ? xaccSplitGetAction (xaccTransFindSplitByAccount (transb, anchor)) : "";
+        }
+        else
+            ca = cb = "Text";
+
+        retval = g_utf8_collate (ca, cb);
+        if (retval)
+           return retval;
+        break;
+    }
+    return 0;
+}
+
+
+/* Sort function for 'Description / Notes / Memo' column */
+gint
+gnc_tree_control_split_reg_sort_by_dnm (GtkTreeModel *tm, GtkTreeIter *a, GtkTreeIter *b,
+                  gpointer user_data)
+{
+    GncTreeModelSplitReg *model  = GNC_TREE_MODEL_SPLIT_REG (tm);
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    Transaction *transa, *transb;
+    Account *anchor;
+    GList *tnode;
+    const char *ca, *cb;
+    int depth;
+    int retval;
+
+//g_print("dnm view is %p\n", view);
+
+    if (gnc_tree_model_split_reg_is_blank_trans (model, a)) return 1;
+    if (gnc_tree_model_split_reg_is_blank_trans (model, b)) return -1;
+
+    tnode = a->user_data2;
+    transa = tnode->data;
+
+    tnode = b->user_data2;
+    transb = tnode->data;
+
+    depth = view->sort_depth;
+//g_print("depth is %d\n", depth);
+    switch (depth) {
+        case 1: // Description
+        ca = xaccTransGetDescription (transa) ? xaccTransGetDescription (transa) : "";
+        cb = xaccTransGetDescription (transb) ? xaccTransGetDescription (transb) : "";
+
+        retval = g_utf8_collate (ca, cb);
+        if (retval)
+           return retval;
+
+        break;
+        case 2: // Notes
+        ca = xaccTransGetNotes (transa) ? xaccTransGetNotes (transa) : "";
+        cb = xaccTransGetNotes (transb) ? xaccTransGetNotes (transb) : "";
+
+        retval = g_utf8_collate (ca, cb);
+        if (retval)
+           return retval;
+
+        break;
+        case 3: // Memo
+        anchor = gnc_tree_model_split_reg_get_anchor (model);
+
+        if (anchor != NULL)
+        {
+            ca = xaccSplitGetMemo (xaccTransFindSplitByAccount (transa, anchor))
+               ? xaccSplitGetMemo (xaccTransFindSplitByAccount (transa, anchor)) : "";
+            cb = xaccSplitGetMemo (xaccTransFindSplitByAccount (transb, anchor))
+               ? xaccSplitGetMemo (xaccTransFindSplitByAccount (transb, anchor)) : "";
+        }
+        else
+            ca = cb = "Text";
+
+        retval = g_utf8_collate (ca, cb);
+        if (retval)
+           return retval;
+
+        break;
+    }
+    return 0;
+}
+
+
+/* Sort function for Reconcile column */
+gint
+gnc_tree_control_split_reg_sort_by_recn (GtkTreeModel *tm, GtkTreeIter *a, GtkTreeIter *b,
+                  gpointer user_data)
+{
+    GncTreeModelSplitReg *model  = GNC_TREE_MODEL_SPLIT_REG (tm);
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    GList *tnode;
+    Transaction *transa, *transb;
+
+    Account *anchor;
+    int depth;
+
+    int na = 0, nb = 0, retval;
+
+//g_print("recn view is %p\n", view);
+
+    if (gnc_tree_model_split_reg_is_blank_trans (model, a)) return 1;
+    if (gnc_tree_model_split_reg_is_blank_trans (model, b)) return -1;
+
+    tnode = a->user_data2;
+    transa = tnode->data;
+
+    tnode = b->user_data2;
+    transb = tnode->data;
+
+    depth = view->sort_depth;
+//g_print("depth is %d\n", depth);
+    anchor = gnc_tree_model_split_reg_get_anchor (model);
+
+    if (anchor != NULL)
+    {
+        Split *splita, *splitb;
+
+        splita = xaccTransFindSplitByAccount (transa, anchor);
+        splitb = xaccTransFindSplitByAccount (transb, anchor);
+
+        switch (xaccSplitGetReconcile (splita))
+        {
+        case YREC:
+            na = 4;
+            break;
+        case FREC:
+            na = 3;
+            break;
+        case VREC:
+            na = 2;
+            break;
+        case NREC:
+            na = 1;
+            break;
+        case CREC:
+            na = 0;
+            break;
+
+        default:
+            break;
+        }
+
+        switch (xaccSplitGetReconcile (splitb))
+        {
+        case YREC:
+            nb = 4;
+            break;
+        case FREC:
+            nb = 3;
+            break;
+        case VREC:
+            nb = 2;
+            break;
+        case NREC:
+            nb = 1;
+            break;
+        case CREC:
+            nb = 0;
+            break;
+
+        default:
+            break;
+        }
+
+        if (na < nb) return -1;
+        if (na > nb) return +1;
+
+        retval = xaccTransOrder (transa, transb);
+        if (retval)
+           return retval;
+    }
+    return 0;
+}
+
diff --git a/src/gnome-utils/gnc-tree-control-split-reg.h b/src/gnome-utils/gnc-tree-control-split-reg.h
new file mode 100644
index 0000000..ec0dc24
--- /dev/null
+++ b/src/gnome-utils/gnc-tree-control-split-reg.h
@@ -0,0 +1,99 @@
+/********************************************************************\
+ * gnc-tree-control-split-reg.h -- GtkTreeView implementation       *
+ *                     to display registers   in a GtkTreeView.     *
+ *                                                                  *
+ * Copyright (C) 2012 Robert Fewell                                 *
+ * Copyright (C) 2006-2007 Chris Shoemaker <c.shoemaker@cox.net>    *
+ *                                                                  *
+ * This program is free software; you can redistribute it and/or    *
+ * modify it under the terms of the GNU General Public License as   *
+ * published by the Free Software Foundation; either version 2 of   *
+ * the License, or (at your option) any later version.              *
+ *                                                                  *
+ * This program is distributed in the hope that it will be useful,  *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
+ * GNU General Public License for more details.                     *
+ *                                                                  *
+ * You should have received a copy of the GNU General Public License*
+ * along with this program; if not, contact:                        *
+ *                                                                  *
+ * Free Software Foundation           Voice:  +1-617-542-5942       *
+ * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
+ * Boston, MA  02110-1301,  USA       gnu@gnu.org                   *
+ *                                                                  *
+\********************************************************************/
+
+
+#ifndef __GNC_TREE_CONTROL_SPLIT_REG_H
+#define __GNC_TREE_CONTROL_SPLIT_REG_H
+
+#include "gnc-tree-model-split-reg.h"
+#include "gnc-tree-view-split-reg.h"
+
+G_BEGIN_DECLS
+
+/*****************************************************************************/
+
+void gnc_tree_control_split_reg_exchange_rate (GncTreeViewSplitReg *view);
+
+void gnc_tree_control_split_reg_void_current_trans (GncTreeViewSplitReg *view, const char *reason);
+
+void gnc_tree_control_split_reg_unvoid_current_trans (GncTreeViewSplitReg *view);
+
+void gnc_tree_control_split_reg_jump_to_blank (GncTreeViewSplitReg *view);
+
+void gnc_tree_control_split_reg_jump_to_split (GncTreeViewSplitReg *view, Split *split);
+
+void gnc_tree_control_split_reg_cancel_edit (GncTreeViewSplitReg *view, gboolean reg_closing);
+
+void gnc_tree_control_split_reg_goto_rel_trans_row (GncTreeViewSplitReg *view, gint relative);
+
+void gnc_tree_control_split_reg_enter (GncTreeViewSplitReg *view, gboolean next_transaction);
+
+void gnc_tree_control_split_reg_reinit (GncTreeViewSplitReg *view, gpointer data);
+
+void gnc_tree_control_split_reg_reverse_current (GncTreeViewSplitReg *view);
+
+void gnc_tree_control_split_reg_delete (GncTreeViewSplitReg *view, gpointer data);
+
+Transaction * gnc_tree_control_split_reg_get_blank_trans (GncTreeViewSplitReg *view);
+
+Split * gnc_tree_control_split_reg_get_current_trans_split (GncTreeViewSplitReg *view);
+
+Split * gnc_tree_control_split_reg_get_blank_split (GncTreeViewSplitReg *view);
+
+gboolean gnc_tree_control_split_reg_duplicate_current (GncTreeViewSplitReg *view);
+
+gboolean gnc_tree_control_split_reg_save (GncTreeViewSplitReg *view, gboolean reg_closing);
+
+gboolean gnc_tree_control_split_reg_recn_change (GncTreeViewSplitReg *view);
+
+gboolean gnc_tree_control_split_reg_recn_test (GncTreeViewSplitReg *view);
+
+/*****************************************************************************/
+
+/* Sort changed callback */
+void gnc_tree_control_split_reg_sort_changed_cb (GtkTreeSortable *sortable, gpointer user_data);
+
+/* Sort by date */
+gint gnc_tree_control_split_reg_sort_by_date (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b,
+                       gpointer user_data);
+
+/* Sort by Description / Notes / Memo */
+gint gnc_tree_control_split_reg_sort_by_dnm (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b,
+                       gpointer user_data);
+
+/* Sort function for Number / Action column */
+gint gnc_tree_control_split_reg_sort_by_numact (GtkTreeModel *tm, GtkTreeIter *a, GtkTreeIter *b,
+                  gpointer user_data);
+
+/* Sort function for Reconcile column */
+gint gnc_tree_control_split_reg_sort_by_recn (GtkTreeModel *tm, GtkTreeIter *a, GtkTreeIter *b,
+                  gpointer user_data);
+
+/*****************************************************************************/
+
+G_END_DECLS
+
+#endif /* __GNC_TREE_CONTROL_SPLIT_REG_H */
