diff --git a/src/zmapWindow/zmapWindow.c b/src/zmapWindow/zmapWindow.c
index 382adf21320289e1facfdb71dd3ec50fece8b9b2..19aab3c0ea89c171384d34367b8c26f6b33c517c 100755
--- a/src/zmapWindow/zmapWindow.c
+++ b/src/zmapWindow/zmapWindow.c
@@ -26,9 +26,9 @@
  *              
  * Exported functions: See ZMap/zmapWindow.h
  * HISTORY:
- * Last edited: May  8 15:11 2009 (edgrif)
+ * Last edited: Jun  5 11:04 2009 (rds)
  * Created: Thu Jul 24 14:36:27 2003 (edgrif)
- * CVS info:   $Id: zmapWindow.c,v 1.282 2009-05-08 14:43:50 edgrif Exp $
+ * CVS info:   $Id: zmapWindow.c,v 1.283 2009-06-05 13:31:14 rds Exp $
  *-------------------------------------------------------------------
  */
 
@@ -44,8 +44,13 @@
 #include <ZMap/zmapConfig.h>
 #include <ZMap/zmapConfigLoader.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
+#include <zmapWindowContainerUtils.h>
+#include <zmapWindowContainerGroup.h>
+#include <zmapWindowContainerFeatureSet.h>
 #include <zmapWindowState.h>
+#include <zmapWindowCanvasItem.h>
+#include <zmapWindowCanvas.h>
+
 
 
 ZMapFeature FEATURE_GLOBAL_G = NULL ;
@@ -228,7 +233,7 @@ static char *makePrimarySelectionText(ZMapWindow window,
 static void rehighlightCB(gpointer list_data, gpointer user_data);
 
 static FooCanvasGroup *getFirstColumn(ZMapWindow window, ZMapStrand strand) ;
-static void getFirstForwardCol(FooCanvasGroup *container, FooCanvasPoints *container_points,
+static void getFirstForwardCol(ZMapWindowContainerGroup container, FooCanvasPoints *container_points,
 			       ZMapContainerLevelType container_level, gpointer func_data) ;
 
 static gboolean checkItem(FooCanvasItem *item, gpointer user_data) ;
@@ -661,6 +666,8 @@ void zMapWindowRedraw(ZMapWindow window)
  *  */
 void zMapWindowStats(ZMapWindow window)
 {
+
+#ifdef WRITE_STATS
   ContainerType type = CONTAINER_INVALID ;
   ZMapIOOut output ;
 
@@ -670,15 +677,14 @@ void zMapWindowStats(ZMapWindow window)
   type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(window->feature_root_group), CONTAINER_TYPE_KEY)) ;
   zMapAssert(type == CONTAINER_PARENT || type == CONTAINER_ROOT) ;
 
-  zmapWindowContainerExecute(window->feature_root_group,
-                             ZMAPCONTAINER_LEVEL_FEATURESET,
-                             printStats, output);
+  zmapWindowContainerUtilsExecute(window->feature_root_group,
+				  ZMAPCONTAINER_LEVEL_FEATURESET,
+				  printStats, output);
 
 
   zMapOutDestroy(output) ;
 
-
-
+#endif /* WRITE_STATS */
   return ;
 }
 
@@ -1232,9 +1238,9 @@ void zMapWindowUpdateInfoPanel(ZMapWindow     window,
                                gboolean       highlight_same_names)
 {
   ZMapWindowItemFeatureType type ;
+  ZMapWindowCanvasItem canvas_item, top_canvas_item;
   ZMapFeature feature = NULL;
   ZMapFeatureTypeStyle style ;
-  ZMapWindowItemFeatureSetData set_data;
   ZMapWindowSelectStruct select = {0} ;
   ZMapFeatureSet set;
   FooCanvasGroup *feature_group;
@@ -1256,13 +1262,17 @@ void zMapWindowUpdateInfoPanel(ZMapWindow     window,
   
   type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(item), ITEM_FEATURE_TYPE)) ;
 
-  feature = g_object_get_data(G_OBJECT(item), ITEM_FEATURE_DATA);
+  canvas_item = zMapWindowCanvasItemIntervalGetObject(item);
+  zMapAssert(ZMAP_IS_CANVAS_ITEM(canvas_item));
+
+  feature = zMapWindowCanvasItemGetFeature(canvas_item);
   zMapAssert(feature_arg == feature);
 
-  feature_group = zmapWindowItemGetParentContainer(item) ;
-  set_data = g_object_get_data(G_OBJECT(feature_group), ITEM_FEATURE_SET_DATA) ;
+  top_canvas_item = zMapWindowCanvasItemIntervalGetTopLevelObject(item);
+
+  feature_group = zmapWindowItemGetParentContainer(FOO_CANVAS_ITEM(top_canvas_item)) ;
 
-  style = zmapWindowItemFeatureSetStyleFromID(set_data, feature->style_id) ;
+  style = zmapWindowContainerFeatureSetStyleFromID((ZMapWindowContainerFeatureSet)feature_group, feature->style_id) ;
 
   select.feature_desc.struct_type = feature->struct_type ;
   select.feature_desc.type        = feature->type ;
@@ -1666,7 +1676,7 @@ static ZMapWindow myWindowCreate(GtkWidget *parent_widget,
 
   /* Create the canvas, add it to the scrolled window so all the scrollbar stuff gets linked up
    * and set the background to be white. */
-  canvas = foo_canvas_new() ;
+  canvas = zMapWindowCanvasNew(1.0) ;
   window->canvas = FOO_CANVAS(canvas);
   /* This will be removed when RT:1589 is resolved */
   g_object_set_data(G_OBJECT(canvas), ZMAP_WINDOW_POINTER, window);
@@ -1689,6 +1699,10 @@ static ZMapWindow myWindowCreate(GtkWidget *parent_widget,
 
   window->zoom = zmapWindowZoomControlCreate(window);
 
+  g_object_set(G_OBJECT(canvas), 
+	       "max-zoom-y", zMapWindowGetZoomMax(window),
+	       NULL);
+
   {
     ZMapWindowRulerCanvasCallbackListStruct callbacks = {NULL};
     GtkAdjustment *vadjust = NULL;
@@ -1881,24 +1895,17 @@ static void myWindowZoom(ZMapWindow window, double zoom_factor, double curr_pos)
  * is needed to reach parts of the canvas not currently mapped. */
 static void myWindowMove(ZMapWindow window, double start, double end)
 {
-  FooCanvasGroup *super_root = NULL;
-
-  zmapWindowInterruptExpose(window);
+  zMapWindowCanvasBusy(ZMAP_CANVAS(window->canvas));
 
   /* Clamp the start/end. */
   zmapWindowClampSpan(window, &start, &end);
 
+  /* Code that looks so simple moves the canvas...  */
+  /* Do we need a call to
+   * zmapWindowContainerRequestReposition(window->feature_root_group); */
   zmapWindowSetScrollRegion(window, NULL, &start, NULL, &end);
 
-  if ((super_root = FOO_CANVAS_GROUP(zmapWindowFToIFindItemFull(window->context_to_item,
-								0,0,0,
-								ZMAPSTRAND_NONE, ZMAPFRAME_NONE,
-								0))))
-    zmapWindowContainerMoveEvent(super_root, window);
-
-  zmapWindowUninterruptExpose(window);
-
-  foo_canvas_update_now(window->canvas) ;
+  zMapWindowCanvasUnBusy(ZMAP_CANVAS(window->canvas));
 
   return ;
 }
@@ -1948,7 +1955,7 @@ static void resetCanvas(ZMapWindow window, gboolean free_child_windows, gboolean
       zmapWindowMarkDestroy(window->mark) ;
       window->mark = zmapWindowMarkCreate(window) ;
 
-      zmapWindowContainerDestroy(window->feature_root_group) ;
+      zmapWindowContainerGroupDestroy(window->feature_root_group) ;
       window->feature_root_group = NULL ;
 
       /* Must follow the container destroy above...in fact if there is no root group we don't need to
@@ -3552,18 +3559,16 @@ void zmapWindowFetchData(ZMapWindow window, ZMapFeatureBlock block,
 
   if(load && column_name_list)
     {
-      ZMapWindowItemFeatureBlockData block_data;
       FooCanvasItem *block_group;
 
       if((block_group = zmapWindowFToIFindItemFull(window->context_to_item, 
 						   block->parent->unique_id, 
 						   block->unique_id, 0, 0, 0, 0)))
 	{
-	  block_data = g_object_get_data(G_OBJECT(block_group), ITEM_FEATURE_BLOCK_DATA);
-	  column_name_list = zmapWindowItemFeatureBlockFilterMarkedColumns(block_data, 
-									   column_name_list,
-									   fetch_data->start,
-									   fetch_data->end);
+	  column_name_list = zmapWindowContainerBlockFilterMarkedColumns((ZMapWindowContainerBlock)block_group, 
+									 column_name_list,
+									 fetch_data->start,
+									 fetch_data->end);
 	}
     }
 
@@ -3620,7 +3625,6 @@ GList *zmapWindowDeferredColumnsInMark(ZMapWindow window)
 
   if(window->mark && zmapWindowMarkIsSet(window->mark))
     {
-      ZMapWindowItemFeatureBlockData block_data;
       FooCanvasGroup *block_group;
       double x1, y1, x2, y2;
       int wy1,wy2;
@@ -3629,16 +3633,15 @@ GList *zmapWindowDeferredColumnsInMark(ZMapWindow window)
 
       if(zmapWindowWorld2SeqCoords(window, x1, y1, x2, y2, &block_group, &wy1, &wy2))
 	{
-	  block_data = g_object_get_data(G_OBJECT(block_group), ITEM_FEATURE_BLOCK_DATA);
-	  list = zmapWindowItemFeatureBlockFilterMarkedColumns(block_data,
-							       list, wy1, wy2);
+	  list = zmapWindowContainerBlockFilterMarkedColumns((ZMapWindowContainerBlock)block_group,
+							     list, wy1, wy2);
 	}
     }
   
   return list;
 }
 
-static void set_block_lists_cb(FooCanvasGroup *container, FooCanvasPoints *points, 
+static void set_block_lists_cb(ZMapWindowContainerGroup container, FooCanvasPoints *points, 
 			       ZMapContainerLevelType level, gpointer user_data)
 {
   switch(level)
@@ -3676,9 +3679,12 @@ GList *zmapWindowDeferredColumnsInBlock(ZMapWindow window)
   else
     {
       GList *block_list = NULL;
-      zmapWindowContainerExecute(window->feature_root_group,
-				 ZMAPCONTAINER_LEVEL_BLOCK,
-				 set_block_lists_cb, &block_list);
+
+      zmapWindowContainerUtilsExecute(window->feature_root_group,
+				      ZMAPCONTAINER_LEVEL_BLOCK,
+				      set_block_lists_cb, &block_list);
+
+      /* We only use the _first_ block! */
       if(block_list)
 	{
 	  block_group = FOO_CANVAS_GROUP(block_list->data);
@@ -3688,15 +3694,24 @@ GList *zmapWindowDeferredColumnsInBlock(ZMapWindow window)
 
   if(block_group)
     {
-      ZMapWindowItemFeatureBlockData block_data;
+      ZMapWindowContainerBlock container_block;
+      ZMapWindowContainerGroup container_group;
       ZMapFeatureBlock block;
+      ZMapFeatureAny block_any;
+      
+      container_block = (ZMapWindowContainerBlock)block_group;
+      container_group = (ZMapWindowContainerGroup)container_block;
 
-      block_data = g_object_get_data(G_OBJECT(block_group), ITEM_FEATURE_BLOCK_DATA);
-      block = g_object_get_data(G_OBJECT(block_group), ITEM_FEATURE_DATA);
-      list  = zmapWindowItemFeatureBlockFilterMarkedColumns(block_data,
-							    list,
-							    block->block_to_sequence.q1,
-							    block->block_to_sequence.q2);
+      if(zmapWindowContainerGetFeatureAny(container_group, &block_any) && 
+	 block_any != NULL && 
+	 block_any->struct_type == ZMAPFEATURE_STRUCT_BLOCK)
+	{
+	  block = (ZMapFeatureBlock)block_any;
+	  list  = zmapWindowContainerBlockFilterMarkedColumns(container_block,
+							      list,
+							      block->block_to_sequence.q1,
+							      block->block_to_sequence.q2);
+	}
     }
   
   return list;  
@@ -3843,16 +3858,16 @@ static gboolean keyboardEvent(ZMapWindow window, GdkEventKey *key_event)
 
 	if ((focus_column = zmapWindowFocusGetHotColumn(window->focus)))
 	  {
-	    ZMapWindowItemFeatureSetData set_data ;
+	    ZMapWindowContainerFeatureSet focus_container;
 	    ZMapStyleBumpMode curr_bump_mode ;
-		
-	    set_data = g_object_get_data(G_OBJECT(focus_column), ITEM_FEATURE_SET_DATA) ;
+	    
+	    focus_container = (ZMapWindowContainerFeatureSet)focus_column;
 
 	    if (zMapGUITestModifiers(key_event, GDK_SHIFT_MASK))
 	      {
 		GList *hidden_items = NULL ;
 
-		if ((hidden_items = g_queue_pop_head(set_data->user_hidden_stack)))
+		if ((hidden_items = zmapWindowContainerFeatureSetPopHiddenStack(focus_container)))
 		  {
 		    g_list_foreach(hidden_items, unhideItemsCB, window) ;
 		    g_list_free(hidden_items) ;
@@ -3864,8 +3879,7 @@ static gboolean keyboardEvent(ZMapWindow window, GdkEventKey *key_event)
 
 		zmapWindowFocusForEachFocusItem(window->focus, hideItemsCB, &hidden_items) ;
 
-		g_queue_push_head(set_data->user_hidden_stack, hidden_items) ;
-
+		zmapWindowContainerFeatureSetPushHiddenStack(focus_container, hidden_items) ;
 
 		/* This all feels really clumsy...we have the focus/highlight stuff the wrong way
 		   round, we should be dealing with focus, not with highlight at this level... */
@@ -3874,7 +3888,7 @@ static gboolean keyboardEvent(ZMapWindow window, GdkEventKey *key_event)
 		zmapHighlightColumn(window, focus_column) ;
 	      }
 
-	    curr_bump_mode = zmapWindowItemFeatureSetGetBumpMode(set_data) ;
+	    curr_bump_mode = zmapWindowContainerFeatureSetGetBumpMode(focus_container) ;
 
 	    zmapWindowColumnBump(FOO_CANVAS_ITEM(focus_column), curr_bump_mode) ;
 
@@ -3940,18 +3954,18 @@ static gboolean keyboardEvent(ZMapWindow window, GdkEventKey *key_event)
 
 	if ((focus_column = zmapWindowFocusGetHotColumn(window->focus)))
 	  {
-	    ZMapWindowItemFeatureSetData set_data ;
+	    ZMapWindowContainerFeatureSet focus_container;
 	    ZMapStyleBumpMode curr_bump_mode, bump_mode ;
 	    ZMapWindowCompressMode compress_mode ;
 
-	    set_data = g_object_get_data(G_OBJECT(focus_column), ITEM_FEATURE_SET_DATA) ;
-	    
-	    curr_bump_mode = zmapWindowItemFeatureSetGetBumpMode(set_data);
+	    focus_container = (ZMapWindowContainerFeatureSet)focus_column;
+
+	    curr_bump_mode = zmapWindowContainerFeatureSetGetBumpMode(focus_container);
 	    
 	    if (curr_bump_mode != ZMAPBUMP_UNBUMP)
 	      bump_mode = ZMAPBUMP_UNBUMP ;
 	    else
-	      bump_mode = zmapWindowItemFeatureSetGetDefaultBumpMode(set_data) ;
+	      bump_mode = zmapWindowContainerFeatureSetGetDefaultBumpMode(focus_container) ;
 
 	    if (key_event->keyval == GDK_B)
 	      {
@@ -4314,7 +4328,7 @@ static void jumpFeature(ZMapWindow window, guint keyval)
 	{
 	  focus_column = getFirstColumn(window, ZMAPSTRAND_FORWARD) ;
 	}
-
+#ifdef GETTING_TO_LINK
       if (keyval == GDK_Down)
 	focus_item = zmapWindowContainerGetNthFeatureItem(focus_column, ZMAPCONTAINER_ITEM_FIRST) ;
       else
@@ -4326,6 +4340,7 @@ static void jumpFeature(ZMapWindow window, guint keyval)
 	highlight_item = TRUE ;
       else
 	move_focus = TRUE ;
+#endif
     }
 
 
@@ -4341,7 +4356,7 @@ static void jumpFeature(ZMapWindow window, guint keyval)
 	direction = ZMAPCONTAINER_ITEM_PREV ;
       else
 	direction = ZMAPCONTAINER_ITEM_NEXT ;
-
+#ifdef GETTING_TO_LINK
       if ((focus_item = zmapWindowContainerGetNextFeatureItem(focus_item,
 							      direction, TRUE,
 							      checkItem,
@@ -4350,6 +4365,7 @@ static void jumpFeature(ZMapWindow window, guint keyval)
 	  move_focus = TRUE ;
 	  highlight_item = TRUE ;
 	}
+#endif /* GETTING_TO_LINK */
     }
 
 
@@ -4376,6 +4392,7 @@ static void jumpFeature(ZMapWindow window, guint keyval)
 /* Jump to the previous/next column according to which arrow key was pressed. */
 static void jumpColumn(ZMapWindow window, guint keyval)
 {
+#ifdef GETTING_TO_LINK
   FooCanvasGroup *focus_column, *column_parent, *columns ;
   gboolean move_focus = FALSE, highlight_column = FALSE ;
 
@@ -4407,8 +4424,8 @@ static void jumpColumn(ZMapWindow window, guint keyval)
       ZMapStrand strand ;
       ZMapContainerItemDirection direction ;
 
-      column_parent = zmapWindowContainerGetSuperGroup(focus_column) ;
-      strand = zmapWindowContainerGetStrand(column_parent) ;
+      column_parent = zmapWindowContainerUtilsGetParentLevel(focus_column, ZMAPCONTAINER_LEVEL_STRAND) ;
+      strand = zmapWindowContainerGetStrand((ZMapWindowContainerGroup)column_parent) ;
 
       if (keyval == GDK_Left)
 	direction = ZMAPCONTAINER_ITEM_PREV ;
@@ -4426,15 +4443,17 @@ static void jumpColumn(ZMapWindow window, guint keyval)
 	}
       else
 	{
-	  FooCanvasGroup *strand_parent = zmapWindowContainerGetSuperGroup(column_parent) ;
+	  FooCanvasGroup *strand_parent;
 	  FooCanvasGroup *strand_group ;
 
+	  strand_parent = zmapWindowContainerUtilsGetParentLevel(column_parent, ZMAPCONTAINER_LEVEL_BLOCK) ;
+
 	  if (strand == ZMAPSTRAND_FORWARD)
 	    strand = ZMAPSTRAND_REVERSE ;
 	  else
 	    strand = ZMAPSTRAND_FORWARD ;
 
-	  strand_group = zmapWindowContainerGetStrandGroup(strand_parent, strand) ;
+	  strand_group = zmapWindowContainerBlockGetContainerStrand((ZMapWindowContainerBlock)strand_parent, strand) ;
 	  columns = zmapWindowContainerGetFeatures(strand_group) ;
 
 	  if (keyval == GDK_Left)
@@ -4465,7 +4484,6 @@ static void jumpColumn(ZMapWindow window, guint keyval)
   /* If we need to highlight a column then do it but also scroll to the column if its off screen. */
   if (highlight_column)
     {
-      ZMapWindowItemFeatureSetData set_data ;
       ZMapWindowSelectStruct select = {0} ;
       ZMapFeatureSet feature_set = NULL ;
       GQuark feature_set_id ;
@@ -4478,15 +4496,9 @@ static void jumpColumn(ZMapWindow window, guint keyval)
 
       zmapWindowScrollToItem(window, FOO_CANVAS_ITEM(focus_column)) ;
 
-      /* These should go in container some time.... */
-      set_data = g_object_get_data(G_OBJECT(focus_column), ITEM_FEATURE_SET_DATA) ;
-      zMapAssert(set_data) ;
-
-      feature_set_id = set_data->unique_id;
+      feature_set = zmapWindowContainerFeatureSetRecoverFeatureSet(highlight_column);
 
-      feature_set = zmapWindowItemFeatureSetRecoverFeatureSet(set_data);
-
-      select.feature_desc.feature_set = (char *)g_quark_to_string(feature_set_id) ;
+      select.feature_desc.feature_set = (char *)g_quark_to_string(feature_set->unique_id) ;
 
       select.secondary_text = zmapWindowFeatureSetDescription(feature_set) ;
       select.type = ZMAPWINDOW_SELECT_SINGLE;
@@ -4496,7 +4508,7 @@ static void jumpColumn(ZMapWindow window, guint keyval)
       g_free(select.secondary_text) ;
 
     }
-
+#endif /* GETTING_TO_LINK */
   return ;
 }
 
@@ -4862,25 +4874,25 @@ static FooCanvasGroup *getFirstColumn(ZMapWindow window, ZMapStrand strand)
 
   strand_data.strand = strand ;
 
-  zmapWindowContainerExecute(window->feature_root_group, ZMAPCONTAINER_LEVEL_STRAND,
-			     getFirstForwardCol, &strand_data) ;
+  zmapWindowContainerUtilsExecute(window->feature_root_group, ZMAPCONTAINER_LEVEL_STRAND,
+				  getFirstForwardCol, &strand_data) ;
 
   return strand_data.first_column ;
 }
 
 
-static void getFirstForwardCol(FooCanvasGroup *container, FooCanvasPoints *container_points,
+static void getFirstForwardCol(ZMapWindowContainerGroup container, FooCanvasPoints *container_points,
 			       ZMapContainerLevelType container_level, gpointer func_data)
 {
   StrandCol strand_data = (StrandCol)func_data ;
   
-  if (container_level == ZMAPCONTAINER_LEVEL_STRAND
-      && !(strand_data->first_column)
-      && zmapWindowContainerGetStrand(container) == strand_data->strand)
+  if ((container_level == ZMAPCONTAINER_LEVEL_STRAND) &&
+      (!(strand_data->first_column)) &&
+      (zmapWindowContainerGetStrand(container) == strand_data->strand))
     {
       FooCanvasGroup *columns ;
 
-      columns = zmapWindowContainerGetFeatures(container) ;
+      columns = (FooCanvasGroup *)zmapWindowContainerGetFeatures(container) ;
 
       if (strand_data->strand == ZMAPSTRAND_FORWARD)
 	strand_data->first_column = (FooCanvasGroup *)(columns->item_list->data) ;
@@ -4949,8 +4961,8 @@ static void popUpMenu(GdkEventKey *key_event, ZMapWindow window, FooCanvasItem *
       feature_type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(focus_item), ITEM_FEATURE_TYPE)) ;
       if (feature_type == ITEM_FEATURE_PARENT || feature_type == ITEM_FEATURE_SIMPLE)
 	is_feature = TRUE ;
-      else if (zmapWindowContainerIsValid(FOO_CANVAS_GROUP(focus_item))
-	       && zmapWindowContainerGetLevel(FOO_CANVAS_GROUP(focus_item)) == ZMAPCONTAINER_LEVEL_FEATURESET)
+      else if (ZMAP_IS_CONTAINER_GROUP(focus_item) &&
+	       zmapWindowContainerUtilsGetLevel(focus_item) == ZMAPCONTAINER_LEVEL_FEATURESET)
 	is_feature = FALSE ;
       else
 	zMapAssertNotReached() ;
@@ -5000,9 +5012,7 @@ static void popUpMenu(GdkEventKey *key_event, ZMapWindow window, FooCanvasItem *
 	{
 	  ZMapFeatureSet feature_set = NULL ;
 
-	  feature_set = (ZMapFeatureSet)zmapWindowContainerGetData(FOO_CANVAS_GROUP(focus_item), ITEM_FEATURE_DATA) ;
-
-	  if (feature_set)
+	  if ((feature_set = zmapWindowContainerGetFeatureSet((ZMapWindowContainerGroup)focus_item)))
 	    {
 	      zmapMakeColumnMenu(&button_event, window, focus_item, feature_set, NULL) ;
 	    }
@@ -5119,7 +5129,7 @@ static void fc_begin_update_cb(FooCanvas *canvas, gpointer user_data)
       if(!(x1 == 0.0 && y1 == 0.0 && x2 == ZMAP_CANVAS_INIT_SIZE && y2 == ZMAP_CANVAS_INIT_SIZE))
 	{
 #endif
-	  zmapWindowLongItemCrop(window->long_items, x1, y1, x2, y2);
+	  //zmapWindowLongItemCrop(window->long_items, x1, y1, x2, y2);
 #ifdef CAUSED_RT_57193
 	}
 #endif
diff --git a/src/zmapWindow/zmapWindowColBump.c b/src/zmapWindow/zmapWindowColBump.c
index bdaef6fea59425b6b50e408023d0085277015617..51f059afacf3339927de9c2039bcf3639ac9efbd 100755
--- a/src/zmapWindow/zmapWindowColBump.c
+++ b/src/zmapWindow/zmapWindowColBump.c
@@ -27,9 +27,9 @@
  *
  * Exported functions: See zmapWindow_P.h
  * HISTORY:
- * Last edited: May 12 10:08 2009 (rds)
+ * Last edited: Jun  4 10:10 2009 (rds)
  * Created: Tue Sep  4 10:52:09 2007 (edgrif)
- * CVS info:   $Id: zmapWindowColBump.c,v 1.42 2009-05-12 09:09:35 rds Exp $
+ * CVS info:   $Id: zmapWindowColBump.c,v 1.43 2009-06-05 13:31:35 rds Exp $
  *-------------------------------------------------------------------
  */
 
@@ -37,18 +37,19 @@
 #include <ZMap/zmapUtils.h>
 #include <ZMap/zmapGLibUtils.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
+#include <zmapWindowContainerFeatureSet_I.h>
+#include <zmapWindowContainerUtils.h>
 #include <zmapWindowCanvasItem.h>
 
 typedef struct
 {
-  ZMapWindow                   window;
-  ZMapWindowItemFeatureSetData set_data;
-  GQuark                       style_id;
-  ZMapStyleBumpMode            overlap_mode;
-  ZMapStyleColumnDisplayState  display_state;
-  unsigned int                 match_threshold;
-  gboolean                     bump_all;
+  ZMapWindow                    window;
+  ZMapWindowContainerFeatureSet container;
+  GQuark                        style_id;
+  ZMapStyleBumpMode             overlap_mode;
+  ZMapStyleColumnDisplayState   display_state;
+  unsigned int                  match_threshold;
+  gboolean                      bump_all;
 } BumpPropertiesStruct, *BumpProperties;
 
 /* For straight forward bumping. */
@@ -74,6 +75,10 @@ typedef struct
   double incr ;
 } BumpColRangeStruct, *BumpColRange ;
 
+typedef struct
+{
+  double x, width;
+}OffsetWidthStruct, *OffsetWidth;
 
 
 /* THERE IS A BUG IN THE CODE THAT USES THIS...IT MOVES FEATURES OUTSIDE OF THE BACKGROUND SO
@@ -86,7 +91,7 @@ typedef struct
 typedef struct
 {
   ZMapWindow window ;
-  GList **gaps_added_items ;
+  ZMapWindowContainerFeatureSet container;
 } AddGapsDataStruct, *AddGapsData ;
 
 typedef gboolean (*OverLapListFunc)(GList *curr_features, GList *new_features) ;
@@ -144,34 +149,14 @@ typedef struct
 } ZoomDataStruct, *ZoomData ;
 
 
-typedef struct execOnChildrenStruct_
-{
-  ZMapContainerLevelType stop ;
-
-  GFunc                  down_func_cb ;
-  gpointer               down_func_data ;
-
-  GFunc                  up_func_cb ;
-  gpointer               up_func_data ;
-
-} execOnChildrenStruct, *execOnChildren ;
-
+typedef gboolean (*MakeNameListNamePredicateFunc)(FooCanvasItem *item, ComplexBump complex_bump);
+typedef GQuark   (*MakeNameListNameKeyFunc)      (ZMapFeature feature, ComplexBump complex_bump);
 
-/* For 3 frame display/normal display. */
 typedef struct
 {
-  FooCanvasGroup *forward_group, *reverse_group ;
-  ZMapFeatureBlock block ;
-  ZMapWindow window ;
-
-  FooCanvasGroup *curr_forward_col ;
-  FooCanvasGroup *curr_reverse_col ;
-
-  int frame3_pos ;
-  ZMapFrame frame ;
-
-} RedrawDataStruct, *RedrawData ;
-
+  MakeNameListNamePredicateFunc predicate_func;
+  MakeNameListNameKeyFunc       quark_gen_func;
+} MakeNameListsHashDataStruct, *MakeNameListsHashData;
 
 
 static void bumpColCB(gpointer data, gpointer user_data) ;
@@ -186,7 +171,6 @@ static gint sortByScoreCB(gconstpointer a, gconstpointer b) ;
 static gint sortByStrandSpanCB(gconstpointer a, gconstpointer b) ;
 static gint sortByOverlapCB(gconstpointer a, gconstpointer b, gpointer user_data) ;
 static void bestFitCB(gpointer data, gpointer user_data) ;
-static gboolean itemGetCoords(FooCanvasItem *item, double *x1_out, double *x2_out) ;
 static void listScoreCB(gpointer data, gpointer user_data) ;
 static void makeNameListCB(gpointer data, gpointer user_data) ;
 
@@ -200,23 +184,18 @@ static void sortListPosition(gpointer data, gpointer user_data) ;
 
 
 static void addGapsCB(gpointer data, gpointer user_data) ;
+#ifdef NEVER
 static void removeGapsCB(gpointer data, gpointer user_data) ;
+#endif
 
-
-static void NEWaddMultiBackgrounds(gpointer data, gpointer user_data) ;
-
-
-
-static FooCanvasItem *makeMatchItem(ZMapWindowLongItems long_items,
-				    FooCanvasGroup *parent, ZMapDrawObjectType shape,
-				    double x1, double y1, double x2, double y2,
-				    GdkColor *colour, gpointer item_data, gpointer event_data) ;
 static gboolean listsOverlap(GList *curr_features, GList *new_features) ;
 static gboolean listsOverlapNoInterleave(GList *curr_features, GList *new_features) ;
 static void reverseOffsets(GList *bumpcol_list) ;
 static void moveItemsCB(gpointer data, gpointer user_data) ;
 static void moveItemCB(gpointer data, gpointer user_data) ;
+#ifdef NEVER
 static void freeExtraItems(gpointer data, gpointer user_data) ;
+#endif
 static void showItems(gpointer data, gpointer user_data) ;
 static gboolean removeNameListsByRange(GList **names_list, int start, int end) ;
 static void testRangeCB(gpointer data, gpointer user_data) ;
@@ -225,8 +204,6 @@ static void hashDataDestroyCB(gpointer data) ;
 static void listDataDestroyCB(gpointer data, gpointer user_data) ;
 static void getListFromHash(gpointer key, gpointer value, gpointer user_data) ;
 static void setStyleBumpCB(ZMapFeatureTypeStyle style, gpointer user_data) ;
-static gboolean bumpBackgroundEventCB(FooCanvasItem *item, GdkEvent *event, gpointer data) ;
-static gboolean bumpBackgroundDestroyCB(FooCanvasItem *feature_item, gpointer data) ;
 
 static gint findItemInQueueCB(gconstpointer a, gconstpointer b) ;
 
@@ -249,28 +226,126 @@ static void printQuarks(gpointer data, gpointer user_data) ;
 static ZMapStyleBumpMode hack_initial_mode(ZMapFeatureTypeStyle style);
 #endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
 
-static void invoke_bump_to_initial(FooCanvasGroup *container, FooCanvasPoints *points, 
+static void invoke_bump_to_initial(ZMapWindowContainerGroup container, FooCanvasPoints *points, 
 				   ZMapContainerLevelType level, gpointer user_data);
 
-
 /* Merely a cover function for the real bumping code function zmapWindowColumnBumpRange(). */
 void zmapWindowColumnBump(FooCanvasItem *column_item, ZMapStyleBumpMode bump_mode)
 {
-  ZMapWindowItemFeatureSetData set_data ;
   ZMapWindowCompressMode compress_mode ;
 
-  set_data = g_object_get_data(G_OBJECT(column_item), ITEM_FEATURE_SET_DATA);
-
-  if (zmapWindowMarkIsSet(set_data->window->mark))
+  g_return_if_fail(ZMAP_IS_CONTAINER_FEATURESET(column_item));
+#warning SOLVE THIS
+#ifdef SOLVE_THIS
+  if (zmapWindowMarkIsSet(((ZMapWindowContainerFeatureSet)column_item)->window->mark))
     compress_mode = ZMAPWINDOW_COMPRESS_MARK ;
   else
     compress_mode = ZMAPWINDOW_COMPRESS_ALL ;
+#endif /* SOLVE_THIS */
 
   zmapWindowColumnBumpRange(column_item, bump_mode, compress_mode) ;
 
   return ;
 }
 
+void zmapWindowContainerShowAllHiddenFeatures(ZMapWindowContainerFeatureSet container_set)
+{
+  if (container_set->hidden_bump_features)
+    {
+      FooCanvasGroup *column_features;
+
+      column_features = (FooCanvasGroup *)(zmapWindowContainerGetFeatures((ZMapWindowContainerGroup)container_set));
+
+      g_list_foreach(column_features->item_list, showItems, container_set) ;
+
+      container_set->hidden_bump_features = FALSE ;
+    }
+  
+  return ;
+}
+
+static void make_parent_item_cb(gpointer data, gpointer user_data)
+{
+  ComplexCol column_data = (ComplexCol)data;
+  FooCanvasGroup *column_features = FOO_CANVAS_GROUP(user_data);
+  ZMapFeature feature;
+
+  if((column_data->feature_list) &&
+     (column_data->feature_list->data) &&
+     (feature = zMapWindowCanvasItemGetFeature(column_data->feature_list->data)))
+    {
+      if (feature->type == ZMAPSTYLE_MODE_ALIGNMENT)
+	column_data->parent_item = zMapWindowCollectionFeatureCreate(column_features);
+    }
+
+  return ;
+}
+
+static ColinearityType colinear_compare_features_cb(ZMapFeature feature_a,
+						    ZMapFeature feature_b,
+						    gpointer    user_data)
+{
+  ComplexCol column_data = (ComplexCol)user_data;
+  ColinearityType type = COLINEAR_INVALID;
+
+  type = featureHomolIsColinear(column_data->bump_properties->window, 
+				column_data->bump_properties->match_threshold, 
+				feature_a, feature_b);
+
+  return type;
+}
+
+static void collection_add_colinear_cb(gpointer data, gpointer user_data)
+{
+  ComplexCol column_data = (ComplexCol)data;
+#ifdef RDS_UNUSED
+  ComplexBump bump_data  = (ComplexBump)user_data;
+#endif
+
+  if(column_data->parent_item)
+    {
+      zMapWindowCollectionFeatureAddColinearMarkers(column_data->parent_item,
+						    colinear_compare_features_cb,
+						    column_data);
+      zMapWindowCollectionFeatureAddIncompleteMarkers(column_data->parent_item,
+						      column_data->bump_properties->window->revcomped_features);
+      zMapWindowCollectionFeatureAddSpliceMarkers(column_data->parent_item);
+    }
+
+  return ;
+}
+
+static gboolean column_clear_collections(FooCanvasGroup *column_features)
+  {
+    GList *list, *next;
+    gboolean result = FALSE;
+
+    if((list = g_list_first(column_features->item_list)))
+      {
+	do
+	  {
+	    next = list->next;
+	    if(ZMAP_IS_WINDOW_COLLECTION_FEATURE(list->data))
+	      {
+		ZMapWindowCanvasItem canvas_item;
+		
+		canvas_item = ZMAP_CANVAS_ITEM(list->data);
+		
+		zMapWindowCollectionFeatureRemoveSubFeatures(canvas_item, FALSE, TRUE);
+
+		zMapWindowCanvasItemClearOverlay(canvas_item);
+		zMapWindowCanvasItemClearUnderlay(canvas_item);
+
+		canvas_item = zMapWindowCanvasItemDestroy(canvas_item);
+
+		result = TRUE;
+	      }
+	  }
+	while((list = next));
+      }
+
+    return result;
+  }
 
 
 /* Bumps either the whole column represented by column_item, or if the item is a feature item
@@ -283,113 +358,82 @@ void zmapWindowColumnBump(FooCanvasItem *column_item, ZMapStyleBumpMode bump_mod
  * we don't always want to reposition all the columns following a bump, e.g. when we
  * are creating a zmap window.
  *  */
-void zmapWindowColumnBumpRange(FooCanvasItem *column_item, ZMapStyleBumpMode bump_mode,
+void zmapWindowColumnBumpRange(FooCanvasItem *bump_item, ZMapStyleBumpMode bump_mode,
 			       ZMapWindowCompressMode compress_mode)
 {
   BumpColStruct bump_data = {NULL} ;
   FooCanvasGroup *column_features ;
-  ZMapWindowItemFeatureType feature_type;
-  ZMapContainerLevelType container_type;
+  ZMapWindowContainerFeatureSet container = NULL;
   BumpPropertiesStruct bump_properties = {NULL};
-  FooCanvasGroup *column_group =  NULL ;
-  ZMapWindowItemFeatureSetData set_data ;
   ZMapStyleBumpMode historic_bump_mode;
+  ZMapWindow window;
   gboolean column = FALSE ;
   gboolean bumped = TRUE ;
   gboolean mark_set;
   int start, end ;
-  double bump_spacing = 0.0 ;
-  double width ;
+  double width, bump_spacing = 0.0 ;
 
   g_return_if_fail(bump_mode != ZMAPBUMP_INVALID);
 
   /* Decide if the column_item is a column group or a feature within that group. */
-  if ((feature_type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(column_item), ITEM_FEATURE_TYPE)))
-      != ITEM_FEATURE_INVALID)
+  if(ZMAP_IS_CANVAS_ITEM(bump_item))
     {
-      column = FALSE ;
-      column_group = zmapWindowContainerGetParentContainerFromItem(column_item) ;
+      column = FALSE;
+      container = (ZMapWindowContainerFeatureSet)zmapWindowContainerCanvasItemGetContainer(bump_item);
     }
-  else if ((container_type = zmapWindowContainerGetLevel(FOO_CANVAS_GROUP(column_item)))
-	   == ZMAPCONTAINER_LEVEL_FEATURESET)
+  else if(ZMAP_IS_CONTAINER_FEATURESET(bump_item))
     {
-      column = TRUE ;
-      column_group = FOO_CANVAS_GROUP(column_item) ;
+      column = TRUE;
+      container = (ZMapWindowContainerFeatureSet)(bump_item);
     }
   else
-    zMapAssertNotReached() ;
+    zMapAssertNotReached();
+
 
-  column_features = zmapWindowContainerGetFeatures(column_group) ;
+  column_features = (FooCanvasGroup *)zmapWindowContainerGetFeatures((ZMapWindowContainerGroup)container) ;
 
-  set_data = g_object_get_data(G_OBJECT(column_group), ITEM_FEATURE_SET_DATA) ;
-  zMapAssert(set_data) ;
+  /* always reset the column */
+  column_clear_collections(column_features);
 
-  bump_properties.set_data     = set_data ;
-  bump_properties.window       = set_data->window;
+  zmapWindowContainerShowAllHiddenFeatures(container);
+
+  bump_properties.container    = container ;
+  bump_properties.window       = window = container->window;
   bump_properties.overlap_mode = bump_mode;
 
-  zMapWindowBusy(set_data->window, TRUE) ;
+  zMapWindowBusy(window, TRUE) ;
 
   /* Need to know if mark is set for limiting feature display for several modes/feature types. */
-  mark_set = zmapWindowMarkIsSet(set_data->window->mark) ;
-
+  mark_set = zmapWindowMarkIsSet(window->mark) ;
 
   /* We need this to know whether to remove and add Gaps */
-  historic_bump_mode = zmapWindowItemFeatureSetGetBumpMode(set_data) ;
-
-  /* We may have created extra items for some bump modes to show all matches from the same query
-   * etc. so now we need to get rid of them before redoing the bump. */
-  if (set_data->extra_items)
-    {
-      g_list_foreach(set_data->extra_items, freeExtraItems, NULL) ;
-
-      g_list_free(set_data->extra_items) ;
-      set_data->extra_items = NULL ;
-    }
-
+  historic_bump_mode = zmapWindowContainerFeatureSetGetBumpMode(container) ;
 
-  /* Some items may have had their gaps added for some bump modes, they need to have
-   * them removed. */
-  if (set_data->gaps_added_items && historic_bump_mode != bump_mode)
-    {
-      g_list_foreach(set_data->gaps_added_items, removeGapsCB, set_data->window) ;
-
-      g_list_free(set_data->gaps_added_items) ;
-      set_data->gaps_added_items = NULL ;
-    }
-
-
-  /* Some features may have been hidden for bumping, unhide them now. */
-  if (set_data->hidden_bump_features)
-    {
-      g_list_foreach(column_features->item_list, showItems, set_data) ;
-      set_data->hidden_bump_features = FALSE ;
-    }
 
   /* If user clicked on the column, not a feature within a column then we need to bump all styles
    * and features within the column, otherwise we just bump the specific features. */
   if (column)
     {
       bump_properties.bump_all      = TRUE ;
-      bump_properties.style_id      = set_data->unique_id;
-      bump_properties.display_state = zmapWindowItemFeatureSetGetDisplay(set_data);
+      bump_properties.style_id      = container->unique_id;
+      bump_properties.display_state = zmapWindowContainerFeatureSetGetDisplay(container);
 
-      zmapWindowItemFeatureSetJoinAligns(set_data, &(bump_properties.match_threshold));
+      zmapWindowContainerFeatureSetJoinAligns(container, &(bump_properties.match_threshold));
 
-      zmapWindowStyleTableForEach(set_data->style_table, setStyleBumpCB, GINT_TO_POINTER(bump_mode)) ;
+      zmapWindowStyleTableForEach(container->style_table, setStyleBumpCB, GINT_TO_POINTER(bump_mode)) ;
     }
   else
     {
       ZMapFeatureTypeStyle style;
       ZMapFeature feature ;
 
-      feature = g_object_get_data(G_OBJECT(column_item), ITEM_FEATURE_DATA) ;
+      feature = g_object_get_data(G_OBJECT(bump_item), ITEM_FEATURE_DATA) ;
       zMapAssert(feature) ;
 
       bump_properties.bump_all = FALSE;
       bump_properties.style_id = feature->style_id;
 
-      if((style = zmapWindowStyleTableFind(set_data->style_table, feature->style_id)))
+      if((style = zmapWindowStyleTableFind(container->style_table, feature->style_id)))
 	{
 	  g_object_get(G_OBJECT(style),
 		       ZMAPSTYLE_PROPERTY_DISPLAY_MODE, &(bump_properties.display_state),
@@ -408,11 +452,11 @@ void zmapWindowColumnBumpRange(FooCanvasItem *column_item, ZMapStyleBumpMode bum
   if (compress_mode == ZMAPWINDOW_COMPRESS_INVALID)
     {
       if (mark_set)
-	zmapWindowMarkGetSequenceRange(set_data->window->mark, &start, &end) ;
+	zmapWindowMarkGetSequenceRange(window->mark, &start, &end) ;
       else
 	{
-	  start = set_data->window->min_coord ;
-	  end   = set_data->window->max_coord ;
+	  start = window->min_coord ;
+	  end   = window->max_coord ;
 	}
     }
   else
@@ -422,7 +466,7 @@ void zmapWindowColumnBumpRange(FooCanvasItem *column_item, ZMapStyleBumpMode bum
 	  double wx1, wy1, wx2, wy2 ;
         
         
-	  zmapWindowItemGetVisibleCanvas(set_data->window, 
+	  zmapWindowItemGetVisibleCanvas(window, 
 					 &wx1, &wy1,
 					 &wx2, &wy2);
         
@@ -440,12 +484,12 @@ void zmapWindowColumnBumpRange(FooCanvasItem *column_item, ZMapStyleBumpMode bum
 
 	  /* we know mark is set so no need to check result of range check. But should check
 	   * that col to be bumped and mark are in same block ! */
-	  zmapWindowMarkGetSequenceRange(set_data->window->mark, &start, &end) ;
+	  zmapWindowMarkGetSequenceRange(window->mark, &start, &end) ;
 	}
       else
 	{
-	  start = set_data->window->min_coord ;
-	  end = set_data->window->max_coord ;
+	  start = window->min_coord ;
+	  end   = window->max_coord ;
 	}
     }
 
@@ -453,8 +497,8 @@ void zmapWindowColumnBumpRange(FooCanvasItem *column_item, ZMapStyleBumpMode bum
   bump_data.end   = end ;
 
 
-  width          = zmapWindowItemFeatureSetGetWidth(set_data);
-  bump_spacing   = zmapWindowItemFeatureGetBumpSpacing(set_data) ;
+  width          = zmapWindowContainerFeatureSetGetWidth(container);
+  bump_spacing   = zmapWindowContainerFeatureGetBumpSpacing(container) ;
   bump_data.incr = width + bump_spacing + 1 ; /* adding one because it makes the spacing work... */
 
   bump_data.bump_prop_data = bump_properties; /* struct copy! */
@@ -561,7 +605,7 @@ void zmapWindowColumnBumpRange(FooCanvasItem *column_item, ZMapStyleBumpMode bum
 	    compress_mode == ZMAPWINDOW_COMPRESS_MARK)
 	  {
 	    if (removeNameListsByRange(&names_list, start, end))
-	      set_data->hidden_bump_features = TRUE ;
+	      container->hidden_bump_features = TRUE ;
 	  }
 
 	list_length = g_list_length(names_list) ;
@@ -584,7 +628,7 @@ void zmapWindowColumnBumpRange(FooCanvasItem *column_item, ZMapStyleBumpMode bum
 	  }
 	else
 	  {
-	    AddGapsDataStruct gaps_data = {set_data->window, &(set_data->gaps_added_items)} ;
+	    AddGapsDataStruct gaps_data = {window, container} ;
 
 
 	    /* TRY JUST ADDING GAPS  IF A MARK IS SET */
@@ -619,10 +663,10 @@ void zmapWindowColumnBumpRange(FooCanvasItem *column_item, ZMapStyleBumpMode bum
 
 
 	    /* we reverse the offsets for reverse strand cols so as to mirror the forward strand. */
-	    set_data = g_object_get_data(G_OBJECT(column_group), ITEM_FEATURE_SET_DATA) ;
-	    if (set_data->strand == ZMAPSTRAND_REVERSE)
+	    if (container->strand == ZMAPSTRAND_REVERSE)
 	      reverseOffsets(complex.bumpcol_list) ;
 
+	    g_list_foreach(complex.bumpcol_list, make_parent_item_cb, column_features);
 
 	    /* Bump all the features to their correct offsets. */
 	    g_list_foreach(complex.bumpcol_list, moveItemsCB, NULL) ;
@@ -641,19 +685,21 @@ void zmapWindowColumnBumpRange(FooCanvasItem *column_item, ZMapStyleBumpMode bum
 
 		/* for no interleave add background items.... */
 #ifdef ED_G_NEVER_INCLUDE_THIS_CODE
-		g_list_foreach(complex.bumpcol_list, addBackgrounds, &set_data->extra_items) ;
+		g_list_foreach(complex.bumpcol_list, addBackgrounds, &container->extra_items) ;
 #endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
 		
 #ifdef ED_G_NEVER_INCLUDE_THIS_CODE
-		g_list_foreach(complex.bumpcol_list, addMultiBackgrounds, &set_data->extra_items) ;
+		g_list_foreach(complex.bumpcol_list, addMultiBackgrounds, &container->extra_items) ;
 #endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
 
 		/* WE SHOULD ONLY BE DOING THIS FOR ALIGN FEATURES...TEST AT THIS LEVEL.... */
 
 #ifdef ED_G_NEVER_INCLUDE_THIS_CODE
-		g_list_foreach(complex.bumpcol_list, NEWaddMultiBackgrounds, &set_data->extra_items) ;
+		g_list_foreach(complex.bumpcol_list, NEWaddMultiBackgrounds, &container->extra_items) ;
+		g_list_foreach(complex.bumpcol_list, NEWaddMultiBackgrounds, container) ;
 #endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
-		g_list_foreach(complex.bumpcol_list, NEWaddMultiBackgrounds, set_data) ;
+
+		g_list_foreach(complex.bumpcol_list, collection_add_colinear_cb, &complex);
 
 		zMapPrintTimer(NULL, "added inter align bars etc.") ;
 	      }
@@ -691,7 +737,7 @@ void zmapWindowColumnBumpRange(FooCanvasItem *column_item, ZMapStyleBumpMode bum
     }
 
 
-  zMapWindowBusy(set_data->window, FALSE) ;
+  zMapWindowBusy(window, FALSE) ;
 
   zMapPrintTimer(NULL, "finished bump") ;
 
@@ -700,15 +746,15 @@ void zmapWindowColumnBumpRange(FooCanvasItem *column_item, ZMapStyleBumpMode bum
 
 void zmapWindowColumnBumpAllInitial(FooCanvasItem *column_item)
 {
-  FooCanvasGroup *strand_container = NULL;
+  ZMapWindowContainerGroup container_strand;
 
   /* Get the strand level container */
-  if((strand_container = zmapWindowContainerGetParentLevel(column_item, ZMAPCONTAINER_LEVEL_STRAND)))
+  if((container_strand = zmapWindowContainerUtilsItemGetParentLevel(column_item, ZMAPCONTAINER_LEVEL_STRAND)))
     {
       /* container execute */
-      zmapWindowContainerExecute(strand_container, 
-				 ZMAPCONTAINER_LEVEL_FEATURESET,
-				 invoke_bump_to_initial, NULL);
+      zmapWindowContainerUtilsExecute(container_strand, 
+				      ZMAPCONTAINER_LEVEL_FEATURESET,
+				      invoke_bump_to_initial, NULL);
       /* happy days */
 
     }
@@ -753,7 +799,7 @@ static void bumpColCB(gpointer data, gpointer user_data)
 {
   FooCanvasItem *item = (FooCanvasItem *)data ;
   BumpCol bump_data   = (BumpCol)user_data ;
-  ZMapWindowItemFeatureSetData set_data ;
+  ZMapWindowContainerFeatureSet container ;
   ZMapFeatureTypeStyle style ;
   ZMapWindowItemFeatureType item_feature_type ;
   ZMapFeature feature ;
@@ -780,8 +826,8 @@ static void bumpColCB(gpointer data, gpointer user_data)
 	proceed = FALSE;
 
       bump_mode = bump_data->bump_prop_data.overlap_mode ;
-      set_data  = bump_data->bump_prop_data.set_data;
-      style     = zmapWindowItemFeatureSetStyleFromID(set_data, feature->style_id) ;
+      container = bump_data->bump_prop_data.container;
+      style     = zmapWindowContainerFeatureSetStyleFromID(container, feature->style_id) ;
     }
 
   if(proceed)
@@ -796,7 +842,7 @@ static void bumpColCB(gpointer data, gpointer user_data)
 	{
 	  if (feature->x2 < bump_data->start || feature->x1 > bump_data->end)
 	    {
-	      set_data->hidden_bump_features = TRUE ;
+	      container->hidden_bump_features = TRUE ;
 	      
 	      foo_canvas_item_hide(item) ;
 	      
@@ -859,7 +905,7 @@ static void bumpColCB(gpointer data, gpointer user_data)
 	    g_list_foreach(bump_data->pos_list, compareListOverlapCB, new_range) ;
 	    
 	    bump_data->pos_list = g_list_append(bump_data->pos_list, new_range) ;
-	    
+
 	    offset = new_range->offset ;
 	    
 	    break ;
@@ -1046,7 +1092,7 @@ static gboolean can_bump_item(FooCanvasItem *item, ComplexBump complex, ZMapFeat
   if(zmapWindowItemIsShown(item))
     {
       ZMapWindowItemFeatureType item_feature_type ;
-      ZMapWindowItemFeatureSetData set_data ;
+      ZMapWindowContainerFeatureSet container ;
       ZMapFeatureTypeStyle style ;
       ZMapFeature feature ;
 
@@ -1056,8 +1102,8 @@ static gboolean can_bump_item(FooCanvasItem *item, ComplexBump complex, ZMapFeat
       feature = g_object_get_data(G_OBJECT(item), ITEM_FEATURE_DATA) ;
       zMapAssert(feature) ;
       
-      set_data = complex->bump_properties->set_data;
-      style    = zmapWindowStyleTableFind(set_data->style_table, feature->style_id) ;
+      container = complex->bump_properties->container;
+      style     = zmapWindowStyleTableFind(container->style_table, feature->style_id) ;
 
       if ((!complex->bump_properties->bump_all) && (complex->bump_properties->style_id != feature->style_id))
 	bump_me = FALSE;
@@ -1117,7 +1163,6 @@ static void makeNameListStrandedCB(gpointer data, gpointer user_data)
   make_or_append_in_hash(name_hash, name_quark, item);
 
   g_string_truncate(complex->temp_buffer, 0);
-
   
   return ;
 }
@@ -1224,7 +1269,6 @@ static void testRangeCB(gpointer data, gpointer user_data)
   return ;
 }
 
-
 /* GFunc() to hide all items in a list. */
 static void hideItemsCB(gpointer data, gpointer user_data_unused)
 {
@@ -1243,7 +1287,6 @@ static void addGapsCB(gpointer data, gpointer user_data)
   GList *feature_list = *((GList **)(data)) ;
   AddGapsData gaps_data = (AddGapsData)user_data ;
   ZMapWindow window = gaps_data->window ;
-  GList *gaps_added_items = *(gaps_data->gaps_added_items) ;
   GList *list_item ;
 
   list_item = feature_list ;
@@ -1251,9 +1294,8 @@ static void addGapsCB(gpointer data, gpointer user_data)
     {
       FooCanvasItem *item = (FooCanvasItem *)(list_item->data) ;
       ZMapFeature feature = NULL ;
-      ZMapWindowItemFeatureSetData set_data = NULL;
+      ZMapWindowContainerFeatureSet container = NULL;
       ZMapFeatureTypeStyle style = NULL;
-      FooCanvasGroup *set_group ;
 
       /* Get the feature. */
       feature = g_object_get_data(G_OBJECT(item), ITEM_FEATURE_DATA) ;
@@ -1261,12 +1303,8 @@ static void addGapsCB(gpointer data, gpointer user_data)
 
 
       /* Get the features active style (the one on the canvas. */
-      set_group = zmapWindowContainerGetParentContainerFromItem(item) ;
-      zMapAssert(set_group) ;
-      set_data = g_object_get_data(G_OBJECT(set_group), ITEM_FEATURE_SET_DATA) ;
-      zMapAssert(set_data) ;
-
-      style = zmapWindowItemFeatureSetStyleFromID(set_data, feature->style_id) ;
+      container = gaps_data->container;
+      style     = zmapWindowContainerFeatureSetStyleFromID(container, feature->style_id) ;
 
       /* Only display gaps on bumping and if the alignments have gaps. */
       if (zMapStyleGetMode(style) == ZMAPSTYLE_MODE_ALIGNMENT)
@@ -1286,7 +1324,7 @@ static void addGapsCB(gpointer data, gpointer user_data)
 
 	      list_item->data = item ;			    /* replace item in list ! */
 
-	      gaps_added_items = g_list_append(gaps_added_items, item) ; /* Record in a our list
+	      container->gaps_added_items = g_list_append(container->gaps_added_items, item) ; /* Record in a our list
 									    of gapped items. */
 
 	      /* Now reset align_gaps to whatever it was. */
@@ -1296,49 +1334,10 @@ static void addGapsCB(gpointer data, gpointer user_data)
 
     } while ((list_item = g_list_next(list_item))) ;
 
-
-  /* Return the gaps_added items... */
-  *(gaps_data->gaps_added_items) = gaps_added_items ;
-
   return ;
 }
 
 
-
-/* Redraw item drawn with gaps as a single block.... */
-static void removeGapsCB(gpointer data, gpointer user_data)
-{
-  FooCanvasItem *item = (FooCanvasItem *)data ;
-  ZMapWindow window = (ZMapWindow)user_data ;
-  ZMapFeature feature ;
-
-  feature = g_object_get_data(G_OBJECT(item), ITEM_FEATURE_DATA) ;
-  zMapAssert(zMapFeatureIsValid((ZMapFeatureAny)feature)) ;
-  zMapAssert(feature->type == ZMAPSTYLE_MODE_ALIGNMENT) ;
-
-  /* Note the logic here....if we are in this routine its because the feature _is_
-   * and alignment AND its style is set to no gaps, so unlike when we draw we don't
-   * have to set any flags.... */
-#ifdef RT_63281
-  if(FOO_CANVAS_ITEM(item)->object.flags & FOO_CANVAS_ITEM_VISIBLE)
-    {
-#endif /* RT_63281 */
-
-      item = zMapWindowFeatureReplace(window, item, feature, FALSE) ;
-      /* replace feature with itself. */
-      zMapAssert(item) ;
-
-#ifdef RT_63281
-    }
-#endif /* RT_63281 */
-
-  return ;
-}
-
-
-
-
-
 static void removeNonColinearExtensions(gpointer data, gpointer user_data)
 {
   GList **name_list_ptr = (GList **)data ;
@@ -1422,471 +1421,6 @@ static void removeNonColinearExtensions(gpointer data, gpointer user_data)
   return ;
 }
 
-//#ifdef RDS_COLLECTION_FEATURES_INSTEAD
-/* 
- * There was/is a problem with this function.  Before FooCanvasItems
- * are mapped calling foo_canvas_item_get_bounds will return 0.0 for
- * all coordinates.  This was causing the bug
- * https://rt.sanger.ac.uk/rt/Ticket/Display.html?id=68459
- *
-
- * Ed, I've changed the function to stop the crashing, but there is a
- * slight problem with the alignment (vertical) of same name items
- * now.  I haven't investigated the cause, but I do have a fool proof
- * way to repoduce using the following database
- * ~rds/acedb_sessions/ib2_update_info_crash/
-
- * Mark AC019068.1-001 (longest Known-CDS transcript)
- * Turn On the EST Mouse Column
- * Bump the EST Mouse Column
- * Rev-Comp
- * Turn On the EST Mouse Column and Em:CO798510.1 has a green line 
- * (longest one) between one HSP and another, but the another is not
- * in the same column...
-
- */
-
-/* GFunc() to add background items indicating goodness of match to each set of items in a list.
- * 
- * Note that each set of items may represent more than one match, the matches won't overlap but
- * there may be more than one. Hence the more complicated code.
- * 
- * THIS FUNCTION HAS SOME HARD CODED STUFF AND QUITE A BIT OF CODE THAT CAN BE REFACTORED TO
- * SIMPLIFY THINGS, I'VE CHECKED IT IN NOW BECAUSE I WANT IT TO BE IN CVS OVER XMAS.
- * 
- *  */
-static void NEWaddMultiBackgrounds(gpointer data, gpointer user_data)
-{
-  ComplexCol col_data = (ComplexCol)data ;
-
-#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
-  GList **extras_ptr = (GList **)user_data ;
-  GList *extra_items = *extras_ptr ;
-#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
-  ZMapWindowItemFeatureSetData set_data = (ZMapWindowItemFeatureSetData)user_data ;
-  GList *extra_items = set_data->extra_items ;
-  ZMapWindow window;
-  GList *name_list = col_data->feature_list ;			    /* Single list of named features. */
-  static gboolean colour_init = FALSE ;
-  static GdkColor perfect, colinear, noncolinear ;
-  char *perfect_colour = ZMAP_WINDOW_MATCH_PERFECT ;
-  char *colinear_colour = ZMAP_WINDOW_MATCH_COLINEAR ;
-  char *noncolinear_colour = ZMAP_WINDOW_MATCH_NOTCOLINEAR ;
-  GList *backgrounds = NULL ;
-  GList *list_item ;
-  double width, mid, half_width ;
-  FooCanvasItem *item ;
-  FooCanvasItem *background ;
-  ZMapFeature prev_feature = NULL, curr_feature = NULL ;
-  ZMapFeatureTypeStyle prev_style = NULL, curr_style = NULL ;
-  GQuark prev_id = 0, curr_id = 0 ;
-  int prev_end = 0, curr_start = 0 ;
-  double x1, x2, prev_y1, prev_y2, curr_y1, curr_y2 ;
-  double start_x1, start_x2, end_x1, end_x2 ;
-
-  /* IN THIS FUNCTION _DO_NOT_ CALL
-   * FOO_CANVAS_ITEM_LOWER_TO_BOTTOM. THIS IS A _VERY_ TIME CONSUMING
-   * CALL WHICH SEARCHES THE LIST FOR THE ITEM BEFORE LOWERING
-   * IT!!! */
-
-  if (!colour_init)
-    {
-      gdk_color_parse(perfect_colour, &perfect) ;
-      gdk_color_parse(colinear_colour, &colinear) ;
-      gdk_color_parse(noncolinear_colour, &noncolinear) ;
-
-      colour_init = TRUE ;
-    }
-
-  /* Get the first item. */
-  list_item = g_list_first(name_list) ;
-  item      = FOO_CANVAS_ITEM(list_item->data);
-
-  /* We only pay attention to the x coords so we can find the midpoint*/
-  foo_canvas_item_get_bounds(item, &x1, NULL, &x2, NULL) ;
-  curr_feature = g_object_get_data(G_OBJECT(item), ITEM_FEATURE_DATA) ;
-  zMapAssert(curr_feature) ;
-
-
-  /* THIS IS WRONG IT NEEDS TO CALCULATE OFFSET (+ 1) CORRECTLY!! */
-  /* THIS IS _NOT_ THE ONLY PLACE! */
-  curr_y1 = curr_feature->x1 + 1;
-  curr_y2 = curr_feature->x2;
-
-
-  /* Only makes sense to add this colinear bars for alignment features.... */
-  if (curr_feature->type != ZMAPSTYLE_MODE_ALIGNMENT)
-    return ;
-
-  curr_id = curr_feature->original_id ;
-  curr_style = zmapWindowItemFeatureSetStyleFromID(set_data, curr_feature->style_id) ;
-
-
-  /* Calculate horizontal mid point of this column of matches from the first item,
-   * N.B. this works because the items have already been positioned in the column. */
-  mid = (x2 + x1) * 0.5 ;
-
-  width = zMapStyleGetWidth(curr_style) ;
-  half_width = width * 0.5 ;
-
-  col_data->width = width ;
-  window = col_data->bump_properties->window;
-
-  /* CODE HERE WORKS BUT IS NOT CORRECT IN THAT IT IS USING THE CANVAS BOX COORDS WHEN IT
-   * SHOULD BE USING THE FEATURE->X1/X2 COORDS...i'LL FIX IT LATER... */
-  do
-    {
-      unsigned int match_threshold ;
-      GdkColor *box_colour ;
-      ZMapWindowItemFeatureBumpData bump_data ;
-      int query_seq_end, align_end ;
-      gboolean incomplete ;
-
-      /* mark start of curr item if its incomplete. */
-      incomplete = FALSE ;
-      if (curr_feature->feature.homol.y1 > curr_feature->feature.homol.y2)
-	{
-	  if (window->revcomped_features)
-	    {
-	      query_seq_end = 1 ;
-	      align_end = curr_feature->feature.homol.y2 ;
-
-	      if (query_seq_end < align_end)
-		incomplete = TRUE ;
-	    }
-	  else
-	    {
-	      query_seq_end = curr_feature->feature.homol.length ;
-	      align_end = curr_feature->feature.homol.y1 ;
-
-	      if (query_seq_end > align_end)
-		incomplete = TRUE ;
-	    }
-	}
-      else
-	{
-	  if (window->revcomped_features)
-	    {
-	      query_seq_end = curr_feature->feature.homol.length ;
-	      align_end = curr_feature->feature.homol.y2 ;
-
-	      if (query_seq_end > align_end)
-		incomplete = TRUE ;
-	    }
-	  else
-	    {
-	      query_seq_end = 1 ;
-	      align_end = curr_feature->feature.homol.y1 ;
-
-	      if (query_seq_end < align_end)
-		incomplete = TRUE ;
-	    }
-	}
-
-      if (incomplete)
-	{
-	  double box_start, box_end, mid ;
-
-	  bump_data = g_new0(ZMapWindowItemFeatureBumpDataStruct, 1) ;
-	  bump_data->first_item = item ;
-	  bump_data->feature_id = curr_id ;
-	  bump_data->style = curr_style ;
-
-	  {
-	    double test_1, test_2 ;
-
-	    foo_canvas_item_get_bounds(item, &test_1, NULL, &test_2, NULL) ;
-	  }
-
-	  itemGetCoords(item, &start_x1, &start_x2) ;
-	  mid = start_x1 + ((start_x2 - start_x1) / 2) ;
-	  
-	  box_start = curr_y1 - 10 ;
-	  box_end = curr_y1 + 10 ;
-
-	  box_colour = &noncolinear ;
-	  background = makeMatchItem(window->long_items,
-				     FOO_CANVAS_GROUP(item->parent), ZMAPDRAW_OBJECT_BOX,
-				     mid - 1, box_start,
-				     mid + 1, box_end,
-				     box_colour, bump_data, window) ;
-
-	  backgrounds = g_list_append(backgrounds, background) ;
-		      
-	  extra_items = g_list_append(extra_items, background) ;
-	}
-
-
-      /* make curr in to prev item */
-      prev_feature = curr_feature ;
-      prev_id = curr_feature->original_id ;
-
-      if (window->revcomped_features)
-	prev_end = curr_feature->feature.homol.y1 ;
-      else
-	prev_end = curr_feature->feature.homol.y2 ;
-
-
-#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
-      prev_style = curr_feature->style ;
-#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
-      prev_style = curr_style ;
-
-      prev_y1 = curr_y1 ;
-      prev_y2 = curr_y2 ;
-
-
-      /* Mark in between matches for their colinearity. */
-      while ((list_item = g_list_next(list_item)))
-	{
-	  /* get new curr item */
-	  item = (FooCanvasItem *)list_item->data ;
-	  /* As the comment says at the top this is completely wrong and if the item isn't mapped curr_y1/y2 end up as 0! */
-	  /* foo_canvas_item_get_bounds(item, NULL, &curr_y1, NULL, &curr_y2); */
-
-	  curr_feature = g_object_get_data(G_OBJECT(item), ITEM_FEATURE_DATA) ;
-	  zMapAssert(curr_feature) ;
-	  curr_id = curr_feature->original_id ;
-	  /* THIS IS WRONG IT NEEDS TO CALCULATE OFFSET (+ 1) CORRECTLY!! */
-	  curr_y1 = curr_feature->x1 + 1;
-	  curr_y2 = curr_feature->x2;
-
-	  if (window->revcomped_features)
-	    curr_start = curr_feature->feature.homol.y2 ;
-	  else
-	    curr_start = curr_feature->feature.homol.y1 ;
-
-	  curr_style = zmapWindowItemFeatureSetStyleFromID(set_data, curr_feature->style_id) ;
-
-	  /* We only do aligns (remember that there can be different types in a single col)
-	   * and only those for which joining of homols was requested. */
-	  if (zMapStyleGetMode(curr_style) != ZMAPSTYLE_MODE_ALIGNMENT
-	      || !(zMapStyleGetJoinAligns(curr_style, &match_threshold)))
-	    continue ;
-
-
-	  /* If we've changed to a new match then break, otherwise mark for colinearity. */
-	  if (curr_id != prev_id)
-	    break ;
-	  else
-	    {
-	      ColinearityType colinearity ;
-
-	      /* Checks that adjacent matches do not overlap and then checks for colinearity.
-	       * Note that matches are most likely to overlap where a false end to an HSP has been made. */
-	      colinearity = featureHomolIsColinear(window, col_data->bump_properties->match_threshold, 
-						   prev_feature, curr_feature) ;
-
-	      if (colinearity != COLINEAR_INVALID)
-		{
-		  double real_start, real_end ;
-
-		  if (colinearity == COLINEAR_NOT)
-		    box_colour = &noncolinear ;
-		  else if (colinearity == COLINEAR_IMPERFECT)
-		    box_colour = &colinear ;
-		  else
-		    box_colour = &perfect ;
-
-
-		  /* make line + box but up against alignment boxes. */
-		  real_start = prev_y2 - 1 ;
-		  real_end = curr_y1 + 1 ;
-
-		  bump_data = g_new0(ZMapWindowItemFeatureBumpDataStruct, 1) ;
-		  bump_data->first_item = item ;
-		  bump_data->feature_id = prev_id ;
-		  bump_data->style = prev_style ;
-
-
-
-		  /* Make line... */
-		  background = makeMatchItem(window->long_items,
-					     FOO_CANVAS_GROUP(item->parent), ZMAPDRAW_OBJECT_LINE,
-					     mid, real_start, mid, real_end,
-					     box_colour, bump_data, window) ;
-
-
-		  extra_items = g_list_append(extra_items, background) ;
-
-		  backgrounds = g_list_append(backgrounds, background) ;
-
-
-		  /* Make invisible box.... */
-		  bump_data = g_new0(ZMapWindowItemFeatureBumpDataStruct, 1) ;
-		  bump_data->first_item = item ;
-		  bump_data->feature_id = prev_id ;
-		  bump_data->style = prev_style ;
-
-		  background = makeMatchItem(window->long_items,
-					     FOO_CANVAS_GROUP(item->parent), ZMAPDRAW_OBJECT_BOX,
-					     (mid - half_width), real_start, (mid + half_width), real_end,
-					     NULL,
-					     bump_data, window) ;
-
-		  extra_items = g_list_append(extra_items, background) ;
-
-		  backgrounds = g_list_append(backgrounds, background) ;
-
-		}
-	      
-
-	      /* make curr into prev */
-	      prev_feature = curr_feature ;
-	      prev_id = curr_feature->original_id ;
-
-	      if (window->revcomped_features)
-		prev_end = curr_feature->feature.homol.y1 ;
-	      else
-		prev_end = curr_feature->feature.homol.y2 ;
-
-
-#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
-	      prev_style = curr_feature->style ;
-#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
-	      prev_style = curr_style ;
-
-	      prev_y1 = curr_y1 ;
-	      prev_y2 = curr_y2 ;
-	    }
-	}
-      
-
-      /* Mark start/end of final feature if its incomplete. */
-      incomplete = FALSE ;
-
-      if (prev_feature->feature.homol.y1 > prev_feature->feature.homol.y2)
-	{
-	  if (window->revcomped_features)
-	    {
-	      query_seq_end = prev_feature->feature.homol.length ;
-	      align_end = prev_feature->feature.homol.y1 ;
-
-	      if (query_seq_end > align_end)
-		incomplete = TRUE ;
-	    }
-	  else
-	    {
-	      query_seq_end = 1 ;
-	      align_end = prev_feature->feature.homol.y2 ;
-
-	      if (query_seq_end < align_end)
-		incomplete = TRUE ;
-	    }
-
-	}
-      else
-	{
-	  if (window->revcomped_features)
-	    {
-	      query_seq_end = 1 ;
-	      align_end = prev_feature->feature.homol.y1 ;
-
-	      if (query_seq_end < align_end)
-		incomplete = TRUE ;
-	    }
-	  else
-	    {
-	      query_seq_end = prev_feature->feature.homol.length ;
-	      align_end = prev_feature->feature.homol.y2 ;
-
-	      if (query_seq_end > align_end)
-		incomplete = TRUE ;
-	    }
-	}
-
-      if (incomplete)
-	{
-	  double box_start, box_end, mid ;
-
-	  box_start = prev_y2 - 10 ;
-	  box_end = prev_y2 + 10 ;
-
-	  bump_data = g_new0(ZMapWindowItemFeatureBumpDataStruct, 1) ;
-	  bump_data->first_item = item ;
-	  bump_data->feature_id = prev_feature->original_id ;
-
-#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
-	  bump_data->style = prev_feature->style ;
-#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
-	  bump_data->style = prev_style ;
-
-	  itemGetCoords(item, &end_x1, &end_x2) ;
-	  mid = end_x1 + ((end_x2 - end_x1) / 2) ;
-
-	  box_colour = &noncolinear ;
-	  background = makeMatchItem(window->long_items,
-				     FOO_CANVAS_GROUP(item->parent), ZMAPDRAW_OBJECT_BOX,
-				     mid - 1, box_start,
-				     mid + 1, box_end,
-				     box_colour, bump_data, window) ;
-
-	  backgrounds = g_list_append(backgrounds, background) ;
-
-	  extra_items = g_list_append(extra_items, background) ;
-	}
-
-    } while (list_item) ;
-
-
-  /* Need to add all backgrounds to col list here and lower them in group.... */
-  name_list = g_list_concat(name_list, backgrounds) ;
-
-  col_data->feature_list = name_list ;
-
-  set_data->extra_items = extra_items ;
-
-  return ;
-}
-
-
-
-static FooCanvasItem *makeMatchItem(ZMapWindowLongItems long_items,
-				    FooCanvasGroup *parent, ZMapDrawObjectType shape,
-				    double x1, double y1, double x2, double y2,
-				    GdkColor *colour,
-				    gpointer item_data, gpointer event_data)
-{
-  FooCanvasItem *match_item ;
-
-  if (shape == ZMAPDRAW_OBJECT_LINE)
-    {
-      match_item = zMapDrawLineFull(parent, FOO_CANVAS_GROUP_BOTTOM,
-				    x1, y1, x2, y2, 
-				    colour, 1.0) ;
-    }
-  else
-    {
-      match_item = zMapDrawBoxFull(parent, FOO_CANVAS_GROUP_BOTTOM,
-				   x1, y1, x2, y2,
-				   colour, colour, 0.0) ;
-    }
-
-  g_object_set_data(G_OBJECT(match_item), ITEM_FEATURE_TYPE,
-		    GINT_TO_POINTER(ITEM_FEATURE_GROUP_BACKGROUND)) ;
-  g_object_set_data(G_OBJECT(match_item), ITEM_FEATURE_BUMP_DATA, item_data) ;
-  g_signal_connect(GTK_OBJECT(match_item), "event",
-		   GTK_SIGNAL_FUNC(bumpBackgroundEventCB), event_data) ;
-  g_signal_connect(GTK_OBJECT(match_item), "destroy",
-		   GTK_SIGNAL_FUNC(bumpBackgroundDestroyCB), event_data) ;
-
-
-  zmapWindowLongItemCheck(long_items, match_item, y1, y2) ;
-
-
-  return match_item ;
-}
-//#endif /* RDS_COLLECTION_FEATURES_INSTEAD */
-
-
-static void freeExtraItems(gpointer data, gpointer user_data_unused)
-{
-  FooCanvasItem *item = (FooCanvasItem *)data ;
-
-  gtk_object_destroy(GTK_OBJECT(item)) ;
-
-  return ;
-}
 
 
 
@@ -1895,10 +1429,10 @@ static void freeExtraItems(gpointer data, gpointer user_data_unused)
 static void showItems(gpointer data, gpointer user_data)
 {
   FooCanvasItem *item = (FooCanvasItem *)data ;
-  ZMapWindowItemFeatureSetData set_data = (ZMapWindowItemFeatureSetData)user_data ;
+  ZMapWindowContainerFeatureSet container = (ZMapWindowContainerFeatureSet)user_data ;
   GList *found_item = NULL ;
 
-  if (!(found_item = g_queue_find_custom(set_data->user_hidden_stack, item, findItemInQueueCB)))
+  if (!(found_item = g_queue_find_custom(container->user_hidden_stack, item, findItemInQueueCB)))
     foo_canvas_item_show(item) ;
 
   return ;
@@ -2226,16 +1760,19 @@ static ComplexCol ComplexBumpComplexColCreate(ComplexBump complex, GList *name_l
 
   if((col = g_new0(ComplexColStruct, 1)))
     {
-      double max_width = 0.0 ;
+      OffsetWidthStruct x1_width = {G_MAXDOUBLE, 0.0};
 
       col->bump_properties  = complex->bump_properties;
       col->offset           = complex->curr_offset ;
       col->feature_list     = name_list ;
 
-      g_list_foreach(name_list, getMaxWidth, &max_width) ;
+      g_list_foreach(name_list, getMaxWidth, &x1_width) ;
 
       complex->bumpcol_list = g_list_append(complex->bumpcol_list, col) ;
-      complex->curr_offset += max_width ;
+      complex->curr_offset += x1_width.width ;
+
+      if(x1_width.x != G_MAXDOUBLE)
+	col->offset -= x1_width.x;
     }
   else
     zMapLogCritical("%s", "Failed to allocate");
@@ -2310,72 +1847,18 @@ static void setAllOffsetCB(gpointer data, gpointer user_data)
 static void getMaxWidth(gpointer data, gpointer user_data)
 {
   FooCanvasItem *item = (FooCanvasItem *)data ;
-  double *max_width = (double *)user_data ;
+  OffsetWidth x1_width = (OffsetWidth)user_data;
   double x1, x2, width ;
-  ZMapFeature feature = NULL ;
-  ZMapWindowItemFeatureType feature_type ;
 
-#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
-  foo_canvas_item_get_bounds(item, &x1, &y1, &x2, &y2) ;
-#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
-
-  feature = g_object_get_data(G_OBJECT(item), ITEM_FEATURE_DATA);
-  feature_type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(item), ITEM_FEATURE_TYPE)) ;
-
-
-#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
-  if (zmapWindowItemIsCompound(item))
-    {
-      true_item = zmapWindowItemGetNthChild(FOO_CANVAS_GROUP(item), 0) ;
-    }
-  else
-    true_item = item ;
-
-
-  if (FOO_IS_CANVAS_GROUP(true_item))
-    {
-      printf("we shouldn't be here\n") ;
-    }
-
-
-  if (FOO_IS_CANVAS_POLYGON(true_item))
-    {
-      FooCanvasPoints *points = NULL ;
-      int i ;
-
-      g_object_get(G_OBJECT(true_item),
-		   "points", &points,
-		   NULL) ;
-
-      x1 = x2 = points->coords[0] ;
-      for (i = 0 ; i < points->num_points ; i += 2)
-	{
-	  if (points->coords[i] < x1)
-	    x1 = points->coords[i] ;
-	  if (points->coords[i] > x2)
-	    x2 = points->coords[i] ;
-	}
-    }
-  else if (FOO_IS_CANVAS_RE(true_item))
-    {
-      g_object_get(G_OBJECT(true_item),
-		   "x1", &x1,
-		   "x2", &x2,
-		   NULL) ;
-    }
-  else
-    {
-      printf("agh....can't cope with this\n") ;
-    }
-
-#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
-
-  itemGetCoords(item, &x1, &x2) ;
+  zMapWindowCanvasItemGetBumpBounds(ZMAP_CANVAS_ITEM(item), &x1, NULL, &x2, NULL);
 
   width = x2 - x1 + 1.0 ;
 
-  if (width > *max_width)
-    *max_width = width ;
+  if (width > x1_width->width)
+    x1_width->width = width ;
+
+  if(x1 < x1_width->x)
+    x1_width->x = x1;
 
   return ;
 }
@@ -2531,12 +2014,11 @@ static void reverseOffsets(GList *bumpcol_list)
 
 static void reparentItemCB(gpointer data, gpointer user_data)
 {
-#ifdef RDS_NO
   ComplexCol col_data = (ComplexCol)user_data;
 
   zMapWindowCollectionFeatureStaticReparent(ZMAP_CANVAS_ITEM(data),
 					    ZMAP_CANVAS_ITEM(col_data->parent_item));
-#endif
+
   return ;
 }
 
@@ -2596,7 +2078,7 @@ static void moveItemCB(gpointer data, gpointer user_data)
   zMapAssert(feature) ;
 
   /* Get hold of the style. */
-  style = zmapWindowItemFeatureSetStyleFromID(col_data->bump_properties->set_data, feature->style_id) ;
+  style = zmapWindowContainerFeatureSetStyleFromID(col_data->bump_properties->container, feature->style_id) ;
 
   /* x1, x2 always needed so might as well get y coords as well because foocanvas will have
    * calculated them anyway. */
@@ -2645,175 +2127,6 @@ static void setStyleBumpCB(ZMapFeatureTypeStyle style, gpointer user_data)
  *   from the canvas.
  */
 
-/* Callback for any events that happen on bump background items.
- * 
- *  */
-static gboolean bumpBackgroundEventCB(FooCanvasItem *item, GdkEvent *event, gpointer data)
-{
-  gboolean event_handled = FALSE ;
-  ZMapWindow window = (ZMapWindowStruct*)data ;
-
-  switch (event->type)
-    {
-    case GDK_BUTTON_PRESS:
-      {
-	GdkEventButton *but_event = (GdkEventButton *)event ;
-
-	/* Button 1 is handled, button 3 is not as there is no applicable item menu,
-	 * 2 is left for a general handler which could be the root handler. */
-	if (but_event->button == 1)
-	  {
-	    ZMapWindowItemFeatureType item_feature_type ;
-	    ZMapWindowItemFeatureBumpData bump_data ;
-	    ZMapWindowSelectStruct select = {0} ;
-	    gboolean replace_highlight = TRUE ;
-	    ZMapFeature feature ;
-
-	    if (zMapGUITestModifiers(but_event, GDK_SHIFT_MASK))
-	      {
-		if (zmapWindowFocusIsItemInHotColumn(window->focus, item))
-		  replace_highlight = FALSE ;
-	      }
-
-	    item_feature_type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(item),
-								  ITEM_FEATURE_TYPE)) ;
-	    zMapAssert(item_feature_type == ITEM_FEATURE_GROUP_BACKGROUND) ;
-
-
-	    /* Retrieve the feature item info from the canvas item. */
-	    bump_data = (ZMapWindowItemFeatureBumpData)g_object_get_data(G_OBJECT(item), ITEM_FEATURE_BUMP_DATA) ;  
-	    zMapAssert(bump_data) ;
-
-	    /* Pass back details for display to the user to our caller. */
-	    select.feature_desc.feature_name = (char *)g_quark_to_string(bump_data->feature_id) ;
-
-	    select.feature_desc.feature_set = (char *)g_quark_to_string(zMapStyleGetID(bump_data->style)) ;
-
-	    feature = g_object_get_data(G_OBJECT(bump_data->first_item), ITEM_FEATURE_DATA) ;
-	    zMapAssert(feature) ;
-
-	    select.secondary_text = zmapWindowFeatureSetDescription((ZMapFeatureSet)feature) ;
-
-	    select.highlight_item = bump_data->first_item ;
-	    select.replace_highlight_item = replace_highlight ;
-            select.type = ZMAPWINDOW_SELECT_SINGLE;
-
-	    (*(window->caller_cbs->select))(window, window->app_data, (void *)&select) ;
-
-	    g_free(select.secondary_text) ;
-
-	    event_handled = TRUE ;
-	  }
-
-	break ;
-      }
-    default:
-      {
-	/* By default we _don't_ handle events. */
-	event_handled = FALSE ;
-
-	break ;
-      }
-    }
-  
-  return event_handled ;
-}
-
-
-
-
-/* Callback for destroy of feature items... */
-static gboolean bumpBackgroundDestroyCB(FooCanvasItem *feature_item, gpointer data)
-{
-  gboolean event_handled = FALSE ;			    /* Make sure any other callbacks also get run. */
-  ZMapWindowItemFeatureType item_feature_type ;
-  ZMapWindow window = (ZMapWindowStruct*)data ;
-  ZMapWindowItemFeatureBumpData bump_data ;
-
-  item_feature_type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(feature_item), ITEM_FEATURE_TYPE)) ;
-  zMapAssert(item_feature_type == ITEM_FEATURE_GROUP_BACKGROUND) ;
-
-  /* Retrieve the feature item info from the canvas item. */
-  bump_data = (ZMapWindowItemFeatureBumpData)g_object_get_data(G_OBJECT(feature_item), ITEM_FEATURE_BUMP_DATA) ;  
-  zMapAssert(bump_data) ;
-  g_free(bump_data) ;
-
-  zmapWindowLongItemRemove(window->long_items, feature_item) ;  /* Ignore boolean result. */
-
-  return event_handled ;
-}
-
-
-
-/* Get the x coords of a drawn feature item, this is more complicated for a compound item where
- * we have to get a child and then transform its coords back to the compound items space.
- * the parent. */
-static gboolean itemGetCoords(FooCanvasItem *item, double *x1_out, double *x2_out)
-{
-  gboolean result = TRUE ;
-  FooCanvasItem *true_item ;
-  double x1, x2, parent_x1, parent_x2 ;
-
-  if (zmapWindowItemIsCompound(item))
-    {
-      true_item = zmapWindowItemGetNthChild(FOO_CANVAS_GROUP(item), 0) ;
-
-      g_object_get(G_OBJECT(item),
-		   "x", &parent_x1,
-		   "y", &parent_x2,
-		   NULL) ;
-    }
-  else
-    true_item = item ;
-
-
-  if (FOO_IS_CANVAS_POLYGON(true_item))
-    {
-      FooCanvasPoints *points = NULL ;
-      int i ;
-
-      g_object_get(G_OBJECT(true_item),
-		   "points", &points,
-		   NULL) ;
-
-      x1 = x2 = points->coords[0] ;
-      for (i = 0 ; i < points->num_points ; i += 2)
-	{
-	  if (points->coords[i] < x1)
-	    x1 = points->coords[i] ;
-	  if (points->coords[i] > x2)
-	    x2 = points->coords[i] ;
-	}
-    }
-  else if (FOO_IS_CANVAS_RE(true_item))
-    {
-      g_object_get(G_OBJECT(true_item),
-		   "x1", &x1,
-		   "x2", &x2,
-		   NULL) ;
-    }
-  else if(FOO_IS_CANVAS_TEXT(true_item))
-    {
-      
-    }
-  else
-    {
-      zMapAssertNotReached() ;
-    }
-
-  if (item != true_item)
-    {
-      x1 += parent_x1 ;
-      x2 += parent_x1 ;
-    }
-
-  *x1_out = x1 ;
-  *x2_out = x2 ;
-
-  return result ;
-}
-
-
 
 #ifdef ED_G_NEVER_INCLUDE_THIS_CODE
 
@@ -3173,60 +2486,8 @@ static ColinearityType featureHomolIsColinear(ZMapWindow window,  unsigned int m
 
 
 
-#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
-/* Checks to see if the start or end of a match is truncated. */
-gboolean featureHomolIsTruncated(ZMapWindow window, ZMapFeature feature, gboolean is_start)
-{
-  gboolean incomplete = FALSE ;
-  gboolean is_revcomped = window->revcomped_features ;
 
-
-  if (feature->feature.homol.y1 > feature->feature.homol.y2)
-    {
-      if (window->revcomped_features)
-	{
-	  query_seq_end = 1 ;
-	  align_end = feature->feature.homol.y2 ;
-
-	  if (query_seq_end < align_end)
-	    incomplete = TRUE ;
-	}
-      else
-	{
-	  query_seq_end = feature->feature.homol.length ;
-	  align_end = feature->feature.homol.y1 ;
-
-	  if (query_seq_end > align_end)
-	    incomplete = TRUE ;
-	}
-    }
-  else
-    {
-      if (window->revcomped_features)
-	{
-	  query_seq_end = feature->feature.homol.length ;
-	  align_end = feature->feature.homol.y2 ;
-
-	  if (query_seq_end > align_end)
-	    incomplete = TRUE ;
-	}
-      else
-	{
-	  query_seq_end = 1 ;
-	  align_end = feature->feature.homol.y1 ;
-
-	  if (query_seq_end < align_end)
-	    incomplete = TRUE ;
-	}
-    }
-
-  return incomplete ;
-}
-#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
-
-
-
-static void invoke_bump_to_initial(FooCanvasGroup *container, FooCanvasPoints *points, 
+static void invoke_bump_to_initial(ZMapWindowContainerGroup container, FooCanvasPoints *points, 
 				   ZMapContainerLevelType level, gpointer user_data)
 {
 
@@ -3234,15 +2495,14 @@ static void invoke_bump_to_initial(FooCanvasGroup *container, FooCanvasPoints *p
     {
     case ZMAPCONTAINER_LEVEL_FEATURESET:
       {
+	ZMapWindowContainerFeatureSet container_set;
 	ZMapStyleBumpMode default_mode, current_mode, initial_mode;
-	ZMapWindowItemFeatureSetData set_data ;
-
-	set_data = g_object_get_data(G_OBJECT(container), ITEM_FEATURE_SET_DATA) ;
 
-	current_mode = zmapWindowItemFeatureSetGetBumpMode(set_data);
-	default_mode = zmapWindowItemFeatureSetGetDefaultBumpMode(set_data);
+	container_set = (ZMapWindowContainerFeatureSet)container;
+	current_mode  = zmapWindowContainerFeatureSetGetBumpMode(container_set);
+	default_mode  = zmapWindowContainerFeatureSetGetDefaultBumpMode(container_set);
 
-	initial_mode = default_mode;
+	initial_mode  = default_mode;
 
 	zmapWindowColumnBumpRange(FOO_CANVAS_ITEM(container), initial_mode, ZMAPWINDOW_COMPRESS_ALL);
       }
diff --git a/src/zmapWindow/zmapWindowColConfig.c b/src/zmapWindow/zmapWindowColConfig.c
index b482f959ae0fb89c3c2670b97e718e5953bb13a7..7e3aae57b1b18705c52c5d5f484d8af4c8875ef3 100755
--- a/src/zmapWindow/zmapWindowColConfig.c
+++ b/src/zmapWindow/zmapWindowColConfig.c
@@ -26,17 +26,17 @@
  *              
  * Exported functions: See ZMap/zmapWindow.h
  * HISTORY:
- * Last edited: May  6 09:58 2009 (rds)
+ * Last edited: Jun  4 10:31 2009 (rds)
  * Created: Thu Mar  2 09:07:44 2006 (edgrif)
- * CVS info:   $Id: zmapWindowColConfig.c,v 1.30 2009-05-06 08:59:22 rds Exp $
+ * CVS info:   $Id: zmapWindowColConfig.c,v 1.31 2009-06-05 13:31:46 rds Exp $
  *-------------------------------------------------------------------
  */
 
 #include <string.h>
 #include <ZMap/zmapUtils.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
-
+#include <zmapWindowContainerFeatureSet_I.h>
+#include <zmapWindowContainerUtils.h>
 
 /* Labels for column state, used in code and the help page. */
 #define SHOW_LABEL     "Show"
@@ -169,7 +169,7 @@ typedef struct
 {
   GList *forward, *reverse;
   gboolean loaded_or_deferred;	/* loaded = FALSE, deferred = TRUE */
-  ZMapWindowItemFeatureBlockData block_data;
+  ZMapWindowContainerBlock block_group;
   int mark1, mark2;
 }ForwardReverseColumnListsStruct, *ForwardReverseColumnLists;
 
@@ -214,7 +214,7 @@ static void revert_button_cb(GtkWidget *apply_button, gpointer user_data);
 
 
 static void select_all_buttons(GtkWidget *button, gpointer user_data);
-static void set_column_lists_cb(FooCanvasGroup *container, FooCanvasPoints *points, 
+static void set_column_lists_cb(ZMapWindowContainerGroup container, FooCanvasPoints *points, 
 				ZMapContainerLevelType level, gpointer user_data);
 
 
@@ -231,7 +231,7 @@ static void loaded_radio_buttons(GtkWidget      *parent,
 				 ShowHideButton *show_out,
 				 ShowHideButton *default_out,
 				 ShowHideButton *hide_out);
-static void column_group_set_active_button(ZMapWindowItemFeatureSetData set_data,
+static void column_group_set_active_button(ZMapWindowContainerFeatureSet container,
 					   GtkWidget *radio_show,
 					   GtkWidget *radio_maybe,
 					   GtkWidget *radio_hide);
@@ -475,6 +475,7 @@ static void configure_get_column_lists(ColConfigure configure_data,
 				       GList **forward_columns_out, GList **reverse_columns_out)
 {
   ZMapWindowColConfigureMode configure_mode;
+  ZMapWindowContainerGroup container = (ZMapWindowContainerGroup)column_group;
   GList *forward_columns = NULL, *reverse_columns = NULL  ;
   ZMapWindow window;
 
@@ -485,7 +486,7 @@ static void configure_get_column_lists(ColConfigure configure_data,
     {
       ZMapStrand strand ;
       
-      strand = zmapWindowContainerGetStrand(column_group);
+      strand = zmapWindowContainerGetStrand(container);
       zMapAssert(strand == ZMAPSTRAND_FORWARD || strand == ZMAPSTRAND_REVERSE) ;
       
       if (strand == ZMAPSTRAND_FORWARD)
@@ -506,7 +507,7 @@ static void configure_get_column_lists(ColConfigure configure_data,
       block = g_object_get_data(G_OBJECT(block_group), ITEM_FEATURE_DATA);
       
       forward_reverse_lists.loaded_or_deferred = deferred_or_loaded;
-      forward_reverse_lists.block_data = g_object_get_data(G_OBJECT(block_group), ITEM_FEATURE_BLOCK_DATA);
+      forward_reverse_lists.block_group = (ZMapWindowContainerBlock)block_group;
 
       if(use_mark_if_marked && window->mark && zmapWindowMarkIsSet(window->mark))
 	{
@@ -520,9 +521,9 @@ static void configure_get_column_lists(ColConfigure configure_data,
 	  forward_reverse_lists.mark2 = block->block_to_sequence.q2;
 	}
 
-      zmapWindowContainerExecute(block_group,
-				 ZMAPCONTAINER_LEVEL_FEATURESET,
-				 set_column_lists_cb, &forward_reverse_lists);
+      zmapWindowContainerUtilsExecute((ZMapWindowContainerGroup)block_group,
+				      ZMAPCONTAINER_LEVEL_FEATURESET,
+				      set_column_lists_cb, &forward_reverse_lists);
 
       forward_columns = forward_reverse_lists.forward;
       reverse_columns = forward_reverse_lists.reverse;
@@ -706,17 +707,17 @@ static void loaded_page_destroy(NotebookPage notebook_page)
   return ;
 }
 
-static void column_group_set_active_button(ZMapWindowItemFeatureSetData set_data,
+static void column_group_set_active_button(ZMapWindowContainerFeatureSet container,
 					   GtkWidget *radio_show,
 					   GtkWidget *radio_maybe,
 					   GtkWidget *radio_hide)
 {
-  if(set_data)
+  if(container)
     {
       ZMapStyleColumnDisplayState col_state ;
       GtkWidget *active_button;
       
-      col_state = zmapWindowItemFeatureSetGetDisplay(set_data) ;
+      col_state = zmapWindowContainerFeatureSetGetDisplay(container) ;
 
       switch(col_state)
 	{
@@ -853,7 +854,7 @@ static void loaded_page_update(NotebookPage notebook_page,
   mode = configure_data->mode;
 
   /* - Get the correct strand container for labels */
-  strand = zmapWindowContainerGetStrand(column_group);
+  strand = zmapWindowContainerGetStrand((ZMapWindowContainerGroup)column_group);
   zMapAssert(strand == ZMAPSTRAND_FORWARD || strand == ZMAPSTRAND_REVERSE) ;
 
   switch(mode)
@@ -1054,14 +1055,14 @@ static GtkWidget *deferred_cols_panel(NotebookPage notebook_page,
 
   if((column = g_list_first(columns_list)))
     {
-      ZMapWindowItemFeatureBlockData block_data;
       FooCanvasGroup *block_group;
       FooCanvasGroup *first_column_group = FOO_CANVAS_GROUP(column->data);
       GList *make_unique = NULL;
+      gboolean have_block_group = FALSE;
 
       if((block_group = configure_get_point_block_container(notebook_page->configure_data, first_column_group)))
 	{
-	  block_data = g_object_get_data(G_OBJECT(block_group), ITEM_FEATURE_BLOCK_DATA);
+	  have_block_group = TRUE;
 	}
 
       do
@@ -1082,9 +1083,10 @@ static GtkWidget *deferred_cols_panel(NotebookPage notebook_page,
 	      
 	      gtk_box_pack_start(GTK_BOX(column_box), button_box, TRUE, TRUE, 0);
 	      
-	      if(mark_set && block_data)
-		loaded_in_mark = zmapWindowItemFeatureBlockIsColumnLoaded(block_data, column_group, 
-									  mark1, mark2);
+	      if(mark_set && have_block_group)
+		loaded_in_mark = zmapWindowContainerBlockIsColumnLoaded((ZMapWindowContainerBlock)block_group, 
+									(ZMapWindowContainerFeatureSet)column_group, 
+									mark1, mark2);
 	      
 	      deferred_radio_buttons(button_box, column_group, loaded_in_mark, 
 				     &all, &mark, &none);
@@ -1171,14 +1173,14 @@ static GtkWidget *deferred_cols_panel(NotebookPage notebook_page,
   return frame;
 }
 
-static void set_block(FooCanvasGroup *container, FooCanvasPoints *points, 
+static void set_block(ZMapWindowContainerGroup container, FooCanvasPoints *points, 
 		      ZMapContainerLevelType level, gpointer user_data)
 {
   switch(level)
     {
     case ZMAPCONTAINER_LEVEL_BLOCK:
       {
-	FooCanvasGroup **block = (FooCanvasGroup **)user_data;
+	ZMapWindowContainerGroup *block = (ZMapWindowContainerGroup *)user_data;
 
 	if(block && !(*block))
 	  *block = container;
@@ -1218,17 +1220,20 @@ static FooCanvasGroup *configure_get_point_block_container(ColConfigure configur
 	}
       else
 	{
+	  ZMapWindowContainerGroup first_block_container = NULL;
 	  /* Just get the first one! */
-	  zmapWindowContainerExecute(window->feature_root_group,
-				     ZMAPCONTAINER_LEVEL_BLOCK,
-				     set_block, &block);
+	  zmapWindowContainerUtilsExecute(window->feature_root_group,
+					  ZMAPCONTAINER_LEVEL_BLOCK,
+					  set_block, &first_block_container);
+
+	  block = (FooCanvasGroup *)first_block_container;
 	}
     }
   else
     {
       /* parent block (canvas container) should have block attached... */
-      block = zmapWindowContainerGetParentLevel(FOO_CANVAS_ITEM(column_group),
-						ZMAPCONTAINER_LEVEL_BLOCK);
+      block = (FooCanvasGroup *)zmapWindowContainerUtilsGetParentLevel((ZMapWindowContainerGroup)(column_group),
+								       ZMAPCONTAINER_LEVEL_BLOCK);
     }
 
   return block;
@@ -1272,9 +1277,9 @@ static void add_name_to_list(gpointer list_data, gpointer user_data)
     {
       if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
 	{
-	  ZMapWindowItemFeatureSetData set_data;
-	  set_data = g_object_get_data(G_OBJECT(button_data->column_group), ITEM_FEATURE_SET_DATA);
-	  *list_out = g_list_append(*list_out, GUINT_TO_POINTER(set_data->unique_id));
+	  ZMapWindowContainerFeatureSet container;
+	  container = (ZMapWindowContainerFeatureSet)(button_data->column_group);
+	  *list_out = g_list_append(*list_out, GUINT_TO_POINTER(container->unique_id));
 	}
     }
 
@@ -1528,7 +1533,6 @@ static GtkWidget *loaded_cols_panel(NotebookPage notebook_page,
       do
 	{
 	  FooCanvasGroup *column_group = FOO_CANVAS_GROUP(column->data) ;
-	  ZMapWindowItemFeatureSetData set_data ;
 	  ShowHideButton show_data, default_data, hide_data;
 	  GtkWidget *label, *button_box;
 	  char *label_text;
@@ -1548,8 +1552,6 @@ static GtkWidget *loaded_cols_panel(NotebookPage notebook_page,
 	      g_object_set_data(G_OBJECT(label), RADIO_BUTTONS_CONTAINER, button_box);
 	      
 	      /* create the actual radio buttons... */
-	      set_data = g_object_get_data(G_OBJECT(column_group), ITEM_FEATURE_SET_DATA) ;
-	      
 	      loaded_radio_buttons(button_box, column_group, &show_data, &default_data, &hide_data);
 	      
 	      show_data->show_hide_data      = 
@@ -1560,7 +1562,7 @@ static GtkWidget *loaded_cols_panel(NotebookPage notebook_page,
 	      default_list = g_list_append(default_list, default_data);
 	      hide_list    = g_list_append(hide_list, hide_data);
 	      
-	      column_group_set_active_button(set_data, 
+	      column_group_set_active_button((ZMapWindowContainerFeatureSet)column_group, 
 					     show_data->show_hide_button,
 					     default_data->show_hide_button,
 					     hide_data->show_hide_button);
@@ -1610,15 +1612,11 @@ static GtkWidget *loaded_cols_panel(NotebookPage notebook_page,
 
 static char *label_text_from_column(FooCanvasGroup *column_group)
 {
-  ZMapWindowItemFeatureSetData set_data ;
   GQuark display_id;
   char *label_text;
 
   /* Get hold of the style. */
-  set_data = g_object_get_data(G_OBJECT(column_group), ITEM_FEATURE_SET_DATA) ;
-  zMapAssert(set_data) ;
-
-  display_id = zmapWindowItemFeatureSetColumnDisplayName(set_data);
+  display_id = zmapWindowContainerFeatureSetColumnDisplayName((ZMapWindowContainerFeatureSet)column_group);
 
   label_text = (char *)(g_quark_to_string(display_id));
 
@@ -1839,25 +1837,23 @@ static void loaded_show_button_cb(GtkToggleButton *togglebutton, gpointer user_d
 
 	      if(window->display_3_frame)
 		{
-		  ZMapWindowItemFeatureSetData set_data;
+		  ZMapWindowContainerFeatureSet container;
 		  ZMapFeatureSet feature_set;
 		  int i;
-		  
-		  set_data = g_object_get_data(G_OBJECT(button_data->show_hide_column),
-					       ITEM_FEATURE_SET_DATA);
+		  container = (ZMapWindowContainerFeatureSet)(button_data->show_hide_column);
 
-		  if((feature_set = zmapWindowItemFeatureSetRecoverFeatureSet(set_data)))
+		  if((feature_set = zmapWindowContainerFeatureSetRecoverFeatureSet(container)))
 		    {
-		      
+
 		      for(i = ZMAPFRAME_NONE ; i <= ZMAPFRAME_2; i++)
 			{
 			  FooCanvasItem *frame_column;
 			  ZMapFrame frame = (ZMapFrame)i;
 
 			  frame_column = zmapWindowFToIFindSetItem(window->context_to_item, feature_set, 
-								   set_data->strand, frame);
+								   container->strand, frame);
 			  
-			  if(frame_column && zmapWindowContainerHasFeatures(FOO_CANVAS_GROUP(frame_column)))
+			  if(frame_column && zmapWindowContainerHasFeatures((ZMapWindowContainerGroup)(frame_column)))
 			    zmapWindowColumnSetState(window, 
 						     FOO_CANVAS_GROUP(frame_column),
 						     button_data->show_hide_state, 
@@ -1936,8 +1932,8 @@ static void select_all_buttons(GtkWidget *button, gpointer user_data)
 }
 
 
-/* Direct copy from zmapWindowContainer.c ... */
-static void set_column_lists_cb(FooCanvasGroup *container, FooCanvasPoints *points, 
+/* Direct copy from zmapWindowContainer.c ... with additions ...*/
+static void set_column_lists_cb(ZMapWindowContainerGroup container, FooCanvasPoints *points, 
 				ZMapContainerLevelType level, gpointer user_data)
 {
   switch(level)
@@ -1945,25 +1941,26 @@ static void set_column_lists_cb(FooCanvasGroup *container, FooCanvasPoints *poin
     case ZMAPCONTAINER_LEVEL_FEATURESET:
       {
 	ForwardReverseColumnLists lists_data;
-	ZMapWindowItemFeatureSetData set_data;
 
 	lists_data = (ForwardReverseColumnLists)user_data;
 
-	if((set_data = g_object_get_data(G_OBJECT(container), ITEM_FEATURE_SET_DATA)))
+	if(ZMAP_IS_CONTAINER_FEATURESET(container))
 	  {
+	    ZMapWindowContainerFeatureSet container_set;
 	    gboolean want_deferred, is_deferred, is_empty;
 	    gboolean loaded = FALSE;
 
+	    container_set = (ZMapWindowContainerFeatureSet)container;
 	    want_deferred = lists_data->loaded_or_deferred;
-	    is_deferred   = zmapWindowItemFeatureSetGetDeferred(set_data);
-	    is_empty      = (zmapWindowContainerHasFeatures(container) == TRUE ? FALSE : TRUE);
+	    is_deferred   = zmapWindowContainerFeatureSetGetDeferred(container_set);
+	    is_empty      = (zmapWindowContainerHasFeatures((ZMapWindowContainerGroup)container_set) == TRUE ? FALSE : TRUE);
 
 	    if(want_deferred && is_deferred)
 	      {
-		loaded = zmapWindowItemFeatureBlockIsColumnLoaded(lists_data->block_data,
-								  container,
-								  lists_data->mark1,
-								  lists_data->mark2);
+		loaded = zmapWindowContainerBlockIsColumnLoaded(lists_data->block_group,
+								(ZMapWindowContainerFeatureSet)container,
+								lists_data->mark1,
+								lists_data->mark2);
 	      }
 	    else if(!is_empty && !want_deferred)
 	      is_deferred = FALSE;
@@ -1971,7 +1968,7 @@ static void set_column_lists_cb(FooCanvasGroup *container, FooCanvasPoints *poin
 	    if(( want_deferred &&  is_deferred && !loaded) ||
 	       (!want_deferred && !is_deferred && !is_empty))
 	      {
-		if(set_data->strand == ZMAPSTRAND_FORWARD)
+		if(container_set->strand == ZMAPSTRAND_FORWARD)
 		  lists_data->forward = g_list_append(lists_data->forward, container);
 		else
 		  lists_data->reverse = g_list_append(lists_data->reverse, container);
diff --git a/src/zmapWindow/zmapWindowColOrder.c b/src/zmapWindow/zmapWindowColOrder.c
index 184c0cf64ee030b78826ac5fec326d96f2a981db..96f6553ca72f76ca4c59d8a9af1250ea0b0aa814 100755
--- a/src/zmapWindow/zmapWindowColOrder.c
+++ b/src/zmapWindow/zmapWindowColOrder.c
@@ -27,16 +27,17 @@
  *
  * Exported functions: See XXXXXXXXXXXXX.h
  * HISTORY:
- * Last edited: Mar 28 06:20 2009 (rds)
+ * Last edited: Jun  4 10:26 2009 (rds)
  * Created: Tue Dec  5 14:48:45 2006 (rds)
- * CVS info:   $Id: zmapWindowColOrder.c,v 1.12 2009-04-01 15:52:38 rds Exp $
+ * CVS info:   $Id: zmapWindowColOrder.c,v 1.13 2009-06-05 13:31:55 rds Exp $
  *-------------------------------------------------------------------
  */
 
 #include <ZMap/zmapUtils.h>
 #include <ZMap/zmapGLibUtils.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
+#include <zmapWindowContainerFeatureSet_I.h>
+#include <zmapWindowContainerUtils.h>
 
 typedef struct 
 {
@@ -49,7 +50,7 @@ typedef struct
 } OrderColumnsDataStruct, *OrderColumnsData;
 
 static void orderPositionColumns(ZMapWindow window, gboolean redraw_too);
-static void orderColumnsCB(FooCanvasGroup *data, FooCanvasPoints *points, 
+static void orderColumnsCB(ZMapWindowContainerGroup container, FooCanvasPoints *points, 
                            ZMapContainerLevelType level, gpointer user_data);
 static gint qsortColumnsCB(gconstpointer colA, gconstpointer colB, gpointer user_data);
 static gboolean isFrameSensitive(gconstpointer col_data);
@@ -79,25 +80,18 @@ void zmapWindowColOrderPositionColumns(ZMapWindow window)
 
 static void orderPositionColumns(ZMapWindow window, gboolean redraw_too)
 {
-  FooCanvasGroup *super_root ;
   OrderColumnsDataStruct order_data = {NULL} ;
 
-  super_root = FOO_CANVAS_GROUP(zmapWindowFToIFindItemFull(window->context_to_item,
-							   0,0,0,
-							   ZMAPSTRAND_NONE, ZMAPFRAME_NONE,
-							   0)) ;
-  zMapAssert(super_root) ;
-
   order_data.window = window;
   order_data.strand = ZMAPSTRAND_FORWARD; /* makes things simpler */
 
   if(order_debug_G)
     printf("%s: starting column ordering\n", __PRETTY_FUNCTION__);
 
-  zmapWindowContainerExecuteFull(FOO_CANVAS_GROUP(super_root),
-                                 ZMAPCONTAINER_LEVEL_STRAND,
-                                 orderColumnsCB, &order_data,
-                                 NULL, NULL, redraw_too);
+  zmapWindowContainerUtilsExecuteFull(window->feature_root_group,
+				      ZMAPCONTAINER_LEVEL_STRAND,
+				      orderColumnsCB, &order_data,
+				      NULL, NULL, redraw_too);
 
   /* If we've reversed the feature_set_names list, and left it like that, re-reverse. */
   if(order_data.strand == ZMAPSTRAND_REVERSE)
@@ -110,11 +104,12 @@ static void orderPositionColumns(ZMapWindow window, gboolean redraw_too)
 
 }
 
-static void orderColumnsCB(FooCanvasGroup *data, FooCanvasPoints *points, 
+static void orderColumnsCB(ZMapWindowContainerGroup container, FooCanvasPoints *points, 
                            ZMapContainerLevelType level, gpointer user_data)
 {
   OrderColumnsData order_data = (OrderColumnsData)user_data;
-  FooCanvasGroup *strand_group;
+  ZMapWindowContainerFeatures container_features;
+  FooCanvasGroup *strand_features_group;
   ZMapStrand strand;
   ZMapWindow window = order_data->window;
   GList *frame_list = NULL;
@@ -122,10 +117,12 @@ static void orderColumnsCB(FooCanvasGroup *data, FooCanvasPoints *points,
   if(level == ZMAPCONTAINER_LEVEL_STRAND)
     {
       /* Get Features */
-      strand_group = zmapWindowContainerGetFeatures(data);
-      zMapAssert(strand_group);
+      container_features = zmapWindowContainerGetFeatures(container);
+      zMapAssert(container_features);
+      /* Cast to FooCanvasGroup */
+      strand_features_group = (FooCanvasGroup *)container_features;
 
-      strand = zmapWindowContainerGetStrand(data);
+      strand = zmapWindowContainerGetStrand(container);
 
       if(strand == ZMAPSTRAND_REVERSE)
         {
@@ -141,7 +138,7 @@ static void orderColumnsCB(FooCanvasGroup *data, FooCanvasPoints *points,
               g_list_reverse(window->feature_set_names);
           order_data->strand = ZMAPSTRAND_FORWARD;
         }
-      else if(zmapWindowContainerIsStrandSeparator(data))
+      else if(zmapWindowContainerIsStrandSeparator(container))
 	return ;		/* Watch early return! */
       else
         zMapAssertNotReached(); /* What! */
@@ -154,13 +151,13 @@ static void orderColumnsCB(FooCanvasGroup *data, FooCanvasPoints *points,
         {
           order_data->three_frame_position = g_list_position(order_data->names_list,
                                                              frame_list);
-          strand_group->item_list = 
-            g_list_sort_with_data(strand_group->item_list,
+          strand_features_group->item_list = 
+            g_list_sort_with_data(strand_features_group->item_list,
                                   qsortColumnsCB, order_data);
         }
 
       /* update foo_canvas list cache. joy. */
-      strand_group->item_list_end = g_list_last(strand_group->item_list);
+      strand_features_group->item_list_end = g_list_last(strand_features_group->item_list);
     }
   
   return ;
@@ -169,25 +166,26 @@ static void orderColumnsCB(FooCanvasGroup *data, FooCanvasPoints *points,
 
 static gboolean isFrameSensitive(gconstpointer col_data)
 {
+  ZMapWindowContainerFeatureSet container;
   gboolean frame_sensitive = FALSE ;
-  FooCanvasGroup *col_group = FOO_CANVAS_GROUP(col_data) ;
   ZMapFeatureAny feature_any ;
-  ZMapWindowItemFeatureSetData set_data ;
 
-  if((set_data = g_object_get_data(G_OBJECT(col_group), ITEM_FEATURE_SET_DATA)) &&
-     (feature_any = (ZMapFeatureAny)(g_object_get_data(G_OBJECT(col_group), ITEM_FEATURE_DATA))))
+  if(col_data && ZMAP_IS_CONTAINER_FEATURESET(col_data) && (container = ZMAP_CONTAINER_FEATURESET(col_data)))
     {
-      if (set_data->frame != ZMAPFRAME_NONE)
-        {
-	  frame_sensitive = zmapWindowItemFeatureSetIsFrameSpecific(set_data, NULL);
-        }
+      if(container->frame != ZMAPFRAME_NONE)
+	{
+	  frame_sensitive = zmapWindowContainerFeatureSetIsFrameSpecific(container, NULL);
+	}
 
       if(order_debug_G)
-        printf("  column %s %s frame sensitive\n", 
-               g_quark_to_string(feature_any->original_id), 
-               (frame_sensitive ? "is" : "is not"));
+	{
+	  if((feature_any = ((ZMapWindowContainerGroup)container)->feature_any))
+	    printf("  column %s %s frame sensitive\n", 
+		   g_quark_to_string(feature_any->original_id), 
+		   (frame_sensitive ? "is" : "is not"));
+	}
     }
-  
+
   return frame_sensitive;
 }
 
@@ -209,14 +207,10 @@ static int columnFSNListPosition(gconstpointer col_data, GList *feature_set_name
 
 static ZMapFrame columnFrame(gconstpointer col_data)
 {
-  FooCanvasGroup *col_group = FOO_CANVAS_GROUP(col_data);
-  ZMapWindowItemFeatureSetData set_data;
+  ZMapWindowContainerFeatureSet container = (ZMapWindowContainerFeatureSet)col_data;
   ZMapFrame frame = ZMAPFRAME_NONE;
 
-  if((set_data = g_object_get_data(G_OBJECT(col_group), ITEM_FEATURE_SET_DATA)))
-    {
-      frame = set_data->frame;
-    }
+  frame = container->frame;
 
   return frame;
 }
diff --git a/src/zmapWindow/zmapWindowDNA.c b/src/zmapWindow/zmapWindowDNA.c
index 03338796cc5d3492f413110e578b66f8b4bc1cae..f2a9e9d6524b80a74e7028e0ccda87da3be6702d 100755
--- a/src/zmapWindow/zmapWindowDNA.c
+++ b/src/zmapWindow/zmapWindowDNA.c
@@ -26,9 +26,9 @@
  *
  * Exported functions: See zmapWindow_P.h
  * HISTORY:
- * Last edited: Feb 11 18:39 2009 (rds)
+ * Last edited: Jun  4 10:26 2009 (rds)
  * Created: Fri Oct  6 16:00:11 2006 (edgrif)
- * CVS info:   $Id: zmapWindowDNA.c,v 1.20 2009-02-11 18:43:09 rds Exp $
+ * CVS info:   $Id: zmapWindowDNA.c,v 1.21 2009-06-05 13:32:06 rds Exp $
  *-------------------------------------------------------------------
  */
 
@@ -38,7 +38,6 @@
 #include <ZMap/zmapDNA.h>
 #include <ZMap/zmapPeptide.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
 #include <ZMap/zmapString.h>
 
 typedef struct
@@ -901,7 +900,7 @@ static void remove_current_matches_from_display(DNASearchData search_data)
       if(context_erase_broken)
 	{
 	  /* which we destroy */
-	  zmapWindowContainerDestroy(FOO_CANVAS_GROUP(container));
+	  zmapWindowContainerGroupDestroy((ZMapWindowContainerGroup)(container));
 	  
 	  /* and the feature set too... It'll get recreated later */
 	  zMapFeatureSetDestroy(feature_set, TRUE);
@@ -923,12 +922,6 @@ static void remove_current_matches_from_display(DNASearchData search_data)
 	    (ZMapFeatureContext)zMapFeatureAnyCopy((ZMapFeatureAny)search_data->window->strand_separator_context);
 
 
-#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
-	  /* This is pretty important! */
-	  erase_context->styles = search_data->window->strand_separator_context->styles;
-#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
-
-	  
 	  zMapFeatureContextAddAlignment(erase_context, align, is_master);
 	  zMapFeatureAlignmentAddBlock(align, block);
 	  
diff --git a/src/zmapWindow/zmapWindowDNAChoose.c b/src/zmapWindow/zmapWindowDNAChoose.c
index 844a837e4aa5376f48d5b4068ece5e183eaddad2..a49595094ccd475d14fd24b595377ac5fc67c4a6 100755
--- a/src/zmapWindow/zmapWindowDNAChoose.c
+++ b/src/zmapWindow/zmapWindowDNAChoose.c
@@ -31,9 +31,9 @@
  *
  * Exported functions: See zmapWindow_P.h
  * HISTORY:
- * Last edited: Feb 11 18:40 2009 (rds)
+ * Last edited: Jun  4 10:31 2009 (rds)
  * Created: Fri Nov 10 09:50:48 2006 (edgrif)
- * CVS info:   $Id: zmapWindowDNAChoose.c,v 1.7 2009-02-11 18:43:09 rds Exp $
+ * CVS info:   $Id: zmapWindowDNAChoose.c,v 1.8 2009-06-05 13:32:17 rds Exp $
  *-------------------------------------------------------------------
  */
 
@@ -42,7 +42,7 @@
 #include <ZMap/zmapUtils.h>
 #include <ZMap/zmapDNA.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
+#include <zmapWindowContainerUtils.h>
 
 typedef struct
 {
@@ -114,7 +114,9 @@ char *zmapWindowDNAChoose(ZMapWindow window, FooCanvasItem *feature_item, ZMapWi
   ZMapFeature feature ;
   ZMapFeatureBlock block ;
   double x1, y1, x2, y2 ;
-  FooCanvasGroup *column_group, *overlay_group ;
+  ZMapWindowContainerGroup container;
+  ZMapWindowContainerOverlay overlay;
+  FooCanvasGroup *overlay_group ;
   FooCanvasItem *parent ;
   gint block_start, block_end ;
   char *button_text ;
@@ -163,8 +165,9 @@ char *zmapWindowDNAChoose(ZMapWindow window, FooCanvasItem *feature_item, ZMapWi
     }
 
   /* Draw an overlay box over the feature to show the extent of the dna selected. */
-  column_group  = zmapWindowContainerGetParentContainerFromItem(feature_item) ;
-  overlay_group = zmapWindowContainerGetOverlays(column_group) ;
+  container = zmapWindowContainerCanvasItemGetContainer(feature_item) ;
+  overlay   = zmapWindowContainerGetOverlay(container) ;
+  overlay_group = (FooCanvasGroup *)overlay;
 
   parent = zmapWindowItemGetTrueItem(feature_item) ;
   foo_canvas_item_get_bounds(parent, &x1, &y1, &x2, &y2) ;
diff --git a/src/zmapWindow/zmapWindowDraw.c b/src/zmapWindow/zmapWindowDraw.c
index 81b38a8b5a11ac1c66b9b125d503b1d9f2666293..79ea381f5d5abc49bf128f4890324a40787efa50 100755
--- a/src/zmapWindow/zmapWindowDraw.c
+++ b/src/zmapWindow/zmapWindowDraw.c
@@ -28,9 +28,9 @@
  *
  * Exported functions: See zmapWindow_P.h
  * HISTORY:
- * Last edited: Apr 27 11:22 2009 (edgrif)
+ * Last edited: Jun  5 14:14 2009 (rds)
  * Created: Thu Sep  8 10:34:49 2005 (edgrif)
- * CVS info:   $Id: zmapWindowDraw.c,v 1.110 2009-04-28 14:32:17 edgrif Exp $
+ * CVS info:   $Id: zmapWindowDraw.c,v 1.111 2009-06-05 13:32:56 rds Exp $
  *-------------------------------------------------------------------
  */
 
@@ -39,95 +39,12 @@
 #include <ZMap/zmapUtils.h>
 #include <ZMap/zmapGLibUtils.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
+#include <zmapWindowContainerUtils.h>
+#include <zmapWindowContainerBlock.h>
+#include <zmapWindowContainerFeatureSet_I.h>
 
 
 
-/* For straight forward bumping. */
-typedef struct
-{
-  ZMapWindow window ;
-  ZMapWindowItemFeatureSetData set_data ;
-
-  GHashTable *pos_hash ;
-  GList *pos_list ;
-
-  double offset ;
-  double incr ;
-
-  int start, end ;
-
-  gboolean bump_all ;
-
-  ZMapFeatureTypeStyle bumped_style ;
-} BumpColStruct, *BumpCol ;
-
-
-typedef struct
-{
-  double y1, y2 ;
-  double offset ;
-  double incr ;
-} BumpColRangeStruct, *BumpColRange ;
-
-
-
-/* THERE IS A BUG IN THE CODE THAT USES THIS...IT MOVES FEATURES OUTSIDE OF THE BACKGROUND SO
- * IT ALL LOOKS NAFF, PROBABLY WE GET AWAY WITH IT BECAUSE COLS ARE SO WIDELY SPACED OTHERWISE
- * THEY MIGHT OVERLAP. I THINK THE MOVING CODE MAY BE AT FAULT. */
-/* For complex bump users seem to want columns to overlap a bit, if this is set to 1.0 there is
- * no overlap, if you set it to 0.5 they will overlap by a half and so on. */
-#define COMPLEX_BUMP_COMPRESS 1.0
-
-typedef struct
-{
-  ZMapWindow window ;
-  GList **gaps_added_items ;
-} AddGapsDataStruct, *AddGapsData ;
-
-typedef gboolean (*OverLapListFunc)(GList *curr_features, GList *new_features) ;
-
-typedef GList* (*GListTraverseFunc)(GList *list) ;
-
-typedef struct
-{
-  ZMapWindow window ;
-  ZMapFeatureTypeStyle bumped_style ;
-  gboolean bump_all ;
-  GHashTable *name_hash ;
-  GList *bumpcol_list ;
-  double curr_offset ;
-  double incr ;
-  OverLapListFunc overlap_func ;
-  gboolean protein ;
-} ComplexBumpStruct, *ComplexBump ;
-
-
-typedef struct
-{
-  ZMapWindow window ;
-  double incr ;
-  double offset ;
-  GList *feature_list ;
-} ComplexColStruct, *ComplexCol ;
-
-
-typedef struct
-{
-  GList **name_list ;
-  OverLapListFunc overlap_func ;
-} FeatureDataStruct, *FeatureData ;
-
-typedef struct
-{
-  gboolean overlap ;
-  int start, end ;
-  int feature_diff ;
-  ZMapFeature feature ;
-  double width ;
-} RangeDataStruct, *RangeData ;
-
-
 
 typedef struct
 {
@@ -176,7 +93,7 @@ typedef enum {COLINEAR_INVALID, COLINEAR_NOT, COLINEAR_IMPERFECT, COLINEAR_PERFE
 
 typedef struct
 {
-  ZMapWindowItemFeatureBlockData block_data ;
+  ZMapWindowContainerBlock block_group;
   int start, end ;
   gboolean in_view ;
   double left, right ;
@@ -197,10 +114,10 @@ typedef struct
   ZMapFeatureSet curr_set ;
 
   FooCanvasGroup *curr_root_group ;
-  FooCanvasGroup *curr_align_group ;
-  FooCanvasGroup *curr_block_group ;
-  FooCanvasGroup *curr_forward_group ;
-  FooCanvasGroup *curr_reverse_group ;
+  ZMapWindowContainerFeatures curr_align_group ;
+  ZMapWindowContainerFeatures curr_block_group ;
+  ZMapWindowContainerFeatures curr_forward_group ;
+  ZMapWindowContainerFeatures curr_reverse_group ;
 
   FooCanvasGroup *curr_forward_col ;
   FooCanvasGroup *curr_reverse_col ;
@@ -208,11 +125,10 @@ typedef struct
 }SeparatorCanvasDataStruct, *SeparatorCanvasData;
 
 
-static void preZoomCB(FooCanvasGroup *data, FooCanvasPoints *points, 
+static void preZoomCB(ZMapWindowContainerGroup container, FooCanvasPoints *points, 
                       ZMapContainerLevelType level, gpointer user_data) ;
-static void resetWindowWidthCB(FooCanvasGroup *data, FooCanvasPoints *points, 
-                               ZMapContainerLevelType level, gpointer user_data);
-static void columnZoomChanged(FooCanvasGroup *container, double new_zoom, ZMapWindow window) ;
+static gboolean resetWindowWidthCB(ZMapWindowContainerGroup container, FooCanvasPoints *points, 
+				   ZMapContainerLevelType level, gpointer user_data);
 
 
 static gint horizPosCompare(gconstpointer a, gconstpointer b) ;
@@ -224,7 +140,7 @@ static void printQuarks(gpointer data, gpointer user_data) ;
 
 
 
-static void hideColsCB(FooCanvasGroup *data, FooCanvasPoints *points, 
+static void hideColsCB(ZMapWindowContainerGroup container, FooCanvasPoints *points, 
 		       ZMapContainerLevelType level, gpointer user_data) ;
 static void featureInViewCB(void *data, void *user_data) ;
 static void showColsCB(void *data, void *user_data) ;
@@ -237,6 +153,7 @@ static ZMapFeatureContextExecuteStatus draw_separator_features(GQuark key_id,
 static void drawSeparatorFeatures(SeparatorCanvasData canvas_data, ZMapFeatureContext context);
 
 
+
 /*! @addtogroup zmapwindow
  * @{
  *  */
@@ -325,13 +242,12 @@ void zmapWindowCanvasGroupChildSort(FooCanvasGroup *group_inout)
 void zmapWindowColumnSetState(ZMapWindow window, FooCanvasGroup *column_group,
 			      ZMapStyleColumnDisplayState new_col_state, gboolean redraw_if_needed)
 {
-  ZMapWindowItemFeatureSetData set_data ;
+  ZMapWindowContainerFeatureSet container;
   ZMapStyleColumnDisplayState curr_col_state ;
 
-  set_data = g_object_get_data(G_OBJECT(column_group), ITEM_FEATURE_SET_DATA) ;
-  zMapAssert(set_data) ;
+  container = (ZMapWindowContainerFeatureSet)column_group;
 
-  curr_col_state = zmapWindowItemFeatureSetGetDisplay(set_data) ;
+  curr_col_state = zmapWindowContainerFeatureSetGetDisplay(container) ;
 
   /* Do we need a redraw....not every time..... */
   if (!new_col_state || new_col_state != curr_col_state)
@@ -371,7 +287,7 @@ void zmapWindowColumnSetState(ZMapWindow window, FooCanvasGroup *column_group,
 		redraw = TRUE;
 	      }
 
-#ifdef RDS_REMOVED
+
 	    /* Check mag, mark, compress etc. etc....probably need some funcs in compress/mark/mag
 	     * packages to return whether a column should be hidden.... */
 	    if ((curr_col_state == ZMAPSTYLE_COLDISPLAY_HIDE || curr_col_state == ZMAPSTYLE_COLDISPLAY_SHOW_HIDE)
@@ -386,20 +302,20 @@ void zmapWindowColumnSetState(ZMapWindow window, FooCanvasGroup *column_group,
 		zmapWindowColumnHide(column_group) ;
 		redraw = TRUE ;
 	      }
-#endif
+
 	    break ;
 	  }
 	default: /* ZMAPSTYLE_COLDISPLAY_SHOW */
 	  {
 	    /* Always show column. */
-	    zmapWindowContainerSetVisibility(column_group, TRUE) ;
+	    zmapWindowContainerSetVisibility((FooCanvasGroup *)container, TRUE) ;
 
 	    redraw = TRUE ;
 	    break ;
 	  }
 	}
 
-      zmapWindowItemFeatureSetDisplay(set_data, new_col_state) ;
+      zmapWindowContainerFeatureSetDisplay(container, new_col_state) ;
 
       /* Only do redraw if it was requested _and_ state change needs it. */
       if (redraw_if_needed && redraw)
@@ -416,13 +332,10 @@ void zmapWindowColumnSetState(ZMapWindow window, FooCanvasGroup *column_group,
  * style for the column but we could allow the user to switch this on and off as well. */
 void zmapWindowColumnSetMagState(ZMapWindow window, FooCanvasGroup *col_group)
 {
-  ZMapWindowItemFeatureSetData set_data ;
-
+  ZMapWindowContainerFeatureSet container;
   zMapAssert(window && FOO_IS_CANVAS_GROUP(col_group)) ;
 
-  set_data = zmapWindowContainerGetData(col_group, ITEM_FEATURE_SET_DATA) ;
-  zMapAssert(set_data) ;
-
+  container = (ZMapWindowContainerFeatureSet)col_group;
   /* Only check the mag factor if the column is visible. (wrong) */
 
   /* 
@@ -432,7 +345,7 @@ void zmapWindowColumnSetMagState(ZMapWindow window, FooCanvasGroup *col_group)
    * (as happens now). I'm not sure we have a record of this.
    */
 
-  if (zmapWindowItemFeatureSetGetDisplay(set_data) == ZMAPSTYLE_COLDISPLAY_SHOW_HIDE &&
+  if (zmapWindowContainerFeatureSetGetDisplay(container) == ZMAPSTYLE_COLDISPLAY_SHOW_HIDE &&
       zmapWindowColumnIs3frameVisible(window, col_group))
     {
       gboolean visible_at_this_mag = FALSE;
@@ -441,10 +354,16 @@ void zmapWindowColumnSetMagState(ZMapWindow window, FooCanvasGroup *col_group)
 
       if(visible_at_this_mag)
 	{
+#ifdef DEBUG_COLUMN_MAG
+	  printf("Column '%s' being shown\n", g_quark_to_string(container->unique_id));
+#endif /* DEBUG_COLUMN_MAG */
 	  zmapWindowColumnShow(col_group) ;
 	}
       else
 	{
+#ifdef DEBUG_COLUMN_MAG
+	  printf("Column '%s' being hidden\n", g_quark_to_string(container->unique_id));
+#endif /* DEBUG_COLUMN_MAG */
 	  zmapWindowColumnHide(col_group) ; 
 	}
     }
@@ -456,19 +375,22 @@ void zmapWindowColumnSetMagState(ZMapWindow window, FooCanvasGroup *col_group)
 /* checks to see if a column is 3 frame visible. */
 gboolean zmapWindowColumnIs3frameVisible(ZMapWindow window, FooCanvasGroup *col_group)
 {
-  ZMapWindowItemFeatureSetData set_data ;
+  ZMapWindowContainerFeatureSet container;
   ZMapStyle3FrameMode frame_mode;
+  ZMapFrame set_frame;
+  ZMapStrand set_strand;
   gboolean frame_specific, visible;
   int forward[ZMAPFRAME_2 + 1], reverse[ZMAPFRAME_2 + 1], none[ZMAPFRAME_2 + 1];
   int *frame_sens[ZMAPSTRAND_REVERSE + 1];
 
   zMapAssert(window);
-  zMapAssert(FOO_IS_CANVAS_GROUP(col_group)) ;
+  zMapAssert(ZMAP_IS_CONTAINER_FEATURESET(col_group));
 
-  set_data = zmapWindowContainerGetData(col_group, ITEM_FEATURE_SET_DATA) ;
-  zMapAssert(set_data) ;
+  container = (ZMapWindowContainerFeatureSet)col_group;
 
-  frame_specific = zmapWindowItemFeatureSetIsFrameSpecific(set_data, &frame_mode);
+  frame_specific = zmapWindowContainerFeatureSetIsFrameSpecific(container, &frame_mode);
+
+  set_frame  = zmapWindowContainerFeatureSetGetFrame(container);
 
   if(frame_specific)
     {
@@ -512,16 +434,18 @@ gboolean zmapWindowColumnIs3frameVisible(ZMapWindow window, FooCanvasGroup *col_
 	case ZMAPSTYLE_3_FRAME_ALWAYS:
 	case ZMAPSTYLE_3_FRAME_ONLY_3:
 	case ZMAPSTYLE_3_FRAME_ONLY_1:
-	  visible = frame_sens[set_data->strand][set_data->frame];
+	  set_strand = zmapWindowContainerFeatureSetGetStrand(container);
+	  
+	  visible = frame_sens[set_strand][set_frame];
 	  if(frame_mode == ZMAPSTYLE_3_FRAME_ONLY_1)
 	    {
-	      if(set_data->frame == ZMAPFRAME_NONE)
+	      if(set_frame == ZMAPFRAME_NONE)
 		visible = !visible;
 	      else
 		visible = FALSE;
 	    }
 	  else if(frame_mode == ZMAPSTYLE_3_FRAME_ONLY_3 &&
-		  set_data->frame == ZMAPFRAME_NONE)
+		  set_frame == ZMAPFRAME_NONE)
 	    {
 	      visible = FALSE;
 	    }
@@ -536,7 +460,7 @@ gboolean zmapWindowColumnIs3frameVisible(ZMapWindow window, FooCanvasGroup *col_
 	  break;
 	}
     }
-  else if(set_data->frame == ZMAPFRAME_NONE)
+  else if(set_frame == ZMAPFRAME_NONE)
     {
       visible = TRUE;
     }
@@ -555,25 +479,20 @@ gboolean zmapWindowColumnIs3frameVisible(ZMapWindow window, FooCanvasGroup *col_
 gboolean zmapWindowColumnIsMagVisible(ZMapWindow window, FooCanvasGroup *col_group)
 {
   gboolean visible = TRUE, mag_sensitive = FALSE ;
-  ZMapWindowItemFeatureSetData set_data ;
   double min_mag, max_mag ;
   double curr_bases ;
 
   zMapAssert(window && FOO_IS_CANVAS_GROUP(col_group)) ;
 
-  if((visible = zmapWindowContainerHasFeatures(col_group)))
+  if((visible = zmapWindowContainerHasFeatures((ZMapWindowContainerGroup)col_group)))
     {
-      set_data = zmapWindowContainerGetData(col_group, ITEM_FEATURE_SET_DATA) ;
-      
-      zMapAssert(set_data) ;
-      
 #ifdef ED_G_NEVER_INCLUDE_THIS_CODE
       curr_zoom = zMapWindowGetZoomMagnification(window) ;
 #endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
 
       curr_bases = zMapWindowGetZoomMagAsBases(window) ;
       
-      if ((mag_sensitive = zmapWindowItemFeatureSetGetMagValues(set_data, &min_mag, &max_mag)))
+      if ((mag_sensitive = zmapWindowContainerFeatureSetGetMagValues((ZMapWindowContainerFeatureSet)col_group, &min_mag, &max_mag)))
 	{
 	  if ((min_mag && curr_bases > min_mag)
 	      || 
@@ -620,38 +539,22 @@ void zmapWindowColumnShow(FooCanvasGroup *column_group)
 /* Function toggles compression on and off. */
 void zmapWindowColumnsCompress(FooCanvasItem *column_item, ZMapWindow window, ZMapWindowCompressMode compress_mode)
 {
-  ZMapWindowItemFeatureType feature_type ;
-  ZMapContainerLevelType container_type ;
-  FooCanvasGroup *column_group =  NULL, *block_group = NULL ;
-  ZMapWindowItemFeatureBlockData block_data ;
+  ZMapWindowContainerGroup column_container, block_container;
+  FooCanvasGroup *column_group =  NULL;
   GList *compressed, *bumped;
   VisCoordsStruct coords ;
   double wx1, wy1, wx2, wy2 ;
 
-  /* Decide if the column_item is a column group or a feature within that group. */
-  if ((feature_type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(column_item), ITEM_FEATURE_TYPE)))
-      != ITEM_FEATURE_INVALID)
-    {
-      column_group = zmapWindowContainerGetParentContainerFromItem(column_item) ;
-    }
-  else if ((container_type = zmapWindowContainerGetLevel(FOO_CANVAS_GROUP(column_item)))
-	   == ZMAPCONTAINER_LEVEL_FEATURESET)
-    {
-      column_group = FOO_CANVAS_GROUP(column_item) ;
-    }
+  column_container = zmapWindowContainerCanvasItemGetContainer(column_item);
+  if(column_container)
+    column_group = (FooCanvasGroup *)column_container;
   else
     zMapAssertNotReached() ;
 
-  block_group = zmapWindowContainerGetSuperGroup(column_group) ;
-  container_type = zmapWindowContainerGetLevel(FOO_CANVAS_GROUP(block_group)) ;
-  block_group = zmapWindowContainerGetSuperGroup(block_group) ;
-  container_type = zmapWindowContainerGetLevel(FOO_CANVAS_GROUP(block_group)) ;
+  block_container = zmapWindowContainerUtilsGetParentLevel(column_container, ZMAPCONTAINER_LEVEL_BLOCK) ;
   
-  block_data = g_object_get_data(G_OBJECT(block_group), ITEM_FEATURE_BLOCK_DATA) ;
-  zMapAssert(block_data) ;
-
-  compressed = zmapWindowItemFeatureBlockRemoveCompressedColumns(block_data);
-  bumped     = zmapWindowItemFeatureBlockRemoveBumpedColumns(block_data);
+  compressed = zmapWindowContainerBlockRemoveCompressedColumns((ZMapWindowContainerBlock)block_container);
+  bumped     = zmapWindowContainerBlockRemoveBumpedColumns((ZMapWindowContainerBlock)block_container);
 
   if(compressed || bumped)
     {
@@ -671,7 +574,7 @@ void zmapWindowColumnsCompress(FooCanvasItem *column_item, ZMapWindow window, ZM
     }
   else
     {
-      coords.block_data = block_data ;
+      coords.block_group   = (ZMapWindowContainerBlock)block_container;
       coords.compress_mode = compress_mode ;
 
       /* If there is no mark or user asked for visible area only then do that. */
@@ -699,27 +602,15 @@ void zmapWindowColumnsCompress(FooCanvasItem *column_item, ZMapWindow window, ZM
 
       /* Note that curretly we need to start at the top of the tree or redraw does
        * not work properly. */
+
       zmapWindowreDrawContainerExecute(window, hideColsCB, &coords);
+
     }
 
   return ;
 }
 
 
-void zmapWindowContainerMoveEvent(FooCanvasGroup *super_root, ZMapWindow window)
-{
-  ContainerType type = CONTAINER_INVALID ;
-
-  type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(super_root), CONTAINER_TYPE_KEY)) ;
-  zMapAssert(type = CONTAINER_ROOT);
-  /* pre callback was set to zmapWindowContainerRegionChanged */
-  zmapWindowContainerExecuteFull(FOO_CANVAS_GROUP(super_root),
-                                 ZMAPCONTAINER_LEVEL_FEATURESET,
-                                 NULL, NULL,
-                                 NULL, NULL, TRUE) ;
-  return ;
-}
-
 /*!
  * It's easy to forget, or not have access to set the window
  * scrollregion using resetWindowWidthCB, so here's a function
@@ -737,32 +628,43 @@ void zmapWindowContainerMoveEvent(FooCanvasGroup *super_root, ZMapWindow window)
  * @param enter_data Data passed to callback as last parameter.
  * @return void
  */
-void zmapWindowreDrawContainerExecute(ZMapWindow             window,
-				      ZMapContainerExecFunc  enter_cb,
-				      gpointer               enter_data)
+
+void zmapWindowreDrawContainerExecute(ZMapWindow                 window,
+				      ZMapContainerUtilsExecFunc enter_cb,
+				      gpointer                   enter_data)
 {
   zMapPrintTimer(NULL, "About to do some work - including a reposition") ;
-
   window->interrupt_expose = TRUE ;
 
-  zmapWindowContainerExecuteFull(FOO_CANVAS_GROUP(window->feature_root_group),
-				 ZMAPCONTAINER_LEVEL_FEATURESET,
-				 enter_cb,
-				 enter_data,
-				 resetWindowWidthCB, window,
-				 TRUE) ;
+  zmapWindowContainerUtilsExecute(window->feature_root_group,
+				  ZMAPCONTAINER_LEVEL_FEATURESET,
+				  enter_cb,
+				  enter_data);
 
-  window->interrupt_expose = FALSE ;
+  zmapWindowContainerRequestReposition(window->feature_root_group);
 
+  window->interrupt_expose = FALSE ;
   zMapPrintTimer(NULL, "Finished the work - including a reposition") ;
 
   return ;
 }
 
+void zmapWindowDrawManageWindowWidth(ZMapWindow window)
+{
+  if(window->feature_root_group)
+    zmapWindowContainerGroupAddUpdateHook(window->feature_root_group, resetWindowWidthCB, window);
+
+  return;
+}
+
 
 /* Makes sure all the things that need to be redrawn when the canvas needs redrawing. */
 void zmapWindowFullReposition(ZMapWindow window)
 {
+  /* Is this enough or do we need to foo_canvas_update_now() */
+  zmapWindowContainerRequestReposition(window->feature_root_group);
+
+#ifdef REWRITE_THIS
   FooCanvasGroup *super_root ;
   ContainerType type = CONTAINER_INVALID ;
 
@@ -780,88 +682,33 @@ void zmapWindowFullReposition(ZMapWindow window)
   zMapAssert(type = CONTAINER_ROOT) ;
 
 
-  window->interrupt_expose = TRUE ;
 
   /* This could probably call the col order stuff as pre recurse function... */
-  zmapWindowContainerExecuteFull(FOO_CANVAS_GROUP(super_root),
-                                 ZMAPCONTAINER_LEVEL_FEATURESET,
-                                 NULL,
-                                 NULL,
-                                 resetWindowWidthCB,
-                                 window, TRUE) ;
+  zmapWindowContainerUtilsExecuteFull(FOO_CANVAS_GROUP(super_root),
+				      ZMAPCONTAINER_LEVEL_FEATURESET,
+				      NULL,
+				      NULL,
+				      resetWindowWidthCB,
+				      window, TRUE) ;
 
-  window->interrupt_expose = FALSE ;
 
   zmapWindowReFocusHighlights(window);
 
   zMapPrintTimer(NULL, "Finished resposition") ;
-
+#endif /* REWRITE_THIS */
   return ;
 }
 
 
-/* Reset scrolled region width so that user can scroll across whole of canvas. */
-void zmapWindowResetWidth(ZMapWindow window)
-{
-  FooCanvasGroup *root ;
-  double x1, x2, y1, y2 ;
-  double root_x1, root_x2, root_y1, root_y2 ;
-  double scr_reg_width, root_width ;
-
-
-  foo_canvas_get_scroll_region(window->canvas, &x1, &y1, &x2, &y2);
-
-  scr_reg_width = x2 - x1 + 1.0 ;
-
-  root = foo_canvas_root(window->canvas) ;
-
-  foo_canvas_item_get_bounds(FOO_CANVAS_ITEM(root), &root_x1, &root_y1, &root_x2, &root_y2) ;
-
-  root_width = root_x2 - root_x1 + 1 ;
-
-  if (root_width != scr_reg_width)
-    {
-      double excess ;
-
-      excess = root_width - scr_reg_width ;
-
-      x2 = x2 + excess;
-
-      foo_canvas_set_scroll_region(window->canvas, x1, y1, x2, y2) ;
-    }
-
-
-  return ;
-}
-
-
-
 /* Makes sure all the things that need to be redrawn for zooming get redrawn. */
 void zmapWindowDrawZoom(ZMapWindow window)
 {
-  FooCanvasGroup *super_root ;
-  ContainerType type = CONTAINER_INVALID ;
-  ZoomDataStruct zoom_data = {NULL} ;
-
-  super_root = FOO_CANVAS_GROUP(zmapWindowFToIFindItemFull(window->context_to_item,
-							   0,0,0,
-							   ZMAPSTRAND_NONE, ZMAPFRAME_NONE,
-							   0)) ;
-  zMapAssert(super_root) ;
+  zmapWindowContainerUtilsExecute(window->feature_root_group,
+				  ZMAPCONTAINER_LEVEL_FEATURESET,
+				  preZoomCB,
+				  window);
 
-
-  type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(super_root), CONTAINER_TYPE_KEY)) ;
-  zMapAssert(type = CONTAINER_ROOT) ;
-
-  zoom_data.window = window ;
-  zoom_data.zoom = zMapWindowGetZoomFactor(window) ;
-
-  zmapWindowContainerExecuteFull(FOO_CANVAS_GROUP(super_root),
-                                 ZMAPCONTAINER_LEVEL_FEATURESET,
-                                 preZoomCB,
-                                 &zoom_data,
-                                 resetWindowWidthCB,
-                                 window, TRUE) ;
+  zmapWindowContainerRequestReposition(window->feature_root_group);
 
   return ;
 }
@@ -1054,21 +901,23 @@ static void printItem(FooCanvasItem *item, int indent, char *prefix)
 /* We need the window in here.... */
 /* GFunc to call on potentially all container groups.
  */
-static void preZoomCB(FooCanvasGroup *data, FooCanvasPoints *points, 
+static void preZoomCB(ZMapWindowContainerGroup container, FooCanvasPoints *points, 
                       ZMapContainerLevelType level, gpointer user_data)
 {
-  FooCanvasGroup *container = (FooCanvasGroup *)data ;
-  ZoomData zoom_data = (ZoomData)user_data ;
-
   switch(level)
     {
     case ZMAPCONTAINER_LEVEL_FEATURESET:
       {
-	FooCanvasGroup *container_underlay;
-	container_underlay = zmapWindowContainerGetUnderlays(container);
-	zmapWindowContainerPurge(container_underlay);
+	ZMapWindowContainerUnderlay container_underlay;
+	ZMapWindow window = (ZMapWindow)user_data;
+
+	container_underlay = zmapWindowContainerGetUnderlay(container);
+	//zmapWindowContainerPurge(container_underlay);
+
+	if (zmapWindowContainerFeatureSetGetDisplay((ZMapWindowContainerFeatureSet)container) == ZMAPSTYLE_COLDISPLAY_SHOW_HIDE)
+	  zmapWindowColumnSetMagState(window, (FooCanvasGroup *)container) ;
+
       }
-      columnZoomChanged(container, zoom_data->zoom, zoom_data->window) ;
       break ;
     default:
       break ;
@@ -1090,86 +939,76 @@ static void set_hlocked_scroll_region(gpointer key, gpointer value, gpointer use
 }
 
 /* A version of zmapWindowResetWidth which uses the points from the recursion to set the width */
-static void resetWindowWidthCB(FooCanvasGroup *data, FooCanvasPoints *points, 
-                               ZMapContainerLevelType level, gpointer user_data)
+static gboolean resetWindowWidthCB(ZMapWindowContainerGroup container, FooCanvasPoints *points, 
+				   ZMapContainerLevelType level, gpointer user_data)
 {
   ZMapWindow window = NULL;
   double x1, x2, y1, y2 ;       /* scroll region positions */
   double scr_reg_width, root_width ;
+  gboolean result = TRUE;
 
-  if(level == ZMAPCONTAINER_LEVEL_ROOT)
-    {
-      window = (ZMapWindow)user_data ;
-
-      zmapWindowGetScrollRegion(window, &x1, &y1, &x2, &y2);
-
-      scr_reg_width = x2 - x1 + 1.0 ;
-
-      root_width = points->coords[2] - points->coords[0] + 1.0 ;
-
-      if (((root_width != scr_reg_width) && 
-	   (window->curr_locking != ZMAP_WINLOCK_HORIZONTAL)))
-        {
-          double excess ;
-          
-          excess = root_width - scr_reg_width ;
-          /* the spacing should be a border width from somewhere. */
-          x2 = x2 + excess + window->config.strand_spacing;
-
-	  /* Annoyingly the initial size of the canvas is an issue here on first draw */
-	  if(y2 == 100.0)
-	    y2 = window->max_coord;
+  window = (ZMapWindow)user_data ;
 
-          zmapWindowSetScrollRegion(window, &x1, &y1, &x2, &y2) ;
-        }
-      else if(((window->curr_locking == ZMAP_WINLOCK_HORIZONTAL) &&
-	       (root_width > scr_reg_width)))
-	{
-	  double excess ;
-          FooCanvasPoints *box;
-
-          excess = root_width - scr_reg_width ;
-          /* the spacing should be a border width from somewhere. */
-          x2 = x2 + excess + window->config.strand_spacing;
-
-	  /* Annoyingly the initial size of the canvas is an issue here on first draw */
-	  if(y2 == 100.0)
-	    y2 = window->max_coord;
-
-	  box = foo_canvas_points_new(2);
-	  box->coords[0] = x1;
-	  box->coords[1] = y1;
-	  box->coords[2] = x2;
-	  box->coords[3] = y2;
-
-          zmapWindowSetScrollRegion(window, &x1, &y1, &x2, &y2) ;
-
-	  g_hash_table_foreach(window->sibling_locked_windows,
-			       set_hlocked_scroll_region, box);
+  zMapAssert(level == ZMAPCONTAINER_LEVEL_ROOT);
+    
+  zmapWindowGetScrollRegion(window, &x1, &y1, &x2, &y2);
+  
+  scr_reg_width = x2 - x1 + 1.0 ;
+  
+  root_width = points->coords[2] - points->coords[0] + 1.0 ;
+  
+  if (((root_width != scr_reg_width) && 
+       (window->curr_locking != ZMAP_WINLOCK_HORIZONTAL)))
+    {
+      double excess ;
+      
+      excess = root_width - scr_reg_width ;
+      /* the spacing should be a border width from somewhere. */
+      x2 = x2 + excess + window->config.strand_spacing;
 
-	  foo_canvas_points_free(box);
-	}
+      /* Annoyingly the initial size of the canvas is an issue here on first draw */
+      if(y2 == 100.0)
+	y2 = window->max_coord;
+      
+      zmapWindowSetScrollRegion(window, &x1, &y1, &x2, &y2) ;
+    }
+  else if(((window->curr_locking == ZMAP_WINLOCK_HORIZONTAL) &&
+	   (root_width > scr_reg_width)))
+    {
+      double excess ;
+      FooCanvasPoints *box;
+      
+      excess = root_width - scr_reg_width ;
+      /* the spacing should be a border width from somewhere. */
+      x2 = x2 + excess + window->config.strand_spacing;
+      
+      /* Annoyingly the initial size of the canvas is an issue here on first draw */
+      if(y2 == 100.0)
+	y2 = window->max_coord;
+      
+      box = foo_canvas_points_new(2);
+      box->coords[0] = x1;
+      box->coords[1] = y1;
+      box->coords[2] = x2;
+      box->coords[3] = y2;
+      
+      zmapWindowSetScrollRegion(window, &x1, &y1, &x2, &y2) ;
+
+      /* We need to make the horizontal split & locked windows have
+       * the maximum width so that _all_ the features are
+       * accessible. Test: bump a column, split window, bump column
+       * another few columns and check the windows are scroolable 
+       * to the full extent of columns. */
+      g_hash_table_foreach(window->sibling_locked_windows,
+			   set_hlocked_scroll_region, box);
+      
+      foo_canvas_points_free(box);
     }
   
-  return ;
+  return result;
 }
 
 
-static void columnZoomChanged(FooCanvasGroup *container, double new_zoom, ZMapWindow window)
-{
-  ZMapWindowItemFeatureSetData set_data ;
-
-  set_data = zmapWindowContainerGetData(container, ITEM_FEATURE_SET_DATA) ;
-  zMapAssert(set_data) ;
-
-  if (zmapWindowItemFeatureSetGetDisplay(set_data) == ZMAPSTYLE_COLDISPLAY_SHOW_HIDE)
-    zmapWindowColumnSetMagState(window, container) ;
-
-  return ;
-}
-
-
-
 
 /* 
  *             3 Frame Display functions.
@@ -1232,10 +1071,9 @@ static void printQuarks(gpointer data, gpointer user_data)
 
 /* GFunc to call on potentially all container groups.
  */
-static void hideColsCB(FooCanvasGroup *data, FooCanvasPoints *points, 
+static void hideColsCB(ZMapWindowContainerGroup container, FooCanvasPoints *points, 
 		       ZMapContainerLevelType level, gpointer user_data)
 {
-  FooCanvasGroup *container = (FooCanvasGroup *)data ;
   VisCoords coord_data = (VisCoords)user_data ;
 
   switch(level)
@@ -1248,30 +1086,26 @@ static void hideColsCB(FooCanvasGroup *data, FooCanvasPoints *points,
 	coord_data->left = 999999999 ;			    /* Must be bigger than any feature position. */
 	coord_data->right = 0 ;
 
-	features = zmapWindowContainerGetFeatures(container) ;
+	features = (FooCanvasGroup *)zmapWindowContainerGetFeatures(container) ;
 
 	g_list_foreach(features->item_list, featureInViewCB, coord_data) ;
 
 	if (zmapWindowItemIsShown(FOO_CANVAS_ITEM(container)))
 	  {
 	    ZMapFeatureSet feature_set ;
-	    ZMapWindowItemFeatureSetData set_data ;
-
-	    set_data = g_object_get_data(G_OBJECT(container), ITEM_FEATURE_SET_DATA) ;
-	    zMapAssert(set_data) ;
 
-	    feature_set = zmapWindowItemFeatureSetRecoverFeatureSet(set_data);
+	    feature_set = zmapWindowContainerGetFeatureSet(container);
 	    zMapAssert(feature_set);
 	    
 	    if (!(coord_data->in_view)
 		&& (coord_data->compress_mode == ZMAPWINDOW_COMPRESS_VISIBLE
-		    || zmapWindowItemFeatureSetGetDisplay(set_data) != ZMAPSTYLE_COLDISPLAY_SHOW))
+		    || zmapWindowContainerFeatureSetGetDisplay((ZMapWindowContainerFeatureSet)container) != ZMAPSTYLE_COLDISPLAY_SHOW))
 	      {
 		/* No items overlap with given area so hide the column completely. */
 
-		zmapWindowColumnHide(container) ;
+		zmapWindowColumnHide((FooCanvasGroup *)container) ;
 
-		zmapWindowItemFeatureBlockAddCompressedColumn(coord_data->block_data, container);
+		zmapWindowContainerBlockAddCompressedColumn((ZMapWindowContainerBlock)(coord_data->block_group), (FooCanvasGroup *)container);
 	      }
 	    else
 	      {
@@ -1303,7 +1137,7 @@ static void hideColsCB(FooCanvasGroup *data, FooCanvasPoints *points,
 		    zmapWindowColumnBumpRange(FOO_CANVAS_ITEM(container),
 					      ZMAPBUMP_INVALID, coord_data->compress_mode) ;
 
-		    zmapWindowItemFeatureBlockAddBumpedColumn(coord_data->block_data, container);
+		    zmapWindowContainerBlockAddBumpedColumn((ZMapWindowContainerBlock)(coord_data->block_group), (FooCanvasGroup *)container);
 		  }
 	      }
 	  }
@@ -1391,7 +1225,6 @@ static ZMapFeatureContextExecuteStatus draw_separator_features(GQuark key_id,
       break;
     case ZMAPFEATURE_STRUCT_ALIGN:
       {
-	FooCanvasGroup *align_parent;
 	FooCanvasItem  *align_hash_item;
 
 	canvas_data->curr_alignment = 
@@ -1402,8 +1235,12 @@ static ZMapFeatureContextExecuteStatus draw_separator_features(GQuark key_id,
 							 0, 0, ZMAPSTRAND_NONE,
 							 ZMAPFRAME_NONE, 0)))
 	  {
-	    zMapAssert(FOO_IS_CANVAS_GROUP(align_hash_item));
-	    align_parent = FOO_CANVAS_GROUP(align_hash_item);
+	    ZMapWindowContainerGroup align_parent;
+
+	    zMapAssert(ZMAP_IS_CONTAINER_GROUP(align_hash_item));
+
+	    align_parent = (ZMapWindowContainerGroup)align_hash_item;
+
 	    canvas_data->curr_align_group = zmapWindowContainerGetFeatures(align_parent);
 	  }
 	else
@@ -1412,7 +1249,6 @@ static ZMapFeatureContextExecuteStatus draw_separator_features(GQuark key_id,
       break;
     case ZMAPFEATURE_STRUCT_BLOCK:
       {
-	FooCanvasGroup *block_parent;
 	FooCanvasItem  *block_hash_item;
 	canvas_data->curr_block = 
 	  zMapFeatureAlignmentGetBlockByID(canvas_data->curr_alignment,
@@ -1423,16 +1259,19 @@ static ZMapFeatureContextExecuteStatus draw_separator_features(GQuark key_id,
 							 feature_any->unique_id, 0,
 							 ZMAPSTRAND_NONE, ZMAPFRAME_NONE, 0)))
 	  {
-	    zMapAssert(FOO_IS_CANVAS_GROUP(block_hash_item));
-	    block_parent = FOO_CANVAS_GROUP(block_hash_item);
+	    ZMapWindowContainerGroup block_parent;
+	    ZMapWindowContainerStrand forward_strand;
+
+	    zMapAssert(ZMAP_IS_CONTAINER_GROUP(block_hash_item));
+
+	    block_parent = (ZMapWindowContainerGroup)(block_hash_item);
 
 	    canvas_data->curr_block_group = 
 	      zmapWindowContainerGetFeatures(block_parent);
 	      
-	    canvas_data->curr_forward_group =
-	      zmapWindowContainerGetStrandGroup(block_parent, ZMAPSTRAND_FORWARD);
-	    canvas_data->curr_forward_group =
-	      zmapWindowContainerGetFeatures(canvas_data->curr_forward_group);
+	    forward_strand = zmapWindowContainerBlockGetContainerStrand((ZMapWindowContainerBlock)block_parent,
+									ZMAPSTRAND_FORWARD);
+	    canvas_data->curr_forward_group = zmapWindowContainerGetFeatures((ZMapWindowContainerGroup)forward_strand);
 	  }
 	else
 	  zMapAssertNotReached();
diff --git a/src/zmapWindow/zmapWindowDrawFeatures.c b/src/zmapWindow/zmapWindowDrawFeatures.c
index 5d5e3ec5e1108998c14befb306c5599a3b7ae07f..325bfbdec5d7b7cec886f98bef7971fe3f532215 100755
--- a/src/zmapWindow/zmapWindowDrawFeatures.c
+++ b/src/zmapWindow/zmapWindowDrawFeatures.c
@@ -26,9 +26,9 @@
  *              
  * Exported functions: 
  * HISTORY:
- * Last edited: May  8 14:09 2009 (rds)
+ * Last edited: Jun  5 12:18 2009 (rds)
  * Created: Thu Jul 29 10:45:00 2004 (rnc)
- * CVS info:   $Id: zmapWindowDrawFeatures.c,v 1.243 2009-05-08 14:10:51 rds Exp $
+ * CVS info:   $Id: zmapWindowDrawFeatures.c,v 1.244 2009-06-05 13:33:04 rds Exp $
  *-------------------------------------------------------------------
  */
 
@@ -39,8 +39,9 @@
 #include <ZMap/zmapConfig.h>
 #include <ZMap/zmapConfigLoader.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
+#include <zmapWindowContainerUtils.h>
 #include <zmapWindowItemFactory.h>
+#include <zmapWindowContainerFeatureSet_I.h>
 
 /* these will go when scale is in separate window. */
 #define SCALEBAR_OFFSET   0.0
@@ -72,14 +73,14 @@ typedef struct _ZMapCanvasDataStruct
 
   /* Records current canvas item groups, these are the direct parent groups of the display
    * types they contain, e.g. curr_root_group is the parent of the align */
-  FooCanvasGroup *curr_root_group ;
-  FooCanvasGroup *curr_align_group ;
-  FooCanvasGroup *curr_block_group ;
-  FooCanvasGroup *curr_forward_group ;
-  FooCanvasGroup *curr_reverse_group ;
+  ZMapWindowContainerFeatures curr_root_group ;
+  ZMapWindowContainerFeatures curr_align_group ;
+  ZMapWindowContainerFeatures curr_block_group ;
+  ZMapWindowContainerFeatures curr_forward_group ;
+  ZMapWindowContainerFeatures curr_reverse_group ;
 
-  FooCanvasGroup *curr_forward_col ;
-  FooCanvasGroup *curr_reverse_col ;
+  ZMapWindowContainerFeatures curr_forward_col ;
+  ZMapWindowContainerFeatures curr_reverse_col ;
 
 
   GHashTable *feature_hash ;
@@ -107,8 +108,8 @@ typedef struct
   GData *styles ;
   GHashTable *feature_hash ;
   int feature_count;
-  FooCanvasGroup *curr_forward_col ;
-  FooCanvasGroup *curr_reverse_col ;
+  ZMapWindowContainerFeatures curr_forward_col ;
+  ZMapWindowContainerFeatures curr_reverse_col ;
   ZMapFrame frame ;
   gboolean drawable_frame;	/* filter */
 } CreateFeatureSetDataStruct, *CreateFeatureSetData ;
@@ -122,13 +123,13 @@ static ZMapFeatureContextExecuteStatus windowDrawContextCB(GQuark   key_id,
 							   gpointer user_data,
 							   char   **error_out) ;
 static FooCanvasGroup *produce_column(ZMapCanvasData  canvas_data,
-				      FooCanvasGroup *container,
+				      ZMapWindowContainerFeatures container,
 				      GQuark          feature_set_id,
 				      ZMapStrand      column_strand,
 				      ZMapFrame       column_frame);
 
 
-static FooCanvasGroup *createColumnFull(FooCanvasGroup      *parent_group,
+static FooCanvasGroup *createColumnFull(ZMapWindowContainerFeatures parent_group,
 					ZMapWindow           window,
 					ZMapFeatureAlignment align,
 					ZMapFeatureBlock     block,
@@ -139,7 +140,7 @@ static FooCanvasGroup *createColumnFull(FooCanvasGroup      *parent_group,
 					gboolean             is_separator_col,
 					double width, double top, double bot);
 
-static FooCanvasGroup *createColumn(FooCanvasGroup      *parent_group,
+static FooCanvasGroup *createColumn(ZMapWindowContainerFeatures parent_group,
 				    ZMapWindow           window,
                                     ZMapFeatureSet       feature_set,
 				    ZMapStrand           strand, 
@@ -161,19 +162,17 @@ static void columnMenuCB(int menu_item_id, gpointer callback_data) ;
 
 static void setColours(ZMapWindow window) ;
 
-void addDataToContainer(FooCanvasGroup *container, ZMapFeatureAny feature) ;
 #ifdef ED_G_NEVER_INCLUDE_THIS_CODE
 static void printFeatureSet(GQuark key_id, gpointer data, gpointer user_data) ;
 #endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
 
-static FooCanvasGroup *separatorGetFeatureSetColumn(FooCanvasGroup *separator_parent,
+static FooCanvasGroup *separatorGetFeatureSetColumn(ZMapWindowContainerStrand separator_parent,
 						    ZMapFeatureSet  feature_set);
 
 
 extern GTimer *view_timer_G ;
 static gboolean window_draw_context_debug_G = FALSE;
 
-
 /* Drawing coordinates: PLEASE READ THIS BEFORE YOU START MESSING ABOUT WITH ANYTHING...
  * 
  * It seems that item coordinates are _not_ specified in absolute world coordinates but
@@ -226,7 +225,7 @@ void zmapWindowDrawFeatures(ZMapWindow window,
 {
   GtkAdjustment *h_adj;
   ZMapCanvasDataStruct canvas_data = {NULL} ;		    /* Rest of struct gets set to zero. */
-  FooCanvasGroup *root_group ;
+  ZMapWindowContainerGroup root_group;
   FooCanvasItem *tmp_item = NULL;
   gboolean debug_containers = FALSE, root_created = FALSE;
   double x, y;
@@ -306,18 +305,20 @@ void zmapWindowDrawFeatures(ZMapWindow window,
   if((tmp_item = zmapWindowFToIFindItemFull(window->context_to_item, 
                                             0, 0, 0, ZMAPSTRAND_NONE, ZMAPFRAME_NONE, 0)))
     {
-      root_group = FOO_CANVAS_GROUP(tmp_item);
+      zMapAssert(ZMAP_IS_CONTAINER_GROUP(tmp_item));
+      root_group   = (ZMapWindowContainerGroup)tmp_item;
       root_created = FALSE;
     }
   else
     {
       /* Add a background to the root window, must be as long as entire sequence... */
-      root_group = zmapWindowContainerCreate(foo_canvas_root(window->canvas),
-                                             ZMAPCONTAINER_LEVEL_ROOT,
-                                             window->config.align_spacing,
-                                             &(window->colour_root), 
-                                             &(window->canvas_border),
-					     window->long_items) ;
+      root_group = zmapWindowContainerGroupCreateFromFoo(foo_canvas_root(window->canvas),
+							 ZMAPCONTAINER_LEVEL_ROOT,
+							 window->config.align_spacing,
+							 &(window->colour_root), 
+							 &(window->canvas_border));
+
+      zmapWindowContainerGroupBackgroundSize(root_group, window->max_coord);
 
       g_signal_connect(G_OBJECT(root_group), "destroy", G_CALLBACK(containerDestroyCB), window) ;
 
@@ -329,15 +330,17 @@ void zmapWindowDrawFeatures(ZMapWindow window,
 
   canvas_data.curr_root_group = zmapWindowContainerGetFeatures(root_group) ;
 
+  /* Always reset this as context changes with new features.*/
+  zmapWindowContainerAttachFeatureAny(root_group, (ZMapFeatureAny)full_context);
 
-  addDataToContainer(root_group, (ZMapFeatureAny)full_context) ; /* Always reset this
-								    as context changes
-								    with new features.*/
-
+  zmapWindowFToIAddRoot(window->context_to_item, (FooCanvasGroup *)root_group);
 
-  zmapWindowFToIAddRoot(window->context_to_item, root_group);
   window->feature_root_group = root_group ;
 
+  if(root_created)
+    {
+      zmapWindowDrawManageWindowWidth(window);
+    }
 
   /* Set root group to start where sequence starts... */
   x = canvas_data.curr_x_offset ;
@@ -383,11 +386,15 @@ void zmapWindowDrawFeatures(ZMapWindow window,
     }
 
   if(debug_containers)
-    zmapWindowContainerPrint(root_group) ;
-
+    {
+      /* This code no longer works */
+      /* zmapWindowContainerPrint(root_group) ; */
+    }
 
   zMapPrintTimer(NULL, "Finished creating canvas features") ;
 
+  zmapWindowContainerRequestReposition(root_group);
+
   /* cursor should have been set on by anyone calling us. */
   zMapWindowBusy(window, FALSE) ;
 
@@ -407,8 +414,8 @@ void zmapWindowDrawFeatures(ZMapWindow window,
  * 
  *  */
 gboolean zmapWindowCreateSetColumns(ZMapWindow window, 
-                                    FooCanvasGroup *forward_strand_group, 
-                                    FooCanvasGroup *reverse_strand_group,
+                                    ZMapWindowContainerFeatures forward_strand_group, 
+                                    ZMapWindowContainerFeatures reverse_strand_group,
                                     ZMapFeatureBlock block, 
                                     ZMapFeatureSet feature_set,
 				    GData *styles,
@@ -488,29 +495,32 @@ gboolean zmapWindowCreateSetColumns(ZMapWindow window,
        * ********************************************************** */
       if(zMapStyleDisplayInSeparator(style) && separator_col_out)
 	{
-	  FooCanvasGroup *separator, *block_level;
+	  ZMapWindowContainerGroup tmp_container;
+	  ZMapWindowContainerGroup block_container;
+	  ZMapWindowContainerStrand separator;
 
 	  /* Yes we piggy back here, but as the function requires a F or R group so what. */
 	  if(forward_strand_group)
 	    {
-	      forward_strand_group = zmapWindowContainerGetParent(FOO_CANVAS_ITEM(forward_strand_group));
-	      block_level = zmapWindowContainerGetSuperGroup(forward_strand_group);
+	      tmp_container   = zmapWindowContainerChildGetParent((FooCanvasItem *)forward_strand_group);
+	      block_container = zmapWindowContainerUtilsGetParentLevel(tmp_container, ZMAPCONTAINER_LEVEL_BLOCK);
 	    }
 	  else
 	    {
-	      reverse_strand_group = zmapWindowContainerGetSuperGroup(reverse_strand_group);
-	      block_level = zmapWindowContainerGetSuperGroup(reverse_strand_group);
+	      tmp_container   = zmapWindowContainerChildGetParent((FooCanvasItem *)reverse_strand_group);
+	      block_container = zmapWindowContainerUtilsGetParentLevel(tmp_container, ZMAPCONTAINER_LEVEL_BLOCK);
 	    }
 
-	  if((separator = zmapWindowContainerGetStrandSeparatorGroup(block_level)))
+	  if((separator = zmapWindowContainerBlockGetContainerSeparator((ZMapWindowContainerBlock)block_container)))
 	    {
 	      /* No need to create if we've already got one. */
 	      /* N.B. separatorGetFeatureSetColumn returns a FooCanvasGroup * */
 	      if(!(*separator_col_out = separatorGetFeatureSetColumn(separator,
 								     feature_set)))
 		{
-		  separator = zmapWindowContainerGetFeatures(separator);
-		  *separator_col_out = createColumn(separator, window,
+		  ZMapWindowContainerFeatures separator_features;
+		  separator_features = zmapWindowContainerGetFeatures((ZMapWindowContainerGroup)separator);
+		  *separator_col_out = createColumn(separator_features, window,
 						    feature_set,
 						    ZMAPSTRAND_NONE,
 						    frame,
@@ -535,14 +545,10 @@ gboolean zmapWindowCreateSetColumns(ZMapWindow window,
 					  ZMAPSTRAND_FORWARD, frame);
 	  if(set_group_item)
 	    {
-	      ZMapWindowItemFeatureSetData set_data = NULL;
-
               zMapAssert(set_group_item && FOO_IS_CANVAS_GROUP(set_group_item));
               *forward_col_out = FOO_CANVAS_GROUP(set_group_item);
 
-	      set_data = g_object_get_data(G_OBJECT(set_group_item), ITEM_FEATURE_SET_DATA);
-
-	      zmapWindowItemFeatureSetAttachFeatureSet(set_data, feature_set);
+	      zmapWindowContainerFeatureSetAttachFeatureSet((ZMapWindowContainerFeatureSet)set_group_item, feature_set);
             }
 	  else
 	    *forward_col_out = NULL;
@@ -566,14 +572,10 @@ gboolean zmapWindowCreateSetColumns(ZMapWindow window,
 
 	  if(set_group_item)
             {
-	      ZMapWindowItemFeatureSetData set_data = NULL;
-
               zMapAssert(set_group_item && FOO_IS_CANVAS_GROUP(set_group_item));
               *reverse_col_out = FOO_CANVAS_GROUP(set_group_item);
 
-	      set_data = g_object_get_data(G_OBJECT(set_group_item), ITEM_FEATURE_SET_DATA);
-
-	      zmapWindowItemFeatureSetAttachFeatureSet(set_data, feature_set);
+	      zmapWindowContainerFeatureSetAttachFeatureSet((ZMapWindowContainerFeatureSet)set_group_item, feature_set);
             }
 	  else
 	    *reverse_col_out = NULL;
@@ -594,9 +596,10 @@ void zmapWindowDrawFeatureSet(ZMapWindow window,
                               FooCanvasGroup *reverse_col_wcp,
                               ZMapFrame frame)
 {
+  ZMapWindowContainerGroup forward_container;
+  ZMapWindowContainerGroup reverse_container;
   CreateFeatureSetDataStruct featureset_data = {NULL} ;
   ZMapFeatureSet view_feature_set = NULL;
-  ZMapWindowItemFeatureSetData forward_set_data, reverse_set_data;
   gboolean bump_required = TRUE;
 
   /* We shouldn't be called if there is no forward _AND_ no reverse col..... */
@@ -604,35 +607,32 @@ void zmapWindowDrawFeatureSet(ZMapWindow window,
 
   featureset_data.window = window ;
 
-  forward_set_data = reverse_set_data = NULL;
-
   if (forward_col_wcp)
     {
+      forward_container = (ZMapWindowContainerGroup)forward_col_wcp;
+
       if(zmapWindowColumnIs3frameVisible(window, forward_col_wcp))
-	featureset_data.curr_forward_col = zmapWindowContainerGetFeatures(forward_col_wcp) ;
+	featureset_data.curr_forward_col = zmapWindowContainerGetFeatures(forward_container) ;
 
-      view_feature_set = zmapWindowContainerGetData(forward_col_wcp, ITEM_FEATURE_DATA);
+      view_feature_set = zmapWindowContainerGetFeatureSet(forward_container);
 
       if(!view_feature_set)
 	zMapLogWarning("Container with no Feature Set attached [%s]", "Forward Strand");
-
-      forward_set_data = zmapWindowContainerGetData(forward_col_wcp, ITEM_FEATURE_SET_DATA);
     }
 
   if (reverse_col_wcp)
     {
+      reverse_container = (ZMapWindowContainerGroup)reverse_col_wcp;
 
       if(zmapWindowColumnIs3frameVisible(window, reverse_col_wcp))
-	featureset_data.curr_reverse_col = zmapWindowContainerGetFeatures(reverse_col_wcp) ;
+	featureset_data.curr_reverse_col = zmapWindowContainerGetFeatures(reverse_container) ;
 
       if(!view_feature_set)
 	{
-	  view_feature_set = zmapWindowContainerGetData(reverse_col_wcp, ITEM_FEATURE_DATA);
+	  view_feature_set = zmapWindowContainerGetFeatureSet(reverse_container);
 	  if(!view_feature_set)
 	    zMapLogWarning("Container with no Feature Set attached [%s]", "Reverse Strand");
 	}
-
-      reverse_set_data = zmapWindowContainerGetData(reverse_col_wcp, ITEM_FEATURE_SET_DATA);
     }  
 
   featureset_data.frame         = frame ;
@@ -644,18 +644,18 @@ void zmapWindowDrawFeatureSet(ZMapWindow window,
 
   if(featureset_data.feature_count > 0)
     {
-      ZMapWindowItemFeatureSetData set_data;
+      ZMapWindowContainerGroup column_container_parent;
       
-      if((set_data = forward_set_data) || (set_data = reverse_set_data))
+      if((column_container_parent = forward_container) || (column_container_parent = reverse_container))
 	{
-	  ZMapWindowItemFeatureBlockData block_data;
-	  FooCanvasGroup *block_item;
+	  ZMapWindowContainerGroup block_container;
 	  
-	  block_item = zmapWindowContainerGetParentLevel(FOO_CANVAS_ITEM(forward_col_wcp), ZMAPCONTAINER_LEVEL_BLOCK);
-	  block_data = g_object_get_data(G_OBJECT(block_item), ITEM_FEATURE_BLOCK_DATA);
+	  block_container = zmapWindowContainerUtilsGetParentLevel(column_container_parent,
+								   ZMAPCONTAINER_LEVEL_BLOCK);
 
-	  zmapWindowItemFeatureBlockMarkRegionForColumn(block_data, (ZMapFeatureBlock)feature_set->parent,
-							set_data);
+	  zmapWindowContainerBlockMarkRegionForColumn((ZMapWindowContainerBlock)block_container, 
+						      (ZMapFeatureBlock)feature_set->parent,
+						      (ZMapWindowContainerFeatureSet)column_container_parent);
 	}
     }
 
@@ -668,9 +668,19 @@ void zmapWindowDrawFeatureSet(ZMapWindow window,
        * column... Better than using what is potentially a diff
        * context... */
 
-      if (forward_col_wcp)
+      /* Changed zmapWindowColumnBump to zmapWindowColumnBumpRange to fix RT#66832 */
+      /* The problem was objects outside of the mark were being hidden as ColumnBump
+       * respects the mark if there is one.  This is probably _not_ the right thing
+       * to do here. However, this might need some re-evaluation... */
+      /* The main reason I think we will fall down here is when we have deferred
+       * loading.  If we are loading a set of alignments within the marked area, 
+       * then if the default display is to bump these and there are other aligns
+       * already loaded in this column a COMPRESS_ALL will bump the whole column
+       * _not_ just the newly loaded ones... */
+
+      if (forward_container)
 	{
-	  if ((bump_mode = zmapWindowItemFeatureSetGetBumpMode(forward_set_data)) != ZMAPBUMP_UNBUMP)
+	  if ((bump_mode = zmapWindowContainerFeatureSetGetBumpMode((ZMapWindowContainerFeatureSet)forward_container)) != ZMAPBUMP_UNBUMP)
 	    zmapWindowColumnBumpRange(FOO_CANVAS_ITEM(forward_col_wcp), bump_mode, ZMAPWINDOW_COMPRESS_ALL) ;
 
 	  /* Some columns are hidden initially, could be mag. level, 3 frame only display or
@@ -678,36 +688,15 @@ void zmapWindowDrawFeatureSet(ZMapWindow window,
 	  zmapWindowColumnSetState(window, forward_col_wcp, ZMAPSTYLE_COLDISPLAY_INVALID, FALSE) ;
 	}
 
-      if (reverse_col_wcp)
+      if (reverse_container)
 	{
-	  if ((bump_mode = zmapWindowItemFeatureSetGetBumpMode(reverse_set_data)) != ZMAPBUMP_UNBUMP)
+	  if ((bump_mode = zmapWindowContainerFeatureSetGetBumpMode((ZMapWindowContainerFeatureSet)reverse_container)) != ZMAPBUMP_UNBUMP)
 	    zmapWindowColumnBumpRange(FOO_CANVAS_ITEM(reverse_col_wcp), bump_mode, ZMAPWINDOW_COMPRESS_ALL) ;
 
 	  /* Some columns are hidden initially, could be mag. level, 3 frame only display or
 	   * set explicitly in the style for the column. */
 	  zmapWindowColumnSetState(window, reverse_col_wcp, ZMAPSTYLE_COLDISPLAY_INVALID, FALSE) ;
 	}
-
-#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
-      if ((forward_style && (bump_mode = zMapStyleGetBumpMode(forward_style)) != ZMAPBUMP_UNBUMP) ||
-	  (reverse_style && (bump_mode = zMapStyleGetBumpMode(reverse_style)) != ZMAPBUMP_UNBUMP))
-        {
-	  /* Changed zmapWindowColumnBump to zmapWindowColumnBumpRange to fix RT#66832 */
-	  /* The problem was objects outside of the mark were being hidden as ColumnBump
-	   * respects the mark if there is one.  This is probably _not_ the right thing
-	   * to do here. However, this might need some re-evaluation... */
-	  /* The main reason I think we will fall down here is when we have deferred
-	   * loading.  If we are loading a set of alignments within the marked area, 
-	   * then if the default display is to bump these and there are other aligns
-	   * already loaded in this column a COMPRESS_ALL will bump the whole column
-	   * _not_ just the newly loaded ones... */
-          if (forward_col_wcp)
-            zmapWindowColumnBumpRange(FOO_CANVAS_ITEM(forward_col_wcp), bump_mode, ZMAPWINDOW_COMPRESS_ALL) ;
-          
-          if (reverse_col_wcp)
-            zmapWindowColumnBumpRange(FOO_CANVAS_ITEM(reverse_col_wcp), bump_mode, ZMAPWINDOW_COMPRESS_ALL) ;
-        }
-#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
     }	    
 
   return ;
@@ -741,16 +730,18 @@ void zmapWindowRemoveEmptyColumns(ZMapWindow window,
 
 gboolean zmapWindowRemoveIfEmptyCol(FooCanvasGroup **col_group)
 {
+  ZMapWindowContainerGroup container;
   gboolean removed = FALSE ;
-  ZMapWindowItemFeatureSetData set_data;
 
-  set_data = zmapWindowContainerGetData(*col_group, ITEM_FEATURE_SET_DATA);
+  container = (ZMapWindowContainerGroup)(*col_group);
 
-  if ((!zmapWindowContainerHasFeatures(*col_group)) && 
-      ((!set_data) || (set_data && !zmapWindowItemFeatureSetShowWhenEmpty(set_data))))
+  if ((!zmapWindowContainerHasFeatures(container)) && 
+      (!zmapWindowContainerFeatureSetShowWhenEmpty((ZMapWindowContainerFeatureSet)container)))
     {
-      zmapWindowContainerDestroy(*col_group) ;
-      *col_group = NULL;
+      container = zmapWindowContainerGroupDestroy(container) ;
+
+      *col_group = (FooCanvasGroup *)container;
+
       removed = TRUE ;
     }
 
@@ -916,7 +907,7 @@ void zmapWindowDraw3FrameFeatures(ZMapWindow window)
   root_group_item = zmapWindowFToIFindItemFull(window->context_to_item, 
 					       0, 0, 0, ZMAPSTRAND_NONE, ZMAPFRAME_NONE, 0);
 
-  canvas_data.curr_root_group = zmapWindowContainerGetFeatures(FOO_CANVAS_GROUP(root_group_item)) ;
+  canvas_data.curr_root_group = zmapWindowContainerGetFeatures(window->feature_root_group) ;
  
 
   zMapFeatureContextExecuteComplete((ZMapFeatureAny)full_context,
@@ -933,42 +924,37 @@ void zmapWindowDraw3FrameFeatures(ZMapWindow window)
   return ;
 }
 
-static void purge_hide_frame_specific_columns(FooCanvasGroup *container, FooCanvasPoints *points,
+static void purge_hide_frame_specific_columns(ZMapWindowContainerGroup container, FooCanvasPoints *points,
 					      ZMapContainerLevelType level, gpointer user_data)
 {
   ZMapWindow window = (ZMapWindow)user_data;
 
   if (level == ZMAPCONTAINER_LEVEL_FEATURESET)
     {
-      ZMapWindowItemFeatureSetData set_data;
       ZMapStyle3FrameMode frame_mode = ZMAPSTYLE_3_FRAME_INVALID ;
+      ZMapWindowContainerFeatureSet container_set;
+      
+      container_set = (ZMapWindowContainerFeatureSet)container;
 
-      set_data = g_object_get_data(G_OBJECT(container), ITEM_FEATURE_SET_DATA) ;
-
-      zMapAssert(set_data) ;
-
-      if (zmapWindowItemFeatureSetIsFrameSpecific(set_data, &frame_mode))
+      if (zmapWindowContainerFeatureSetIsFrameSpecific(container_set, &frame_mode))
 	{
 	  if (frame_mode == ZMAPSTYLE_3_FRAME_ONLY_1)
 	    {
 	      if (window->display_3_frame)
-		zmapWindowColumnHide(container) ;
+		zmapWindowColumnHide((FooCanvasGroup *)container) ;
 	    }
 	  else
 	    {
-	      FooCanvasGroup *features ;
 	      ZMapStrand column_strand;
 
-	      column_strand = zmapWindowItemFeatureSetGetStrand(set_data);
+	      column_strand = zmapWindowContainerFeatureSetGetStrand(container_set);
 
 	      if ((column_strand != ZMAPSTRAND_REVERSE) ||
 		  (column_strand == ZMAPSTRAND_REVERSE && window->show_3_frame_reverse))
 		{
-		  zmapWindowColumnHide(container) ;
-
-		  features = zmapWindowContainerGetFeatures(container);
+		  zmapWindowColumnHide((FooCanvasGroup *)container) ;
 
-		  zmapWindowContainerPurge(features) ;
+		  zmapWindowContainerFeatureSetRemoveAllItems(container_set) ;
 		}
 	    }
 	}
@@ -980,10 +966,10 @@ static void purge_hide_frame_specific_columns(FooCanvasGroup *container, FooCanv
 
 void zmapWindowDrawRemove3FrameFeatures(ZMapWindow window)
 {
-  zmapWindowContainerExecute(window->feature_root_group,
-			     ZMAPCONTAINER_LEVEL_FEATURESET,
-			     purge_hide_frame_specific_columns,
-			     window);
+  zmapWindowContainerUtilsExecute(window->feature_root_group,
+				  ZMAPCONTAINER_LEVEL_FEATURESET,
+				  purge_hide_frame_specific_columns,
+				  window);
 }
 
 static void set_name_create_set_columns(gpointer list_data, gpointer user_data)
@@ -1106,7 +1092,7 @@ static gboolean feature_set_matches_frame_drawing_mode(ZMapWindow     window,
 }
 
 static FooCanvasGroup *find_or_create_column(ZMapCanvasData  canvas_data,
-					     FooCanvasGroup *strand_container,
+					     ZMapWindowContainerFeatures strand_container,
 					     GQuark          feature_set_id,
 					     ZMapStrand      column_strand,
 					     ZMapFrame       column_frame,
@@ -1148,29 +1134,26 @@ static FooCanvasGroup *find_or_create_column(ZMapCanvasData  canvas_data,
 
       if(existing_column_item)
 	{
-	  ZMapWindowItemFeatureSetData set_data = NULL;
 	  ZMapStyle3FrameMode frame_mode;
 	  gboolean valid_strand = FALSE;
 	  gboolean valid_frame  = FALSE;
 	  
 	  existing_column = FOO_CANVAS_GROUP(existing_column_item);
 
-	  set_data = g_object_get_data(G_OBJECT(existing_column), ITEM_FEATURE_SET_DATA);
-	  
 	  if(column_strand == ZMAPSTRAND_FORWARD)
 	    valid_strand = TRUE;
 	  else if(column_strand == ZMAPSTRAND_REVERSE)
-	    valid_strand = zmapWindowItemFeatureSetIsStrandSpecific(set_data);
+	    valid_strand = zmapWindowContainerFeatureSetIsStrandSpecific((ZMapWindowContainerFeatureSet)existing_column_item);
 	  
 	  if(column_frame == ZMAPFRAME_NONE)
 	    valid_frame = TRUE;
 	  else if(column_strand == ZMAPSTRAND_FORWARD || window->show_3_frame_reverse)
-	    valid_frame = zmapWindowItemFeatureSetIsFrameSpecific(set_data, &frame_mode);
+	    valid_frame = zmapWindowContainerFeatureSetIsFrameSpecific((ZMapWindowContainerFeatureSet)existing_column_item, 
+								       &frame_mode);
 	  
 	}
       else if(create_if_not_exist)
 	{
-	  ZMapWindowItemFeatureSetData set_data = NULL;
 	  ZMapStyle3FrameMode frame_mode;
 	  gboolean valid_strand = FALSE;
 	  gboolean valid_frame  = FALSE;
@@ -1191,17 +1174,16 @@ static FooCanvasGroup *find_or_create_column(ZMapCanvasData  canvas_data,
 	    }
 	  else
 	    {
-	      set_data = g_object_get_data(G_OBJECT(new_column), ITEM_FEATURE_SET_DATA);
-	      
 	      if(column_strand == ZMAPSTRAND_FORWARD)
 		valid_strand = TRUE;
 	      else if(column_strand == ZMAPSTRAND_REVERSE)
-		valid_strand = zmapWindowItemFeatureSetIsStrandSpecific(set_data);
+		valid_strand = zmapWindowContainerFeatureSetIsStrandSpecific((ZMapWindowContainerFeatureSet)new_column);
 	      
 	      if(column_frame == ZMAPFRAME_NONE)
 		valid_frame = TRUE;
 	      else if(column_strand == ZMAPSTRAND_FORWARD || window->show_3_frame_reverse)
-		valid_frame = zmapWindowItemFeatureSetIsFrameSpecific(set_data, &frame_mode);
+		valid_frame = zmapWindowContainerFeatureSetIsFrameSpecific((ZMapWindowContainerFeatureSet)new_column, 
+									   &frame_mode);
 	    }
 
 	  if (valid_frame && valid_strand)
@@ -1213,7 +1195,7 @@ static FooCanvasGroup *find_or_create_column(ZMapCanvasData  canvas_data,
 }
 
 static FooCanvasGroup *find_column(ZMapCanvasData  canvas_data,
-				   FooCanvasGroup *container,
+				   ZMapWindowContainerFeatures container,
 				   GQuark          feature_set_id,
 				   ZMapStrand      column_strand,
 				   ZMapFrame       column_frame)
@@ -1227,7 +1209,7 @@ static FooCanvasGroup *find_column(ZMapCanvasData  canvas_data,
 }
 
 static FooCanvasGroup *produce_column(ZMapCanvasData  canvas_data,
-				      FooCanvasGroup *container,
+				      ZMapWindowContainerFeatures container,
 				      GQuark          feature_set_id,
 				      ZMapStrand      column_strand,
 				      ZMapFrame       column_frame)
@@ -1257,11 +1239,7 @@ static gboolean pick_forward_reverse_columns(ZMapWindow       window,
 			       canvas_data->curr_set->unique_id,
 			       ZMAPSTRAND_FORWARD, frame)))
     {
-      ZMapWindowItemFeatureSetData set_data = NULL;
-
-      set_data = g_object_get_data(G_OBJECT(set_column), ITEM_FEATURE_SET_DATA);
-      
-      zmapWindowItemFeatureSetAttachFeatureSet(set_data, feature_set);
+      zmapWindowContainerFeatureSetAttachFeatureSet((ZMapWindowContainerFeatureSet)set_column, feature_set);
 
       *fwd_col_out = set_column;
       found_one    = TRUE;
@@ -1276,11 +1254,7 @@ static gboolean pick_forward_reverse_columns(ZMapWindow       window,
 			       canvas_data->curr_set->unique_id,
 			       ZMAPSTRAND_REVERSE, frame)))
     {
-      ZMapWindowItemFeatureSetData set_data = NULL;
-
-      set_data = g_object_get_data(G_OBJECT(set_column), ITEM_FEATURE_SET_DATA);
-      
-      zmapWindowItemFeatureSetAttachFeatureSet(set_data, feature_set);
+      zmapWindowContainerFeatureSetAttachFeatureSet((ZMapWindowContainerFeatureSet)set_column, feature_set);
 
       *rev_col_out = set_column;
       found_one    = TRUE;
@@ -1288,8 +1262,6 @@ static gboolean pick_forward_reverse_columns(ZMapWindow       window,
   else if(rev_col_out)
     *rev_col_out = NULL;
 
-#ifdef RDS_REMOVED
-#endif
 
   return found_one;
 }
@@ -1335,7 +1307,7 @@ static ZMapFeatureContextExecuteStatus windowDrawContextCB(GQuark   key_id,
 
     case ZMAPFEATURE_STRUCT_ALIGN:
       {
-        FooCanvasGroup *align_parent;
+        ZMapWindowContainerGroup align_parent;
         FooCanvasItem  *align_hash_item;
         double x, y;
         feature_align = (ZMapFeatureAlignment)feature_any;
@@ -1357,17 +1329,16 @@ static ZMapFeatureContextExecuteStatus windowDrawContextCB(GQuark   key_id,
 							  0, 0, ZMAPSTRAND_NONE, 
 							  ZMAPFRAME_NONE, 0)))
           {
-            zMapAssert(FOO_IS_CANVAS_GROUP(align_hash_item));
-            align_parent = FOO_CANVAS_GROUP(align_hash_item);
+            zMapAssert(ZMAP_IS_CONTAINER_GROUP(align_hash_item));
+            align_parent = (ZMapWindowContainerGroup)(align_hash_item);
           }
         else
           {
-            align_parent = zmapWindowContainerCreate(canvas_data->curr_root_group,
-                                                     ZMAPCONTAINER_LEVEL_ALIGN,
-                                                     window->config.block_spacing,
-                                                     &(window->colour_alignment),
-                                                     &(window->canvas_border),
-                                                     window->long_items) ;
+            align_parent = zmapWindowContainerGroupCreate(canvas_data->curr_root_group,
+							  ZMAPCONTAINER_LEVEL_ALIGN,
+							  window->config.block_spacing,
+							  &(window->colour_alignment),
+							  &(window->canvas_border));
             g_signal_connect(G_OBJECT(align_parent), 
                              "destroy", 
                              G_CALLBACK(containerDestroyCB), 
@@ -1376,14 +1347,14 @@ static ZMapFeatureContextExecuteStatus windowDrawContextCB(GQuark   key_id,
 	    g_object_set_data(G_OBJECT(align_parent), ITEM_FEATURE_STATS,
 			      zmapWindowStatsCreate((ZMapFeatureAny)(canvas_data->curr_alignment))) ;
 
-	    addDataToContainer(align_parent, (ZMapFeatureAny)(canvas_data->curr_alignment)) ;
+	    zmapWindowContainerAttachFeatureAny(align_parent, (ZMapFeatureAny)(canvas_data->curr_alignment)) ;
 
 	    foo_canvas_item_set(FOO_CANVAS_ITEM(align_parent),
 				"x", x,
 				"y", y,
 				NULL) ;
 
-	    if (!(zmapWindowFToIAddAlign(window->context_to_item, key_id, align_parent)))
+	    if (!(zmapWindowFToIAddAlign(window->context_to_item, key_id, (FooCanvasGroup *)align_parent)))
 	      {
 		status = ZMAP_CONTEXT_EXEC_STATUS_ERROR;
 		*error_out = g_strdup_printf("Failed to add alignment '%s' to hash!", 
@@ -1399,8 +1370,10 @@ static ZMapFeatureContextExecuteStatus windowDrawContextCB(GQuark   key_id,
 
     case ZMAPFEATURE_STRUCT_BLOCK:
       {
-        FooCanvasGroup *block_parent, *forward_group, *reverse_group ;
-	FooCanvasGroup *strand_separator;
+	ZMapWindowContainerGroup block_parent;
+        ZMapWindowContainerGroup forward_group, reverse_group ;
+	ZMapWindowContainerGroup strand_separator;
+	ZMapWindowContainerBlock container_block;
         FooCanvasItem *block_hash_item;
         GdkColor *for_bg_colour, *rev_bg_colour ;
         double x, y;
@@ -1420,33 +1393,29 @@ static ZMapFeatureContextExecuteStatus windowDrawContextCB(GQuark   key_id,
                                                          feature_block->unique_id, 0, ZMAPSTRAND_NONE,
                                                          ZMAPFRAME_NONE, 0)))
           {
-            zMapAssert(FOO_IS_CANVAS_GROUP(block_hash_item));
-            block_parent = FOO_CANVAS_GROUP(block_hash_item);
+	    zMapAssert(ZMAP_IS_CONTAINER_GROUP(block_hash_item));
+            block_parent = (ZMapWindowContainerGroup)(block_hash_item);
           }
         else
           {
-	    ZMapWindowItemFeatureBlockData block_data ;
-
-            block_parent = zmapWindowContainerCreate(canvas_data->curr_align_group,
-                                                     ZMAPCONTAINER_LEVEL_BLOCK,
-                                                     window->config.strand_spacing,
-                                                     &(window->colour_block),
-                                                     &(canvas_data->window->canvas_border),
-                                                     window->long_items) ;
+            block_parent = zmapWindowContainerGroupCreate(canvas_data->curr_align_group,
+							  ZMAPCONTAINER_LEVEL_BLOCK,
+							  window->config.strand_spacing,
+							  &(window->colour_block),
+							  &(canvas_data->window->canvas_border));
             g_signal_connect(G_OBJECT(block_parent), 
                              "destroy", 
                              G_CALLBACK(containerDestroyCB), 
                              window) ;
             block_created = TRUE;
 
-	    block_data = zmapWindowItemFeatureBlockCreate(window) ;
-	    g_object_set_data(G_OBJECT(block_parent), ITEM_FEATURE_BLOCK_DATA, block_data) ;
+	    zmapWindowContainerBlockAugment((ZMapWindowContainerBlock)block_parent) ;
 
 	    g_object_set_data(G_OBJECT(block_parent), ITEM_FEATURE_STATS,
 			      zmapWindowStatsCreate((ZMapFeatureAny)(canvas_data->curr_block))) ;
 
 
-	    addDataToContainer(block_parent, (ZMapFeatureAny)(canvas_data->curr_block)) ;
+	    zmapWindowContainerAttachFeatureAny(block_parent, (ZMapFeatureAny)(canvas_data->curr_block)) ;
         
 	    x = 0.0 ;
 	    y = feature_block->block_to_sequence.t1 ;
@@ -1461,7 +1430,7 @@ static ZMapFeatureContextExecuteStatus windowDrawContextCB(GQuark   key_id,
 	    if (!(zmapWindowFToIAddBlock(canvas_data->window->context_to_item,
 					 canvas_data->curr_alignment->unique_id, 
 					 key_id,
-					 block_parent)))
+					 (FooCanvasGroup *)block_parent)))
 	      {
 		status = ZMAP_CONTEXT_EXEC_STATUS_ERROR;
 		*error_out = g_strdup_printf("Failed to add block '%s' to hash!", 
@@ -1469,14 +1438,12 @@ static ZMapFeatureContextExecuteStatus windowDrawContextCB(GQuark   key_id,
 	      }
 	  }
 
+	container_block = (ZMapWindowContainerBlock)block_parent;
+
 	if(feature_block->features_start != 0 &&
 	   feature_block->features_end   != 0)
 	  {
-	    ZMapWindowItemFeatureBlockData block_data;
-
-	    block_data = g_object_get_data(G_OBJECT(block_parent), ITEM_FEATURE_BLOCK_DATA);
-
-	    zmapWindowItemFeatureBlockMarkRegion(block_data, feature_block);
+	    zmapWindowContainerBlockMarkRegion(container_block, feature_block);
 	  }
 
 
@@ -1500,56 +1467,59 @@ static ZMapFeatureContextExecuteStatus windowDrawContextCB(GQuark   key_id,
             
             /* Create the reverse group first.  It's then first in the list and
              * so gets called first in container execute. e.g. reposition code */
-            if (block_created
-		|| !(reverse_group = zmapWindowContainerGetStrandGroup(block_parent, ZMAPSTRAND_REVERSE)))
+            if ((block_created) ||
+		(reverse_group = (ZMapWindowContainerGroup)zmapWindowContainerBlockGetContainerStrand(container_block, ZMAPSTRAND_REVERSE)) == NULL)
               {
-                reverse_group = zmapWindowContainerCreate(canvas_data->curr_block_group,
-                                                          ZMAPCONTAINER_LEVEL_STRAND,
-                                                          window->config.column_spacing,
-                                                          rev_bg_colour, 
-                                                          &(canvas_data->window->canvas_border),
-                                                          window->long_items) ;
-                
-                zmapWindowContainerSetStrand(reverse_group, ZMAPSTRAND_REVERSE);
-		zmapWindowContainerSetBackgroundSize(reverse_group, feature_block->block_to_sequence.t2);
+                reverse_group = zmapWindowContainerGroupCreate(canvas_data->curr_block_group,
+							       ZMAPCONTAINER_LEVEL_STRAND,
+							       window->config.column_spacing,
+							       rev_bg_colour, 
+							       &(canvas_data->window->canvas_border));
+
+                zmapWindowContainerStrandAugment((ZMapWindowContainerStrand)reverse_group, ZMAPSTRAND_REVERSE);
+
+		zmapWindowContainerGroupBackgroundSize(reverse_group, 
+						       (double)feature_block->block_to_sequence.t2);
 
                 g_signal_connect(G_OBJECT(zmapWindowContainerGetBackground(reverse_group)),
                                  "event", G_CALLBACK(strandBoundingBoxEventCB), 
                                  (gpointer)window);
               }
+
             canvas_data->curr_reverse_group = zmapWindowContainerGetFeatures(reverse_group) ;
 
 	    /* Create the strand separator... */
-	    if (block_created || !(strand_separator = zmapWindowContainerGetStrandSeparatorGroup(block_parent)))
+	    if ((block_created == TRUE) || 
+		(strand_separator = (ZMapWindowContainerGroup)zmapWindowContainerBlockGetContainerSeparator(container_block)) == NULL)
 	      {
-		strand_separator = zmapWindowContainerCreate(canvas_data->curr_block_group,
-							     ZMAPCONTAINER_LEVEL_STRAND,
-							     window->config.column_spacing,
-							     &(window->colour_separator),
-							     &(canvas_data->window->canvas_border),
-							     window->long_items);
-		zmapWindowContainerSetAsStrandSeparator(strand_separator);
-		zmapWindowContainerSetBackgroundSize(strand_separator, 
-						     feature_block->block_to_sequence.t2);
+		strand_separator = zmapWindowContainerGroupCreate(canvas_data->curr_block_group,
+								  ZMAPCONTAINER_LEVEL_STRAND,
+								  window->config.column_spacing,
+								  &(window->colour_separator),
+								  &(canvas_data->window->canvas_border));
+		zmapWindowContainerStrandSetAsSeparator((ZMapWindowContainerStrand)strand_separator);
+		zmapWindowContainerGroupBackgroundSize(strand_separator, 
+						       (double)feature_block->block_to_sequence.t2);
 	      }
 
-            if (block_created
-		|| !(forward_group = zmapWindowContainerGetStrandGroup(block_parent, ZMAPSTRAND_FORWARD)))
+            if ((block_created == TRUE) ||
+		(forward_group = (ZMapWindowContainerGroup)zmapWindowContainerBlockGetContainerStrand(container_block, ZMAPSTRAND_FORWARD)) == NULL)
               {
-                forward_group = zmapWindowContainerCreate(canvas_data->curr_block_group,
-                                                          ZMAPCONTAINER_LEVEL_STRAND,
-                                                          window->config.column_spacing,
-                                                          for_bg_colour, 
-                                                          &(canvas_data->window->canvas_border),
-                                                          window->long_items) ;
+                forward_group = zmapWindowContainerGroupCreate(canvas_data->curr_block_group,
+							       ZMAPCONTAINER_LEVEL_STRAND,
+							       window->config.column_spacing,
+							       for_bg_colour, 
+							       &(canvas_data->window->canvas_border));
                 
-                zmapWindowContainerSetStrand(forward_group, ZMAPSTRAND_FORWARD);
-		zmapWindowContainerSetBackgroundSize(forward_group, feature_block->block_to_sequence.t2);                
+                zmapWindowContainerStrandAugment((ZMapWindowContainerStrand)forward_group, ZMAPSTRAND_FORWARD);
+		zmapWindowContainerGroupBackgroundSize(forward_group, 
+						       (double)feature_block->block_to_sequence.t2);
                
                 g_signal_connect(G_OBJECT(zmapWindowContainerGetBackground(forward_group)),
                                  "event", G_CALLBACK(strandBoundingBoxEventCB), 
                                  (gpointer)window);
               }
+
             canvas_data->curr_forward_group = zmapWindowContainerGetFeatures(forward_group) ;
 
 
@@ -1607,27 +1577,6 @@ static ZMapFeatureContextExecuteStatus windowDrawContextCB(GQuark   key_id,
 	    while(got_columns && i <= frame_end);
 	  }
 
-#ifdef RDS_REMOVED
-        if (zmapWindowCreateSetColumns(window,
-				       canvas_data->curr_forward_group,
-				       canvas_data->curr_reverse_group,
-				       canvas_data->curr_block,
-				       canvas_data->curr_set,
-				       canvas_data->styles,
-				       ZMAPFRAME_NONE,
-				       &tmp_forward, &tmp_reverse, &separator))
-          {
-
-            zmapWindowDrawFeatureSet(window,
-				     canvas_data->styles,
-                                     feature_set,
-                                     tmp_forward,
-                                     tmp_reverse,
-                                     ZMAPFRAME_NONE);
-
-
-          }
-#endif
 	break;
       }
     case ZMAPFEATURE_STRUCT_FEATURE:
@@ -1649,7 +1598,7 @@ static ZMapFeatureContextExecuteStatus windowDrawContextCB(GQuark   key_id,
 
 
 /* Cover/Utility function for createColumnFull() to save caller work. */
-static FooCanvasGroup *createColumn(FooCanvasGroup      *parent_group,
+static FooCanvasGroup *createColumn(ZMapWindowContainerFeatures parent_group,
 				    ZMapWindow           window,
 				    ZMapFeatureSet       feature_set,
 				    ZMapStrand           strand, 
@@ -1691,7 +1640,7 @@ static FooCanvasGroup *createColumn(FooCanvasGroup      *parent_group,
  * ITEM_FEATURE_SET_DATA will reflect this.
  * The Container is added to the FToI Hash.
  */
-static FooCanvasGroup *createColumnFull(FooCanvasGroup      *parent_group,
+static FooCanvasGroup *createColumnFull(ZMapWindowContainerFeatures parent_group,
 					ZMapWindow           window,
 					ZMapFeatureAlignment align,
 					ZMapFeatureBlock     block,
@@ -1702,9 +1651,7 @@ static FooCanvasGroup *createColumnFull(FooCanvasGroup      *parent_group,
 					gboolean             is_separator_col,
 					double width, double top, double bot)
 {
-  ZMapWindowItemFeatureSetData set_data ;
   ZMapWindowOverlay overlay_manager;
-  FooCanvasItem *bounding_box ;
   FooCanvasGroup *group = NULL ;
   GList *style_list = NULL;
   GdkColor *colour ;
@@ -1792,21 +1739,22 @@ static FooCanvasGroup *createColumnFull(FooCanvasGroup      *parent_group,
 
   if(proceed)
     {
-      group = zmapWindowContainerCreate(parent_group, ZMAPCONTAINER_LEVEL_FEATURESET,
-					window->config.feature_spacing,
-					colour, &(window->canvas_border),
-					window->long_items) ;
+      ZMapWindowContainerGroup container;
+
+      container = zmapWindowContainerGroupCreate(parent_group, ZMAPCONTAINER_LEVEL_FEATURESET,
+						 window->config.feature_spacing,
+						 colour, &(window->canvas_border));
       
       /* reverse the column ordering on the reverse strand */
       if (strand == ZMAPSTRAND_REVERSE)
-	foo_canvas_item_lower_to_bottom(FOO_CANVAS_ITEM(group));
+	foo_canvas_item_lower_to_bottom(FOO_CANVAS_ITEM(container));
       
       /* By default we do not redraw our children which are the individual features, the canvas
        * should do this for us. */
-      zmapWindowContainerSetChildRedrawRequired(group, FALSE) ;
+      zmapWindowContainerGroupChildRedrawRequired(container, FALSE) ;
       
       /* Make sure group covers whole span in y direction. */
-      zmapWindowContainerSetBackgroundSize(group, bot) ;
+      zmapWindowContainerGroupBackgroundSize(container, bot) ;
       
       /* THIS WOULD ALL GO IF WE DIDN'T ADD EMPTY COLS...... */
       /* We can't set the ITEM_FEATURE_DATA as we don't have the feature set at this point.
@@ -1819,23 +1767,23 @@ static FooCanvasGroup *createColumnFull(FooCanvasGroup      *parent_group,
        * where there is more than one feature type in a column. */
       
       /* needs to accept style_list */
-      set_data = zmapWindowItemFeatureSetCreate(window, group, feature_set_unique_id, 0, 
-						style_list, strand, frame);
+      zmapWindowContainerFeatureSetAugment((ZMapWindowContainerFeatureSet)container, window, 
+					   feature_set_unique_id, 0, 
+					   style_list, strand, frame);
       
       /* This will create the stats if feature_set != NULL */
-      zmapWindowItemFeatureSetAttachFeatureSet(set_data, feature_set);
+      zmapWindowContainerAttachFeatureAny(container, (ZMapFeatureAny)feature_set);
       
       /* Add an overlay manager */
-      if((overlay_manager = zmapWindowOverlayCreate(FOO_CANVAS_ITEM(group), NULL)))
-	g_object_set_data(G_OBJECT(group), ITEM_FEATURE_OVERLAY_DATA, overlay_manager);
+      if((overlay_manager = zmapWindowOverlayCreate(FOO_CANVAS_ITEM(container), NULL)))
+	g_object_set_data(G_OBJECT(container), ITEM_FEATURE_OVERLAY_DATA, overlay_manager);
       
-      g_signal_connect(G_OBJECT(group), "destroy", G_CALLBACK(containerDestroyCB), (gpointer)window) ;
-      
-      bounding_box = zmapWindowContainerGetBackground(group) ;
-      /* Not sure why the bounding_box isn't the subject here, but it breaks a load of stuff. */
-      g_signal_connect(G_OBJECT(group), "event", G_CALLBACK(columnBoundingBoxEventCB), (gpointer)window) ;
+      g_signal_connect(G_OBJECT(container), "destroy", G_CALLBACK(containerDestroyCB), (gpointer)window) ;
       
+      g_signal_connect(G_OBJECT(container), "event", G_CALLBACK(columnBoundingBoxEventCB), (gpointer)window) ;
       
+      group = (FooCanvasGroup *)container;
+
       if(!is_separator_col)
 	{
 	  status = zmapWindowFToIAddSet(window->context_to_item,
@@ -1877,10 +1825,9 @@ static void ProcessFeature(gpointer key, gpointer data, gpointer user_data)
   ZMapFeature feature = (ZMapFeature)data ; 
   CreateFeatureSetData featureset_data = (CreateFeatureSetData)user_data ;
   ZMapWindow window = featureset_data->window ;
-  FooCanvasGroup *column_group ;
+  ZMapWindowContainerGroup column_group ;
   ZMapStrand strand ;
   FooCanvasItem *feature_item ;
-  ZMapWindowItemFeatureSetData set_data ;
   ZMapFeatureTypeStyle style ;
 
   
@@ -1905,29 +1852,26 @@ static void ProcessFeature(gpointer key, gpointer data, gpointer user_data)
   /* Get the correct column to draw into... */
   if (strand == ZMAPSTRAND_FORWARD)
     {
-      column_group = zmapWindowContainerGetParent(FOO_CANVAS_ITEM(featureset_data->curr_forward_col)) ;
+      column_group = zmapWindowContainerChildGetParent(FOO_CANVAS_ITEM(featureset_data->curr_forward_col)) ;
     }
   else
     {
-      column_group = zmapWindowContainerGetParent(FOO_CANVAS_ITEM(featureset_data->curr_reverse_col)) ;
+      column_group = zmapWindowContainerChildGetParent(FOO_CANVAS_ITEM(featureset_data->curr_reverse_col)) ;
     }
 
   featureset_data->feature_count++;
 
-  set_data = g_object_get_data(G_OBJECT(column_group), ITEM_FEATURE_SET_DATA) ;
-  zMapAssert(set_data) ;
-
   style = zMapFindStyle(featureset_data->styles, feature->style_id) ;
 
   if(style)
-    style = zmapWindowItemFeatureSetStyleFromStyle(set_data, style) ;
+    style = zmapWindowContainerFeatureSetStyleFromStyle((ZMapWindowContainerFeatureSet)column_group, style) ;
   else
     g_warning("need a style '%s' for feature '%s'", 
 	      g_quark_to_string(feature->style_id),
 	      g_quark_to_string(feature->original_id));
 
   if(style)
-    feature_item = zmapWindowFeatureDraw(window, style, column_group, feature) ;
+    feature_item = zmapWindowFeatureDraw(window, style, (FooCanvasGroup *)column_group, feature) ;
   else
     g_warning("definitely need a style '%s' for feature '%s'", 
 	      g_quark_to_string(feature->style_id),
@@ -1989,26 +1933,24 @@ static gboolean columnBoundingBoxEventCB(FooCanvasItem *item, GdkEvent *event, g
       {
 	GdkEventButton *but_event = (GdkEventButton *)event ;
 	ZMapFeatureSet feature_set = NULL ;
-	ZMapWindowItemFeatureSetData set_data ;
-        FooCanvasGroup *container_parent;
+	ZMapWindowContainerFeatureSet container_set;
+        ZMapWindowContainerGroup container_parent;
 
-        container_parent = zmapWindowContainerGetParent(item);
+        container_parent = zmapWindowContainerChildGetParent(item);
 
 	/* These should go in container some time.... */
-	set_data = (ZMapWindowItemFeatureSetData)zmapWindowContainerGetData(container_parent, 
-                                                                            ITEM_FEATURE_SET_DATA) ;
-	zMapAssert(set_data) ;
+	container_set = (ZMapWindowContainerFeatureSet)container_parent;
 
-	feature_set = zmapWindowItemFeatureSetRecoverFeatureSet(set_data);
+	feature_set = zmapWindowContainerFeatureSetRecoverFeatureSet(container_set);
 
-	zMapAssert(feature_set || set_data) ;
+	zMapAssert(feature_set || container_set) ;
 
 #warning COLUMN_HIGHLIGHT_NEEDS_TO_WORK_WITH_MULTIPLE_WINDOWS
 	/* Swop focus from previous item(s)/columns to this column. */
 	zMapWindowUnHighlightFocusItems(window) ;
 
-	zmapWindowFocusSetHotColumn(window->focus, container_parent);
-	zmapHighlightColumn(window, container_parent) ;
+	zmapWindowFocusSetHotColumn(window->focus, (FooCanvasGroup *)container_parent);
+	zmapHighlightColumn(window, (FooCanvasGroup *)container_parent) ;
         
 	/* Button 1 and 3 are handled, 2 is passed on to a general handler which could be
 	 * the root handler. */
@@ -2023,7 +1965,7 @@ static gboolean columnBoundingBoxEventCB(FooCanvasItem *item, GdkEvent *event, g
 	      if (feature_set)
 		feature_set_id = feature_set->original_id ;
 	      else
-		feature_set_id = zmapWindowItemFeatureSetColumnDisplayName(set_data);
+		feature_set_id = zmapWindowContainerFeatureSetColumnDisplayName(container_set);
 
 	      select.feature_desc.struct_type = ZMAPFEATURE_STRUCT_FEATURESET ;
 
@@ -2095,7 +2037,6 @@ void zmapMakeColumnMenu(GdkEventButton *button_event, ZMapWindow window,
       {ZMAPGUI_MENU_SEPARATOR, NULL, 0, NULL, NULL},
       {ZMAPGUI_MENU_NONE, NULL, 0, NULL, NULL}
     } ;
-  ZMapWindowItemFeatureSetData set_data;
   char *menu_title ;
   GList *menu_sets = NULL ;
   ItemMenuCBData cbdata ;
@@ -2117,11 +2058,9 @@ void zmapMakeColumnMenu(GdkEventButton *button_event, ZMapWindow window,
       menu_sets = g_list_append(menu_sets, separator) ;
     }
 
-  set_data = g_object_get_data(G_OBJECT(item), ITEM_FEATURE_SET_DATA);
-
   menu_sets = g_list_append(menu_sets,
 			    zmapWindowMakeMenuBump(NULL, NULL, cbdata,
-						   zmapWindowItemFeatureSetGetBumpMode(set_data))) ;
+						   zmapWindowContainerFeatureSetGetBumpMode((ZMapWindowContainerFeatureSet)item))) ;
 
   menu_sets = g_list_append(menu_sets, separator) ;
 
@@ -2182,11 +2121,8 @@ static void show_all_styles_cb(ZMapFeatureTypeStyle style, gpointer unused)
 
 static void columnMenuCB(int menu_item_id, gpointer callback_data)
 {
+  ZMapWindowContainerFeatureSet container_set;
   ItemMenuCBData menu_data = (ItemMenuCBData)callback_data ;
-  ZMapWindowItemFeatureSetData set_data ;
-
-  set_data = g_object_get_data(G_OBJECT(menu_data->item), ITEM_FEATURE_SET_DATA) ;
-  zMapAssert(set_data) ;
 
   switch (menu_item_id)
     {
@@ -2196,7 +2132,9 @@ static void columnMenuCB(int menu_item_id, gpointer callback_data)
 	ZMapWindowFToISetSearchData search_data;
 	gboolean zoom_to_item = TRUE;
 	
-        feature_set = zmapWindowItemFeatureSetRecoverFeatureSet(set_data);
+	container_set = (ZMapWindowContainerFeatureSet)(menu_data->item);
+
+        feature_set = zmapWindowContainerFeatureSetRecoverFeatureSet(container_set);
 
 #ifndef REQUEST_TO_STOP_ZOOMING_IN_ON_SELECTION
 	zoom_to_item = FALSE;
@@ -2207,8 +2145,8 @@ static void columnMenuCB(int menu_item_id, gpointer callback_data)
 						    feature_set->parent->unique_id,
 						    feature_set->unique_id,
 						    g_quark_from_string("*"),
-						    zMapFeatureStrand2Str(set_data->strand),
-						    zMapFeatureFrame2Str(set_data->frame));
+						    zMapFeatureStrand2Str(container_set->strand),
+						    zMapFeatureFrame2Str(container_set->frame));
 	
 	zmapWindowListWindow(menu_data->window, 
 			     NULL, (char *)g_quark_to_string(feature_set->original_id),
@@ -2236,7 +2174,7 @@ static void columnMenuCB(int menu_item_id, gpointer callback_data)
       break;
 
     case 8:
-      zmapWindowStyleTableForEach(set_data->style_table, show_all_styles_cb, NULL);
+      zmapWindowStyleTableForEach(container_set->style_table, show_all_styles_cb, NULL);
       break;
 
     default:
@@ -2370,7 +2308,6 @@ static void setColours(ZMapWindow window)
 static gboolean containerDestroyCB(FooCanvasItem *item, gpointer user_data)
 {
   gboolean result = FALSE ;				    /* Always return FALSE ?? check this.... */
-  ZMapWindowItemFeatureSetData set_data ;
   FooCanvasGroup *group = FOO_CANVAS_GROUP(item) ;
   ZMapWindow window = (ZMapWindow)user_data ;
   GHashTable *context_to_item ;
@@ -2407,13 +2344,14 @@ static gboolean containerDestroyCB(FooCanvasItem *item, gpointer user_data)
 	  }
 	case ZMAPFEATURE_STRUCT_BLOCK:
 	  {
+#ifdef SHOULD_HAPPEN_IN_ITS_GOBJECT_DISPOSE_FINALISE
 	    ZMapWindowItemFeatureBlockData block_data ;
 
 	    block_data = g_object_get_data(G_OBJECT(group), ITEM_FEATURE_BLOCK_DATA) ;
 	    zMapAssert(block_data) ;
 
 	    block_data = zmapWindowItemFeatureBlockDestroy(block_data);
-
+#endif
 	    feature_block = (ZMapFeatureBlock)feature_any ;
 
 	    status = zmapWindowFToIRemoveBlock(context_to_item,
@@ -2424,8 +2362,8 @@ static gboolean containerDestroyCB(FooCanvasItem *item, gpointer user_data)
 	  }
 	case ZMAPFEATURE_STRUCT_FEATURESET:
 	  {
-	    ZMapWindowItemFeatureSetData set_data ;
 	    ZMapWindowOverlay overlay_manager;
+	    ZMapWindowContainerFeatureSet container_set;
 
 	    feature_set = (ZMapFeatureSet)feature_any ;
 
@@ -2441,20 +2379,18 @@ static gboolean containerDestroyCB(FooCanvasItem *item, gpointer user_data)
 		overlay_manager = zmapWindowOverlayDestroy(overlay_manager);
 	      }
 
-	    /* These should go in container some time.... */
-	    set_data = g_object_get_data(G_OBJECT(group), ITEM_FEATURE_SET_DATA) ;
-	    zMapAssert(set_data) ;
+	    container_set = (ZMapWindowContainerFeatureSet)item;
 
 	    status = zmapWindowFToIRemoveSet(context_to_item,
 					     feature_set->parent->parent->unique_id,
 					     feature_set->parent->unique_id,
 					     feature_set->unique_id,
-					     set_data->strand, set_data->frame) ;
-
+					     container_set->strand, container_set->frame) ;
 
+#ifdef SHOULD_HAPPEN_IN_ITS_GOBJECT_DISPOSE_FINALISE
 	    /* Get rid of this columns own style + its style table etc... */
             zmapWindowItemFeatureSetDestroy(set_data);
-
+#endif
 	    break ;
 	  }
 	default:
@@ -2468,6 +2404,7 @@ static gboolean containerDestroyCB(FooCanvasItem *item, gpointer user_data)
 	printf("containerDestroyCB (%p): remove failed\n", group);
 #endif /* RDS_DEBUG_ITEM_IN_HASH_DESTROY */
     }
+#ifdef WHATS_GOING_ON_HERE
   else if((set_data = g_object_get_data(G_OBJECT(group), ITEM_FEATURE_SET_DATA)))
     {
       ZMapFeatureSet feature_set;
@@ -2483,6 +2420,8 @@ static gboolean containerDestroyCB(FooCanvasItem *item, gpointer user_data)
       /* We just need to destroy this */
       zmapWindowItemFeatureSetDestroy(set_data);
     }
+#endif
+
   else
     {
       zMapLogCritical("containerDestroyCB (%p): no Feature Data\n", group);
@@ -2497,44 +2436,17 @@ static gboolean containerDestroyCB(FooCanvasItem *item, gpointer user_data)
 }
 
 
-void addDataToContainer(FooCanvasGroup *container, ZMapFeatureAny feature)
-{
-  ZMapWindowStats stats ;
-  FooCanvasGroup *parent_container ;
-  ZMapContainerLevelType level ;
-
-  zmapWindowContainerSetData(container, ITEM_FEATURE_DATA, feature) ;
-
-  /* There won't be a parent if its the root container. */
-  if ((level = zmapWindowContainerGetLevel(container)) != ZMAPCONTAINER_LEVEL_ROOT)
-    {
-      parent_container = zmapWindowContainerGetSuperGroup(container) ;
-  
-      if (level == ZMAPCONTAINER_LEVEL_FEATURESET)
-	{
-	  parent_container = zmapWindowContainerGetSuperGroup(parent_container) ;
-	  level = zmapWindowContainerGetLevel(parent_container) ;
-	}
-
-      stats = g_object_get_data(G_OBJECT(parent_container), ITEM_FEATURE_STATS) ;
-      zmapWindowStatsAddChild(stats, feature) ;
-    }
-
-  return ;
-}
-
-
 
 
 /* return zero if match */
 static gint separator_find_col_func(gconstpointer list_data, gconstpointer user_data)
 {
-  FooCanvasGroup *column_parent = FOO_CANVAS_GROUP(list_data);
+  ZMapWindowContainerGroup column_parent = (ZMapWindowContainerGroup)list_data;
   ZMapFeatureSet feature_set = (ZMapFeatureSet)user_data;
   ZMapFeatureSet column_set;
   gint match = -1;
 
-  if((column_set = zmapWindowContainerGetData(column_parent, ITEM_FEATURE_DATA)))
+  if((column_set = zmapWindowContainerGetFeatureSet(column_parent)))
     {
       if(column_set->unique_id == feature_set->unique_id)
 	match = 0;
@@ -2543,19 +2455,22 @@ static gint separator_find_col_func(gconstpointer list_data, gconstpointer user_
   return match;
 }
 
-static FooCanvasGroup *separatorGetFeatureSetColumn(FooCanvasGroup *separator_parent,
+static FooCanvasGroup *separatorGetFeatureSetColumn(ZMapWindowContainerStrand separator_container,
 						    ZMapFeatureSet  feature_set)
 {
+  ZMapWindowContainerFeatures container_features;
   FooCanvasGroup *column = NULL;
   FooCanvasGroup *features;
   GList *column_list = NULL;
 
-  features = zmapWindowContainerGetFeatures(separator_parent);
-  
-  column_list = g_list_find_custom(features->item_list, feature_set, separator_find_col_func);
-  
-  if(column_list)
-    column = FOO_CANVAS_GROUP(column_list->data);
+  if((container_features = zmapWindowContainerGetFeatures((ZMapWindowContainerGroup)separator_container)))
+    {
+      features = (FooCanvasGroup *)container_features;
+      column_list = g_list_find_custom(features->item_list, feature_set, separator_find_col_func);
+      
+      if(column_list)
+	column = FOO_CANVAS_GROUP(column_list->data);
+    }
 
   return column;
 }
diff --git a/src/zmapWindow/zmapWindowDump.c b/src/zmapWindow/zmapWindowDump.c
index 48236046b2b09302988cbf240a6a7c4002698a8b..b4e1f1116b803efdda08e57d65b9b5ead68010b7 100755
--- a/src/zmapWindow/zmapWindowDump.c
+++ b/src/zmapWindow/zmapWindowDump.c
@@ -27,9 +27,9 @@
  *
  * Exported functions: See ZMap/zmapWindow.h
  * HISTORY:
- * Last edited: May 23 17:13 2008 (rds)
+ * Last edited: Jun  4 12:23 2009 (rds)
  * Created: Thu Mar 30 16:48:34 2006 (edgrif)
- * CVS info:   $Id: zmapWindowDump.c,v 1.6 2008-05-23 16:15:09 rds Exp $
+ * CVS info:   $Id: zmapWindowDump.c,v 1.7 2009-06-05 13:33:18 rds Exp $
  *-------------------------------------------------------------------
  */
 
@@ -51,7 +51,7 @@
 #include <g2_gd.h>
 #include <ZMap/zmapUtils.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
+#include <zmapWindowContainerUtils.h>
 
 
 /* dump data/options. */
@@ -137,7 +137,7 @@ typedef struct
 
 
 static gboolean dumpWindow(DumpOptions dump_opts) ;
-static void dumpCB(FooCanvasGroup *container_parent, FooCanvasPoints *points, 
+static void dumpCB(ZMapWindowContainerGroup container_parent, FooCanvasPoints *points, 
                    ZMapContainerLevelType level, gpointer user_data);
 static void itemCB(gpointer data, gpointer user_data) ;
 static void dumpFeature(FooCanvasItem *item, gpointer user_data) ;
@@ -262,7 +262,7 @@ static gboolean dumpWindow(DumpOptions dump_opts)
 
       /* Could turn off autoflush herefor performance, see how it goes....see p.16 in docs... */
 
-      zmapWindowContainerExecute(dump_opts->window->feature_root_group, 
+      zmapWindowContainerUtilsExecute(dump_opts->window->feature_root_group, 
                                  ZMAPCONTAINER_LEVEL_FEATURESET,
                                  dumpCB, dump_opts);
 
@@ -690,14 +690,14 @@ static int openGD(DumpOptions dump_opts)
  * AND WE SHOULD ALLOW CONTAINERS NOT TO HAVE A BACKGROUND.... */
 
 
-static void dumpCB(FooCanvasGroup *container_parent, FooCanvasPoints *points, 
+static void dumpCB(ZMapWindowContainerGroup container_parent, FooCanvasPoints *points, 
                    ZMapContainerLevelType level,  gpointer user_data)
 {
   DumpOptions cb_data = (DumpOptions)user_data ;
 
   if (zmapWindowItemIsShown(FOO_CANVAS_ITEM(container_parent)))
     {
-      FooCanvasItem *background ;
+      ZMapWindowContainerBackground background ;
 
       /* We need to print the container backgrounds because we need the block background
        * as we use it as the strand separator, we may need to revisit this whole business
@@ -714,7 +714,7 @@ static void dumpCB(FooCanvasGroup *container_parent, FooCanvasPoints *points,
   
       if (level == ZMAPCONTAINER_LEVEL_FEATURESET)
 	{
-	  FooCanvasGroup *features ;
+	  ZMapWindowContainerFeatures features;
 	  ZMapFeatureAny any_feature ;
 
 	  /* Need to allocate the pen colour here ???? */
@@ -723,7 +723,11 @@ static void dumpCB(FooCanvasGroup *container_parent, FooCanvasPoints *points,
 							   ITEM_FEATURE_DATA)) ;
 
 	  if ((features = zmapWindowContainerGetFeatures(container_parent)))
-	    g_list_foreach(features->item_list, itemCB, user_data) ;
+	    {
+	      FooCanvasGroup *features_group;
+	      features_group = (FooCanvasGroup *)features;
+	      g_list_foreach(features_group->item_list, itemCB, user_data) ;
+	    }
 	}
     }
 
diff --git a/src/zmapWindow/zmapWindowFeature.c b/src/zmapWindow/zmapWindowFeature.c
index 0e7e942e8d6295393a751b20d29a8f58c58d1369..078fc70603a28a4c886c7e7f144a55f0ca483651 100755
--- a/src/zmapWindow/zmapWindowFeature.c
+++ b/src/zmapWindow/zmapWindowFeature.c
@@ -28,9 +28,9 @@
  *
  * Exported functions: See zmapWindow_P.h
  * HISTORY:
- * Last edited: May  8 15:17 2009 (edgrif)
+ * Last edited: Jun  4 16:38 2009 (rds)
  * Created: Mon Jan  9 10:25:40 2006 (edgrif)
- * CVS info:   $Id: zmapWindowFeature.c,v 1.159 2009-05-08 14:43:03 edgrif Exp $
+ * CVS info:   $Id: zmapWindowFeature.c,v 1.160 2009-06-05 13:33:40 rds Exp $
  *-------------------------------------------------------------------
  */
 
@@ -41,10 +41,12 @@
 #include <ZMap/zmapPeptide.h>
 #include <ZMap/zmapGLibUtils.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
+#include <zmapWindowContainerUtils.h>
 #include <zmapWindowItemFactory.h>
 #include <zmapWindowItemTextFillColumn.h>
+#include <zmapWindowCanvasItem.h>
 #include <libpfetch/libpfetch.h>
+#include <zmapWindowContainerFeatureSet_I.h>
 
 #define PFETCH_READ_SIZE 80	/* about a line */
 #define PFETCH_FAILED_PREFIX "PFetch failed:"
@@ -226,7 +228,7 @@ FooCanvasItem *zMapWindowFeatureAdd(ZMapWindow window,
   zMapAssert(window && feature_group && feature && zMapFeatureIsValid((ZMapFeatureAny)feature)) ;
 
 
-  feature_set = zmapWindowContainerGetData(feature_group, ITEM_FEATURE_DATA) ;
+  feature_set = zmapWindowContainerGetFeatureSet((ZMapWindowContainerGroup)feature_group);
   zMapAssert(feature_set) ;
 
 
@@ -260,11 +262,11 @@ FooCanvasItem *zMapWindowFeatureSetAdd(ZMapWindow window,
   ZMapFeatureBlock feature_block;
   ZMapFeatureContext     context;
   ZMapFeatureTypeStyle     style;
-  FooCanvasGroup *forward_strand;
-  FooCanvasGroup *reverse_strand;
+  ZMapWindowContainerStrand forward_strand, reverse_strand;
+  ZMapWindowContainerFeatures forward_features, reverse_features;
   GQuark style_id,feature_set_id;
 
-  feature_block = zmapWindowContainerGetData(block_group, ITEM_FEATURE_DATA);
+  feature_block = zmapWindowContainerGetFeatureBlock(ZMAP_CONTAINER_GROUP( block_group ));
   zMapAssert(feature_block);
   
   context = (ZMapFeatureContext)(zMapFeatureGetParentGroup((ZMapFeatureAny)feature_block, ZMAPFEATURE_STRUCT_CONTEXT));
@@ -293,13 +295,15 @@ FooCanvasItem *zMapWindowFeatureSetAdd(ZMapWindow window,
         }
 
       /* Get the strand groups */
-      forward_strand = zmapWindowContainerGetStrandGroup(block_group, ZMAPSTRAND_FORWARD);
-      reverse_strand = zmapWindowContainerGetStrandGroup(block_group, ZMAPSTRAND_REVERSE);
-      
+      forward_strand   = zmapWindowContainerBlockGetContainerStrand(ZMAP_CONTAINER_BLOCK( block_group ), ZMAPSTRAND_FORWARD);
+      forward_features = zmapWindowContainerGetFeatures((ZMapWindowContainerGroup)forward_strand);
+      reverse_strand   = zmapWindowContainerBlockGetContainerStrand(ZMAP_CONTAINER_BLOCK( block_group ), ZMAPSTRAND_REVERSE);
+      reverse_features = zmapWindowContainerGetFeatures((ZMapWindowContainerGroup)reverse_strand);
+
       /* Create the columns */
       zmapWindowCreateSetColumns(window,
-                                 forward_strand, 
-                                 reverse_strand,
+                                 forward_features, 
+                                 reverse_features,
                                  feature_block, 
                                  feature_set,
 				 window->read_only_styles,
@@ -349,7 +353,7 @@ FooCanvasItem *zMapWindowFeatureReplace(ZMapWindow zmap_window,
     {
       FooCanvasGroup *set_group ;
 
-      set_group = zmapWindowContainerGetParentContainerFromItem(curr_feature_item) ;
+      set_group = (FooCanvasGroup *)zmapWindowContainerCanvasItemGetContainer(curr_feature_item) ;
       zMapAssert(set_group) ;
 
       /* Remove it completely. */
@@ -368,21 +372,17 @@ FooCanvasItem *zMapWindowFeatureReplace(ZMapWindow zmap_window,
  * Returns FALSE if the feature does not exist. */
 gboolean zMapWindowFeatureRemove(ZMapWindow zmap_window, FooCanvasItem *feature_item, gboolean destroy_feature)
 {
+  ZMapWindowContainerFeatureSet container_set;
   gboolean result = FALSE ;
   ZMapFeature feature ;
-  ZMapWindowItemFeatureSetData set_data ;
   ZMapFeatureSet feature_set ;
-  FooCanvasGroup *set_group ;
 
 
   feature = g_object_get_data(G_OBJECT(feature_item), ITEM_FEATURE_DATA) ;
   zMapAssert(feature && zMapFeatureIsValid((ZMapFeatureAny)feature)) ;
   feature_set = (ZMapFeatureSet)(feature->parent) ;
 
-  set_group = zmapWindowContainerGetParentContainerFromItem(feature_item) ;
-  zMapAssert(set_group) ;
-  set_data = g_object_get_data(G_OBJECT(set_group), ITEM_FEATURE_SET_DATA) ;
-  zMapAssert(set_data) ;    
+  container_set = (ZMapWindowContainerFeatureSet)zmapWindowContainerCanvasItemGetContainer(feature_item) ;
 
 
   /* Need to delete the feature from the feature set and from the hash and destroy the
@@ -394,7 +394,8 @@ gboolean zMapWindowFeatureRemove(ZMapWindow zmap_window, FooCanvasItem *feature_
 
   /* Firstly remove from the FToI hash... */
   if (zmapWindowFToIRemoveFeature(zmap_window->context_to_item,
-				  set_data->strand, set_data->frame, feature))
+				  container_set->strand, 
+				  container_set->frame, feature))
     {
       /* check the feature is in featureset. */
       if(zMapFeatureSetFindFeature(feature_set, feature))
@@ -527,6 +528,7 @@ FooCanvasItem *zmapWindowFeatureDraw(ZMapWindow      window,
 							    ZMAPFEATURE_STRUCT_CONTEXT) ;
   
   new_feature = zmapWindowFToIFactoryRunSingle(window->item_factory,
+					       NULL,
                                                set_group, 
                                                context, 
                                                alignment, 
@@ -715,11 +717,11 @@ char *zmapWindowFeatureTranscriptFASTA(ZMapFeature feature, gboolean spliced, gb
 /* Callback for destroy of feature items... */
 static gboolean canvasItemDestroyCB(FooCanvasItem *feature_item, gpointer data)
 {
+  ZMapWindowContainerFeatureSet container_set;
   gboolean event_handled = FALSE ;			    /* Make sure any other callbacks also get run. */
   ZMapWindowItemFeatureType item_feature_type ;
   ZMapWindow window = (ZMapWindowStruct*)data ;
   gboolean status ;
-  FooCanvasGroup *set_group ;
 
   item_feature_type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(feature_item), ITEM_FEATURE_TYPE)) ;
   zMapAssert(item_feature_type == ITEM_FEATURE_SIMPLE || item_feature_type == ITEM_FEATURE_PARENT) ;
@@ -727,21 +729,16 @@ static gboolean canvasItemDestroyCB(FooCanvasItem *feature_item, gpointer data)
   /* We may not have a parent group if we are being called as a result of a
    * parent/superparent being destroyed. In this case our parent pointer is
    * set to NULL before we are called. */
-  if ((set_group = zmapWindowContainerGetParentContainerFromItem(feature_item)))
+  if ((container_set = (ZMapWindowContainerFeatureSet)zmapWindowContainerCanvasItemGetContainer(feature_item)))
     {
       ZMapFeature feature ;
-      ZMapWindowItemFeatureSetData set_data ;
-
-      /* These should go in container some time.... */
-      set_data = g_object_get_data(G_OBJECT(set_group), ITEM_FEATURE_SET_DATA) ;
-      zMapAssert(set_data) ;
 
       feature = g_object_get_data(G_OBJECT(feature_item), ITEM_FEATURE_DATA) ;
       zMapAssert(feature && zMapFeatureIsValid((ZMapFeatureAny)feature)) ;
 
       /* Remove this feature item from the hash. */
       status = zmapWindowFToIRemoveFeature(window->context_to_item,
-					   set_data->strand, set_data->frame, feature) ;
+					   container_set->strand, container_set->frame, feature) ;
 
 #ifdef ED_G_NEVER_INCLUDE_THIS_CODE
       /* Can't do this at the moment because the hash may have been invalidated....
@@ -777,14 +774,16 @@ static void cleanUpFeatureCB(gpointer data, gpointer user_data)
 {
   FooCanvasItem *feature_item = FOO_CANVAS_ITEM(data) ;
   ZMapWindow window = (ZMapWindow)user_data ;
-  ZMapWindowItemFeatureType item_feature_type ;
   ZMapWindowItemFeature item_data ;
 
+#ifdef DOES_THIS_DO_ANYTHING
+  ZMapWindowItemFeatureType item_feature_type ;
   item_feature_type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(feature_item), ITEM_FEATURE_TYPE)) ;
   zMapAssert(item_feature_type == ITEM_FEATURE_BOUNDING_BOX || item_feature_type == ITEM_FEATURE_CHILD) ;
+#endif
 
-  item_data = g_object_get_data(G_OBJECT(feature_item), ITEM_SUBFEATURE_DATA) ;
-  g_free(item_data) ;
+  if((item_data = g_object_get_data(G_OBJECT(feature_item), ITEM_SUBFEATURE_DATA)))
+    g_free(item_data) ;
 
   /* Check to see if there is an entry in long items for this feature.... */
   zmapWindowLongItemRemove(window->long_items, feature_item) ;  /* Ignore boolean result. */
@@ -851,26 +850,22 @@ static gboolean canvasItemEventCB(FooCanvasItem *item, GdkEvent *event, gpointer
     case GDK_2BUTTON_PRESS:
       {
 	GdkEventButton *but_event = (GdkEventButton *)event ;
-	ZMapWindowItemFeatureType item_feature_type ;
-	FooCanvasItem *real_item = NULL ;
+	ZMapWindowCanvasItem canvas_item;
+	FooCanvasItem *sub_item = NULL ;
 	FooCanvasItem *highlight_item = NULL ;
 
+	if(!ZMAP_IS_CANVAS_ITEM(item))
+	  {
+	    g_warning("Not a ZMapWindowCanvasItem.");
+	    return FALSE;
+	  }
+
+	canvas_item = ZMAP_CANVAS_ITEM(item);
+
         /* Get the feature attached to the item, checking that its type is valid */
-	feature = (ZMapFeature)g_object_get_data(G_OBJECT(item), 
-                                                 ITEM_FEATURE_DATA);  
-	item_feature_type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(item),
-							      ITEM_FEATURE_TYPE)) ;
-	zMapAssert(feature) ;
-	zMapAssert(item_feature_type    == ITEM_FEATURE_SIMPLE
-		   || item_feature_type == ITEM_FEATURE_CHILD
-		   || item_feature_type == ITEM_FEATURE_BOUNDING_BOX) ;
-
-	/* If its type is bounding box then we don't want the that to influence
-         * highlighting... so we look up the real item, or just take the current */
-	if (item_feature_type == ITEM_FEATURE_BOUNDING_BOX)
-	  real_item = zMapWindowFindFeatureItemByItem(window, item) ;
-	else
-	  real_item = item ;
+	feature  = zMapWindowCanvasItemGetFeature(canvas_item);
+
+	sub_item = zMapWindowCanvasItemGetInterval(canvas_item, but_event->x, but_event->y);
 
 	if (but_event->type == GDK_BUTTON_PRESS)
 	  {
@@ -913,9 +908,12 @@ static gboolean canvasItemEventCB(FooCanvasItem *item, GdkEvent *event, gpointer
 
 			/* Annotators say they don't want subparts sub selections + multiple selections */
 			if (feature->type == ZMAPSTYLE_MODE_ALIGNMENT)
-			  highlight_item = FOO_CANVAS_ITEM(zmapWindowItemGetTrueItem(real_item)) ;
+			  {
+			    highlight_item = FOO_CANVAS_ITEM(zmapWindowItemGetTrueItem(sub_item)) ;
+			    highlight_item = item;
+			  }
 			else
-			  highlight_item = real_item ;
+			  highlight_item = sub_item ;
 
 
                         /* monkey around to get feature_copy to be the right correct data */
@@ -944,7 +942,7 @@ static gboolean canvasItemEventCB(FooCanvasItem *item, GdkEvent *event, gpointer
                         ZMapFeatureStruct feature_copy = {};
 
 			/* sub selections */
-			highlight_item = real_item ;
+			highlight_item = sub_item ;
 			highlight_same_names = FALSE ;
 
                         /* monkey around to get feature_copy to be the right correct data */
@@ -959,7 +957,8 @@ static gboolean canvasItemEventCB(FooCanvasItem *item, GdkEvent *event, gpointer
 		    else if (zMapGUITestModifiersOnly(but_event, shift_control_mask))
 		      {
 			/* multiple selections */
-			highlight_item = FOO_CANVAS_ITEM(zmapWindowItemGetTrueItem(real_item)) ;
+			highlight_item = FOO_CANVAS_ITEM(zmapWindowItemGetTrueItem(sub_item)) ;
+			highlight_item = item;
 
 			if (zmapWindowFocusIsItemInHotColumn(window->focus, highlight_item)
 			    && window->multi_select)
@@ -976,15 +975,16 @@ static gboolean canvasItemEventCB(FooCanvasItem *item, GdkEvent *event, gpointer
 		    else
 		      {
                         /* single select */
-			highlight_item = FOO_CANVAS_ITEM(zmapWindowItemGetTrueItem(real_item)) ;
+			highlight_item = FOO_CANVAS_ITEM(zmapWindowItemGetTrueItem(sub_item)) ;
+			highlight_item = item;
                         externally_handled = zmapWindowUpdateXRemoteData(window, (ZMapFeatureAny)feature, "single_select", highlight_item);
 			window->multi_select = FALSE ;
 		      }
 
 		    /* Pass information about the object clicked on back to the application. */
-		    zMapWindowUpdateInfoPanel(window, feature, real_item, highlight_item,
+		    zMapWindowUpdateInfoPanel(window, feature, sub_item, highlight_item,
 					      replace_highlight, highlight_same_names) ;
-
+		    
 		    if (but_event->button == 3)
 		      {
 			/* Pop up an item menu. */
@@ -1004,8 +1004,9 @@ static gboolean canvasItemEventCB(FooCanvasItem *item, GdkEvent *event, gpointer
 	      {
 		gboolean externally_handled = FALSE ;
 
-		highlight_item = FOO_CANVAS_ITEM(zmapWindowItemGetTrueItem(real_item)) ;
-		
+		highlight_item = FOO_CANVAS_ITEM(zmapWindowItemGetTrueItem(sub_item)) ;
+		highlight_item = item;
+
                 if (!(externally_handled = zmapWindowUpdateXRemoteData(window, (ZMapFeatureAny)feature,
 								       "edit", highlight_item)))
                   {
@@ -1560,14 +1561,15 @@ static gboolean dnaItemEventCB(FooCanvasItem *item, GdkEvent *event, gpointer da
           }
         else if (button->button == 1)
           {
-            FooCanvasGroup *container_parent;
+            ZMapWindowContainerGroup container_parent;
             ZMapWindowOverlay overlay;
-            if((container_parent = zmapWindowContainerGetParentContainerFromItem(item)) &&
-               (overlay          = zmapWindowContainerGetData(container_parent, ITEM_FEATURE_OVERLAY_DATA)))
+
+            if((container_parent = zmapWindowContainerCanvasItemGetContainer(item)) &&
+               (overlay          = g_object_get_data(G_OBJECT(container_parent), ITEM_FEATURE_OVERLAY_DATA)))
               {
                 FooCanvasGroup *container_underlay;
                 
-                if((container_underlay = zmapWindowContainerGetUnderlays(container_parent)))
+                if((container_underlay = (FooCanvasGroup *)zmapWindowContainerGetUnderlay(container_parent)))
                   {
                     ZMapFeature feature;
                     GdkColor* background;
@@ -1615,13 +1617,13 @@ static gboolean dnaItemEventCB(FooCanvasItem *item, GdkEvent *event, gpointer da
       {
         if(dna_item_event.selected)
           {
-            FooCanvasGroup *container_parent;
+            ZMapWindowContainerGroup container_parent;
             ZMapWindowOverlay overlay;
-            FooCanvasGroup *container_underlay;
+            ZMapWindowContainerUnderlay container_underlay;
 
-            if((container_parent   = zmapWindowContainerGetParentContainerFromItem(item)) &&
-               (overlay            = zmapWindowContainerGetData(container_parent, ITEM_FEATURE_OVERLAY_DATA)) &&
-               (container_underlay = zmapWindowContainerGetUnderlays(container_parent)))
+            if((container_parent   = zmapWindowContainerCanvasItemGetContainer(item)) &&
+               (overlay            = g_object_get_data(G_OBJECT(container_parent), ITEM_FEATURE_OVERLAY_DATA)) &&
+               (container_underlay = zmapWindowContainerGetUnderlay(container_parent)))
               {
                 zmapWindowOverlayUnmaskAll(overlay);
                 
@@ -1662,6 +1664,7 @@ static gboolean dnaItemEventCB(FooCanvasItem *item, GdkEvent *event, gpointer da
 /* Build the menu for a feature item. */
 void zmapMakeItemMenu(GdkEventButton *button_event, ZMapWindow window, FooCanvasItem *item)
 {
+  ZMapWindowContainerGroup column_group =  NULL ;
   static ZMapGUIMenuItemStruct separator[] =
     {
       {ZMAPGUI_MENU_SEPARATOR, NULL, 0, NULL, NULL},
@@ -1676,19 +1679,13 @@ void zmapMakeItemMenu(GdkEventButton *button_event, ZMapWindow window, FooCanvas
 
   /* Some parts of the menu are feature type specific so retrieve the feature item info
    * from the canvas item. */
-  feature = g_object_get_data(G_OBJECT(item), ITEM_FEATURE_DATA) ;
-  zMapAssert(feature) ;
+  feature = zMapWindowCanvasItemGetFeature(ZMAP_CANVAS_ITEM(item));
+  zMapAssert(feature);
 
-  {
-    FooCanvasGroup *column_group =  NULL ;
-    ZMapWindowItemFeatureSetData set_data = NULL;
+  column_group  = zmapWindowContainerCanvasItemGetContainer(item) ;
     
-    column_group = zmapWindowContainerGetParentContainerFromItem(item) ;
-    set_data     = g_object_get_data(G_OBJECT(column_group), ITEM_FEATURE_SET_DATA);
-    zMapAssert(set_data);
-    
-    style = zmapWindowItemFeatureSetStyleFromID(set_data, feature->style_id);
-  }
+  style = zmapWindowContainerFeatureSetStyleFromID((ZMapWindowContainerFeatureSet)column_group, 
+						   feature->style_id);
 
 
   menu_title = zMapFeatureName((ZMapFeatureAny)feature) ;
@@ -2490,6 +2487,21 @@ static gboolean factoryTopItemCreated(FooCanvasItem *top_item,
 {
   g_signal_connect(GTK_OBJECT(top_item), "destroy",
 		   GTK_SIGNAL_FUNC(canvasItemDestroyCB), handler_data) ;
+
+  switch(feature->type)
+    {
+    case ZMAPSTYLE_MODE_TRANSCRIPT:
+    case ZMAPSTYLE_MODE_ALIGNMENT:
+    case ZMAPSTYLE_MODE_BASIC:
+    case ZMAPSTYLE_MODE_TEXT:
+    case ZMAPSTYLE_MODE_GLYPH:
+      g_signal_connect(G_OBJECT(top_item), "event", G_CALLBACK(canvasItemEventCB), handler_data);
+      break;
+    default:
+      break;
+    }
+
+
   return TRUE;
 }
 
@@ -2567,20 +2579,18 @@ FooCanvasItem *addNewCanvasItem(ZMapWindow window, FooCanvasGroup *feature_group
 				ZMapFeature feature, gboolean bump_col)
 {
   FooCanvasItem *new_feature = NULL ;
-  ZMapWindowItemFeatureSetData set_data;
   ZMapFeatureTypeStyle style ;
   ZMapFeatureSet feature_set ;
   gboolean column_is_empty = FALSE;
   FooCanvasGroup *container_features;
   ZMapStyleBumpMode bump_mode;
 
-  feature_set = zmapWindowContainerGetData(feature_group, ITEM_FEATURE_DATA) ;
+  feature_set = zmapWindowContainerFeatureSetRecoverFeatureSet(ZMAP_CONTAINER_FEATURESET( feature_group ));
   zMapAssert(feature_set) ;
 
-  set_data = g_object_get_data(G_OBJECT(feature_group), ITEM_FEATURE_SET_DATA) ;
-  style    = zmapWindowItemFeatureSetStyleFromID(set_data, feature->style_id) ;
+  style = zmapWindowContainerFeatureSetStyleFromID(ZMAP_CONTAINER_FEATURESET( feature_group ), feature->style_id) ;
 
-  container_features = zmapWindowContainerGetFeatures(feature_group);
+  container_features = FOO_CANVAS_GROUP(zmapWindowContainerGetFeatures((ZMapWindowContainerGroup)feature_group));
   column_is_empty = !(container_features->item_list);
             
   /* This function will add the new feature to the hash. */
diff --git a/src/zmapWindow/zmapWindowFeatureList.c b/src/zmapWindow/zmapWindowFeatureList.c
index 7c01c39b9f620cbd365d9336fcf12da6f5bdda6b..e1fa7ca80923fc0e67312ec48c37d1a5c7a6426e 100755
--- a/src/zmapWindow/zmapWindowFeatureList.c
+++ b/src/zmapWindow/zmapWindowFeatureList.c
@@ -28,16 +28,17 @@
  * Exported functions: See zmapWindow_P.h
  *              
  * HISTORY:
- * Last edited: Nov  5 11:40 2008 (edgrif)
+ * Last edited: Jun  3 23:01 2009 (rds)
  * Created: Tue Sep 27 13:06:09 2005 (rds)
- * CVS info:   $Id: zmapWindowFeatureList.c,v 1.28 2008-11-12 17:04:48 edgrif Exp $
+ * CVS info:   $Id: zmapWindowFeatureList.c,v 1.29 2009-06-05 13:34:47 rds Exp $
  *-------------------------------------------------------------------
  */
 
 #include <ZMap/zmapFeature.h>
 #include <zmapWindowFeatureList_I.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
+#include <zmapWindowContainerUtils.h>
+#include <zmapWindowContainerFeatureSet_I.h>
 
 #define ZMAP_WFL_SETDATASTRAND_COLUMN_NAME "-set-data-strand-"
 #define ZMAP_WFL_SETDATAFRAME_COLUMN_NAME  "-set-data-frame-"
@@ -1459,17 +1460,13 @@ static void feature_item_data_strand_to_value(GValue *value, gpointer feature_it
 {
   AddSimpleDataFeatureItem add_data = (AddSimpleDataFeatureItem)feature_item_data;
   FooCanvasItem *feature_item = FOO_CANVAS_ITEM(add_data->item);
-  FooCanvasGroup *feature_set_container;
-  ZMapWindowItemFeatureSetData set_data;
+  ZMapWindowContainerGroup feature_set_container;
+  ZMapWindowContainerFeatureSet container;
 
-  if((feature_set_container = zmapWindowContainerGetParentContainerFromItem(feature_item)))
+  if((feature_set_container = zmapWindowContainerCanvasItemGetContainer(feature_item)))
     {
-      if((set_data = g_object_get_data(G_OBJECT(feature_set_container), ITEM_FEATURE_SET_DATA)))
-	{
-	  g_value_set_uint(value, set_data->strand);
-	}
-      else
-	g_warning("%s", "Failed to get ZMapWindowItemFeatureSetData.");
+      container = (ZMapWindowContainerFeatureSet)feature_set_container;
+      g_value_set_uint(value, container->strand);
     }
   else
     g_warning("%s", "Failed to get Parent Contianer.");
@@ -1481,17 +1478,13 @@ static void feature_item_data_frame_to_value(GValue *value, gpointer feature_ite
 {
   AddSimpleDataFeatureItem add_data = (AddSimpleDataFeatureItem)feature_item_data;
   FooCanvasItem *feature_item = FOO_CANVAS_ITEM(add_data->item);
-  FooCanvasGroup *feature_set_container;
-  ZMapWindowItemFeatureSetData set_data;
+  ZMapWindowContainerGroup feature_set_container;
+  ZMapWindowContainerFeatureSet container;
 
-  if((feature_set_container = zmapWindowContainerGetParentContainerFromItem(feature_item)))
+  if((feature_set_container = zmapWindowContainerCanvasItemGetContainer(feature_item)))
     {
-      if((set_data = g_object_get_data(G_OBJECT(feature_set_container), ITEM_FEATURE_SET_DATA)))
-	{
-	  g_value_set_uint(value, set_data->frame);
-	}
-      else
-	g_warning("%s", "Failed to get ZMapWindowItemFeatureSetData.");
+      container = (ZMapWindowContainerFeatureSet)feature_set_container;
+      g_value_set_uint(value, container->frame);
     }
   else
     g_warning("%s", "Failed to get Parent Contianer.");
@@ -1542,19 +1535,15 @@ static void feature_item_to_bump_hidden_value(GValue *value, gpointer feature_it
 {
   AddSimpleDataFeatureItem add_data = (AddSimpleDataFeatureItem)feature_item_data;
   FooCanvasItem *feature_item = FOO_CANVAS_ITEM(add_data->item);
-  FooCanvasGroup *feature_set_container;
-  ZMapWindowItemFeatureSetData set_data;
+  ZMapWindowContainerGroup feature_set_container;
+  ZMapWindowContainerFeatureSet container;
 
-  if((feature_set_container = zmapWindowContainerGetParentContainerFromItem(feature_item)))
+  if((feature_set_container = zmapWindowContainerCanvasItemGetContainer(feature_item)))
     {
-      if((set_data = g_object_get_data(G_OBJECT(feature_set_container), ITEM_FEATURE_SET_DATA)))
-	{
-	  char *yes = "yes";
-	  char *no  = "no";
-	  g_value_set_string(value, (set_data->hidden_bump_features ? yes : no));
-	}
-      else
-	g_warning("%s", "Failed to get ZMapWindowItemFeatureSetData.");
+      container = (ZMapWindowContainerFeatureSet)feature_set_container;
+      char *yes = "yes";
+      char *no  = "no";
+      g_value_set_string(value, (container->hidden_bump_features ? yes : no));
     }
   else
     g_warning("%s", "Failed to get Parent Contianer.");
@@ -1582,21 +1571,20 @@ static void feature_item_to_user_hidden_value(GValue *value, gpointer feature_it
 {
   AddSimpleDataFeatureItem add_data = (AddSimpleDataFeatureItem)feature_item_data;
   FooCanvasItem *feature_item = FOO_CANVAS_ITEM(add_data->item);
-  FooCanvasGroup *feature_set_container;
-  ZMapWindowItemFeatureSetData set_data;
+  ZMapWindowContainerGroup feature_set_container;
+  ZMapWindowContainerFeatureSet container;
 
-  if((feature_set_container = zmapWindowContainerGetParentContainerFromItem(feature_item)))
+  if((feature_set_container = zmapWindowContainerCanvasItemGetContainer(feature_item)))
     {
-      if((set_data = g_object_get_data(G_OBJECT(feature_set_container), ITEM_FEATURE_SET_DATA)))
-	{
-	  char *yes = "yes";
-	  char *no  = "no";
-	  gboolean in_stack;
-	  in_stack = in_user_hidden_stack(set_data->user_hidden_stack, feature_item);
-	  g_value_set_string(value, (in_stack ? yes : no));
-	}
-      else
-	g_warning("%s", "Failed to get ZMapWindowItemFeatureSetData.");
+      gboolean in_stack;
+      char *yes = "yes";
+      char *no  = "no";
+
+      container = (ZMapWindowContainerFeatureSet)feature_set_container;
+      
+      in_stack = in_user_hidden_stack(container->user_hidden_stack, feature_item);
+
+      g_value_set_string(value, (in_stack ? yes : no));
     }
   else
     g_warning("%s", "Failed to get Parent Contianer.");
@@ -1608,22 +1596,21 @@ static void feature_item_to_is_visible_value(GValue *value, gpointer feature_ite
 {
   AddSimpleDataFeatureItem add_data = (AddSimpleDataFeatureItem)feature_item_data;
   FooCanvasItem *feature_item = FOO_CANVAS_ITEM(add_data->item);
-  FooCanvasGroup *feature_set_container;
-  ZMapWindowItemFeatureSetData set_data;
+  ZMapWindowContainerGroup feature_set_container;
+  ZMapWindowContainerFeatureSet container;
 
-  if((feature_set_container = zmapWindowContainerGetParentContainerFromItem(feature_item)))
+  if((feature_set_container = zmapWindowContainerCanvasItemGetContainer(feature_item)))
     {
-      if((set_data = g_object_get_data(G_OBJECT(feature_set_container), ITEM_FEATURE_SET_DATA)))
-	{
-	  char *yes = "yes";
-	  char *no  = "no";
-	  gboolean is_visible = FALSE;
-	  if(feature_item->object.flags & FOO_CANVAS_ITEM_VISIBLE)
-	    is_visible = TRUE;
-	  g_value_set_string(value, (is_visible ? yes : no));
-	}
-      else
-	g_warning("%s", "Failed to get ZMapWindowItemFeatureSetData.");
+      char *yes = "yes";
+      char *no  = "no";
+      gboolean is_visible = FALSE;
+      
+      container = (ZMapWindowContainerFeatureSet)feature_set_container;
+
+      if(feature_item->object.flags & FOO_CANVAS_ITEM_VISIBLE)
+	is_visible = TRUE;
+
+      g_value_set_string(value, (is_visible ? yes : no));
     }
   else
     g_warning("%s", "Failed to get Parent Contianer.");
diff --git a/src/zmapWindow/zmapWindowFocus.c b/src/zmapWindow/zmapWindowFocus.c
index 790bf752a101aa87a9f031b18c84097b5725c7ec..8cc4d72132b3fdbb9459de5850a73df6329de182 100755
--- a/src/zmapWindow/zmapWindowFocus.c
+++ b/src/zmapWindow/zmapWindowFocus.c
@@ -27,16 +27,16 @@
  *
  * Exported functions: See zmapWindow_P.h
  * HISTORY:
- * Last edited: Apr  2 10:44 2008 (edgrif)
+ * Last edited: Jun  4 16:43 2009 (rds)
  * Created: Tue Jan 16 09:46:23 2007 (rds)
- * CVS info:   $Id: zmapWindowFocus.c,v 1.12 2008-04-02 09:51:06 edgrif Exp $
+ * CVS info:   $Id: zmapWindowFocus.c,v 1.13 2009-06-05 13:34:52 rds Exp $
  *-------------------------------------------------------------------
  */
 
 #include <ZMap/zmapUtils.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
-
+#include <zmapWindowContainerUtils.h>
+#include <zmapWindowContainerFeatureSet_I.h>
 
 /* Used for window focus items and column.
  * 
@@ -51,7 +51,7 @@ typedef struct _ZMapWindowFocusStruct
 
   int hot_item_orig_index ;				    /* Record where hot_item was in its list. */
 
-  FooCanvasGroup *focus_column ;
+  ZMapWindowContainerFeatureSet focus_column ;
 
   GList *overlay_managers;
 } ZMapWindowFocusStruct ;
@@ -163,7 +163,11 @@ gboolean zmapWindowFocusIsItemInHotColumn(ZMapWindowFocus focus, FooCanvasItem *
 
   if (focus->focus_column)
     {
-      if (focus->focus_column == zmapWindowItemGetParentContainer(item))
+      ZMapWindowContainerGroup column_container;
+
+      column_container = (ZMapWindowContainerGroup)focus->focus_column;
+
+      if (column_container == zmapWindowContainerCanvasItemGetContainer(item))
 	result = TRUE ;
     }
 
@@ -194,12 +198,14 @@ void zmapWindowFocusSetHotItem(ZMapWindowFocus focus, FooCanvasItem *item, gbool
   focus->focus_item_set = g_list_prepend(focus->focus_item_set, item_area) ;
 
   /* Set the focus items column as the focus column. */
-  column = zmapWindowContainerGetParentContainerFromItem(item) ;
+  column = (FooCanvasGroup *) zmapWindowContainerCanvasItemGetContainer(item) ;
 
   setFocusColumn(focus, column) ;			    /* N.B. May sort features. */
 
+#ifdef GETTING_TO_LINK
   /* Record where the item is in the stack of column items _after_ setFocusColumn. */
   focus->hot_item_orig_index = zmapWindowContainerGetItemPosition(column, item) ;
+#endif /* GETTING_TO_LINK */
 
   /* Now raise the item to the top of its group to make sure it is visible. */
   zmapWindowRaiseItem(item) ;
@@ -259,7 +265,7 @@ FooCanvasGroup *zmapWindowFocusGetHotColumn(ZMapWindowFocus focus)
 {
   FooCanvasGroup *column = NULL ;
 
-  column = focus->focus_column ;
+  column =(FooCanvasGroup *)( focus->focus_column );
 
   return column ;
 }
@@ -294,7 +300,9 @@ void zmapWindowFocusRemoveFocusItem(ZMapWindowFocus focus, FooCanvasItem *item)
   if (focus->focus_item_set)
     {
       FooCanvasGroup  *container_parent ;
+#ifdef GETTING_TO_LINK
       int curr_index, position ;
+#endif /* GETTING_TO_LINK */
 
       if ((remove = g_list_find_custom(focus->focus_item_set, item, find_item)))
         {
@@ -306,8 +314,9 @@ void zmapWindowFocusRemoveFocusItem(ZMapWindowFocus focus, FooCanvasItem *item)
 
 	  /* Try to put it back in its original position, note if this function is called during destroy
 	   * the features list may already have gone so we cannot put it back.... */
-	  container_parent = zmapWindowContainerGetParentContainerFromItem(item) ;
+	  container_parent =(FooCanvasGroup *) zmapWindowContainerCanvasItemGetContainer(item) ;
 
+#ifdef GETTING_TO_LINK
 	  if ((curr_index = zmapWindowContainerGetItemPosition(container_parent, item)))
 	    {
 	      position = curr_index - focus->hot_item_orig_index ;
@@ -316,6 +325,7 @@ void zmapWindowFocusRemoveFocusItem(ZMapWindowFocus focus, FooCanvasItem *item)
 
 	      focus->hot_item_orig_index = 0 ;
 	    }
+#endif /* GETTING_TO_LINK */
         }
     }
 
@@ -342,6 +352,8 @@ void zmapWindowFocusReset(ZMapWindowFocus focus)
  * item! */
 void zmapWindowFocusMaskOverlay(ZMapWindowFocus focus, FooCanvasItem *item, GdkColor *highlight_colour)
 {
+  return ;
+
   if(highlight_colour)
     g_list_foreach(focus->overlay_managers, set_default_highlight_colour, highlight_colour);
 
@@ -633,18 +645,20 @@ static void set_default_highlight_colour(gpointer list_data, gpointer user_data)
 
 static void setFocusColumn(ZMapWindowFocus focus, FooCanvasGroup *column)
 {
-  ZMapWindowItemFeatureSetData set_data ;
+  ZMapWindowContainerFeatureSet container;
 
-  focus->focus_column = column ;
-  
-  set_data = (ZMapWindowItemFeatureSetData)zmapWindowContainerGetData(column, ITEM_FEATURE_SET_DATA) ;
-  zMapAssert(set_data) ;
-
-  if (!set_data->sorted)
+  if(ZMAP_IS_CONTAINER_FEATURESET(column))
     {
-      zmapWindowContainerSortFeatures(focus->focus_column, ZMAPCONTAINER_VERTICAL) ;
+      focus->focus_column =container = (ZMapWindowContainerFeatureSet)column ;
 
-      set_data->sorted = TRUE ;
+      
+      if (!container->sorted)
+	{
+	  //zmapWindowContainerFeatureSetSortFeatures(focus->focus_column, ZMAPCONTAINER_VERTICAL) ;
+	  zmapWindowContainerFeatureSetSortFeatures(container, 0) ;
+
+	  container->sorted = TRUE ;
+	}
     }
 
   return ;
diff --git a/src/zmapWindow/zmapWindowItem.c b/src/zmapWindow/zmapWindowItem.c
index 3d5f8bc83f80d28b4a203cd243c72f195df27ce2..76032c66dff8aa0c7fcff8a59537ed2d71b07cbc 100755
--- a/src/zmapWindow/zmapWindowItem.c
+++ b/src/zmapWindow/zmapWindowItem.c
@@ -26,9 +26,9 @@
  *
  * Exported functions: See zmapWindow_P.h
  * HISTORY:
- * Last edited: May 15 16:16 2009 (edgrif)
+ * Last edited: Jun  4 16:57 2009 (rds)
  * Created: Thu Sep  8 10:37:24 2005 (edgrif)
- * CVS info:   $Id: zmapWindowItem.c,v 1.112 2009-05-15 15:29:39 edgrif Exp $
+ * CVS info:   $Id: zmapWindowItem.c,v 1.113 2009-06-05 13:34:56 rds Exp $
  *-------------------------------------------------------------------
  */
 
@@ -36,9 +36,10 @@
 #include <ZMap/zmapUtils.h>
 #include <ZMap/zmapGLibUtils.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
+#include <zmapWindowContainerUtils.h>
 #include <zmapWindowItemTextFillColumn.h>
-
+#include <zmapWindowCanvasItem.h>
+#include <zmapWindowContainerFeatureSet_I.h>
 
 /* Used to hold highlight information for the hightlight callback function. */
 typedef struct
@@ -76,8 +77,7 @@ static void highlightCB(gpointer data, gpointer user_data) ;
 static void unhighlightCB(gpointer data, gpointer user_data) ;
 
 static void highlightItem(ZMapWindow window, FooCanvasItem *item, gboolean highlight) ;
-static void highlightFuncCB(gpointer data, gpointer user_data);
-static void setItemColour(ZMapWindow window, FooCanvasItem *item, gboolean highlight) ;
+
 
 static gint sortByPositionCB(gconstpointer a, gconstpointer b) ;
 static void extract_feature_from_item(gpointer list_data, gpointer user_data);
@@ -90,10 +90,10 @@ static FooCanvasItem *translation_item_from_block_frame(ZMapWindow window, char
 							gboolean require_visible,
 							ZMapFeatureBlock block, ZMapFrame frame) ;
 
-static void fill_workaround_struct(FooCanvasGroup        *container, 
-				   FooCanvasPoints       *points,
-				   ZMapContainerLevelType level,
-				   gpointer               user_data);
+static void fill_workaround_struct(ZMapWindowContainerGroup container, 
+				   FooCanvasPoints         *points,
+				   ZMapContainerLevelType   level,
+				   gpointer                 user_data);
 
 static gboolean areas_intersection(AreaStruct *area_1, AreaStruct *area_2, AreaStruct *intersect);
 static gboolean areas_intersect_gt_threshold(AreaStruct *area_1, AreaStruct *area_2, double threshold);
@@ -117,24 +117,18 @@ GList *zmapWindowItemSortByPostion(GList *feature_item_list)
 
 gboolean zmapWindowItemGetStrandFrame(FooCanvasItem *item, ZMapStrand *set_strand, ZMapFrame *set_frame)
 {                                               
-  gboolean result = FALSE ;
+  ZMapWindowContainerFeatureSet container;
   ZMapFeature feature ;
-  FooCanvasGroup *set_group ;
-  ZMapWindowItemFeatureSetData set_data ;
-
+  gboolean result = FALSE ;
 
   /* Retrieve the feature item info from the canvas item. */
   feature = g_object_get_data(G_OBJECT(item), ITEM_FEATURE_DATA);  
   zMapAssert(feature && feature->struct_type == ZMAPFEATURE_STRUCT_FEATURE) ;
 
-  set_group = zmapWindowContainerGetParentContainerFromItem(item) ;
-
-  /* These should go in container some time.... */
-  set_data = g_object_get_data(G_OBJECT(set_group), ITEM_FEATURE_SET_DATA) ;
-  zMapAssert(set_data) ;
+  container = (ZMapWindowContainerFeatureSet)zmapWindowContainerCanvasItemGetContainer(item) ;
 
-  *set_strand = set_data->strand ;
-  *set_frame = set_data->frame ;
+  *set_strand = container->strand ;
+  *set_frame  = container->frame ;
 
   result = TRUE ;
 
@@ -328,7 +322,7 @@ void zmapWindowHighlightObject(ZMapWindow window, FooCanvasItem *item,
       ZMapWindowOverlay overlay_manager;
       FooCanvasGroup *container;
 
-      container = zmapWindowContainerGetParentContainerFromItem(dna_item);
+      container = (FooCanvasGroup *)zmapWindowContainerCanvasItemGetContainer(dna_item);
 
       if((overlay_manager = g_object_get_data(G_OBJECT(container), ITEM_FEATURE_OVERLAY_DATA)))
         {
@@ -346,7 +340,7 @@ void zmapWindowHighlightObject(ZMapWindow window, FooCanvasItem *item,
 	    ZMapWindowOverlay overlay_manager;
 	    FooCanvasGroup *container;
 	    
-	    container = zmapWindowContainerGetParentContainerFromItem(framed_3ft);
+	    container = (FooCanvasGroup *)zmapWindowContainerCanvasItemGetContainer(framed_3ft);
 	    
 	    if((overlay_manager = g_object_get_data(G_OBJECT(container), ITEM_FEATURE_OVERLAY_DATA)))
 	      {
@@ -406,7 +400,7 @@ void zMapWindowUnHighlightFocusItems(ZMapWindow window)
 /* highlight/unhiglight cols. */
 void zmapHighlightColumn(ZMapWindow window, FooCanvasGroup *column)
 {
-  zmapWindowContainerSetBackgroundColour(column, &(window->colour_column_highlight)) ;
+  zmapWindowContainerGroupSetBackgroundColour(ZMAP_CONTAINER_GROUP(column), &(window->colour_column_highlight)) ;
 
   return ;
 }
@@ -414,7 +408,7 @@ void zmapHighlightColumn(ZMapWindow window, FooCanvasGroup *column)
 
 void zmapUnHighlightColumn(ZMapWindow window, FooCanvasGroup *column)
 {
-  zmapWindowContainerResetBackgroundColour(column) ;
+  zmapWindowContainerGroupResetBackgroundColour(ZMAP_CONTAINER_GROUP(column)) ;
 
   return ;
 }
@@ -518,6 +512,10 @@ void zmapWindowRaiseItem(FooCanvasItem *item)
 FooCanvasGroup *zmapWindowItemGetParentContainer(FooCanvasItem *feature_item)
 {
   FooCanvasGroup *parent_container = NULL ;
+
+  parent_container = (FooCanvasGroup *)zmapWindowContainerCanvasItemGetContainer(feature_item);
+
+#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
   ZMapWindowItemFeatureType item_feature_type ;
   FooCanvasItem *parent_item = NULL ;
 
@@ -543,6 +541,8 @@ FooCanvasGroup *zmapWindowItemGetParentContainer(FooCanvasItem *feature_item)
       zMapAssert(parent_container) ;
     }
 
+#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
+
   return parent_container ;
 }
 
@@ -629,7 +629,7 @@ void zmapWindowItemHighlightDNARegion(ZMapWindow window,
       ZMapWindowOverlay overlay_manager;
       FooCanvasGroup *container;
       
-      container = zmapWindowContainerGetParentContainerFromItem(dna_item);
+      container = (FooCanvasGroup *)zmapWindowContainerCanvasItemGetContainer(dna_item);
 
       /* Check the column is visible, otherwise failure is imminent. */
       if((FOO_CANVAS_ITEM(container)->object.flags & FOO_CANVAS_ITEM_VISIBLE) &&
@@ -706,7 +706,7 @@ void zmapWindowItemHighlightTranslationRegion(ZMapWindow window, FooCanvasItem *
       ZMapWindowOverlay overlay_manager;
       FooCanvasGroup *container;
       
-      container = zmapWindowContainerGetParentContainerFromItem(translation_item);
+      container = (FooCanvasGroup *)zmapWindowContainerCanvasItemGetContainer(translation_item);
       
       if((overlay_manager = g_object_get_data(G_OBJECT(container), ITEM_FEATURE_OVERLAY_DATA)))
         {
@@ -807,22 +807,31 @@ FooCanvasItem *zmapWindowItemGetShowTranslationColumn(ZMapWindow window, FooCanv
       
       if (feature_set)
 	{
+	  ZMapWindowContainerGroup parent_container;
+	  ZMapWindowContainerStrand forward_container;
+	  ZMapWindowContainerFeatures forward_features;
+	  FooCanvasGroup *tmp_forward, *tmp_reverse;
+
+#ifdef SIMPLIER
 	  FooCanvasGroup *forward_group, *parent_group, *tmp_forward, *tmp_reverse ;
-	  
 	  /* Get the FeatureSet Level Container */
-	  parent_group = zmapWindowContainerGetParentContainerFromItem(item);
+	  parent_group = zmapWindowContainerCanvasItemGetContainer(item);
 	  /* Get the Strand Level Container (Could be Forward OR Reverse) */
 	  parent_group = zmapWindowContainerGetSuperGroup(parent_group);
 	  /* Get the Block Level Container... */
 	  parent_group = zmapWindowContainerGetSuperGroup(parent_group);
+#endif /* SIMPLIER */
+
+	  parent_container = zmapWindowContainerUtilsItemGetParentLevel(item, ZMAPCONTAINER_LEVEL_BLOCK);
+	  
 	  /* Get the Forward Group Parent Container... */
-	  forward_group = zmapWindowContainerGetStrandGroup(parent_group, ZMAPSTRAND_FORWARD);
+	  forward_container = zmapWindowContainerBlockGetContainerStrand((ZMapWindowContainerBlock)parent_container, ZMAPSTRAND_FORWARD);
 	  /* zmapWindowCreateSetColumns needs the Features not the Parent. */
-	  forward_group = zmapWindowContainerGetFeatures(forward_group);
+	  forward_features  = zmapWindowContainerGetFeatures((ZMapWindowContainerGroup)forward_container);
 	  
 	  /* make the column... */
 	  if (zmapWindowCreateSetColumns(window,
-					 forward_group,
+					 forward_features,
 					 NULL,
 					 block,
 					 feature_set,
@@ -922,6 +931,11 @@ ZMapFeatureTypeStyle zmapWindowItemGetStyle(FooCanvasItem *feature_item)
   FooCanvasItem *parent_item = NULL ;
   ZMapWindowItemFeatureType item_feature_type ;
 
+  parent_item = feature_item;
+
+  style = g_object_get_data(G_OBJECT(parent_item), ITEM_FEATURE_ITEM_STYLE);
+
+  return style;
 
   item_feature_type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(feature_item),
 							ITEM_FEATURE_TYPE)) ;
@@ -960,28 +974,22 @@ FooCanvasItem *zMapWindowFindFeatureItemByItem(ZMapWindow window, FooCanvasItem
   FooCanvasItem *matching_item = NULL ;
   ZMapFeature feature ;
   ZMapWindowItemFeatureType item_feature_type ;
-  FooCanvasGroup *set_group ;
-  ZMapWindowItemFeatureSetData set_data ;
-
+  ZMapWindowContainerFeatureSet container;
+  ZMapWindowCanvasItem canvas_item;
 
   /* Retrieve the feature item info from the canvas item. */
-  feature = g_object_get_data(G_OBJECT(item), ITEM_FEATURE_DATA);  
-  zMapAssert(feature) ;
-
-  item_feature_type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(item),
-							ITEM_FEATURE_TYPE)) ;
-
-  set_group = zmapWindowContainerGetParentContainerFromItem(item) ;
+  canvas_item = zMapWindowCanvasItemIntervalGetObject(item);
+  feature = zMapWindowCanvasItemGetFeature(canvas_item) ;
+  zMapAssert(feature);
 
-  /* These should go in container some time.... */
-  set_data = g_object_get_data(G_OBJECT(set_group), ITEM_FEATURE_SET_DATA) ;
-  zMapAssert(set_data) ;
+  item_feature_type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(item), ITEM_FEATURE_TYPE));
 
+  container = (ZMapWindowContainerFeatureSet)zmapWindowContainerCanvasItemGetContainer(item) ;
 
   if (item_feature_type == ITEM_FEATURE_SIMPLE || item_feature_type == ITEM_FEATURE_PARENT)
     {
       matching_item = zmapWindowFToIFindFeatureItem(window->context_to_item,
-						    set_data->strand, set_data->frame,
+						    container->strand, container->frame,
 						    feature) ;
     }
   else
@@ -992,7 +1000,7 @@ FooCanvasItem *zMapWindowFindFeatureItemByItem(ZMapWindow window, FooCanvasItem
 								      ITEM_SUBFEATURE_DATA) ;
 
       matching_item = zmapWindowFToIFindItemChild(window->context_to_item,
-						  set_data->strand, set_data->frame,
+						  container->strand, container->frame,
 						  feature,
 						  item_subfeature_data->start,
 						  item_subfeature_data->end) ;
@@ -1011,8 +1019,7 @@ FooCanvasItem *zMapWindowFindFeatureItemChildByItem(ZMapWindow window, FooCanvas
 {
   FooCanvasItem *matching_item = NULL ;
   ZMapFeature feature ;
-  FooCanvasGroup *set_group ;
-  ZMapWindowItemFeatureSetData set_data ;
+  ZMapWindowContainerFeatureSet container;
 
   zMapAssert(window && item && child_start > 0 && child_end > 0 && child_start <= child_end) ;
 
@@ -1021,15 +1028,11 @@ FooCanvasItem *zMapWindowFindFeatureItemChildByItem(ZMapWindow window, FooCanvas
   feature = g_object_get_data(G_OBJECT(item), ITEM_FEATURE_DATA);  
   zMapAssert(feature) ;
 
-  set_group = zmapWindowContainerGetParentContainerFromItem(item) ;
-
-  /* These should go in container some time.... */
-  set_data = g_object_get_data(G_OBJECT(set_group), ITEM_FEATURE_SET_DATA) ;
-  zMapAssert(set_data) ;
+  container = (ZMapWindowContainerFeatureSet)zmapWindowContainerCanvasItemGetContainer(item) ;
 
   /* Find the item that matches */
   matching_item = zmapWindowFToIFindFeatureItem(window->context_to_item,
-						set_data->strand, set_data->frame, feature) ;
+						container->strand, container->frame, feature) ;
 
   return matching_item ;
 }
@@ -1201,11 +1204,11 @@ void zmapWindowItemCentreOnItemSubPart(ZMapWindow window, FooCanvasItem *item,
     {
       /* If the item is a group then we need to use its background to check in long items as the
        * group itself is not a long item. */
-      if (FOO_IS_CANVAS_GROUP(item) && zmapWindowContainerIsValid(FOO_CANVAS_GROUP(item)))
+      if (FOO_IS_CANVAS_GROUP(item) && zmapWindowContainerUtilsIsValid(FOO_CANVAS_GROUP(item)))
 	{
 	  FooCanvasItem *long_item ;
 
-	  long_item = zmapWindowContainerGetBackground(FOO_CANVAS_GROUP(item)) ;
+	  long_item = (FooCanvasItem *)zmapWindowContainerGetBackground(ZMAP_CONTAINER_GROUP(item)) ;
 
 	  /* Item may have been clipped by long items code so reinstate its true bounds. */
 	  my_foo_canvas_item_get_long_bounds(window->long_items, long_item,
@@ -1607,7 +1610,7 @@ gboolean zmapWindowWorld2SeqCoords(ZMapWindow window,
       
       /* Getting the block struct as well is a bit belt and braces...we could return it but
        * its redundant info. really. */
-      if ((block_container = zmapWindowContainerGetParentLevel(item, ZMAPCONTAINER_LEVEL_BLOCK))
+      if ((block_container = zmapWindowContainerUtilsItemGetParentLevel(item, ZMAPCONTAINER_LEVEL_BLOCK))
 	  && (block = g_object_get_data(G_OBJECT(block_container), ITEM_FEATURE_DATA)))
 	{
 	  double offset ;
@@ -1625,14 +1628,14 @@ gboolean zmapWindowWorld2SeqCoords(ZMapWindow window,
 
 	  result = TRUE ;
 	}
+      else
+	zMapLogWarning("%s", "No Block Container");
     }
   else 
     {
       get_item_at_workaround_struct workaround_struct = {NULL};
       double scroll_x2;
 
-      FooCanvasItem *cont_root = zmapWindowFToIFindItemFull(window->context_to_item, 0, 0, 0, 0, 0, 0);
-
       workaround_struct.wx1 = wx1;
       workaround_struct.wx2 = wx2;
       workaround_struct.wy1 = wy1;
@@ -1665,8 +1668,8 @@ gboolean zmapWindowWorld2SeqCoords(ZMapWindow window,
        * item's (block container background) original size. */
       workaround_struct.window = window;
 
-      zmapWindowContainerExecute(FOO_CANVAS_GROUP(cont_root), ZMAPCONTAINER_LEVEL_BLOCK, 
-				 fill_workaround_struct,      &workaround_struct);
+      zmapWindowContainerUtilsExecute(window->feature_root_group, ZMAPCONTAINER_LEVEL_BLOCK, 
+				      fill_workaround_struct,     &workaround_struct);
 
       if((result = workaround_struct.result))
 	{
@@ -1702,7 +1705,7 @@ static gboolean simple_highlight_region(FooCanvasPoints **points_out,
   StartEndTextHighlight high_data = (StartEndTextHighlight)user_data;
   FooCanvasPoints *points;
   double first[ITEMTEXT_CHAR_BOUND_COUNT], last[ITEMTEXT_CHAR_BOUND_COUNT];
-  int index1, index2, tmp;
+  int index1, index2;
   gboolean first_found, last_found;
   gboolean redraw = FALSE;
   
@@ -1712,7 +1715,8 @@ static gboolean simple_highlight_region(FooCanvasPoints **points_out,
   index2 = high_data->end;
 
   /* SWAP MACRO? */
-  if(index1 > index2){ tmp = index1; index1 = index2; index2 = tmp; }
+  if(index1 > index2)
+    ZMAP_SWAP_TYPE(int, index1, index2);
 
   /* From the text indices, get the bounds of that char */
   first_found = zmapWindowItemTextIndex2Item(high_data->item, index1, &first[0]);
@@ -2058,230 +2062,29 @@ static void unhighlightCB(gpointer list_data, gpointer user_data)
 }
 
 
-
 /* Do the right thing with groups and items */
 static void highlightItem(ZMapWindow window, FooCanvasItem *item, gboolean highlight)
 {
-  if (FOO_IS_CANVAS_GROUP(item))
-    {
-      HighlightStruct highlight_data = {NULL} ;
-      FooCanvasGroup *group = FOO_CANVAS_GROUP(item) ;
+  GdkColor green = {}, blue = {};
+  gdk_color_parse("green", &green);
+  gdk_color_parse("blue", &blue);
 
-      highlight_data.window = window ;
-      highlight_data.highlight = highlight ;
-      
-      g_list_foreach(group->item_list, highlightFuncCB, (void *)&highlight_data) ;
-    }
-  else
+  if(highlight)
     {
-      ZMapWindowItemFeatureType item_feature_type ;
-      ZMapFeature feature = NULL;
-
-      item_feature_type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(item), ITEM_FEATURE_TYPE)) ;
-      feature = g_object_get_data(G_OBJECT(item), ITEM_FEATURE_DATA);
-
-      if (item_feature_type == ITEM_FEATURE_BOUNDING_BOX || item_feature_type == ITEM_FEATURE_CHILD)
-	{
-	  ZMapWindowItemFeature item_data ;
-
-	  item_data = g_object_get_data(G_OBJECT(item), ITEM_SUBFEATURE_DATA) ;
-
-	  if (item_data->twin_item)
-	    setItemColour(window, item_data->twin_item, highlight) ;
-	}
-
-      setItemColour(window, item, highlight) ;
-
-    }
-
-  return ;
-}
-
-
-/* This is a g_list callback function. */
-static void highlightFuncCB(gpointer data, gpointer user_data)
-{
-  FooCanvasItem *item = (FooCanvasItem *)data ;
-  Highlight highlight = (Highlight)user_data ;
-
-  setItemColour(highlight->window, item, highlight->highlight) ;
-
-  return ;
-}
-
-static void setItemColour(ZMapWindow window, FooCanvasItem *item, gboolean highlight)
-{
-  ZMapWindowItemFeatureType item_feature_type ;
-  ZMapFeature item_feature = NULL;
-  ZMapFeatureTypeStyle style = NULL;
-  ZMapWindowItemFeature exon_data ;
-
-
-  item_feature_type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(item), ITEM_FEATURE_TYPE)) ;
-  zMapAssert(item_feature_type != ITEM_FEATURE_INVALID) ;
-
-  item_feature = g_object_get_data(G_OBJECT(item), ITEM_FEATURE_DATA) ;
-  zMapAssert(item_feature) ;
-
-  style = zmapWindowItemGetStyle(item) ;
-  zMapAssert(style) ;
-
-  exon_data = g_object_get_data(G_OBJECT(item), ITEM_SUBFEATURE_DATA) ;
-
-  
-  /* Ok we need to be item type specific here now */
-  /* Item type     has fill color   has outline color 
-   * ------------------------------------------------*/
-  /* Text items        yes              no
-   * Rectangle/        yes              yes
-   *   Ellipse items
-   * Polygon items     yes              yes
-   * Line items        yes              no
-   * Widget and Pixel Buffer items have neither
-   */
-  
-
-  if (!(FOO_IS_CANVAS_GROUP(item)) && item_feature_type != ITEM_FEATURE_BOUNDING_BOX)
-    {
-      GdkColor *highlight_colour = NULL ;
-      GdkColor *fill_style = NULL, *draw_style = NULL, *border_style = NULL ;
-      GdkColor *fill_colour = NULL,
-	*border_colour = NULL ;
-      ZMapStyleColourTarget target ;
-      ZMapStyleColourType type ;
-      gboolean status ;
-      ZMapStyleMode mode ;
-
-      /* Set a default highlight if there is one. */
-      if (highlight && window->highlights_set.item)
-	{
-	  highlight_colour = &(window->colour_item_highlight) ;
-	}
-
-      /* Get the normal or selected colours from the style according to feature type. */
-      if (highlight)
-	type = ZMAPSTYLE_COLOURTYPE_SELECTED ;
+      if(window->highlights_set.item)
+	zMapWindowCanvasItemSetIntervalColours(ZMAP_CANVAS_ITEM(item), ZMAPSTYLE_COLOURTYPE_SELECTED, 
+					       &(window->colour_item_highlight));
       else
-	type = ZMAPSTYLE_COLOURTYPE_NORMAL ;
-
-      mode = zMapStyleGetMode(style) ;
-
-      switch (mode)
-	{
-	case ZMAPSTYLE_MODE_TRANSCRIPT:
-	  {
-	    if (exon_data && exon_data->subpart == ZMAPFEATURE_SUBPART_EXON_CDS)
-	      target = ZMAPSTYLE_COLOURTARGET_CDS ;
-	    else
-	      target = ZMAPSTYLE_COLOURTARGET_NORMAL ;	    
-
-	    break ;
-	  }
-
-	case ZMAPSTYLE_MODE_GLYPH:
-	  {
-	    switch(zmapWindowFeatureFrame(item_feature))
-	      {
-	      case ZMAPFRAME_0:
-		target = ZMAPSTYLE_COLOURTARGET_FRAME0 ;
-		break ;
-	      case ZMAPFRAME_1:
-		target = ZMAPSTYLE_COLOURTARGET_FRAME1 ;
-		break ;
-	      case ZMAPFRAME_2:
-		target = ZMAPSTYLE_COLOURTARGET_FRAME2 ;
-		break ;
-	      default:
-		target = ZMAPSTYLE_COLOURTARGET_NORMAL ;
-	      }
-	    break ;
-	  }
-
-	case ZMAPSTYLE_MODE_ALIGNMENT:
-	case ZMAPSTYLE_MODE_BASIC:
-	case ZMAPSTYLE_MODE_ASSEMBLY_PATH:
-	case ZMAPSTYLE_MODE_TEXT:
-	case ZMAPSTYLE_MODE_GRAPH:
-	  {
-	    target = ZMAPSTYLE_COLOURTARGET_NORMAL ;	    
-
-	    if(item_feature->strand == ZMAPSTRAND_REVERSE &&
-	       zMapStyleColourByStrand(style))
-	      target = ZMAPSTYLE_COLOURTARGET_STRAND;
-
-	    break ;
-	  }
-
-	default:
-	  {
-	    zMapAssertNotReached() ;
-	  }
-	}
-
-      status = zMapStyleGetColours(style, target, type, &fill_style, &draw_style, &border_style) ;
-
-
-      /* Choose what to colour according the canvas item type we are colouring. */
-      if (status)
-	{
-	  if (FOO_IS_CANVAS_LINE(item))
-	    {
-
-#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
-	      /* This isn't right, its here as an acedb related hack...we can't truly sort this
-	       * out until we have the new styles stuff... */
-	      if (mode == ZMAPSTYLE_MODE_TRANSCRIPT)
-		fill_colour = fill_style ;
-	      else
-#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
-
-		fill_colour = border_style ;
-	    }
-	  else if (FOO_IS_CANVAS_TEXT(item))
-	    {
-	      fill_colour = draw_style ;
-	    }
-	  else if (FOO_IS_CANVAS_LINE_GLYPH(item))
-	    {
-	      fill_colour = fill_style ;
-	    }
-	  else if (FOO_IS_CANVAS_RE(item) || FOO_IS_CANVAS_POLYGON(item))
-	    {
-	      fill_colour = fill_style ;
-	      border_colour = border_style ;
-	    }
-	  else
-	    {
-	      zMapAssertNotReached() ;
-	    }
-	}
-
-
-      /* Use default colour if set. */
-      if (highlight && !fill_colour && highlight_colour)
-	fill_colour = highlight_colour ;
-
-
-      foo_canvas_item_set(FOO_CANVAS_ITEM(item),
-			  "fill_color_gdk", fill_colour,
-			  NULL) ;
-
-      if (border_colour)
-	foo_canvas_item_set(FOO_CANVAS_ITEM(item),
-			    "outline_color_gdk", border_colour,
-			    NULL) ;
+	zMapWindowCanvasItemSetIntervalColours(ZMAP_CANVAS_ITEM(item), ZMAPSTYLE_COLOURTYPE_SELECTED, NULL);
     }
-
+  else
+    zMapWindowCanvasItemSetIntervalColours(ZMAP_CANVAS_ITEM(item), ZMAPSTYLE_COLOURTYPE_NORMAL, NULL);
 
   return ;
 }
 
 
 
-
-
-
-
 /* GCompareFunc() to compare two features by their coords so they are sorted into ascending order. */
 static gint sortByPositionCB(gconstpointer a, gconstpointer b)
 {
@@ -2351,7 +2154,7 @@ static void getVisibleCanvas(ZMapWindow window,
 }
 
 /* workaround for a failing foo_canvas_item_at(). Actually only looks for blocks! */
-static void fill_workaround_struct(FooCanvasGroup        *container, 
+static void fill_workaround_struct(ZMapWindowContainerGroup container, 
 				   FooCanvasPoints       *points,
 				   ZMapContainerLevelType level,
 				   gpointer               user_data)
@@ -2365,7 +2168,7 @@ static void fill_workaround_struct(FooCanvasGroup        *container,
 	FooCanvasItem *cont_backgrd;
 	ZMapFeatureBlock block;
 
-	if((cont_backgrd = zmapWindowContainerGetBackground(container)))
+	if((cont_backgrd = (FooCanvasItem *)zmapWindowContainerGetBackground(container)))
 	  {
 	    double offset;
 	    AreaStruct area_src = {workaround->wx1, workaround->wy1, workaround->wx2, workaround->wy2}, 
@@ -2392,7 +2195,7 @@ static void fill_workaround_struct(FooCanvasGroup        *container,
 	       areas_intersect_gt_threshold(&area_src, &area_block, 0.55))
 	      {
 		/* We're inside */
-		workaround->block = container;
+		workaround->block = (FooCanvasGroup *)container;
 		block = g_object_get_data(G_OBJECT(container), ITEM_FEATURE_DATA);
 
 		offset = (double)(block->block_to_sequence.q1 - 1) ; /* - 1 for 1 based coord system. */
diff --git a/src/zmapWindow/zmapWindowItemDebug.c b/src/zmapWindow/zmapWindowItemDebug.c
index 8745b24f01f4c766faea66567d09e4223cecd6d0..28351fe4072a97ff394e71b32ea0b224ac33379b 100755
--- a/src/zmapWindow/zmapWindowItemDebug.c
+++ b/src/zmapWindow/zmapWindowItemDebug.c
@@ -27,18 +27,18 @@
  *
  * Exported functions: See XXXXXXXXXXXXX.h
  * HISTORY:
- * Last edited: Nov  9 13:34 2007 (rds)
+ * Last edited: Jun  3 23:26 2009 (rds)
  * Created: Tue Nov  6 16:33:44 2007 (rds)
- * CVS info:   $Id: zmapWindowItemDebug.c,v 1.1 2007-11-09 13:45:17 rds Exp $
+ * CVS info:   $Id: zmapWindowItemDebug.c,v 1.2 2009-06-05 13:34:59 rds Exp $
  *-------------------------------------------------------------------
  */
 #include <string.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
+#include <zmapWindowContainerUtils.h>
 #include <ZMap/zmapUtils.h>
 
 #define STRING_SIZE 50
-
+#ifdef NO_NEED
 static gboolean get_container_type_as_string(FooCanvasItem *item, char *str_inout)
 {
   ContainerType container_type = CONTAINER_INVALID;
@@ -159,11 +159,13 @@ static gboolean get_feature_type_as_string(FooCanvasItem *item, char *str_inout)
 
   return has_type;
 }
-
+#endif /* NO_NEED */
 void zmapWindowItemDebugItemToString(FooCanvasItem *item, GString *string)
 {
+  gboolean has_feature = FALSE, is_container = FALSE;
+
+#ifdef NO_NEED
   char tmp_string[STRING_SIZE] = {0};
-  gboolean has_feature, is_container;
 
   if((has_feature = get_feature_type_as_string(item, &tmp_string[0])))
     g_string_append_printf(string, "Feature Type = '%s' ",   &tmp_string[0]);
@@ -176,6 +178,7 @@ void zmapWindowItemDebugItemToString(FooCanvasItem *item, GString *string)
 
   if (g_object_get_data(G_OBJECT(item), "my_range_key"))
     g_string_append_printf(string, "Item is a mark item ") ;
+#endif /* NO_NEED */
 
   if(has_feature)
     {
@@ -187,7 +190,7 @@ void zmapWindowItemDebugItemToString(FooCanvasItem *item, GString *string)
   if(is_container)
     {
       FooCanvasItem *container;
-      container = FOO_CANVAS_ITEM( zmapWindowContainerGetParent(item) );
+      container = FOO_CANVAS_ITEM( zmapWindowContainerCanvasItemGetContainer(item) );
       if(container != item)
 	{
 	  g_string_append_printf(string, "Parent Details... ");
diff --git a/src/zmapWindow/zmapWindowItemFactory.c b/src/zmapWindow/zmapWindowItemFactory.c
index c4930a68355ac951d071e02948d25ecc111b38f1..7d6e968e4cb82d71c64f795cc351964d4fdfa68e 100755
--- a/src/zmapWindow/zmapWindowItemFactory.c
+++ b/src/zmapWindow/zmapWindowItemFactory.c
@@ -28,9 +28,9 @@
  *
  * Exported functions: See zmapWindowItemFactory.h
  * HISTORY:
- * Last edited: May 15 16:07 2009 (edgrif)
+ * Last edited: Jun  5 10:27 2009 (rds)
  * Created: Mon Sep 25 09:09:52 2006 (rds)
- * CVS info:   $Id: zmapWindowItemFactory.c,v 1.60 2009-05-15 15:30:03 edgrif Exp $
+ * CVS info:   $Id: zmapWindowItemFactory.c,v 1.61 2009-06-05 13:35:01 rds Exp $
  *-------------------------------------------------------------------
  */
 
@@ -40,9 +40,10 @@
 #include <ZMap/zmapUtils.h>
 #include <ZMap/zmapStyle.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
+#include <zmapWindowContainerUtils.h>
 #include <zmapWindowItemFactory.h>
 #include <zmapWindowItemTextFillColumn.h>
+#include <zmapWindowCanvasItem.h>
 
 typedef struct _RunSetStruct *RunSet;
 
@@ -86,6 +87,7 @@ typedef struct _RunSetStruct
   ZMapFeatureSet        set;
   ZMapFrame             frame;
   FooCanvasGroup       *container;
+  FooCanvasItem        *canvas_item;
 }RunSetStruct;
 
 
@@ -101,15 +103,6 @@ static void callItemHandler(ZMapWindowFToIFactory                   factory,
                             ZMapWindowItemFeature     sub_feature,
                             double                    new_item_y1,
                             double                    new_item_y2);
-inline
-static void callTopItemHandler(ZMapWindowFToIFactory factory, 
-                               ZMapFeatureContext context,
-                               ZMapFeatureAlignment align,
-                               ZMapFeatureBlock block,
-                               ZMapFeatureSet set,
-                               ZMapFeature feature,
-                               ZMapWindowItemFeatureSetData set_data,
-                               FooCanvasItem *top_item);
 
 /* ZMapWindowFToIFactoryInternalMethod prototypes */
 static FooCanvasItem *invalidFeature(RunSet run_data, ZMapFeature feature,
@@ -159,6 +152,11 @@ static void GapAlignBlockFromAdjacentBlocks(ZMapAlignBlock block_a, ZMapAlignBlo
 					    gboolean *t_indel_gt_1,
 					    gboolean *q_indel_gt_1);
 
+static void GapAlignBlockFromAdjacentBlocks2(ZMapAlignBlock block_a, ZMapAlignBlock block_b, 
+					     ZMapAlignBlockStruct *gap_span_out,
+					     gboolean *t_indel_gt_1,
+					     gboolean *q_indel_gt_1);
+
 static void null_item_created(FooCanvasItem            *new_item,
                               ZMapWindowItemFeatureType new_item_type,
                               ZMapFeature               full_feature,
@@ -178,6 +176,12 @@ static gboolean null_feature_size_request(ZMapFeature feature,
                                           double *points_array_inout, 
                                           gpointer handler_data);
 
+static gboolean clip_feature_coords(ZMapWindowFToIFactory factory,
+				    ZMapFeature           feature,
+				    double                offset,
+				    double               *start_inout,
+				    double               *end_inout);
+
 
 /*
  * Static function tables for drawing features in various ways.
@@ -240,7 +244,6 @@ const static ZMapWindowFToIFactoryMethodsStruct factory_basic_methods_G[] = {
 };
 
 
-
 ZMapWindowFToIFactory zmapWindowFToIFactoryOpen(GHashTable *feature_to_item_hash, 
                                                 ZMapWindowLongItems long_items)
 {
@@ -321,6 +324,7 @@ void zmapWindowFToIFactoryRunSet(ZMapWindowFToIFactory factory,
 
 
 FooCanvasItem *zmapWindowFToIFactoryRunSingle(ZMapWindowFToIFactory factory, 
+					      FooCanvasItem        *current_item,
                                               FooCanvasGroup       *parent_container,
                                               ZMapFeatureContext    context, 
                                               ZMapFeatureAlignment  align, 
@@ -331,25 +335,28 @@ FooCanvasItem *zmapWindowFToIFactoryRunSingle(ZMapWindowFToIFactory factory,
   RunSetStruct run_data = {NULL};
   FooCanvasItem *item = NULL, *return_item = NULL;
   FooCanvasGroup *features_container = NULL;
-  ZMapWindowItemFeatureSetData set_data = NULL;
   ZMapFeatureTypeStyle style = NULL;
   ZMapStyleMode style_mode = ZMAPSTYLE_MODE_INVALID ;
   gboolean no_points_in_block = TRUE;
   /* check here before they get called.  I'd prefer to only do this
    * once per factory rather than once per Run! */
-  ZMapWindowStats parent_stats ;
+
 
   zMapAssert(factory->user_funcs && 
              factory->user_funcs->item_created &&
              factory->user_funcs->top_item_created);
 #ifdef RDS_REMOVED
+  ZMapWindowItemFeatureSetData set_data = NULL;
+  ZMapWindowStats parent_stats ;
+
   parent_stats = g_object_get_data(G_OBJECT(parent_container), ITEM_FEATURE_STATS) ;
-#endif
+
   set_data = g_object_get_data(G_OBJECT(parent_container), ITEM_FEATURE_SET_DATA) ;
   zMapAssert(set_data) ;
+#endif
   
   /* Get the styles table from the column and look for the features style.... */
-  if (!(style = zmapWindowItemFeatureSetStyleFromID(set_data, feature->style_id)))
+  if (!(style = zmapWindowContainerFeatureSetStyleFromID((ZMapWindowContainerFeatureSet)parent_container, feature->style_id)))
     {
       zMapAssertNotReached();
     }
@@ -358,8 +365,8 @@ FooCanvasItem *zmapWindowFToIFactoryRunSingle(ZMapWindowFToIFactory factory,
 
   if (style_mode >= 0 && style_mode <= FACTORY_METHOD_COUNT)
     {
-      double *limits = factory->limits;
-      double *points = factory->points;
+      double *limits = &(factory->limits[0]);
+      double *points = &(factory->points[0]);
       ZMapWindowFToIFactoryMethods method = NULL;
       ZMapWindowFToIFactoryMethodsStruct *method_table = NULL;
       ZMapWindowStats stats ;
@@ -370,7 +377,8 @@ FooCanvasItem *zmapWindowFToIFactoryRunSingle(ZMapWindowFToIFactory factory,
       
       zmapWindowStatsAddChild(stats, (ZMapFeatureAny)feature) ;
 #endif
-      features_container = zmapWindowContainerGetFeatures(parent_container) ;
+
+      features_container = (FooCanvasGroup *)zmapWindowContainerGetFeatures((ZMapWindowContainerGroup)parent_container) ;
   
       if (zMapStyleIsStrandSpecific(style)
           && (feature->strand == ZMAPSTRAND_REVERSE && !zMapStyleIsShowReverseStrand(style)))
@@ -378,9 +386,9 @@ FooCanvasItem *zmapWindowFToIFactoryRunSingle(ZMapWindowFToIFactory factory,
 
       /* Note: for object to _span_ "width" units, we start at zero and end at "width". */
       limits[0] = 0.0;
-      limits[1] = block->block_to_sequence.q1;
+      limits[1] = (double)(block->block_to_sequence.q1);
       limits[2] = zMapStyleGetWidth(style);
-      limits[3] = block->block_to_sequence.q2;
+      limits[3] = (double)(block->block_to_sequence.q2);
 
       /* Set these to this for normal main window use. */
       points[0] = 0.0;
@@ -404,8 +412,8 @@ FooCanvasItem *zmapWindowFToIFactoryRunSingle(ZMapWindowFToIFactory factory,
         case ZMAPSTYLE_MODE_BASIC:
         case ZMAPSTYLE_MODE_GLYPH:
 	  {
-	    ZMapWindowStatsBasic stats ;
 #ifdef RDS_REMOVED
+	    ZMapWindowStatsBasic stats ;
 	    stats = zmapWindowStatsAddBasic(parent_stats, feature) ;
 	    stats->features++ ;
 	    stats->items++ ;
@@ -422,8 +430,8 @@ FooCanvasItem *zmapWindowFToIFactoryRunSingle(ZMapWindowFToIFactory factory,
 
         case ZMAPSTYLE_MODE_ALIGNMENT:
 	  {
-	    ZMapWindowStatsAlign stats ;
 #ifdef RDS_REMOVED
+	    ZMapWindowStatsAlign stats ;
 	    stats = zmapWindowStatsAddAlign(parent_stats, feature) ;
 	    stats->total_matches++ ;
 #endif
@@ -464,14 +472,16 @@ FooCanvasItem *zmapWindowFToIFactoryRunSingle(ZMapWindowFToIFactory factory,
 
 		method = &(method_table[style_mode]);
 	      }
+
+	    method = &(method_table[style_mode]);
 	    
 	    break;
 	  }
 
         case ZMAPSTYLE_MODE_TEXT:
 	  {
-	    ZMapWindowStatsBasic stats ;
 #ifdef RDS_REMOVED
+	    ZMapWindowStatsBasic stats ;
 	    stats = zmapWindowStatsAddBasic(parent_stats, feature) ;
 	    stats->features++ ;
 	    stats->items++ ;
@@ -485,8 +495,8 @@ FooCanvasItem *zmapWindowFToIFactoryRunSingle(ZMapWindowFToIFactory factory,
 
         case ZMAPSTYLE_MODE_GRAPH:
 	  {
-	    ZMapWindowStatsBasic stats ;
 #ifdef RDS_REMOVED
+	    ZMapWindowStatsBasic stats ;
 	    stats = zmapWindowStatsAddBasic(parent_stats, feature) ;
 	    stats->features++ ;
 	    stats->items++ ;
@@ -500,8 +510,8 @@ FooCanvasItem *zmapWindowFToIFactoryRunSingle(ZMapWindowFToIFactory factory,
 
         case ZMAPSTYLE_MODE_TRANSCRIPT:
 	  {
-	    ZMapWindowStatsTranscript stats ;
 #ifdef RDS_REMOVED
+	    ZMapWindowStatsTranscript stats ;
 	    stats = zmapWindowStatsAddTranscript(parent_stats, feature) ;
 	    stats->transcripts++ ;
 
@@ -562,23 +572,31 @@ FooCanvasItem *zmapWindowFToIFactoryRunSingle(ZMapWindowFToIFactory factory,
       run_data.block     = block;
       run_data.set       = set;
 
+      run_data.canvas_item = current_item;
+
       item   = ((method)->method)(&run_data, feature, limits[1],
-				  points[0], points[1],
+				  points[0], points[1], 
 				  points[2], points[3],
 				  style);
+      /* if(!run_data.item_in && item) */
 
       if (item)
         {
           gboolean status = FALSE;
-          
+          ZMapFrame frame;
+	  ZMapStrand strand;
+
           g_object_set_data(G_OBJECT(item), ITEM_FEATURE_ITEM_STYLE, style) ;
-          
+
+	  frame  = zmapWindowContainerFeatureSetGetFrame((ZMapWindowContainerFeatureSet)parent_container);
+	  strand = zmapWindowContainerFeatureSetGetStrand((ZMapWindowContainerFeatureSet)parent_container);
+         
           if(factory->ftoi_hash)
             status = zmapWindowFToIAddFeature(factory->ftoi_hash,
-                                              align->unique_id, block->unique_id, 
+                                              align->unique_id, 
+					      block->unique_id, 
                                               set->unique_id, 
-                                              set_data->strand, 
-                                              set_data->frame,
+                                              strand, frame,
                                               feature->unique_id, item) ;
 
           status = (factory->user_funcs->top_item_created)(item, context, align, block, set, feature, factory->user_data);
@@ -670,6 +688,7 @@ static void datalistRun(gpointer key, gpointer list_data, gpointer user_data)
     return ;
 
   zmapWindowFToIFactoryRunSingle(run_data->factory, 
+				 run_data->canvas_item,
                                  run_data->container,
                                  run_data->context,
                                  run_data->align,
@@ -701,7 +720,7 @@ static void callItemHandler(ZMapWindowFToIFactory     factory,
     zMapAssert(new_item_type != ITEM_FEATURE_CHILD &&
                new_item_type != ITEM_FEATURE_BOUNDING_BOX);
 
-  if(factory->long_items)
+  if(factory->long_items && 0)
     zmapWindowLongItemCheck(factory->long_items, new_item, new_item_y1, new_item_y2);
 
   (factory->user_funcs->item_created)(new_item, new_item_type, full_feature, sub_feature, 
@@ -710,41 +729,7 @@ static void callItemHandler(ZMapWindowFToIFactory     factory,
   return ;
 }
 
-inline
-static void callTopItemHandler(ZMapWindowFToIFactory factory, 
-                               ZMapFeatureContext context,
-                               ZMapFeatureAlignment align,
-                               ZMapFeatureBlock block,
-                               ZMapFeatureSet set,
-                               ZMapFeature feature,
-                               ZMapWindowItemFeatureSetData set_data,
-                               FooCanvasItem *top_item)
-{
 
-  return ;
-}
-
-static FooCanvasItem *createParentGroup(FooCanvasGroup *parent,
-					ZMapFeature feature,
-					double y_origin)
-{
-  FooCanvasItem *group = NULL;
-  /* this group is the parent of the entire transcript. */
-  group = foo_canvas_item_new(FOO_CANVAS_GROUP(parent),
-                              foo_canvas_group_get_type(),
-                              "x", 0.0,
-                              "y", y_origin,
-                              NULL) ;
-  group = FOO_CANVAS_ITEM(group) ;
-
-  /* we probably need to set this I think, it means we will go to the group when we
-   * navigate or whatever.... */
-  g_object_set_data(G_OBJECT(group), ITEM_FEATURE_TYPE,
-                    GINT_TO_POINTER(ITEM_FEATURE_PARENT)) ;
-  g_object_set_data(G_OBJECT(group), ITEM_FEATURE_DATA, feature) ;
-
-  return group ;
-}
 
 static double getWidthFromScore(ZMapFeatureTypeStyle style, double score)
 {
@@ -789,39 +774,29 @@ static double getWidthFromScore(ZMapFeatureTypeStyle style, double score)
   return width ;
 }
 
+
 static FooCanvasItem *drawSimpleFeature(RunSet run_data, ZMapFeature feature,
                                         double feature_offset,
 					double x1, double y1, double x2, double y2,
                                         ZMapFeatureTypeStyle style)
 {
-  ZMapWindowFToIFactory factory = run_data->factory;
   FooCanvasGroup        *parent = run_data->container;
-  FooCanvasItem *feature_item ;
-  GdkColor *outline = NULL, *foreground = NULL, *background = NULL ;
-  guint line_width;
-  gboolean status ;
-
-  line_width = factory->line_width;
-
-  zmapWindowSeq2CanOffset(&y1, &y2, feature_offset) ;	    /* Make sure we cover the whole last base. */
-
-  if(feature->strand == ZMAPSTRAND_REVERSE &&
-     zMapStyleColourByStrand(style))
-    status = zMapStyleGetColours(style, ZMAPSTYLE_COLOURTARGET_STRAND, ZMAPSTYLE_COLOURTYPE_NORMAL,
-				 &background, &foreground, &outline) ;
-  else
-    status = zMapStyleGetColours(style, ZMAPSTYLE_COLOURTARGET_NORMAL, ZMAPSTYLE_COLOURTYPE_NORMAL,
-				 &background, &foreground, &outline) ;
-  zMapAssert(status) ;
+  FooCanvasItem   *feature_item = NULL;
+  ZMapWindowCanvasItem new_canvas_item;
 
-  feature_item = zMapDrawBox(parent,
-			     x1, y1, x2, y2,
-			     outline, background, line_width) ;
-
-  callItemHandler(factory, feature_item,
-                  ITEM_FEATURE_SIMPLE,
-                  feature, NULL, y1, y2);
+  /* clip the coords to the block, extending end to canvas drawing coords. */
+  /* Feature span coords are already clipped to block sapce.  
+   * We just need to Seq2CanOffset */
+  zmapWindowSeq2CanOffset(&y1, &y2, feature_offset);
 
+  if((new_canvas_item = zMapWindowCanvasItemCreate(parent, y1, feature, style)))
+    {
+      zMapWindowCanvasItemSetIntervalType(new_canvas_item, ZMAP_WINDOW_BASIC_BOX);
+      
+      zMapWindowCanvasItemAddInterval(new_canvas_item, NULL, 0.0, y2 - y1, x1, x2);
+  
+      feature_item = FOO_CANVAS_ITEM(new_canvas_item);
+    }
 
   return feature_item ;
 }
@@ -834,7 +809,8 @@ static FooCanvasItem *drawGlyphFeature(RunSet run_data, ZMapFeature feature,
 {
   ZMapWindowFToIFactory factory = run_data->factory;
   FooCanvasGroup        *parent = run_data->container;
-  FooCanvasItem *feature_item ;
+  ZMapWindowCanvasItem new_canvas_item;
+  FooCanvasItem *feature_item = NULL;
   guint line_width;
 
   line_width = factory->line_width;
@@ -843,7 +819,7 @@ static FooCanvasItem *drawGlyphFeature(RunSet run_data, ZMapFeature feature,
 
 
   /* There will be other alternatives to splice once we add them to the the canvas. */
-  if (feature->flags.has_boundary)
+  if (feature->flags.has_boundary && 0)
     {
       GdkColor *splice_background ;
       double width, origin, start ;
@@ -920,11 +896,17 @@ static FooCanvasItem *drawGlyphFeature(RunSet run_data, ZMapFeature feature,
 				   glyph_type,
 				   splice_background, width, 2) ;
     }
-
-  callItemHandler(factory, feature_item,
-                  ITEM_FEATURE_SIMPLE,
-                  feature, NULL, y1, y2);
-
+  else
+    {
+      if((new_canvas_item = zMapWindowCanvasItemCreate(parent, y1, feature, style)))
+	{
+	  zMapWindowCanvasItemSetIntervalType(new_canvas_item, ZMAP_WINDOW_BASIC_BOX);
+	  
+	  zMapWindowCanvasItemAddInterval(new_canvas_item, NULL, 0.0, y2 - y1, x1, x2);
+	  
+	  feature_item = FOO_CANVAS_ITEM(new_canvas_item);
+	}
+    }
 
   return feature_item ;
 }
@@ -932,19 +914,6 @@ static FooCanvasItem *drawGlyphFeature(RunSet run_data, ZMapFeature feature,
 
 
 
-/* Reduce the number of variables in drawAlignFeature slightly */
-typedef struct 
-{
-  gboolean colour_init;
-  GdkColor perfect;
-  GdkColor colinear;
-  GdkColor noncolinear;
-  char *perfect_colour;
-  char *colinear_colour;
-  char *noncolinear_colour;
-
-} AlignColinearityColoursStruct;
-
 /* Draws a series of boxes connected by centrally placed straight lines which represent the match
  * blocks given by the align array in an alignment feature.
  * 
@@ -979,18 +948,14 @@ static FooCanvasItem *drawAlignFeature(RunSet run_data, ZMapFeature feature,
                                        double x1, double y1, double x2, double y2,
                                        ZMapFeatureTypeStyle style)
 {
+  FooCanvasGroup *parent = run_data->container;
   FooCanvasItem *feature_item = NULL ;
+  ZMapWindowCanvasItem new_canvas_item;
   ZMapWindowFToIFactory factory = run_data->factory;
   ZMapFeatureBlock        block = run_data->block;
   GdkColor *outline = NULL, *foreground = NULL, *background = NULL ;
   guint match_threshold = 0, line_width = 0;
   gboolean status ;
-  static AlignColinearityColoursStruct c_colours = {
-    FALSE, {0}, {0}, {0}, 
-    ZMAP_WINDOW_MATCH_PERFECT,
-    ZMAP_WINDOW_MATCH_COLINEAR,
-    ZMAP_WINDOW_MATCH_NOTCOLINEAR
-  };
 
   /* Get the colours, it's an error at this stage if none set we don't draw. */
   /* We could speed performance by caching these colours and only changing them when the style
@@ -1001,411 +966,438 @@ static FooCanvasItem *drawAlignFeature(RunSet run_data, ZMapFeature feature,
 
   /* If we are here, style should be ok for display. */
 
-  /* Fill in the static colinearity colours struct... */
-  if (!c_colours.colour_init)
+  if (!zMapStyleIsAlignGaps(style) || !(feature->feature.homol.align))
     {
-      gboolean colinear_colours_from_style = FALSE;
-
-      if(colinear_colours_from_style)
-	{
-	  /* These will _never_ parse. Write, if this is required... */
-	  c_colours.perfect_colour     = "ZMapStyle->perfect_colour";
-	  c_colours.colinear_colour    = "ZMapStyle->perfect_colour";
-	  c_colours.noncolinear_colour = "ZMapStyle->perfect_colour";
-	}
-
-      gdk_color_parse(c_colours.perfect_colour, &c_colours.perfect) ;
-      gdk_color_parse(c_colours.colinear_colour, &c_colours.colinear) ;
-      gdk_color_parse(c_colours.noncolinear_colour, &c_colours.noncolinear) ;
-
-      c_colours.colour_init = TRUE ;
-    }
-
-  /* Are we drawing gapped alignments? get the match threshold */
-  zMapStyleGetGappedAligns(style, &match_threshold) ;
-
-  /* line width from the factory? Should this be from the style? */
-  line_width = factory->line_width;
-
-  if (feature->feature.homol.align)
-    {
-      FooCanvasGroup *feature_group  = NULL;
-      ZMapAlignBlock first_match_block = NULL, prev_match_block;
-      double limits[]       = {0.0, 0.0, 0.0, 0.0};
-      double points_inout[] = {0.0, 0.0, 0.0, 0.0};
       double feature_start, feature_end;
-      double first_item_top    = 0.0;
-      double first_item_bottom = 0.0;
-      double prev_item_bottom;
-      double line_x_axis = ((x2 - x1) / 2) + x1;
-      double offset ;
-      guint i = 0;		/* Get First Block */
-
-      limits[1] = block->block_to_sequence.q1;
-      limits[3] = block->block_to_sequence.q2;
-
       feature_start = feature->x1;
       feature_end   = feature->x2; /* I want this function to find these values */
       zmapWindowSeq2CanOffset(&feature_start, &feature_end, feature_offset) ;
-      feature_item  = createParentGroup(run_data->container, feature, feature_start);
-      feature_group = FOO_CANVAS_GROUP(feature_item);
-
-      /* Calculate total offset for for subparts of the feature. */
-      offset = feature_start + feature_offset ;
-
-      /* Algorithm here is:
-       * - Get First Block (first)
-       * Loop
-       *   - Get Next Block (this)
-       *   - Calculate Gap
-       *   - Draw Gap _if_ there is one
-       *   - Draw Block (this)
-       * - Draw First Block (first)
-       *
-       * Sadly, it only really avoids a if(prev_match_block) in the loop and
-       * doesn't cure any issue with the the gap lines overlapping the
-       * match blocks (this requires 2 loops or a change to the way we draw all features). 
-       */
 
-      first_match_block = prev_match_block =
-	&(g_array_index(feature->feature.homol.align, ZMapAlignBlockStruct, i));
-
-      points_inout[1] = first_match_block->t1;
-      points_inout[3] = first_match_block->t2;
-      
-      /* Do a size request to check we need not be clipped */
-      (factory->user_funcs->feature_size_request)(feature, &limits[0], 
-						  &points_inout[0], 
-						  factory->user_data);
-      first_item_top    = points_inout[1];
-      first_item_bottom = points_inout[3];
-
-      zmapWindowSeq2CanOffset(&first_item_top, &first_item_bottom, offset) ;
-
-      prev_item_bottom  = first_item_bottom;
+      if(!(feature_item = run_data->canvas_item))
+	{
+	  new_canvas_item = zMapWindowCanvasItemCreate(parent, feature_start, feature, style);
+	  feature_item = FOO_CANVAS_ITEM(new_canvas_item);
+	}
+      else
+	{
+	  new_canvas_item = ZMAP_CANVAS_ITEM(feature_item);
+	  zMapWindowCanvasItemClear(new_canvas_item);
+	}
 
+      zMapWindowCanvasItemSetIntervalType(new_canvas_item, ZMAP_WINDOW_ALIGNMENT_NO_GAPS);
 
-      /* Do any more we have... */
-      for (i = 1; prev_match_block && i < feature->feature.homol.align->len ; i++)  
-        {
-          ZMapWindowItemFeature box_data, gap_data, align_data ;
-	  ZMapAlignBlockStruct gap_block, *match_block;
-          FooCanvasItem *gap_line, *gap_line_box, *align_box;
-          double item_top, item_bottom;
-	  int q_indel, t_indel;
-	  gboolean expect_problems = TRUE;
-	  gboolean t_indel_set, q_indel_set;
-          
-          match_block = &(g_array_index(feature->feature.homol.align, ZMapAlignBlockStruct, i));
-	  points_inout[1] = match_block->t1;
-          points_inout[3] = match_block->t2;
+      zmapWindowExt2Zero(&feature_start, &feature_end);
 
+      zMapWindowCanvasItemAddInterval(new_canvas_item, NULL, feature_start, feature_end, x1, x2);
+    }
+  else
+    {
+      /* Are we drawing gapped alignments? get the match threshold */
+      zMapStyleGetGappedAligns(style, &match_threshold) ;
+      
+      /* line width from the factory? Should this be from the style? */
+      line_width = factory->line_width;
+      
+      if (feature->feature.homol.align)
+	{
+	  ZMapAlignBlock first_match_block = NULL, prev_match_block;
+	  double limits[]       = {0.0, 0.0, 0.0, 0.0};
+	  double feature_start, feature_end;
+	  double first_item_top    = 0.0;
+	  double first_item_bottom = 0.0;
+	  double prev_item_bottom;
+	  guint i = 0;		/* Get First Block */
+	  
+	  limits[1] = block->block_to_sequence.q1;
+	  limits[3] = block->block_to_sequence.q2;
+	  
+	  feature_start = feature->x1;
+	  feature_end   = feature->x2; /* I want this function to find these values */
+#ifdef DEBUG_COORDS
+	  printf("feature %d -> %d [%d -> %d]\n", 
+		 feature->x1, feature->x2, 
+		 feature->x1 - feature->x1,
+		 feature->x2 - feature->x1 + 1);
+#endif /* DEBUG_COORDS */
+	  zmapWindowSeq2CanOffset(&feature_start, &feature_end, feature_offset) ;
+#ifdef DEBUG_COORDS
+	  printf("feature %f -> %f [%f, %f]\n", 
+		 feature_start, feature_end, 
+		 feature_start - feature_start, feature_end - feature_start);
+#endif /* DEBUG_COORDS */
+	  if(!(feature_item = run_data->canvas_item))
+	    {
+	      new_canvas_item = zMapWindowCanvasItemCreate(parent, feature_start, feature, style);
+	      feature_item    = FOO_CANVAS_ITEM(new_canvas_item);
+	    }
+	  else
+	    {
+	      new_canvas_item = ZMAP_CANVAS_ITEM(feature_item);
+	      zMapWindowCanvasItemClear(new_canvas_item);
+	    }
+	  
+	  /* Calculate total offset for for subparts of the feature. */
+	  
+	  /* Algorithm here is:
+	   * - Get First Block (first)
+	   * Loop
+	   *   - Get Next Block (this)
+	   *   - Calculate Gap
+	   *   - Draw Gap _if_ there is one
+	   *   - Draw Block (this)
+	   * - Draw First Block (first)
+	   *
+	   * Sadly, it only really avoids a if(prev_match_block) in the loop and
+	   * doesn't cure any issue with the the gap lines overlapping the
+	   * match blocks (this requires 2 loops or a change to the way we draw all features). 
+	   */
+	  
+	  first_match_block = prev_match_block =
+	    &(g_array_index(feature->feature.homol.align, ZMapAlignBlockStruct, i));
+	  
+	  first_item_top    = first_match_block->t1;
+	  first_item_bottom = first_match_block->t2;
+	  
 	  /* Do a size request to check we need not be clipped */
-          if((factory->user_funcs->feature_size_request)(feature, &limits[0], &points_inout[0], factory->user_data))
-	    continue;
-
-          item_top    = points_inout[1];
-          item_bottom = points_inout[3];
-
-          zmapWindowSeq2CanOffset(&item_top, &item_bottom, offset) ;
+	  clip_feature_coords(factory, feature, feature_offset,
+			      &first_item_top, &first_item_bottom);
+	  
+	  first_item_top    -= feature_start;
+	  first_item_bottom -= feature_start;
 
-	  /* Check the strandedness of prev and current
-	   * align_spans. This should be removed when Ed finishes
-	   * the correct dumping in the sgifaceserver. */
-	  if(expect_problems)
+	  prev_item_bottom   = first_item_bottom;
+	  	  
+	  /* Do any more we have... */
+	  for (i = 1; prev_match_block && i < feature->feature.homol.align->len ; i++)  
 	    {
+	      ZMapWindowItemFeature gap_data, align_data ;
+	      ZMapAlignBlockStruct gap_block, *match_block;
+	      FooCanvasItem *match;
+	      double item_top, item_bottom;
+	      int q_indel, t_indel;
+	      gboolean expect_problems = TRUE;
+	      gboolean t_indel_set, q_indel_set;
 	      
-	      /* Problems expected are due to some services
-	       * providing data to us which relies on the order of
-	       * the coordinates to determine strand.  This is all
-	       * well and good for everything _except_ single
-	       * bases. We probably don't do enough to trap this 
-	       * elsewhere, by the time we are here, we should just
-	       * be drawing... */
-	    
-	      if(match_block->t_strand != prev_match_block->t_strand &&
-		 match_block->t1 == match_block->t2)
-		match_block->t_strand = prev_match_block->t_strand;
-
-	      if(match_block->q_strand != prev_match_block->q_strand &&
-		 match_block->q1 == match_block->q2)
-		match_block->q_strand = prev_match_block->q_strand;
-
-	      /* Sadly we need to check _again_ as the prev block
-	       * could be the one with the single base match.
-	       * Only a problem for the _first_ one I think...sigh... */
-	      /* Anyway we set the prev one's strand to match this 
-	       * one, rather than vice versa as above. */
-	      if(match_block->t_strand != prev_match_block->t_strand &&
-		 prev_match_block->t1 == prev_match_block->t2)
-		prev_match_block->t_strand = match_block->t_strand;
+	      match_block = &(g_array_index(feature->feature.homol.align, ZMapAlignBlockStruct, i));
+	      item_top    = match_block->t1;
+	      item_bottom = match_block->t2;
 	      
-	      if(match_block->q_strand != prev_match_block->q_strand &&
-		 prev_match_block->q1 == prev_match_block->q2)
-		prev_match_block->q_strand = match_block->q_strand;
-	    }
+	      clip_feature_coords(factory, feature, feature_offset,
+				  &item_top, &item_bottom);
+	      
+	      item_top    -= feature_start;
+	      item_bottom -= feature_start;
+
+	      /* Check the strandedness of prev and current
+	       * align_spans. This should be removed when Ed finishes
+	       * the correct dumping in the sgifaceserver. */
+	      if(expect_problems)
+		{
+		  
+		  /* Problems expected are due to some services
+		   * providing data to us which relies on the order of
+		   * the coordinates to determine strand.  This is all
+		   * well and good for everything _except_ single
+		   * bases. We probably don't do enough to trap this 
+		   * elsewhere, by the time we are here, we should just
+		   * be drawing... */
+		  
+		  if(match_block->t_strand != prev_match_block->t_strand &&
+		     match_block->t1 == match_block->t2)
+		    match_block->t_strand = prev_match_block->t_strand;
+		  
+		  if(match_block->q_strand != prev_match_block->q_strand &&
+		     match_block->q1 == match_block->q2)
+		    match_block->q_strand = prev_match_block->q_strand;
+
+		  /* Sadly we need to check _again_ as the prev block
+		   * could be the one with the single base match.
+		   * Only a problem for the _first_ one I think...sigh... */
+		  /* Anyway we set the prev one's strand to match this 
+		   * one, rather than vice versa as above. */
+		  if(match_block->t_strand != prev_match_block->t_strand &&
+		     prev_match_block->t1 == prev_match_block->t2)
+		    prev_match_block->t_strand = match_block->t_strand;
+	      
+		  if(match_block->q_strand != prev_match_block->q_strand &&
+		     prev_match_block->q1 == prev_match_block->q2)
+		    prev_match_block->q_strand = match_block->q_strand;
+		}
 	      
 	  
 
 #ifdef ED_G_NEVER_INCLUDE_THIS_CODE
-	  /* THIS NEEDS MORE THOUGHT......WE CAN'T JUST ASSERT HERE, WE EITHER NEED
-	   * TO CHUCK OUT THE DATA AT AN EARLIER STAGE (E.G. GFF PARSER) OR HANDLE
-	   * IT AT THIS STAGE...BOMBING OUT IS NO GOOD..... */
-
-
-	  /* These may or may not be good to assert... */
-	  /* I don't see any reason why someone shouldn't supply
-	   * data that will break these, but I'm assuming the hit
-	   * would actually be a separate HSP at that point.
-	   * These are _after_ the above "expect_problems" code!
-	   */
-	  zMapAssert(match_block->t_strand == prev_match_block->t_strand);
-	  zMapAssert(match_block->q_strand == prev_match_block->q_strand);
+	      /* THIS NEEDS MORE THOUGHT......WE CAN'T JUST ASSERT HERE, WE EITHER NEED
+	       * TO CHUCK OUT THE DATA AT AN EARLIER STAGE (E.G. GFF PARSER) OR HANDLE
+	       * IT AT THIS STAGE...BOMBING OUT IS NO GOOD..... */
+
+
+	      /* These may or may not be good to assert... */
+	      /* I don't see any reason why someone shouldn't supply
+	       * data that will break these, but I'm assuming the hit
+	       * would actually be a separate HSP at that point.
+	       * These are _after_ the above "expect_problems" code!
+	       */
+	      zMapAssert(match_block->t_strand == prev_match_block->t_strand);
+	      zMapAssert(match_block->q_strand == prev_match_block->q_strand);
 #endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
 
 	  
-	  /* Get the Gap AlignBlock from the adjacent Match AlignBlocks. */
-	  GapAlignBlockFromAdjacentBlocks(prev_match_block, match_block, &gap_block, &t_indel_set, &q_indel_set);
+	      /* Get the Gap AlignBlock from the adjacent Match AlignBlocks. */
+	      GapAlignBlockFromAdjacentBlocks(prev_match_block, match_block, &gap_block, &t_indel_set, &q_indel_set);
 	  
-	  /* Null this... */
-	  prev_match_block = NULL;
+	      /* Null this... */
+	      prev_match_block = NULL;
 
-	  t_indel = gap_block.t2 - gap_block.t1;
-	  q_indel = gap_block.q2 - gap_block.q1;
+	      t_indel = gap_block.t2 - gap_block.t1;
+	      q_indel = gap_block.q2 - gap_block.q1;
 	    
-	  if(t_indel_set)
-	    {
-	      GdkColor *line_colour = &c_colours.perfect ;
-	      
-	      box_data          = g_new0(ZMapWindowItemFeatureStruct, 1) ;
-	      box_data->subpart = ZMAPFEATURE_SUBPART_GAP ;
-	      box_data->start   = gap_block.t1;
-	      box_data->end     = gap_block.t2;
-	      box_data->query_start = 0;
-	      box_data->query_end   = 0;
-
-	      if(q_indel_set)
+	      if(t_indel_set)
 		{
-		  box_data->query_start = gap_block.q1;
-		  box_data->query_end   = gap_block.q2;
+		  FooCanvasItem *gap;
+		  double gap_top, gap_bottom;
+
+		  gap_data          = g_new0(ZMapWindowItemFeatureStruct, 1) ;
+		  gap_data->subpart = ZMAPFEATURE_SUBPART_GAP ;
+		  gap_data->start   = gap_block.t1;
+		  gap_data->end     = gap_block.t2;
+		  gap_data->query_start = 0;
+		  gap_data->query_end   = 0;
+
+		  if(q_indel_set)
+		    {
+		      gap_data->query_start = gap_block.q1;
+		      gap_data->query_end   = gap_block.q2;
+		    }
+		  gap_top    = gap_block.t1;
+		  gap_bottom = gap_block.t2;
+
+		  /* we don't need to clip check here, but item that do have feature_offset seq2can so add here. */
+		  zmapWindowSeq2CanOffset(&gap_top, &gap_bottom, feature_start + feature_offset);
+
+		  zMapWindowCanvasItemSetIntervalType(new_canvas_item, ZMAP_WINDOW_ALIGNMENT_GAP);
+#ifdef DEBUG_COORDS
+		  printf("\tgap %f, %f\n", gap_top, gap_bottom);
+#endif /* DEBUG_COORDS */
+		  gap = zMapWindowCanvasItemAddInterval(new_canvas_item, gap_data, 
+							gap_top, gap_bottom, x1, x2);
+
+		  g_object_set_data(G_OBJECT(gap), ITEM_SUBFEATURE_DATA, gap_data);
+
+#ifdef RDS_BREAKING_STUFF
+		  if(q_indel - 1 > match_threshold)
+		    line_colour = &c_colours.colinear;
+#endif
+		  
 		}
 
-	      if(q_indel - 1 > match_threshold)
-		line_colour = &c_colours.colinear;
-
-	      gap_data = g_new0(ZMapWindowItemFeatureStruct, 1) ;
-	      memcpy(gap_data, box_data, sizeof(ZMapWindowItemFeatureStruct));
-
-	      gap_line_box = zMapDrawBox(feature_group, 
-					 x1, prev_item_bottom,
-					 x2, item_top,
-					 NULL, NULL, line_width);
+	      align_data              = g_new0(ZMapWindowItemFeatureStruct, 1) ;
+	      align_data->subpart     = ZMAPFEATURE_SUBPART_MATCH ;
+	      align_data->start       = match_block->t1 ;
+	      align_data->end         = match_block->t2 ;
+	      align_data->query_start = match_block->q1 ;
+	      align_data->query_end   = match_block->q2 ;
 
-	      callItemHandler(factory, gap_line_box, 
-			      ITEM_FEATURE_BOUNDING_BOX, 
-			      feature, box_data, 
-			      prev_item_bottom, item_top);
+	      zMapWindowCanvasItemSetIntervalType(new_canvas_item, ZMAP_WINDOW_ALIGNMENT_MATCH);
+#ifdef DEBUG_COORDS
+	      printf("\tmatch %f, %f\n", item_top, item_bottom);
+#endif /* DEBUG_COORDS */
+	      match = zMapWindowCanvasItemAddInterval(new_canvas_item, align_data, item_top, item_bottom, x1, x2);
 
-	      gap_line = zMapDrawLine(feature_group,
-				      line_x_axis, prev_item_bottom, 
-				      line_x_axis, item_top,
-				      line_colour, line_width);
+	      g_object_set_data(G_OBJECT(match), ITEM_SUBFEATURE_DATA, align_data);
 
-	      callItemHandler(factory, gap_line, 
-			      ITEM_FEATURE_CHILD, 
-			      feature, gap_data, 
-			      prev_item_bottom, item_top);
+	      /* Save this block for next iteration... Incl. the
+	       * Seq2CanOffset of the Bottom of this drawn align box */
+	      prev_match_block = match_block;
+	      prev_item_bottom = item_bottom;
 
-	      gap_data->twin_item = gap_line_box;
-	      box_data->twin_item = gap_line;
 	    }
 
-
-          align_data              = g_new0(ZMapWindowItemFeatureStruct, 1) ;
-	  align_data->subpart     = ZMAPFEATURE_SUBPART_MATCH ;
-          align_data->start       = match_block->t1 ;
-          align_data->end         = match_block->t2 ;
-          align_data->query_start = match_block->q1 ;
-          align_data->query_end   = match_block->q2 ;
-
-	  align_box = zMapDrawBox(feature_group, x1, item_top, x2, item_bottom, 
-				  outline, background, line_width);
-
-	  callItemHandler(factory, align_box, 
-			  ITEM_FEATURE_CHILD, 
-			  feature, align_data, 
-			  item_top, item_bottom);
-
-	  /* Save this block for next iteration... Incl. the
-	   * Seq2CanOffset of the Bottom of this drawn align box */
-	  prev_match_block = match_block;
-	  prev_item_bottom = item_bottom;
-        }
-
-      if(first_match_block)
-	{
-	  FooCanvasItem *align_box;
-	  ZMapWindowItemFeature align_data;
-
-	  align_data              = g_new0(ZMapWindowItemFeatureStruct, 1) ;
-	  align_data->subpart     = ZMAPFEATURE_SUBPART_MATCH ;
-	  align_data->start       = first_match_block->t1 ;
-	  align_data->end         = first_match_block->t2 ;
-	  align_data->query_start = first_match_block->q1 ;
-	  align_data->query_end   = first_match_block->q2 ;
-	  
-	  align_box = zMapDrawBox(feature_group, 
-				  x1, first_item_top, 
-				  x2, first_item_bottom, 
-				  outline, background, 
-				  line_width);
+	  if(first_match_block)
+	    {
+	      FooCanvasItem *match;
+	      ZMapWindowItemFeature align_data;
+
+	      align_data              = g_new0(ZMapWindowItemFeatureStruct, 1) ;
+	      align_data->subpart     = ZMAPFEATURE_SUBPART_MATCH ;
+	      align_data->start       = first_match_block->t1 ;
+	      align_data->end         = first_match_block->t2 ;
+	      align_data->query_start = first_match_block->q1 ;
+	      align_data->query_end   = first_match_block->q2 ;
 	  
-	  callItemHandler(factory, align_box, 
-			  ITEM_FEATURE_CHILD, 
-			  feature, align_data, 
-			  first_item_top, first_item_bottom);
+	      match = zMapWindowCanvasItemAddInterval(new_canvas_item, align_data, 
+						      first_item_top, first_item_bottom, x1, x2);
+	      g_object_set_data(G_OBJECT(match), ITEM_SUBFEATURE_DATA, align_data);
+#ifdef DEBUG_COORDS
+	      printf("\t1st %f, %f\n", first_item_top, first_item_bottom);
+#endif /* DEBUG_COORDS */
+	    }
 	}
     }
     
   return feature_item ;
 }
 
-static void drawFeatureExon(ZMapWindowFToIFactory factory, 
-                            FooCanvasItem *parent,
-                            ZMapFeature feature, 
-                            ZMapSpan exon_span,
-                            ZMapFeatureTypeStyle style,
-                            int left, int right,
-                            int top, int bottom, int offset,
-                            int cds_start, int cds_end,
-                            int line_width,
-                            GdkColor *background,
-                            GdkColor *foreground,
-                            GdkColor *outline,
-                            gboolean has_cds,
-                            GdkColor *cds_fill,
-                            GdkColor *cds_draw,
-                            GdkColor *cds_border)
+static void get_exon_regions(ZMapSpan exon_cds, ZMapSpan utr_one, ZMapSpan utr_two,
+			     double cds_start, double cds_end, int *first_out, int *last_out)
 {
-  ZMapWindowItemFeature exon_data_ptr, tmp_data_ptr; 
-  FooCanvasItem *exon_box, *utr_box;
-  GdkColor *exon_fill, *exon_outline;
-  int non_start, non_end ;
-  
-  /* create a ZMapWindowItemFeature for the exon, this will be attached later */
-  tmp_data_ptr = exon_data_ptr = g_new0(ZMapWindowItemFeatureStruct, 1) ;
-  /* tmp_data_ptr == exon_data_ptr for original box in case 
-   * cds_start > exon_start && cds_end < exon_end  */
-  exon_data_ptr->start   = exon_span->x1;
-  exon_data_ptr->end     = exon_span->x2;
-  exon_data_ptr->subpart = ZMAPFEATURE_SUBPART_EXON ;
-  
-  /* If any of the cds is in this exon we colour the whole exon as a cds and then
-   * overlay non-cds parts. For the cds part we use the foreground colour, else it's the background. 
-   * If background is null though outline will need to be set to what background would be and 
-   * background should then = NULL */
-  if (has_cds)
+  int first = 0, last = 0;
+
+  if((cds_start > exon_cds->x2) || (cds_end < exon_cds->x1))
     {
-      if ((cds_start > bottom) || (cds_end < top))
-        {
-          has_cds = FALSE;      /* This exon is not a exon of the CDS */
+      first = last = 1;
+      utr_one->x1  = exon_cds->x1;
+      utr_one->x2  = exon_cds->x2;
+      exon_cds->x1 = exon_cds->x2 = 0.0;
+    }  
+  else
+    {
+      if((cds_start > exon_cds->x1) && (cds_start <= exon_cds->x2))
+	{
+	  utr_one->x1  = exon_cds->x1;
+	  /* These are the same so they butt up  */
+	  utr_one->x2  = cds_start; 
+	  exon_cds->x1 = cds_start;
+	  last++;
+	}
+      if((cds_end >= exon_cds->x1) && (cds_end < exon_cds->x2))
+	{
+	  ZMapSpan utr_ptr = utr_one;
 
-	  exon_fill = background ;
-	  exon_outline = outline ;
-        }
-      else
-        {
-          /* At least some part of the exon is CDS... */
-          exon_data_ptr->subpart = ZMAPFEATURE_SUBPART_EXON_CDS ;
-          
-	  exon_fill = cds_fill ;
-	  exon_outline = cds_border ;
-        }
+	  if(last == 1)
+	    utr_ptr = utr_two;
+	  
+	  utr_ptr->x2  = exon_cds->x2;
+	  utr_ptr->x1  = cds_end;
+	  exon_cds->x2 = cds_end;
+
+	  last++;
+	}
     }
+
+  if(first_out)
+    *first_out = first;
+  if(last_out)
+    *last_out  = last;
+
+  return ;
+}
+
+static void new_draw_feature_exon(FooCanvasItem *feature_item,
+				  double feature_offset,
+				  double item_top,   double item_bottom,
+				  double cds_start,  double cds_end,
+				  double item_right, double line_width,
+				  gboolean has_cds)
+{
+  ZMapWindowCanvasItem canvas_item;
+  ZMapSpanStruct regions[3] = {{0}};
+  int j, last, first, top;
+  int cds_idx = 0;
+  gboolean cdsless_use_utr_colours = TRUE;
+
+  regions[cds_idx].x1 = item_top;
+  regions[cds_idx].x2 = item_bottom;
+
+  /* top != feature_offset */
+  top = (FOO_CANVAS_GROUP(feature_item))->ypos;
+
+  if(has_cds)
+    get_exon_regions(&regions[0], &regions[1], &regions[2], 
+		     cds_start, cds_end, &first, &last);
+  else if(!cdsless_use_utr_colours)
+    first = last = cds_idx;
   else
     {
-      exon_fill = background ;
-      exon_outline = outline ;
+      int utr_idx = 1;
+      regions[utr_idx] = regions[cds_idx]; /* struct copy */
+      first = last = utr_idx;
     }
 
-  exon_box = zMapDrawSSPolygon(parent, 
-                               (zMapStyleIsDirectionalEnd(style) ? ZMAP_POLYGON_POINTING : ZMAP_POLYGON_SQUARE), 
-                               left, right,
-                               top, bottom,
-                               exon_outline, 
-                               exon_fill,
-                               line_width,
-                               feature->strand);
-  callItemHandler(factory, exon_box, ITEM_FEATURE_CHILD, feature, exon_data_ptr, top, bottom);
+  canvas_item = ZMAP_CANVAS_ITEM(feature_item);
+
+  /* draw the cds [0] over the utr [1,2] */
+  for(j = last; j >= first; --j)
+    {
+      FooCanvasItem *exon_item = NULL;
+      ZMapWindowItemFeature exon_data;
+
+      exon_data = g_new0(ZMapWindowItemFeatureStruct, 1);
+      /* actual start will be canvas coord + feature_offset */
+      exon_data->start = regions[j].x1 + feature_offset;
+      exon_data->end   = regions[j].x2;
+      /* we have to translate these to the feature_item coord space */
+      regions[j].x2   -= top;
+      regions[j].x1   -= top;
+
+      /* Do something about data here... */
+      if(j == cds_idx)
+	{
+	  exon_data->subpart = ZMAPFEATURE_SUBPART_EXON_CDS;
+	  zMapWindowCanvasItemSetIntervalType(canvas_item, ZMAP_WINDOW_TRANSCRIPT_EXON_CDS);
+	}
+      else
+	{
+	  exon_data->subpart = ZMAPFEATURE_SUBPART_EXON;
+	  zMapWindowCanvasItemSetIntervalType(canvas_item, ZMAP_WINDOW_TRANSCRIPT_EXON);
+	}
+
+      exon_item = zMapWindowCanvasItemAddInterval(canvas_item,
+						  exon_data,
+						  (double)(regions[j].x1),
+						  (double)(regions[j].x2),
+						  (double)0.0, 
+						  (double)item_right);
+
+    }
+
+  return ;
+}
+
+static gboolean invoke_size_request(ZMapWindowFToIFactory factory,
+				    ZMapFeature           feature,
+				    double *start, double *end)
+{
+  ZMapWindowFToIFactoryItemFeatureSizeRequest feature_size_request;
+  double points_inout[] = {0.0, 0.0, 0.0, 0.0};
+  gboolean drawable = FALSE;
   
-  if (has_cds)
+  if(start && end)
     {
-      utr_box = NULL;
+      feature_size_request = factory->user_funcs->feature_size_request;
 
-      /* Watch out for the conditions on the start/end here... */
-      if ((cds_start > top) && (cds_start <= bottom))
-        {
-          utr_box = zMapDrawAnnotatePolygon(exon_box,
-                                            (feature->strand == ZMAPSTRAND_REVERSE ? 
-                                             ZMAP_ANNOTATE_UTR_LAST
-                                             : ZMAP_ANNOTATE_UTR_FIRST),
-                                            outline,
-                                            background,
-                                            cds_start,
-                                            line_width,
-                                            feature->strand) ;
-          
-          if (utr_box)
-            {
-              non_start = top ;
-              non_end = top + (cds_start - top) - 1 ;
-              
-              /* set the cds box's exon_data_ptr while we still have ptr 2 it */
-              /* Without this the cds part retains the coords of the FULL exon! */
-              tmp_data_ptr->start = non_end + offset + 1 ;
-              
-              exon_data_ptr        = g_new0(ZMapWindowItemFeatureStruct, 1) ;
-              exon_data_ptr->subpart = ZMAPFEATURE_SUBPART_EXON ;
-              exon_data_ptr->start = non_start + offset ;
-              exon_data_ptr->end   = non_end + offset ;
-              
-              callItemHandler(factory, utr_box, ITEM_FEATURE_CHILD, feature, exon_data_ptr, non_start, non_end);
-            }
-        }
-      if ((cds_end >= top) && (cds_end < bottom))
-        {
-          utr_box = zMapDrawAnnotatePolygon(exon_box,
-                                            (feature->strand == ZMAPSTRAND_REVERSE ? 
-                                             ZMAP_ANNOTATE_UTR_FIRST
-                                             : ZMAP_ANNOTATE_UTR_LAST),
-                                            outline,
-                                            background,
-                                            cds_end,
-                                            line_width,
-                                            feature->strand) ;
-          
-          if (utr_box)
-            {
-              non_start = bottom - (bottom - cds_end) - 1 ;
-              non_end = bottom ;
-              
-              /* set the cds box's exon_data_ptr while we still have ptr 2 it */
-              /* Without this the cds part retains the coords of the FULL exon! */
-              tmp_data_ptr->end = non_start + offset - 1 ;
-              
-              exon_data_ptr = g_new0(ZMapWindowItemFeatureStruct, 1) ;
-              exon_data_ptr->subpart = ZMAPFEATURE_SUBPART_EXON ;
-              exon_data_ptr->start = non_start + offset ;
-              exon_data_ptr->end   = non_end + offset - 1 ; /* - 1 because non_end
-                                                           calculated from bottom
-                                                           which covers the last base. */
-              
-              callItemHandler(factory, utr_box, ITEM_FEATURE_CHILD, feature, exon_data_ptr, non_start, non_end);
-            }
-        }
+      points_inout[1] = *start;
+      points_inout[3] = *end;
+
+      if(!((feature_size_request)(feature, factory->limits, 
+				  &points_inout[0], factory->user_data)))
+	{
+	  drawable = TRUE;
+	  *start   = points_inout[1];
+	  *end     = points_inout[3];
+	}
+    }
+
+  return drawable;
+}
+
+static gboolean clip_feature_coords(ZMapWindowFToIFactory factory,
+				    ZMapFeature           feature,
+				    double                offset,
+				    double               *start_inout,
+				    double               *end_inout)
+{
+  gboolean drawable = FALSE;
+
+  /* make sure we're within the block size we're drawing */
+  if((drawable = invoke_size_request(factory, feature, start_inout, end_inout)))
+    {
+      /* alter the start and end to be block coords "zeroed" in block space */
+      /* N.B. That the end is extended + 1, as that's how we draw items. */
+      zmapWindowSeq2CanOffset(start_inout, end_inout, offset);
     }
 
-  return;
+  return drawable;
 }
 
 static FooCanvasItem *drawTranscriptFeature(RunSet run_data,  ZMapFeature feature,
@@ -1414,266 +1406,160 @@ static FooCanvasItem *drawTranscriptFeature(RunSet run_data,  ZMapFeature featur
                                             ZMapFeatureTypeStyle style)
 {
   ZMapWindowFToIFactory factory = run_data->factory;
-  /*  ZMapFeatureBlock        block = run_data->block; */
   FooCanvasGroup        *parent = run_data->container;
-  FooCanvasItem *feature_item ;
-  gboolean has_cds = FALSE;
-  gboolean status ;
-  GdkColor *outline = NULL, *foreground = NULL, *background = NULL ;
-  GdkColor *cds_border = NULL, *cds_draw = NULL, *cds_fill = NULL ;
-  guint line_width;
-  GdkColor *intron_fill = NULL;
-  int i ;
-  double offset ;
-
-
-  if (feature->feature.transcript.flags.cds)
-    has_cds = TRUE ;
-
+  FooCanvasItem   *feature_item = run_data->canvas_item;
+  ZMapWindowCanvasItem canvas_item;
+  gboolean has_cds = FALSE, status = TRUE;
+  double cds_start = 0.0, cds_end = 0.0 ; /* cds_start < cds_end */
+  double feature_start, feature_end;
+  double item_left, item_right;
 
-  /* NOT SURE THIS SHOULD BE AN ASSERT HERE...BETTER TO DEAL WITH THIS BY NOT DRAWING THIS COL
-   * AT ALL...perhaps that's what the assert is about ??? */
-  status = zMapStyleGetColours(style, ZMAPSTYLE_COLOURTARGET_NORMAL, ZMAPSTYLE_COLOURTYPE_NORMAL,
-			       &background, &foreground, &outline) ;
-  zMapAssert(status) ;
+  feature_start = y1;
+  feature_end   = y2;
 
+  zmapWindowSeq2CanOffset(&feature_start, &feature_end, feature_offset) ;  
 
-  if (has_cds)
+  if(status)
     {
-      /* cds will default to normal colours if its own colours are not set. */
-      if (!(status = zMapStyleGetColours(style, ZMAPSTYLE_COLOURTARGET_CDS, ZMAPSTYLE_COLOURTYPE_NORMAL,
-					 &cds_fill, &cds_draw, &cds_border)))
+      if(!feature_item)
+	{
+	  canvas_item = zMapWindowCanvasItemCreate(parent, feature_start, feature, style);
+	  feature_item = FOO_CANVAS_ITEM(canvas_item);
+	}
+      else
 	{
-	  cds_fill = background ;
-	  cds_draw = foreground ;
-	  cds_border = outline ;
-
-	  zMapLogWarning("Feature \"%s\" of feature set \"%s\" has a CDS but it's style, \"%s\","
-			 "has no CDS colours set.",
-			 g_quark_to_string(feature->original_id),
-			 g_quark_to_string(feature->parent->original_id),
-			 zMapStyleGetName(style)) ;
+	  canvas_item = ZMAP_CANVAS_ITEM(feature_item);
+	  zMapWindowCanvasItemClear(canvas_item);
+	  foo_canvas_item_set(feature_item, "y", feature_start, NULL);
 	}
     }
 
-
-
-
-  line_width = factory->line_width ;
-
-  intron_fill = outline ;
-
-  
-  if (feature->feature.transcript.introns && feature->feature.transcript.exons)
+  if(status && feature->feature.transcript.flags.cds)
     {
-      double feature_start, feature_end;
-      double cds_start = 0.0, cds_end = 0.0 ; /* cds_start < cds_end */
-      FooCanvasGroup *feature_group ;
-      double *limits        = factory->limits;
-      double points_inout[] = {0.0, 0.0, 0.0, 0.0};
-
-      feature_start = feature->x1;
-      feature_end   = feature->x2; /* I want this function to find these values */
-
-      zmapWindowSeq2CanOffset(&feature_start, &feature_end, feature_offset) ;
-
-      feature_item  = createParentGroup(parent, feature, feature_start);
-      feature_group = FOO_CANVAS_GROUP(feature_item);
-
-      /* Calculate total offset for subparts of the feature. */
-      /* We could look @ foo_canavs_group->ypos, but locks us 2 the vertical! */
-      offset = feature_start + feature_offset ;
+      has_cds = TRUE;
 
       /* Set up the cds coords if there is one. */
-      if (feature->feature.transcript.flags.cds)
+      cds_start = feature->feature.transcript.cds_start ;
+      cds_end   = feature->feature.transcript.cds_end ;
+      
+      /* clip the coords to the block, extending end to canvas drawing coords. */
+      /* we _must_ do this to the cds as it will be compared later to the exon coords */
+      if(!clip_feature_coords(factory, feature, feature_offset, &cds_start, &cds_end))
         {
-          cds_start = points_inout[1] = feature->feature.transcript.cds_start ;
-          cds_end   = points_inout[3] = feature->feature.transcript.cds_end ;
-          zMapAssert(cds_start < cds_end);
-          
-          /* I think this is correct...???? */
-          if (!((factory->user_funcs->feature_size_request)(feature, &limits[0], 
-                                                           &points_inout[0], 
-                                                           factory->user_data)))
-            {
-              cds_start = points_inout[1];
-              cds_end   = points_inout[3];
-              zmapWindowSeq2CanOffset(&cds_start, &cds_end, offset) ;
-            }
+	  g_warning("CDS coords clipped");
+	}
+    }
 
-        }
+  item_left  = x1;
+  item_right = x2 - factory->line_width;
+
+  if (status && feature_item &&
+      feature->feature.transcript.introns && 
+      feature->feature.transcript.exons)
+    {
+      double line_width = 1.5;
+      double parent_ypos = 0.0;
+      int i;
+      
+      parent_ypos = FOO_CANVAS_GROUP(feature_item)->ypos;
+      
+      zMapWindowCanvasItemSetIntervalType(canvas_item, ZMAP_WINDOW_TRANSCRIPT_INTRON);
 
-      /* first we draw the introns, then the exons.  Introns will have an invisible
-       * box around them to allow the user to click there and get a reaction.
-       * It's a bit hacky but the bounding box has the same coords stored on it as
-       * the intron...this needs tidying up because its error prone, better if they
-       * had a surrounding group.....e.g. what happens when we free ?? */
-      if (feature->feature.transcript.introns)
+      for (i = 0 ; i < feature->feature.transcript.introns->len ; i++)  
 	{
-          float line_width = 1.5 ;
-          GdkColor *line_fill = intron_fill;
-          double dimension = 1.5 ;
+	  ZMapWindowItemFeature intron;
+	  FooCanvasItem  *intron_line ;
+	  double item_top, item_bottom ;
+	  ZMapSpan intron_span ;
+	  
+	  intron_span = &g_array_index(feature->feature.transcript.introns, ZMapSpanStruct, i) ;
+	  
+	  item_top    = intron_span->x1;
+	  item_bottom = intron_span->x2;
 
-	  for (i = 0 ; i < feature->feature.transcript.introns->len ; i++)  
-	    {
-	      FooCanvasItem *intron_box, *intron_line ;
-	      double left, right, top, bottom ;
-	      ZMapWindowItemFeature box_data, intron_data ;
-	      ZMapSpan intron_span ;
-
-	      intron_span = &g_array_index(feature->feature.transcript.introns, ZMapSpanStruct, i) ;
-
-	      left   = x1;
-	      right  = x2 - (double)line_width ;
-              top    = points_inout[1] = intron_span->x1;
-              bottom = points_inout[3] = intron_span->x2;
-
-              if((factory->user_funcs->feature_size_request)(feature, &limits[0], &points_inout[0], factory->user_data))
-                continue;
-
-              top    = points_inout[1];
-              bottom = points_inout[3];
-
-              box_data        = g_new0(ZMapWindowItemFeatureStruct, 1) ;
-              box_data->start = intron_span->x1;
-              box_data->end   = intron_span->x2;
-
-              intron_data        = g_new0(ZMapWindowItemFeatureStruct, 1) ;
-	      intron_data->subpart = ZMAPFEATURE_SUBPART_INTRON ;
-              intron_data->start = intron_span->x1;
-              intron_data->end   = intron_span->x2;
-
-              zmapWindowSeq2CanOffset(&top, &bottom, offset);
-              intron_box = zMapDrawSSPolygon(feature_item, 
-                                             ZMAP_POLYGON_SQUARE, 
-                                             left, right,
-                                             top, bottom,
-                                             NULL, NULL,
-					     line_width,
-                                             feature->strand);
-
-              callItemHandler(factory, intron_box, ITEM_FEATURE_BOUNDING_BOX, feature, box_data, top, bottom);
-
-              /* IF we are part of CDS we need to set intron_fill to foreground */
-              /* introns will be completely contained */
-#ifdef RDS_FMAP_DOESNT_DO_THIS
-              if(has_cds && 
-                 ((cds_start < top) && (cds_end >= bottom)) )
-                line_fill = foreground;
-              else
-                line_fill = intron_fill;
-#endif
-              intron_line = zMapDrawAnnotatePolygon(intron_box,
-                                                    ZMAP_ANNOTATE_INTRON, 
-                                                    NULL,
-                                                    line_fill,
-						    dimension,
-                                                    line_width,
-                                                    feature->strand);
-              callItemHandler(factory, intron_line, ITEM_FEATURE_CHILD, feature, intron_data, top, bottom);
-                  
-              intron_data->twin_item = intron_box;
-              box_data->twin_item    = intron_line;
-              
-            }
+	  /* clip the coords to the block, extending end to canvas drawing coords. */
+	  if(!clip_feature_coords(factory, feature, feature_offset, &item_top, &item_bottom))
+	    continue;
 
+	  /* set up the item sub feature data */
+	  intron          = g_new0(ZMapWindowItemFeatureStruct, 1);
+	  intron->start   = intron_span->x1;
+	  intron->end     = intron_span->x2;
+	  intron->subpart = ZMAPFEATURE_SUBPART_INTRON;
+
+	  /* this is a sub item we're drawing _within_ the feature_item,
+	   * so we need to zero in its space. new_draw_feature_exon does
+	   * this for exons */
+	  item_top       -= parent_ypos;
+	  item_bottom    -= parent_ypos;
+
+	  /* And draw the item. */
+	  intron_line     = zMapWindowCanvasItemAddInterval(canvas_item, intron,
+							    item_top, item_bottom,
+							    item_left, item_right);
 	}
-
-
-      if (feature->feature.transcript.exons)
+      
+      for (i = 0; i < feature->feature.transcript.exons->len; i++)
 	{
+	  ZMapSpan exon_span ;
+	  double item_top, item_bottom ;
+	  
+	  exon_span = &g_array_index(feature->feature.transcript.exons, ZMapSpanStruct, i);
+	  
+	  item_top    = exon_span->x1;
+	  item_bottom = exon_span->x2;
+	  
+	  /* clip the coords to the block, extending end to canvas drawing coords. */
+	  if (!clip_feature_coords(factory, feature, feature_offset, &item_top, &item_bottom))
+	    continue;
 
-	  for (i = 0; i < feature->feature.transcript.exons->len; i++)
-	    {
-	      ZMapSpan exon_span ;
-	      double top, bottom ;
-
-	      exon_span = &g_array_index(feature->feature.transcript.exons, ZMapSpanStruct, i);
-
-              top    = points_inout[1] = exon_span->x1;
-              bottom = points_inout[3] = exon_span->x2;
-
-              if ((factory->user_funcs->feature_size_request)(feature, &limits[0],
-							      &points_inout[0], factory->user_data))
-                continue;
-
-              top    = points_inout[1];
-              bottom = points_inout[3];
-
-              zmapWindowSeq2CanOffset(&top, &bottom, offset) ;
-
-              drawFeatureExon(factory, feature_item, feature, 
-                              exon_span, style, 
-                              x1, x2, top, bottom, offset,
-                              cds_start, cds_end, line_width, 
-                              background, foreground, outline,
-			      has_cds, cds_fill, cds_draw, cds_border);
-            }
+	  new_draw_feature_exon(feature_item, feature_offset,
+				item_top, item_bottom, 
+				cds_start, cds_end,
+				item_right, line_width, has_cds);
 	}
     }
-  else
+  else if(status && feature_item)
     {
-      ZMapSpanStruct exon_span = {0,0};
-      double top, bottom, feature_start;
-      double *limits        = factory->limits;
-      double points_inout[] = {0.0, 0.0, 0.0, 0.0};
-      double cds_start = 0.0, cds_end = 0.0; /* cds_start < cds_end */
-      gboolean has_cds = FALSE;
+      double item_top, item_bottom;
       float line_width = 1.5 ;
-
-      feature_start = exon_span.x1 = feature->x1;
-      exon_span.x2  = feature->x2;
-      feature_item  = createParentGroup(parent, feature, feature_start);
-
-      offset = feature_start + feature_offset ;
-      top    = points_inout[1] = exon_span.x1;
-      bottom = points_inout[3] = exon_span.x2;
-      
-      if (!(factory->user_funcs->feature_size_request)(feature, &limits[0],
-                                                      &points_inout[0], factory->user_data))
-        {
       
-	  top    = points_inout[1];
-	  bottom = points_inout[3];
-      
-	  zmapWindowSeq2CanOffset(&top, &bottom, offset) ;
-
-	  /* Set up the cds coords if there is one. */
-	  if(feature->feature.transcript.flags.cds)
-	    {
-	      cds_start = points_inout[1] = feature->feature.transcript.cds_start ;
-	      cds_end   = points_inout[3] = feature->feature.transcript.cds_end ;
-	      zMapAssert(cds_start < cds_end);
-	      has_cds   = TRUE;
-          
-	      /* I think this is correct...???? */
-	      if(!((factory->user_funcs->feature_size_request)(feature, &limits[0], 
-							       &points_inout[0], 
-							       factory->user_data)))
-		{
-		  cds_start = points_inout[1];
-		  cds_end   = points_inout[3];
-		  zmapWindowSeq2CanOffset(&cds_start, &cds_end, offset) ;
-		}
-	      
-	    }
-
+      /* item_top gets feature_offset added and item_bottom gets 1 added, 
+       * as feature_start & feature_end have already been through 
+       * zmapWindowSeq2CanOffset(), but we still need to clip_feature_coords(). */
+      item_top    = feature_start + feature_offset;
+      item_bottom = feature_end   + feature_offset - 1.0;
       
+      /* clip the coords to the block, extending end to canvas drawing coords. */
+      if(clip_feature_coords(factory, feature, feature_offset, &item_top, &item_bottom))
+	{
 	  /* This is a single exon transcript.  We can't just get away
 	   * with using the simple feature code.. Single exons may have a
 	   * cds */
-
-	  /* need to sort out top and bottom! */
-	  drawFeatureExon(factory, feature_item, feature, 
-			  &exon_span, style,
-			  x1, x2, top, bottom, offset,
-			  cds_start, cds_end, line_width, 
-			  background, foreground, outline,
-			  has_cds, cds_fill, cds_draw, cds_border);
-        }
+	  new_draw_feature_exon(feature_item, feature_offset,
+				item_top, item_bottom, 
+				cds_start, cds_end,
+				item_right, line_width, has_cds);
+	}
     }
-  
-  return feature_item ;
+  else
+    {
+      zMapLogWarning("Must have failed to create a canvas item for feature '%s' [%s]",
+		     g_quark_to_string(feature->original_id),
+		     g_quark_to_string(feature->unique_id));
+    }
+
+  if(feature_item)
+    {
+      GError *error = NULL;
+      if(!(zMapWindowCanvasItemCheckData(canvas_item, &error)))
+	{
+	  zMapLogCritical("Error: %s", (error ? error->message : "No error produced"));
+	  g_error_free(error);
+	}
+    }	
+
+  return feature_item;
 }
 
 static FooCanvasItem *drawSeqFeature(RunSet run_data,  ZMapFeature feature,
@@ -1836,7 +1722,7 @@ static gint canvas_fetch_feature_text_cb(FooCanvasItem *text_item,
 					 gpointer user_data)
 {
   ZMapFeature feature = (ZMapFeature)user_data;
-  ZMapFeatureAny feature_any = (ZMapFeatureAny)user_data;
+  /*  ZMapFeatureAny feature_any = (ZMapFeatureAny)user_data; */
   char *buffer_ptr = buffer_in_out;
   char *seq = NULL, *seq_ptr;
   int itr, start;
@@ -1941,7 +1827,7 @@ static gboolean item_to_char_cell_coords2(FooCanvasPoints **points_out,
   ZMapFeature subject_feature, overlay_feature;
   FooCanvasPoints *points;
   double first[ITEMTEXT_CHAR_BOUND_COUNT], last[ITEMTEXT_CHAR_BOUND_COUNT];
-  int index1, index2, tmp;
+  int index1, index2;
   gboolean first_found, last_found;
   gboolean do_overlay = FALSE;
   gboolean redraw = FALSE;
@@ -1952,7 +1838,7 @@ static gboolean item_to_char_cell_coords2(FooCanvasPoints **points_out,
       overlay_group = FOO_CANVAS_GROUP(user_data);
       overlay_item  = FOO_CANVAS_ITEM(overlay_group->item_list->data);
 
-      container = zmapWindowContainerGetParentContainerFromItem(overlay_item);
+      container = (FooCanvasGroup *)zmapWindowContainerCanvasItemGetContainer(overlay_item);
 
       do_overlay = (gboolean)(FOO_CANVAS_ITEM(container)->object.flags & FOO_CANVAS_ITEM_VISIBLE);
     }
@@ -2085,8 +1971,8 @@ static gboolean item_to_char_cell_coords2(FooCanvasPoints **points_out,
 
   if(do_overlay)
     {
-      /* SWAP MACRO? */
-      if(index1 > index2){ tmp = index1; index1 = index2; index2 = tmp; }
+      if(index1 > index2)
+	ZMAP_SWAP_TYPE(int, index1, index2);
 
       /* From the text indices, get the bounds of that char */
       first_found = zmapWindowItemTextIndex2Item(overlay_item, index1, &first[0]);
@@ -2183,7 +2069,7 @@ static FooCanvasItem *drawFullColumnTextFeature(RunSet run_data,  ZMapFeature fe
 
   my_foo_canvas_item_goto(feature_parent, &new_x, NULL);
 
-  column_parent = zmapWindowContainerGetParent(FOO_CANVAS_ITEM(parent)) ;
+  column_parent = (FooCanvasGroup *)zmapWindowContainerCanvasItemGetContainer(FOO_CANVAS_ITEM(parent)) ;
 
   if (!factory->font_desc)
     zMapFoocanvasGetTextDimensions(FOO_CANVAS_ITEM(feature_parent)->canvas, 
@@ -2241,19 +2127,30 @@ static FooCanvasItem *drawSimpleAsTextFeature(RunSet run_data, ZMapFeature featu
                                               double x1, double y1, double x2, double y2,
                                               ZMapFeatureTypeStyle style)
 {
-  ZMapWindowFToIFactory factory = run_data->factory;
+  /*  ZMapWindowFToIFactory factory = run_data->factory; */
   FooCanvasGroup        *parent = run_data->container;
-  FooCanvasItem *item = NULL;
+  FooCanvasItem *item = NULL, *text_item = NULL;
+  ZMapWindowCanvasItem canvas_item;
+  double parent_ypos;
   char *text_string = NULL;
-  char *text_colour = "black";
   
   text_string = (char *)g_quark_to_string(feature->locus_id);
 
-  item = zMapDisplayText(parent, text_string, 
-                         text_colour, 0.0, y1);
-  
-  callItemHandler(factory, item, ITEM_FEATURE_SIMPLE, feature, NULL, y1, y1);
-    
+  zmapWindowSeq2CanOffset(&y1, &y2, feature_offset);
+
+  canvas_item = zMapWindowCanvasItemCreate(parent, y1, feature, style);
+  item        = FOO_CANVAS_ITEM(canvas_item);
+  parent_ypos = FOO_CANVAS_GROUP(item)->ypos;
+
+  y1 -= parent_ypos;
+  y2 -= parent_ypos;
+
+  text_item = zMapWindowCanvasItemAddInterval(canvas_item, NULL, y1, y2, x1, x2);
+
+  foo_canvas_item_set(text_item,
+		      "text",       text_string,
+		      NULL);
+
   return item;
 }
 
@@ -2471,6 +2368,84 @@ static void GapAlignBlockFromAdjacentBlocks(ZMapAlignBlock block_a, ZMapAlignBlo
   return ;
 }
 
+static void GapAlignBlockFromAdjacentBlocks2(ZMapAlignBlock block_a, ZMapAlignBlock block_b, 
+					     ZMapAlignBlockStruct *gap_span_out,
+					     gboolean *t_indel_gt_1,
+					     gboolean *q_indel_gt_1)
+{
+  if(gap_span_out)
+    {
+      int t_indel, q_indel, t_order = 0, q_order = 0;
+      gboolean t = FALSE, q = FALSE;
+
+      /* ordering == -1 when a < b, and == +1 when a > b. 
+       * If it ends up as 0 they equal and this is BAD */
+
+      /* First copy across the strand to the gap span */
+      gap_span_out->q_strand = block_a->q_strand;
+      gap_span_out->t_strand = block_a->t_strand;
+
+
+      /* get orders... */
+      /* q1 < q2 _always_! so a->q2 < b->q1 means a < b and v.v.*/
+
+      if(block_a->t2 < block_b->t1)
+	{
+	  t_order = -1;
+	  gap_span_out->t1 = block_a->t2;
+	  gap_span_out->t2 = block_b->t1;
+	}
+      else
+	{
+	  t_order =  1;
+	  gap_span_out->t1 = block_b->t2;
+	  gap_span_out->t2 = block_a->t1;
+	}
+
+      if(block_a->q2 < block_b->q1)
+	{
+	  q_order = -1;
+	  gap_span_out->q1 = block_a->q2;
+	  gap_span_out->q2 = block_b->q1;
+	}
+      else
+	{
+	  q_order =  1;
+	  gap_span_out->q1 = block_b->q2;
+	  gap_span_out->q2 = block_a->q1;
+	}
+
+      /* What are the indels?  */
+      t_indel = gap_span_out->t2 - gap_span_out->t1;
+      q_indel = gap_span_out->q2 - gap_span_out->q1;
+
+      /* If we've got an indel then the gap is actually + and - 1 from that.
+       * We need to let our caller know what we know though.
+       */
+      if(t_indel > 1)
+	{
+	  t = TRUE;
+	}
+
+      if(q_indel > 1)
+	{
+	  q = TRUE;
+	}
+
+      (gap_span_out->t1)++;
+      (gap_span_out->t2)--;
+      (gap_span_out->q1)++;
+      (gap_span_out->q2)--;
+
+      if(t_indel_gt_1)
+	*t_indel_gt_1 = t;
+      if(q_indel_gt_1)
+	*q_indel_gt_1 = q;
+    }
+
+  return ;
+}
+
 
 static FooCanvasItem *invalidFeature(RunSet run_data,  ZMapFeature feature,
                                      double feature_offset,
diff --git a/src/zmapWindow/zmapWindowItemFactory.h b/src/zmapWindow/zmapWindowItemFactory.h
index c618d0714c3b8771a23a906a7ec1cfa8cf7522bb..bf8fc78107e35307fd22a853899264ad891648d0 100755
--- a/src/zmapWindow/zmapWindowItemFactory.h
+++ b/src/zmapWindow/zmapWindowItemFactory.h
@@ -27,9 +27,9 @@
  *
  * Exported functions: See XXXXXXXXXXXXX.h
  * HISTORY:
- * Last edited: Feb  4 12:02 2008 (edgrif)
+ * Last edited: Dec 10 10:43 2008 (rds)
  * Created: Mon Sep 25 09:09:52 2006 (rds)
- * CVS info:   $Id: zmapWindowItemFactory.h,v 1.6 2008-02-07 14:20:39 edgrif Exp $
+ * CVS info:   $Id: zmapWindowItemFactory.h,v 1.7 2009-06-05 13:35:05 rds Exp $
  *-------------------------------------------------------------------
  */
 
@@ -81,6 +81,7 @@ void zmapWindowFToIFactoryRunSet(ZMapWindowFToIFactory factory,
                                  FooCanvasGroup *container,
                                  ZMapFrame frame);
 FooCanvasItem *zmapWindowFToIFactoryRunSingle(ZMapWindowFToIFactory factory, 
+					      FooCanvasItem        *current_item,
                                               FooCanvasGroup       *parent_container,
                                               ZMapFeatureContext    context, 
                                               ZMapFeatureAlignment  align, 
diff --git a/src/zmapWindow/zmapWindowItemText.c b/src/zmapWindow/zmapWindowItemText.c
index aea9dae0cda837fddb0436142b97e5791a86a138..e352cba927f4a8f02978051eeac2eba93efc2849 100755
--- a/src/zmapWindow/zmapWindowItemText.c
+++ b/src/zmapWindow/zmapWindowItemText.c
@@ -27,9 +27,9 @@
  *
  * Exported functions: See XXXXXXXXXXXXX.h
  * HISTORY:
- * Last edited: Apr  1 16:36 2009 (edgrif)
+ * Last edited: Jun  4 22:56 2009 (rds)
  * Created: Mon Apr  2 09:35:42 2007 (rds)
- * CVS info:   $Id: zmapWindowItemText.c,v 1.19 2009-04-06 13:43:10 edgrif Exp $
+ * CVS info:   $Id: zmapWindowItemText.c,v 1.20 2009-06-05 13:35:11 rds Exp $
  *-------------------------------------------------------------------
  */
 
@@ -38,7 +38,7 @@
 #include <string.h>
 #include <ZMap/zmapPeptide.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
+#include <zmapWindowContainerUtils.h>
 #include <zmapWindowItemTextFillColumn.h>
 
 #define SHOW_TRANSLATION_COUNTER_SIZE "5"
@@ -95,10 +95,10 @@ static gint canvas_fetch_show_transaltion_text_cb(FooCanvasItem *text_item,
 						  gint  buffer_size,
 						  gpointer user_data);
 
-static void show_translation_cb(FooCanvasGroup        *container, 
-				FooCanvasPoints       *this_points, 
-				ZMapContainerLevelType level, 
-				gpointer               user_data);
+static void show_translation_cb(ZMapWindowContainerGroup container,
+				FooCanvasPoints         *this_points, 
+				ZMapContainerLevelType   level, 
+				gpointer                 user_data);
 
 static int get_item_canvas_start(FooCanvasItem *item);
 
@@ -183,8 +183,8 @@ void zmapWindowItemTextOverlayFromCellBounds(FooCanvasPoints *overlay_points,
 void zmapWindowItemTextOverlayText2Overlay(FooCanvasItem   *item, 
 					   FooCanvasPoints *points)
 {
-  FooCanvasGroup *container_parent;
-  FooCanvasGroup *container_overlay;
+  ZMapWindowContainerGroup container_parent;
+  ZMapWindowContainerOverlay container_overlay;
   FooCanvasItem  *overlay_item;
   int i;
 
@@ -193,8 +193,8 @@ void zmapWindowItemTextOverlayText2Overlay(FooCanvasItem   *item,
       foo_canvas_item_i2w(item, &(points->coords[i]), &(points->coords[i+1]));
     }
 
-  container_parent  = zmapWindowContainerGetParentContainerFromItem(item);
-  container_overlay = zmapWindowContainerGetOverlays(container_parent);
+  container_parent  = zmapWindowContainerCanvasItemGetContainer(item);
+  container_overlay = zmapWindowContainerGetOverlay(container_parent);
   overlay_item      = FOO_CANVAS_ITEM(container_overlay);
 
   for(i = 0; i < points->num_points * 2; i++, i++)
@@ -319,7 +319,7 @@ void zmapWindowItemShowTranslation(ZMapWindow window, FooCanvasItem *feature_to_
 							FOO_CANVAS_GROUP(translation_column)};
 	  /* This calls ContainerExecuteFull() why can't we combine them ;) */
 	  zmapWindowColOrderColumns(window); /* Mainly because this one stops at STRAND level */
-	  show_translation.style = zmapWindowContainerGetStyle(FOO_CANVAS_GROUP(translation_column)) ;
+	  show_translation.style = zmapWindowContainerFeatureSetStyleFromID((ZMapWindowContainerFeatureSet)(translation_column), feature->style_id) ;
 	  /* I'm not sure which is the best way to go here.  Do a
 	   * ContainerExecuteFull() with a redraw, or do the stuff then a
 	   * FullReposition() */
@@ -1300,17 +1300,17 @@ static FooCanvasItem *draw_show_translation(FooCanvasGroup *container_features,
   return item;
 }
 
-static void show_translation_cb(FooCanvasGroup        *container, 
-				FooCanvasPoints       *this_points, 
-				ZMapContainerLevelType level, 
-				gpointer               user_data)
+static void show_translation_cb(ZMapWindowContainerGroup container_group, 
+				FooCanvasPoints         *this_points, 
+				ZMapContainerLevelType   level, 
+				gpointer                 user_data)
 {
   ShowTranslationData show_data = (ShowTranslationData)user_data; 
+  FooCanvasGroup *container = (FooCanvasGroup *)container_group;
 
   if(level == ZMAPCONTAINER_LEVEL_FEATURESET && 
      (show_data->translation_column) == container)
     {
-      ZMapWindowItemFeatureSetData feature_set_data;
       ZMapFeatureSet feature_set;
       ZMapFeatureBlock feature_block;
       ZMapFeature feature;
@@ -1320,14 +1320,13 @@ static void show_translation_cb(FooCanvasGroup        *container,
       /* We've found the column... */
       /* Create the features */
 
-      feature_set_data   = g_object_get_data(G_OBJECT(container), ITEM_FEATURE_SET_DATA);
-      feature_set        = g_object_get_data(G_OBJECT(container), ITEM_FEATURE_DATA);
-      feature_block      = (ZMapFeatureBlock)(zMapFeatureGetParentGroup((ZMapFeatureAny)feature_set, ZMAPFEATURE_STRUCT_BLOCK));
-      feature            = show_data->feature;
+      feature_set   = g_object_get_data(G_OBJECT(container), ITEM_FEATURE_DATA);
+      feature_block = (ZMapFeatureBlock)(zMapFeatureGetParentGroup((ZMapFeatureAny)feature_set, ZMAPFEATURE_STRUCT_BLOCK));
+      feature       = show_data->feature;
 
-      container_features = zmapWindowContainerGetFeatures(container);
+      container_features = (FooCanvasGroup *)zmapWindowContainerGetFeatures(container_group);
 
-      zmapWindowContainerPurge(container_features);
+      zmapWindowContainerFeatureSetRemoveAllItems((ZMapWindowContainerFeatureSet)container_group);
 
       item = draw_show_translation(container_features, feature, 
 				   feature_block->block_to_sequence.q1,
diff --git a/src/zmapWindow/zmapWindowLongItems.c b/src/zmapWindow/zmapWindowLongItems.c
index 4d25bbc1af2116d0b6694bebfd2e5d9558ded7eb..a7332a1119c5f5a309365b6b0f654e47f0dfa276 100755
--- a/src/zmapWindow/zmapWindowLongItems.c
+++ b/src/zmapWindow/zmapWindowLongItems.c
@@ -34,16 +34,16 @@
  *
  * Exported functions: See zmapWindow_P.h
  * HISTORY:
- * Last edited: Apr 22 14:31 2008 (rds)
+ * Last edited: Jun  5 14:29 2009 (rds)
  * Created: Thu Sep  7 14:56:34 2006 (edgrif)
- * CVS info:   $Id: zmapWindowLongItems.c,v 1.16 2008-04-22 14:14:51 rds Exp $
+ * CVS info:   $Id: zmapWindowLongItems.c,v 1.17 2009-06-05 13:35:25 rds Exp $
  *-------------------------------------------------------------------
  */
 
 #include <string.h>
 #include <ZMap/zmapUtils.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
+#include <zmapWindowContainerUtils.h>
 
 
 /* struct to represent the scrolled region, plus a bit of cached canvas info */
@@ -348,7 +348,7 @@ void zmapWindowLongItemCrop(ZMapWindowLongItems long_items,
 {
   /* User function that forces cropping */
 
-  //long_items->force_crop = TRUE;
+  long_items->force_crop = TRUE;
 
   LongItemExposeCrop(long_items, x1, y1, x2, y2);
 
@@ -450,6 +450,8 @@ static void LongItemExposeCrop(ZMapWindowLongItems long_items,
                                double x1, double y1,
                                double x2, double y2)
 {
+  return ;
+
   if (long_items->long_feature_items)
     {
       WindowScrollRegionStruct func_data = {0.0}, *last_region;
@@ -743,7 +745,7 @@ static void save_long_item(LongFeatureItemStruct *long_item, double start, doubl
       long_item->pos.box.start = start ;
       long_item->pos.box.end   = end ;
     }
-  else
+  else if(!FOO_IS_CANVAS_ITEM(item))
     zMapAssertNotReached();
 
   long_item->extreme.y1 = start;
diff --git a/src/zmapWindow/zmapWindowMark.c b/src/zmapWindow/zmapWindowMark.c
index e15b5c3a871224b671b6675ae5c702823810bdaf..a706fce20b16fff3af396498d2ad67a834f19d68 100755
--- a/src/zmapWindow/zmapWindowMark.c
+++ b/src/zmapWindow/zmapWindowMark.c
@@ -27,15 +27,17 @@
  *
  * Exported functions: See zmapWindow_P.h
  * HISTORY:
- * Last edited: Apr 15 14:33 2009 (rds)
+ * Last edited: Jun  4 09:21 2009 (rds)
  * Created: Tue Jan 16 09:51:19 2007 (rds)
- * CVS info:   $Id: zmapWindowMark.c,v 1.15 2009-04-15 14:38:52 rds Exp $
+ * CVS info:   $Id: zmapWindowMark.c,v 1.16 2009-06-05 13:35:36 rds Exp $
  *-------------------------------------------------------------------
  */
 
 #include <ZMap/zmapUtils.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
+#include <zmapWindowCanvasItem.h>
+#include <zmapWindowContainerUtils.h>
+
 
 /* User can set a range (perhaps by selecting an item) for operations like zooming and bump options. */
 typedef struct _ZMapWindowMarkStruct
@@ -44,7 +46,7 @@ typedef struct _ZMapWindowMarkStruct
   gboolean        mark_set ;
   ZMapWindow      window ;
   FooCanvasItem  *range_item ;
-  FooCanvasGroup *block_group ;
+  ZMapWindowContainerBlock block_container;
   ZMapFeatureBlock block ;
   double world_x1, world_y1, world_x2, world_y2 ;
   int range_top, range_bottom ;
@@ -133,6 +135,8 @@ void zmapWindowMarkReset(ZMapWindowMark mark)
 
   if (mark->mark_set)
     {
+      zmapWindowContainerBlockUnmark(mark->block_container);
+
       if (mark->range_item)
 	{
 	  /* undo highlighting */
@@ -204,8 +208,8 @@ void zmapWindowMarkSetItem(ZMapWindowMark mark, FooCanvasItem *item)
   mark->range_top = feature->x1 - 1 ;
   mark->range_bottom = feature->x2 + 1 ;
 
-  mark->block_group = zmapWindowContainerGetParentLevel(mark->range_item, ZMAPCONTAINER_LEVEL_BLOCK) ;
-  mark->block = g_object_get_data(G_OBJECT(mark->block_group), ITEM_FEATURE_DATA) ;
+  mark->block_container = (ZMapWindowContainerBlock)zmapWindowContainerUtilsItemGetParentLevel(mark->range_item, ZMAPCONTAINER_LEVEL_BLOCK) ;
+  mark->block = g_object_get_data(G_OBJECT(mark->block_container), ITEM_FEATURE_DATA) ;
 
   markItem(mark, mark->range_item, TRUE) ;
 
@@ -260,8 +264,8 @@ gboolean zmapWindowMarkSetWorldRange(ZMapWindowMark mark,
     {
       double y1, y2, dummy;
 
-      mark->block_group = block_grp_out ;
-      mark->block = g_object_get_data(G_OBJECT(mark->block_group), ITEM_FEATURE_DATA) ;
+      mark->block_container = (ZMapWindowContainerBlock)block_grp_out ;
+      mark->block = g_object_get_data(G_OBJECT(mark->block_container), ITEM_FEATURE_DATA) ;
       mark->world_x1 = world_x1 ;
       mark->world_y1 = world_y1 ;
       mark->world_x2 = world_x2 ;
@@ -272,8 +276,8 @@ gboolean zmapWindowMarkSetWorldRange(ZMapWindowMark mark,
 
       y1 = mark->world_y1 ;
       y2 = mark->world_y2 ;
-      foo_canvas_item_w2i(FOO_CANVAS_ITEM(mark->block_group), &dummy, &y1) ;
-      foo_canvas_item_w2i(FOO_CANVAS_ITEM(mark->block_group), &dummy, &y2) ;
+      foo_canvas_item_w2i(FOO_CANVAS_ITEM(mark->block_container), &dummy, &y1) ;
+      foo_canvas_item_w2i(FOO_CANVAS_ITEM(mark->block_container), &dummy, &y2) ;
 
       markRange(mark, y1, y2) ;
 
@@ -358,6 +362,10 @@ static void markItem(ZMapWindowMark mark, FooCanvasItem *item, gboolean set_mark
 
   parent = item ;
 
+  setBoundingBoxColour(mark, parent, set_mark) ;
+
+  return ;
+
   if (FOO_IS_CANVAS_GROUP(parent))
     {
       HighlightStruct highlight_data = {NULL} ;
@@ -370,7 +378,6 @@ static void markItem(ZMapWindowMark mark, FooCanvasItem *item, gboolean set_mark
     }
   else
     {
-      setBoundingBoxColour(mark, parent, set_mark) ;
     }
 
   return ;
@@ -395,7 +402,7 @@ static void markRange(ZMapWindowMark mark, double y1, double y2)
 {
   double block_x1, block_y1, block_x2, block_y2, tmp_y1, tmp_y2 ;
 
-  foo_canvas_item_get_bounds(FOO_CANVAS_ITEM(mark->block_group), &block_x1, &block_y1, &block_x2, &block_y2) ;
+  foo_canvas_item_get_bounds(FOO_CANVAS_ITEM(mark->block_container), &block_x1, &block_y1, &block_x2, &block_y2) ;
 
   zmapWindowExt2Zero(&block_x1, &block_x2) ;
   zmapWindowExt2Zero(&block_y1, &block_y2) ;
@@ -424,28 +431,15 @@ static void markRange(ZMapWindowMark mark, double y1, double y2)
       block_y2 = tmp ;
     }
 
-
-  /* Only maximise overlays width on resize, do not change height. */
-  zmapWindowContainerSetOverlayResizing(mark->block_group, TRUE, FALSE) ;
-
-  mark->range_group = zmapWindowContainerGetOverlays(mark->block_group) ;
-
-  mark->top_range_item = zMapDrawBoxOverlay(FOO_CANVAS_GROUP(mark->range_group), 
-					    block_x1, block_y1, block_x2, tmp_y1, 
-					    &(mark->colour)) ;
-
-  zmapWindowLongItemCheck(mark->window->long_items, mark->top_range_item, block_y1, tmp_y1) ;
-
-  g_object_set_data(G_OBJECT(mark->top_range_item), "my_range_key", "top range item") ;
-
-
-  mark->bottom_range_item = zMapDrawBoxOverlay(FOO_CANVAS_GROUP(mark->range_group), 
-					       block_x1, tmp_y2, block_x2, block_y2, 
-					       &(mark->colour)) ;
-
-  zmapWindowLongItemCheck(mark->window->long_items, mark->bottom_range_item, tmp_y2, block_y2) ;
-
-  g_object_set_data(G_OBJECT(mark->bottom_range_item), "my_range_key", "bottom range item") ;
+  {
+    GdkColor  *mark_colour;
+    GdkBitmap *mark_stipple;
+    
+    mark_colour  = zmapWindowMarkGetColour(mark);
+    mark_stipple = mark->stipple;
+    
+    zmapWindowContainerBlockMark(mark->block_container, mark_colour, mark_stipple, tmp_y1, tmp_y2);
+  }
 
   mark->world_y1 = y1;
   mark->world_y2 = y2;
@@ -464,45 +458,18 @@ static void markRange(ZMapWindowMark mark, double y1, double y2)
  */
 static void setBoundingBoxColour(ZMapWindowMark mark, FooCanvasItem *item, gboolean highlight)
 {
-  ZMapWindowItemFeatureType item_feature_type ;
-  ZMapFeature item_feature = NULL;
-  ZMapFeatureTypeStyle style = NULL;
-
-
-  item_feature_type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(item), ITEM_FEATURE_TYPE)) ;
-  zMapAssert(item_feature_type != ITEM_FEATURE_INVALID) ;
-
-  item_feature = g_object_get_data(G_OBJECT(item), ITEM_FEATURE_DATA) ;
-  zMapAssert(item_feature) ;
-
-  style = zmapWindowItemGetStyle(item) ;
-  zMapAssert(style) ;
-
-  if (item_feature_type == ITEM_FEATURE_BOUNDING_BOX)
+  if(highlight)
     {
-      GdkColor *highlight_colour = NULL ;
-      GdkBitmap *stipple ;
-      char *highlight_target, *highlight_stipple ;
-
-      highlight_target = "fill_color_gdk" ;
-      highlight_stipple = "fill_stipple" ;
-
-      if (highlight)
-	{
-	  highlight_colour = zmapWindowMarkGetColour(mark) ;
-	  stipple = mark->stipple ;
-	}
-      else
-	{
-	  highlight_colour = NULL ;
-	  stipple = NULL ;
-	}
-
-      foo_canvas_item_set(FOO_CANVAS_ITEM(item),
-			  highlight_target, highlight_colour,
-			  highlight_stipple, stipple,
-			  NULL) ;
+      GdkColor  *mark_colour;
+      GdkBitmap *mark_stipple;
+      
+      mark_colour  = zmapWindowMarkGetColour(mark);
+      mark_stipple = mark->stipple;
+      
+      zMapWindowCanvasItemMark((ZMapWindowCanvasItem)item, mark_colour, mark_stipple);
     }
+  else
+    zMapWindowCanvasItemUnmark((ZMapWindowCanvasItem)item);
 
   return ;
 }
diff --git a/src/zmapWindow/zmapWindowMenus.c b/src/zmapWindow/zmapWindowMenus.c
index 1990cdfe55fea7f25b13177b9a62ced6a051d103..a038a701f77c9487ccf19d9e0f044837438734a2 100755
--- a/src/zmapWindow/zmapWindowMenus.c
+++ b/src/zmapWindow/zmapWindowMenus.c
@@ -27,13 +27,9 @@
  * Exported functions: ZMap/zmapWindows.h
  *              
  * HISTORY:
-<<<<<<< zmapWindowMenus.c
- * Last edited: Apr 28 14:28 2009 (edgrif)
-=======
- * Last edited: Apr 24 11:36 2009 (rds)
->>>>>>> 1.58
+ * Last edited: Jun  3 14:27 2009 (rds)
  * Created: Thu Mar 10 07:56:27 2005 (edgrif)
- * CVS info:   $Id: zmapWindowMenus.c,v 1.59 2009-04-28 14:34:56 edgrif Exp $
+ * CVS info:   $Id: zmapWindowMenus.c,v 1.60 2009-06-05 13:36:06 rds Exp $
  *-------------------------------------------------------------------
  */
 
@@ -44,8 +40,8 @@
 #include <ZMap/zmapGFF.h>
 #include <ZMap/zmapPeptide.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
-
+#include <zmapWindowContainerUtils.h>
+#include <zmapWindowContainerFeatureSet_I.h>
 
 /* some common menu strings, needed because cascading menus need the same string as their parent
  * menu item. */
@@ -118,7 +114,7 @@ static void dumpMenuCB(int menu_item_id, gpointer callback_data) ;
 static void developerMenuCB(int menu_item_id, gpointer callback_data) ;
 static void blixemMenuCB(int menu_item_id, gpointer callback_data) ;
 
-static FooCanvasGroup *getItemsColGroup(FooCanvasItem *item) ;
+static FooCanvasGroup *menuDataItemToColumn(FooCanvasItem *item) ;
 
 static void dumpFASTA(ZMapWindow window, ZMapFASTASeqType seq_type, char *seq, char *seq_name, int seq_len,
 		      char *molecule_name, char *gene_name) ;
@@ -729,10 +725,7 @@ static void configureMenuCB(int menu_item_id, gpointer callback_data)
   FooCanvasGroup *column_group ;
 
   /* did user click on an item or on the column background ? */
-  if (menu_data->item_cb)
-    column_group = getItemsColGroup(menu_data->item) ;
-  else
-    column_group = FOO_CANVAS_GROUP(menu_data->item) ;
+  column_group = menuDataItemToColumn(menu_data->item);
 
   zmapWindowColumnConfigure(menu_data->window, column_group, configure_mode) ;
 
@@ -746,14 +739,7 @@ static void bumpToInitialCB(int menu_item_id, gpointer callback_data)
   ItemMenuCBData menu_data = (ItemMenuCBData)callback_data ;
   FooCanvasGroup *column_group ;
 
-  if (menu_data->item_cb)
-    {
-      column_group = getItemsColGroup(menu_data->item) ;
-    }
-  else
-    {
-      column_group = FOO_CANVAS_GROUP(menu_data->item) ;
-    }
+  column_group = menuDataItemToColumn(menu_data->item);
 
   zmapWindowColumnBumpAllInitial(FOO_CANVAS_ITEM(column_group));
 
@@ -774,18 +760,8 @@ static void bumpMenuCB(int menu_item_id, gpointer callback_data)
   ItemMenuCBData menu_data = (ItemMenuCBData)callback_data ;
   ZMapStyleBumpMode bump_type = (ZMapStyleBumpMode)menu_item_id  ;
   ZMapWindowCompressMode compress_mode ;
-  FooCanvasGroup *column_group ;
   FooCanvasItem *style_item ;
 
-  if (menu_data->item_cb)
-    {
-      column_group = getItemsColGroup(menu_data->item) ;
-    }
-  else
-    {
-      column_group = FOO_CANVAS_GROUP(menu_data->item) ;
-    }
-
   style_item = menu_data->item ;
 
   if (zmapWindowMarkIsSet(menu_data->window->mark))
@@ -812,29 +788,22 @@ static void bumpToggleMenuCB(int menu_item_id, gpointer callback_data)
   ItemMenuCBData menu_data = (ItemMenuCBData)callback_data ;
   FooCanvasGroup *column_group = NULL;
 
-  if (menu_data->item_cb)
-    {
-      column_group = getItemsColGroup(menu_data->item) ;
-    }
-  else
-    {
-      column_group = FOO_CANVAS_GROUP(menu_data->item) ;
-    }
+  column_group = menuDataItemToColumn(menu_data->item);
 
   if (column_group)
     {
-      ZMapWindowItemFeatureSetData set_data ;
+      ZMapWindowContainerFeatureSet container;
       ZMapStyleBumpMode curr_bump_mode, bump_mode ;
       ZMapWindowCompressMode compress_mode ;
       
-      set_data = g_object_get_data(G_OBJECT(column_group), ITEM_FEATURE_SET_DATA) ;
+      container = (ZMapWindowContainerFeatureSet)column_group;
 
-      curr_bump_mode = zmapWindowItemFeatureSetGetBumpMode(set_data);
+      curr_bump_mode = zmapWindowContainerFeatureSetGetBumpMode(container);
       
       if (curr_bump_mode != ZMAPBUMP_UNBUMP)
 	bump_mode = ZMAPBUMP_UNBUMP ;
       else
-	bump_mode = zmapWindowItemFeatureSetResetBumpModes(set_data) ;
+	bump_mode = zmapWindowContainerFeatureSetResetBumpModes(container) ;
 
       if (zmapWindowMarkIsSet(menu_data->window->mark))
 	compress_mode = ZMAPWINDOW_COMPRESS_MARK ;
@@ -985,24 +954,24 @@ static void developerMenuCB(int menu_item_id, gpointer callback_data)
     {
     case 1:
       {
-	ZMapWindowItemFeatureSetData set_data = NULL;
+	ZMapWindowContainerFeatureSet container = NULL;
 
 	if (feature_any->struct_type == ZMAPFEATURE_STRUCT_FEATURESET)
 	  {
-	    set_data = g_object_get_data(G_OBJECT(menu_data->item), ITEM_FEATURE_SET_DATA);
+	    container = (ZMapWindowContainerFeatureSet)(menu_data->item);
 
-	    zmapWindowStyleTableForEach(set_data->style_table, show_all_styles_cb, NULL);
+	    zmapWindowStyleTableForEach(container->style_table, show_all_styles_cb, NULL);
 	  }
 	else if (feature_any->struct_type == ZMAPFEATURE_STRUCT_FEATURE)
 	  {
-	    set_data = g_object_get_data(G_OBJECT(menu_data->item->parent->parent), ITEM_FEATURE_SET_DATA);
-	    if(set_data)
+	    container = (ZMapWindowContainerFeatureSet)(menu_data->item->parent->parent);
+	    if(container)
 	      {
 		ZMapFeatureTypeStyle style;
 		ZMapFeature feature;
 
 		feature = (ZMapFeature)feature_any;
-		style   = zmapWindowItemFeatureSetStyleFromID(set_data, feature->style_id);
+		style   = zmapWindowContainerFeatureSetStyleFromID(container, feature->style_id);
 
 		zmapWindowShowStyle(style);
 	      }
@@ -1138,37 +1107,21 @@ static void blixemMenuCB(int menu_item_id, gpointer callback_data)
 
 
 /* this needs to be a general function... */
-static FooCanvasGroup *getItemsColGroup(FooCanvasItem *item)
+static FooCanvasGroup *menuDataItemToColumn(FooCanvasItem *item) 
 {
-  FooCanvasGroup *group = NULL ;
-  ZMapWindowItemFeatureType item_feature_type ;
-
-
-  item_feature_type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(item),
-							ITEM_FEATURE_TYPE)) ;
+  ZMapWindowContainerGroup container;
+  FooCanvasGroup *column_group = NULL;
 
-  switch (item_feature_type)
+  if((container = zmapWindowContainerCanvasItemGetContainer(item)))
     {
-    case ITEM_FEATURE_SIMPLE:
-    case ITEM_FEATURE_PARENT:
-      group = zmapWindowContainerGetParent(item->parent) ;
-      break ;
-    case ITEM_FEATURE_CHILD:
-    case ITEM_FEATURE_BOUNDING_BOX:
-      group = zmapWindowContainerGetParent(item->parent->parent) ;
-      break ;
-    default:
-      zMapAssert("Coding error, unrecognised menu item number.") ;
-      break ;
+      column_group = (FooCanvasGroup *)container;
     }
 
-  return group ;
+  return column_group;
 }
 
 
 
-
-
 static void dumpFASTA(ZMapWindow window, ZMapFASTASeqType seq_type, char *sequence, char *seq_name, int seq_len,
 		      char *molecule_name, char *gene_name)
 {
diff --git a/src/zmapWindow/zmapWindowNavigator.c b/src/zmapWindow/zmapWindowNavigator.c
index 413f5018fb0ded72c04a725084acb9af7e061e54..b647bf2a357f9373e1472529572be06794ec3abe 100755
--- a/src/zmapWindow/zmapWindowNavigator.c
+++ b/src/zmapWindow/zmapWindowNavigator.c
@@ -27,9 +27,9 @@
  *
  * Exported functions: See XXXXXXXXXXXXX.h
  * HISTORY:
- * Last edited: Apr 28 14:28 2009 (edgrif)
+ * Last edited: Jun  4 16:36 2009 (rds)
  * Created: Wed Sep  6 11:22:24 2006 (rds)
- * CVS info:   $Id: zmapWindowNavigator.c,v 1.51 2009-04-28 14:34:56 edgrif Exp $
+ * CVS info:   $Id: zmapWindowNavigator.c,v 1.52 2009-06-05 13:36:15 rds Exp $
  *-------------------------------------------------------------------
  */
 
@@ -41,6 +41,7 @@
 #ifdef RDS_WITH_STIPPLE
 #include <ZMap/zmapNavigatorStippleG.xbm> /* bitmap... */
 #endif
+#include <zmapWindowContainerFeatureSet_I.h>
 
 /* Return the widget! */
 #define NAVIGATOR_WIDGET(navigate) GTK_WIDGET(fetchCanvas(navigate))
@@ -57,9 +58,9 @@ typedef struct
   ZMapFeatureBlock     current_block;
   ZMapFeatureSet       current_set;
   /* The current containers in the recursion */
-  FooCanvasGroup     *container_block;
-  FooCanvasGroup     *container_strand;
-  FooCanvasGroup     *container_feature_set;
+  ZMapWindowContainerGroup container_block;
+  ZMapWindowContainerGroup container_strand;
+  ZMapWindowContainerGroup container_feature_set;
   double current;               
 
 } NavigateDrawStruct, *NavigateDraw;
@@ -132,7 +133,7 @@ static void setupLocatorGroup(ZMapWindowNavigator navigate);
 static void updateLocatorDragger(ZMapWindowNavigator navigate, double button_y, double size);
 static gboolean rootBGEventCB(FooCanvasItem *item, GdkEvent *event, gpointer data);
 static gboolean columnBackgroundEventCB(FooCanvasItem *item, GdkEvent *event, gpointer data);
-static void positioningCB(FooCanvasGroup *container, FooCanvasPoints *points, 
+static void positioningCB(ZMapWindowContainerGroup container, FooCanvasPoints *points, 
                           ZMapContainerLevelType level, gpointer user_data);
 
 static FooCanvas *fetchCanvas(ZMapWindowNavigator navigate);
@@ -178,7 +179,7 @@ static void available_locus_names_filter(GList **filter_out);
 static void default_locus_names_filter(GList **filter_out);
 static gint strcmp_list_find(gconstpointer list_data, gconstpointer user_data);
 
-static void highlight_columns_cb(FooCanvasGroup *container, FooCanvasPoints *points, 
+static void highlight_columns_cb(ZMapWindowContainerGroup container, FooCanvasPoints *points, 
 				 ZMapContainerLevelType level, gpointer user_data);
 static void locator_highlight_column_areas(ZMapWindowNavigator navigate,
 					   double x1, double x2,
@@ -190,7 +191,6 @@ static gboolean nav_locator_expose_handler(GtkWidget *widget, GdkEventExpose *ex
 
 static ZMapFeatureTypeStyle getPredefinedStyleByName(char *style_name);
 
-static void set_data_destroy(gpointer user_data);
 
 /* ------------------- */
 static gboolean locator_debug_G = FALSE;
@@ -316,11 +316,11 @@ ZMapWindowNavigator zMapWindowNavigatorCreate(GtkWidget *canvas_widget)
       /* create the root container */
       canvas = FOO_CANVAS(canvas_widget);
       root   = FOO_CANVAS_GROUP(foo_canvas_root(canvas));
-      navigate->container_root = zmapWindowContainerCreate(root, ZMAPCONTAINER_LEVEL_ROOT,
-                                                           ROOT_CHILD_SPACING, 
-                                                           &(navigate->root_background), NULL, NULL);
+      navigate->container_root = zmapWindowContainerGroupCreateFromFoo(root, ZMAPCONTAINER_LEVEL_ROOT,
+								       ROOT_CHILD_SPACING, 
+								       &(navigate->root_background), NULL);
       /* add it to the hash. */
-      zmapWindowFToIAddRoot(navigate->ftoi_hash, navigate->container_root);
+      zmapWindowFToIAddRoot(navigate->ftoi_hash, (FooCanvasGroup *)(navigate->container_root));
       /* lower to bottom so that everything else works... */
       foo_canvas_item_lower_to_bottom(FOO_CANVAS_ITEM(navigate->container_root));
 
@@ -385,7 +385,8 @@ void zMapWindowNavigatorReset(ZMapWindowNavigator navigate)
       navigate->locator_expose_handler_id = 0;
     }
 
-  zmapWindowContainerPurge(zmapWindowContainerGetFeatures( navigate->container_root ));
+#warning FIX_ME
+  //zmapWindowContainerFeat(zmapWindowContainerGetFeatures( navigate->container_root ));
 
   /* Keep pointers in step and recreate what was destroyed */
   navigate->container_align = NULL;
@@ -450,7 +451,7 @@ void zMapWindowNavigatorFocus(ZMapWindowNavigator navigate,
       else
 	*y2_inout = y_max;
       
-      root_bg = zmapWindowContainerGetBackground(navigate->container_root);
+      root_bg = (FooCanvasItem *)zmapWindowContainerGetBackground(navigate->container_root);
 
       foo_canvas_item_set(root, "x", -1000.0, NULL);
       
@@ -628,9 +629,9 @@ void zmapWindowNavigatorPositioning(ZMapWindowNavigator navigate)
 
   /* Some of the next code needs to be encoded in a function passed to
    * this call to container execute. */
-  zmapWindowContainerExecuteFull(navigate->container_align, 
-                                 ZMAPCONTAINER_LEVEL_FEATURESET,
-                                 NULL, NULL, positioningCB, navigate, TRUE);
+  zmapWindowContainerUtilsExecuteFull(navigate->container_align, 
+				      ZMAPCONTAINER_LEVEL_FEATURESET,
+				      NULL, NULL, positioningCB, navigate, TRUE);
   /* ***************************** i.e. here ^^^^, ^^^^ */
 
   return ;
@@ -654,7 +655,7 @@ void zMapWindowNavigatorDestroy(ZMapWindowNavigator navigate)
 
 /* INTERNAL */
 
-static void positioningCB(FooCanvasGroup *container, FooCanvasPoints *points, 
+static void positioningCB(ZMapWindowContainerGroup container, FooCanvasPoints *points, 
                           ZMapContainerLevelType level, gpointer user_data)
 {
   ZMapWindowNavigator navigate = (ZMapWindowNavigator)user_data;
@@ -731,7 +732,7 @@ static FooCanvas *fetchCanvas(ZMapWindowNavigator navigate)
   FooCanvas *canvas = NULL;
   FooCanvasGroup *g = NULL;
 
-  g = navigate->container_root;
+  g = (FooCanvasGroup *)(navigate->container_root);
 
   zMapAssert(g);
 
@@ -939,25 +940,28 @@ static ZMapFeatureContextExecuteStatus drawContext(GQuark key_id,
       break;
     case ZMAPFEATURE_STRUCT_ALIGN:
       {
-        FooCanvasGroup *container = NULL;
+	ZMapWindowContainerFeatures container_features;
 
         draw_data->current_align = (ZMapFeatureAlignment)feature_any;
-        container = zmapWindowContainerGetFeatures(navigate->container_root);
+        container_features = zmapWindowContainerGetFeatures(navigate->container_root);
         if(!navigate->container_align)
           {
-            navigate->container_align = zmapWindowContainerCreate(container, ZMAPCONTAINER_LEVEL_ALIGN,
-                                                                  ALIGN_CHILD_SPACING, 
-                                                                  &(navigate->align_background), NULL, NULL);
+            navigate->container_align = zmapWindowContainerGroupCreate(container_features, ZMAPCONTAINER_LEVEL_ALIGN,
+								       ALIGN_CHILD_SPACING, 
+								       &(navigate->align_background), NULL);
+
 	    g_object_set_data(G_OBJECT(navigate->container_align), ITEM_FEATURE_STATS, 
 			      zmapWindowStatsCreate((ZMapFeatureAny)draw_data->current_align)) ;
-            hash_status = zmapWindowFToIAddAlign(navigate->ftoi_hash, key_id, navigate->container_align);
+
+            hash_status = zmapWindowFToIAddAlign(navigate->ftoi_hash, key_id, (FooCanvasGroup *)(navigate->container_align));
+
             zMapAssert(hash_status);
           }
       }
       break;
     case ZMAPFEATURE_STRUCT_BLOCK:
       {
-        FooCanvasGroup *features = NULL;
+        ZMapWindowContainerFeatures features = NULL;
         double block_start, block_end;
 
         draw_data->current_block = feature_block = (ZMapFeatureBlock)feature_any;
@@ -969,21 +973,21 @@ static ZMapFeatureContextExecuteStatus drawContext(GQuark key_id,
         
         /* create the block and add the item to the hash */
         features    = zmapWindowContainerGetFeatures(draw_data->navigate->container_align);
-        draw_data->container_block = zmapWindowContainerCreate(features, ZMAPCONTAINER_LEVEL_BLOCK,
-                                                               BLOCK_CHILD_SPACING, 
-                                                               &(navigate->block_background), NULL, NULL);
+        draw_data->container_block = zmapWindowContainerGroupCreate(features, ZMAPCONTAINER_LEVEL_BLOCK,
+								    BLOCK_CHILD_SPACING, 
+								    &(navigate->block_background), NULL);
 	g_object_set_data(G_OBJECT(draw_data->container_block), ITEM_FEATURE_STATS, 
 			  zmapWindowStatsCreate((ZMapFeatureAny)draw_data->current_block)) ;
         hash_status = zmapWindowFToIAddBlock(navigate->ftoi_hash, draw_data->current_align->unique_id,
-                                             key_id, draw_data->container_block);
+                                             key_id, (FooCanvasGroup *)(draw_data->container_block));
         zMapAssert(hash_status);
 
         /* we're only displaying one strand... create it ... */
         features = zmapWindowContainerGetFeatures(draw_data->container_block);
         /* The strand container doesn't get added to the hash! */
-        draw_data->container_strand = zmapWindowContainerCreate(features, ZMAPCONTAINER_LEVEL_STRAND,
-                                                                STRAND_CHILD_SPACING, 
-                                                                &(navigate->strand_background), NULL, NULL);
+        draw_data->container_strand = zmapWindowContainerGroupCreate(features, ZMAPCONTAINER_LEVEL_STRAND,
+								     STRAND_CHILD_SPACING, 
+								     &(navigate->strand_background), NULL);
 
         /* create a column per set ... */
         initialiseScaleIfNotExists(draw_data->current_block);
@@ -1008,7 +1012,8 @@ static ZMapFeatureContextExecuteStatus drawContext(GQuark key_id,
 	    ZMapFeatureTypeStyle navigator_version, context_copy, context_version;
 	    ZMapStyleBumpMode bump_mode;
 
-	    context_version = zmapWindowContainerGetStyle(FOO_CANVAS_GROUP(item));
+	    context_version = zmapWindowContainerFeatureSetStyleFromID((ZMapWindowContainerFeatureSet)item, 
+								       feature_set->unique_id);
 
 	    if((navigator_version = getPredefinedStyleByName(zMapStyleGetName(context_version))))
 	      {
@@ -1023,7 +1028,7 @@ static ZMapFeatureContextExecuteStatus drawContext(GQuark key_id,
 
 	    if ((bump_mode = zMapStyleGetBumpMode(context_version)) != ZMAPBUMP_UNBUMP)
 	      {
-		zmapWindowContainerSortFeatures(container_feature_set, ZMAPCONTAINER_VERTICAL);
+		zmapWindowContainerFeatureSetSortFeatures((ZMapWindowContainerFeatureSet)container_feature_set, 0);
 
 		zmapWindowColumnBumpRange(item, bump_mode, ZMAPWINDOW_COMPRESS_ALL) ;
 	      }
@@ -1085,7 +1090,7 @@ static gboolean drawScaleRequired(NavigateDraw draw_data)
                                         scale_id, ZMAPSTRAND_NONE, ZMAPFRAME_NONE, 0)))
     {
       /* if block size changes then the scale will start breaking... */
-      required = !(zmapWindowContainerHasFeatures(FOO_CANVAS_GROUP(item)));
+      required = !(zmapWindowContainerHasFeatures(ZMAP_CONTAINER_GROUP(item)));
     }
 
   return required;
@@ -1093,7 +1098,6 @@ static gboolean drawScaleRequired(NavigateDraw draw_data)
 
 static void drawScale(NavigateDraw draw_data)
 {
-  FooCanvasGroup *features    = NULL;
   FooCanvasItem *item = NULL;
   
   GQuark scale_id = 0;
@@ -1108,10 +1112,11 @@ static void drawScale(NavigateDraw draw_data)
                                         scale_id, ZMAPSTRAND_NONE, ZMAPFRAME_NONE, 0)))
     {
       FooCanvasGroup *scale_group = NULL;
+      FooCanvasGroup *features    = NULL;
       
       scale_group = FOO_CANVAS_GROUP(item);
 
-      features = zmapWindowContainerGetFeatures(scale_group);
+      features = (FooCanvasGroup *)zmapWindowContainerGetFeatures((ZMapWindowContainerGroup)scale_group);
 
       min = draw_data->context->sequence_to_parent.c1;
       max = draw_data->context->sequence_to_parent.c2;
@@ -1131,23 +1136,14 @@ static void drawScale(NavigateDraw draw_data)
   return ;
 }
 
-static void set_data_destroy(gpointer user_data)
-{
-  ZMapWindowItemFeatureSetData set_data = (ZMapWindowItemFeatureSetData)user_data;
-
-  zmapWindowItemFeatureSetDestroy(set_data);
-
-  return ;
-}
 
 /* data is a GQuark, user_data is a NavigateDraw */
 static void createColumnCB(gpointer data, gpointer user_data)
 {
   GQuark set_id = GPOINTER_TO_UINT(data);
   NavigateDraw draw_data = (NavigateDraw)user_data;
-  ZMapWindowItemFeatureSetData set_data = NULL;
-  FooCanvasGroup *features = NULL;
-  FooCanvasItem  *container_background = NULL;
+  ZMapWindowContainerFeatures features;
+  ZMapWindowContainerBackground container_background = NULL;
   ZMapFeatureTypeStyle style = NULL;
   gboolean status = FALSE;
 
@@ -1159,10 +1155,10 @@ static void createColumnCB(gpointer data, gpointer user_data)
 
       zMapAssert(draw_data->current_set);
 
-      features = zmapWindowContainerGetFeatures(draw_data->container_strand);
-      draw_data->container_feature_set = zmapWindowContainerCreate(features, ZMAPCONTAINER_LEVEL_FEATURESET,
-                                                                   SET_CHILD_SPACING, 
-                                                                   &(draw_data->navigate->column_background), NULL, NULL);
+      features = zmapWindowContainerGetFeatures(ZMAP_CONTAINER_GROUP(draw_data->container_strand));
+      draw_data->container_feature_set = zmapWindowContainerGroupCreate(features, ZMAPCONTAINER_LEVEL_FEATURESET,
+									SET_CHILD_SPACING, 
+									&(draw_data->navigate->column_background), NULL);
 
       g_object_set_data(G_OBJECT(draw_data->container_feature_set), ITEM_FEATURE_STATS, 
 			zmapWindowStatsCreate((ZMapFeatureAny)draw_data->current_set)) ;
@@ -1171,7 +1167,7 @@ static void createColumnCB(gpointer data, gpointer user_data)
                                     draw_data->current_align->unique_id,
                                     draw_data->current_block->unique_id,
                                     set_id, ZMAPSTRAND_NONE, ZMAPFRAME_NONE,
-                                    draw_data->container_feature_set);
+                                    (FooCanvasGroup *)draw_data->container_feature_set);
       zMapAssert(status);
 
       style    = zMapFeatureStyleCopy(style);
@@ -1181,22 +1177,25 @@ static void createColumnCB(gpointer data, gpointer user_data)
 
       if(style_list)		/* This should be tested earlier! i.e. We shouldn't be creating the column. */
 	{
-	  set_data = zmapWindowItemFeatureSetCreate(draw_data->navigate->current_window,
-						    draw_data->container_feature_set,
-						    set_id, 0, style_list,
-						    ZMAPSTRAND_FORWARD, ZMAPFRAME_NONE);
-
-	  zmapWindowItemFeatureSetAttachFeatureSet(set_data, draw_data->current_set);
+	  ZMapWindowContainerFeatureSet container_set;
+	  container_set = (ZMapWindowContainerFeatureSet)draw_data->container_feature_set;
+	  zmapWindowContainerFeatureSetAugment(container_set,
+					       draw_data->navigate->current_window,
+					       set_id, 0, style_list,
+					       ZMAPSTRAND_FORWARD, ZMAPFRAME_NONE);
+
+	  zmapWindowContainerFeatureSetAttachFeatureSet(container_set, 
+							draw_data->current_set);
 	  
 	  g_list_free(style_list);
 	}
 
-      zmapWindowContainerSetVisibility(draw_data->container_feature_set, TRUE);
+      zmapWindowContainerSetVisibility(FOO_CANVAS_GROUP(draw_data->container_feature_set), TRUE);
 
       container_background = zmapWindowContainerGetBackground(draw_data->container_feature_set);
 
-      zmapWindowContainerSetBackgroundSize(draw_data->container_feature_set, 
-					   draw_data->current_block->block_to_sequence.t2 * draw_data->navigate->scaling_factor);
+      zmapWindowContainerGroupBackgroundSize(draw_data->container_feature_set, 
+					     draw_data->current_block->block_to_sequence.t2 * draw_data->navigate->scaling_factor);
 
       /* scale doesn't need this. */
       if(set_id != g_quark_from_string(ZMAP_FIXED_STYLE_SCALE_NAME))
@@ -1227,7 +1226,7 @@ static void setupLocatorGroup(ZMapWindowNavigator navigate)
   if(!(locator_grp = navigate->locator_group))
     {
       FooCanvasGroup *root_features = NULL;
-      root_features = zmapWindowContainerGetFeatures(navigate->container_root);
+      root_features = (FooCanvasGroup *)zmapWindowContainerGetFeatures(navigate->container_root);
 
       locator_grp = navigate->locator_group = 
         FOO_CANVAS_GROUP(foo_canvas_item_new(root_features,
@@ -1279,7 +1278,7 @@ static void setupLocatorGroup(ZMapWindowNavigator navigate)
     {
       FooCanvasItem *root_bg = NULL;
 
-      root_bg = zmapWindowContainerGetBackground(navigate->container_root);
+      root_bg = (FooCanvasItem *)zmapWindowContainerGetBackground(navigate->container_root);
 
       transp_data->navigate      = navigate;
       transp_data->locator_click = FALSE;
@@ -1542,18 +1541,15 @@ static void makeMenuFromCanvasItem(GdkEventButton *button, FooCanvasItem *item,
       else
         {
           /* get set_data->style */
-          ZMapWindowItemFeatureSetData set_data ;
-
-          set_data = g_object_get_data(G_OBJECT(item), ITEM_FEATURE_SET_DATA) ;
-          zMapAssert(set_data) ;
+          ZMapWindowContainerFeatureSet container;
 
-	  if(set_data->unique_id == menu_data->navigate->locus_id)
+	  if(container->unique_id == menu_data->navigate->locus_id)
 	    {
               menu_sets = g_list_append(menu_sets, zmapWindowNavigatorMakeMenuLocusColumnOps(NULL, NULL, menu_data));
               menu_sets = g_list_append(menu_sets, separator);
 	    }
 
-	  bump_mode = zmapWindowItemFeatureSetGetBumpMode(set_data);
+	  bump_mode = zmapWindowContainerFeatureSetGetBumpMode(container);
           menu_data->item_cb  = FALSE;
         }
 
@@ -1584,7 +1580,7 @@ static gboolean columnBackgroundEventCB(FooCanvasItem *item, GdkEvent *event, gp
         GdkEventButton *button = (GdkEventButton *)event;
         if(button->button == 3)
           {
-            item = FOO_CANVAS_ITEM(zmapWindowContainerGetParent(item));
+            item = FOO_CANVAS_ITEM(zmapWindowContainerChildGetParent(item));
             makeMenuFromCanvasItem(button, item, data);
             event_handled = TRUE;
           }
@@ -1777,7 +1773,7 @@ static void customiseFactory(ZMapWindowNavigator navigate)
   /* create a factory and set up */ 
   navigate->item_factory = zmapWindowFToIFactoryOpen(navigate->ftoi_hash, NULL);
   factory_helpers.feature_size_request = factoryFeatureSizeReq;
-  factory_helpers.item_created         = factoryItemHandler;
+  factory_helpers.top_item_created     = factoryItemHandler;
   zmapWindowFToIFactorySetup(navigate->item_factory, 1, /* line_width hardcoded for now. */
                              &factory_helpers, (gpointer)navigate);
 
@@ -1966,7 +1962,7 @@ static ZMapFeatureTypeStyle getPredefinedStyleByName(char *style_name)
 }
 
 
-static void highlight_columns_cb(FooCanvasGroup *container, FooCanvasPoints *points, 
+static void highlight_columns_cb(ZMapWindowContainerGroup container, FooCanvasPoints *points, 
 				 ZMapContainerLevelType level, gpointer user_data)
 {
   NavigatorLocator nav_data = (NavigatorLocator)user_data;
@@ -1980,9 +1976,9 @@ static void highlight_columns_cb(FooCanvasGroup *container, FooCanvasPoints *poi
     case ZMAPCONTAINER_LEVEL_BLOCK:
     case ZMAPCONTAINER_LEVEL_STRAND:
     case ZMAPCONTAINER_LEVEL_FEATURESET:
-      container_underlay = zmapWindowContainerGetUnderlays(container);
-      container_features = zmapWindowContainerGetFeatures(container);
-      container_overlay  = zmapWindowContainerGetOverlays(container);
+      container_underlay = (FooCanvasGroup *)zmapWindowContainerGetUnderlay(container);
+      container_features = (FooCanvasGroup *)zmapWindowContainerGetFeatures(container);
+      container_overlay  = (FooCanvasGroup *)zmapWindowContainerGetOverlay(container);
 
       foo_canvas_item_set(FOO_CANVAS_ITEM(container_underlay),
 			  "x", 0.0, "y", 0.0, NULL);
@@ -1994,8 +1990,8 @@ static void highlight_columns_cb(FooCanvasGroup *container, FooCanvasPoints *poi
 	  foo_canvas_item_get_bounds(FOO_CANVAS_ITEM(container),
 				     &(points->coords[0]), NULL,
 				     &(points->coords[2]), NULL);
-	  points->coords[0] -= container->xpos;
-	  points->coords[2] -= container->xpos;
+	  points->coords[0] -= ((FooCanvasGroup *)container)->xpos;
+	  points->coords[2] -= ((FooCanvasGroup *)container)->xpos;
 	}
       else
 	{
@@ -2045,10 +2041,10 @@ static void locator_highlight_column_areas(ZMapWindowNavigator navigate,
 
   gdk_color_parse("white", &(tmp_data.highlight_colour));
 
-  zmapWindowContainerExecuteFull(navigate->container_align, 
-                                 ZMAPCONTAINER_LEVEL_FEATURESET,
-                                 NULL, NULL, highlight_columns_cb, 
-				 &tmp_data, FALSE);  
+  zmapWindowContainerUtilsExecuteFull(navigate->container_align, 
+				      ZMAPCONTAINER_LEVEL_FEATURESET,
+				      NULL, NULL, highlight_columns_cb, 
+				      &tmp_data, FALSE);  
 
   return ;
 }
diff --git a/src/zmapWindow/zmapWindowNavigatorMenus.c b/src/zmapWindow/zmapWindowNavigatorMenus.c
index 83cb101a81c693dbf097d8fb6f682b9669e4eec1..ccbff503aded2a3182899e89f368493170b205a0 100755
--- a/src/zmapWindow/zmapWindowNavigatorMenus.c
+++ b/src/zmapWindow/zmapWindowNavigatorMenus.c
@@ -27,14 +27,15 @@
  *
  * Exported functions: See XXXXXXXXXXXXX.h
  * HISTORY:
- * Last edited: Apr 27 16:36 2009 (edgrif)
+ * Last edited: Jun  4 12:19 2009 (rds)
  * Created: Wed Oct 18 08:21:15 2006 (rds)
- * CVS info:   $Id: zmapWindowNavigatorMenus.c,v 1.22 2009-04-28 14:34:56 edgrif Exp $
+ * CVS info:   $Id: zmapWindowNavigatorMenus.c,v 1.23 2009-06-05 13:36:20 rds Exp $
  *-------------------------------------------------------------------
  */
 
 #include <zmapWindowNavigator_P.h>
 #include <ZMap/zmapUtils.h>
+#include <zmapWindowContainerFeatureSet_I.h>
 
 #define FILTER_DATA_KEY        "ZMapWindowNavigatorFilterData"
 #define FILTER_CANCEL_DATA_KEY "ZMapWindowNavigatorFilterCancelData"
@@ -210,8 +211,8 @@ void zmapWindowNavigatorShowSameNameList(ZMapWindowNavigator navigate, FooCanvas
     zmapWindowListWindowCreate(window, item, 
 			       (char *)(g_quark_to_string(feature->original_id)),
 			       access_window_context_to_item,  window, 
-			       zmapWindowFToISetSearchPerform, search_data,
-			       zmapWindowFToISetSearchDestroy, zoom_to_item);
+			       (ZMapWindowListSearchHashFunc)zmapWindowFToISetSearchPerform, search_data,
+			       (GDestroyNotify)zmapWindowFToISetSearchDestroy, zoom_to_item);
     
   }
 #endif /* USING_SET_SEARCH_DATA_METHOD */
@@ -349,8 +350,8 @@ static void navigatorColumnMenuCB(int menu_item_id, gpointer callback_data)
     case 1:
       {
         ZMapFeatureAny feature ;
+	ZMapWindowContainerFeatureSet container;
 	ZMapWindowFToISetSearchData search_data;
-	ZMapWindowItemFeatureSetData set_data ;
         FooCanvasItem *set_item = menu_data->item;
 	gboolean zoom_to_item = FALSE;
 	
@@ -359,28 +360,27 @@ static void navigatorColumnMenuCB(int menu_item_id, gpointer callback_data)
         if(feature->struct_type == ZMAPFEATURE_STRUCT_FEATURE)
           {
             /* a small hack for the time being... */
-            set_item = FOO_CANVAS_ITEM(zmapWindowContainerGetParentContainerFromItem(menu_data->item));
+            set_item = FOO_CANVAS_ITEM(zmapWindowContainerCanvasItemGetContainer(menu_data->item));
             feature = (ZMapFeatureAny)(feature->parent);
           }
 
-        set_data = g_object_get_data(G_OBJECT(set_item), ITEM_FEATURE_SET_DATA) ;
-	zMapAssert(set_data) ;
+	container = (ZMapWindowContainerFeatureSet)set_item;
 
 	search_data = zmapWindowFToISetSearchCreate(zmapWindowFToIFindItemSetFull, NULL,
 						    feature->parent->parent->unique_id,
 						    feature->parent->unique_id,
 						    feature->unique_id,
 						    g_quark_from_string("*"),
-						    zMapFeatureStrand2Str(set_data->strand),
-						    zMapFeatureFrame2Str(set_data->frame));
+						    zMapFeatureStrand2Str(container->strand),
+						    zMapFeatureFrame2Str(container->frame));
 	
         zmapWindowListWindowCreate(menu_data->navigate->current_window, 
 				   NULL,
                                    (char *)g_quark_to_string(feature->original_id), 
 				   access_navigator_context_to_item,
 				   menu_data->navigate,
-				   zmapWindowFToISetSearchPerform, search_data, 
-				   zmapWindowFToISetSearchDestroy, zoom_to_item) ;
+				   (ZMapWindowListSearchHashFunc)zmapWindowFToISetSearchPerform, search_data, 
+				   (GDestroyNotify)zmapWindowFToISetSearchDestroy, zoom_to_item) ;
 
 	break ;
       }
diff --git a/src/zmapWindow/zmapWindowNavigator_P.h b/src/zmapWindow/zmapWindowNavigator_P.h
index 4235a7757b2b5060c737feda90aa1fceebe4c36e..c54571ade783d9aaab47f518824424d095e5e98a 100755
--- a/src/zmapWindow/zmapWindowNavigator_P.h
+++ b/src/zmapWindow/zmapWindowNavigator_P.h
@@ -27,9 +27,9 @@
  *
  * Exported functions: See XXXXXXXXXXXXX.h
  * HISTORY:
- * Last edited: Apr 27 12:39 2009 (edgrif)
+ * Last edited: Jun  4 16:16 2009 (rds)
  * Created: Thu Sep  7 09:23:47 2006 (rds)
- * CVS info:   $Id: zmapWindowNavigator_P.h,v 1.12 2009-04-28 14:34:56 edgrif Exp $
+ * CVS info:   $Id: zmapWindowNavigator_P.h,v 1.13 2009-06-05 13:36:30 rds Exp $
  *-------------------------------------------------------------------
  */
 
@@ -38,7 +38,7 @@
 #define ZMAP_WINDOW_NAVIGATOR_P_H
 
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
+#include <zmapWindowContainerUtils.h>
 #include <zmapWindowItemFactory.h>
 #include <ZMap/zmapWindowNavigator.h>
 
@@ -65,8 +65,8 @@
 
 typedef struct _ZMapWindowNavigatorStruct
 {
-  FooCanvasGroup *container_root ; /* what we'll raise and lower */
-  FooCanvasGroup *container_align; /* because I think we'll probably need it. */
+  ZMapWindowContainerGroup container_root ; /* what we'll raise and lower */
+  ZMapWindowContainerGroup container_align; /* because I think we'll probably need it. */
 
   ZMapWindowFToIFactory item_factory;
 
diff --git a/src/zmapWindow/zmapWindowOverlays.c b/src/zmapWindow/zmapWindowOverlays.c
index 519a705eb9866c642e371274b43072213f51231e..f92f7465846d477cd649b4514e14e1b6f4542eb6 100755
--- a/src/zmapWindow/zmapWindowOverlays.c
+++ b/src/zmapWindow/zmapWindowOverlays.c
@@ -27,16 +27,16 @@
  *
  * Exported functions: See XXXXXXXXXXXXX.h
  * HISTORY:
- * Last edited: Feb  6 11:09 2008 (edgrif)
+ * Last edited: Jun  4 21:23 2009 (rds)
  * Created: Mon Mar 12 12:28:18 2007 (rds)
- * CVS info:   $Id: zmapWindowOverlays.c,v 1.10 2008-02-07 14:19:44 edgrif Exp $
+ * CVS info:   $Id: zmapWindowOverlays.c,v 1.11 2009-06-05 13:36:36 rds Exp $
  *-------------------------------------------------------------------
  */
 
 #include <gdk/gdk.h>
 #include <string.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
+#include <zmapWindowContainerUtils.h>
 #include <ZMap/zmapUtils.h>
 
 #define OVERLAY_DEFAULT_ITEM_TYPE_MASK (ITEM_FEATURE_SIMPLE | ITEM_FEATURE_CHILD)
@@ -109,7 +109,7 @@ ZMapWindowOverlay zmapWindowOverlayCreate(FooCanvasItem *parent_container,
 
       overlay->gc_function = GDK_COPY;
       
-      if((overlay->masks_parent = zmapWindowContainerGetUnderlays(FOO_CANVAS_GROUP(parent_container))))
+      if((overlay->masks_parent = (FooCanvasGroup *)zmapWindowContainerGetUnderlay((ZMapWindowContainerGroup)(parent_container))))
         updateBounds(overlay);
 
       if(subject && FOO_IS_CANVAS_ITEM(subject))
@@ -459,12 +459,13 @@ ZMapWindowOverlay zmapWindowOverlayDestroy(ZMapWindowOverlay overlay)
 
 static void updateBounds(ZMapWindowOverlay overlay)
 {
-  FooCanvasItem *parent_container, *item;
+  ZMapWindowContainerGroup container_group;
+  FooCanvasItem *item;
 
   if(overlay->alternative_limit)
     item = overlay->alternative_limit;
-  else if((parent_container = FOO_CANVAS_ITEM(zmapWindowContainerGetParent(FOO_CANVAS_ITEM(overlay->masks_parent)))))
-    item = parent_container;
+  else if((container_group = zmapWindowContainerChildGetParent(FOO_CANVAS_ITEM(overlay->masks_parent))))
+    item = (FooCanvasItem *)container_group;
   else
     zMapAssertNotReached();
 
diff --git a/src/zmapWindow/zmapWindowSearch.c b/src/zmapWindow/zmapWindowSearch.c
index 3887b26b7c4ee8654fd5aa9fa5d1da419b252840..8252f690222c4f8afff7c9c5704d3fe4cee322b8 100755
--- a/src/zmapWindow/zmapWindowSearch.c
+++ b/src/zmapWindow/zmapWindowSearch.c
@@ -28,9 +28,9 @@
  *              
  * Exported functions: See zmapWindow_P.h
  * HISTORY:
- * Last edited: Apr 20 09:58 2009 (edgrif)
+ * Last edited: Jun  4 21:23 2009 (rds)
  * Created: Fri Aug 12 16:53:21 2005 (edgrif)
- * CVS info:   $Id: zmapWindowSearch.c,v 1.39 2009-04-24 10:39:37 edgrif Exp $
+ * CVS info:   $Id: zmapWindowSearch.c,v 1.40 2009-06-05 13:37:25 rds Exp $
  *-------------------------------------------------------------------
  */
 
@@ -38,7 +38,8 @@
 #include <glib.h>
 #include <ZMap/zmapUtils.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
+#include <zmapWindowContainerUtils.h>
+#include <zmapWindowContainerFeatureSet_I.h>
 
 typedef struct
 {
@@ -969,32 +970,31 @@ static void setFilterDefaults(SearchData search_data)
       || feature_any->struct_type == ZMAPFEATURE_STRUCT_FEATURESET)
     {
       FooCanvasGroup *featureset_group ;
-      ZMapWindowItemFeatureSetData set_data ;
+      ZMapWindowContainerFeatureSet container;
 
       if (feature_any->struct_type == ZMAPFEATURE_STRUCT_FEATURE)
 	{
-	  featureset_group = zmapWindowContainerGetParentContainerFromItem(search_data->feature_item) ;
+	  featureset_group = (FooCanvasGroup *)zmapWindowContainerCanvasItemGetContainer(search_data->feature_item) ;
 	}
       else
 	featureset_group = FOO_CANVAS_GROUP(search_data->feature_item) ;
 
-      set_data = g_object_get_data(G_OBJECT(featureset_group), ITEM_FEATURE_SET_DATA) ;
-      zMapAssert(set_data) ;
+      container = (ZMapWindowContainerFeatureSet)(featureset_group);
 
-      if (set_data->strand == ZMAPSTRAND_FORWARD)
+      if (container->strand == ZMAPSTRAND_FORWARD)
 	search_data->strand_txt = "+" ;
-      else if (set_data->strand == ZMAPSTRAND_REVERSE)
+      else if (container->strand == ZMAPSTRAND_REVERSE)
 	search_data->strand_txt = "-" ;
       else
 	search_data->strand_txt = "." ;
 
-      if (set_data->frame == ZMAPFRAME_NONE)
+      if (container->frame == ZMAPFRAME_NONE)
 	search_data->frame_txt = "." ;
-      else if (set_data->frame == ZMAPFRAME_0)
+      else if (container->frame == ZMAPFRAME_0)
 	search_data->frame_txt = "1" ;
-      else if (set_data->frame == ZMAPFRAME_1)
+      else if (container->frame == ZMAPFRAME_1)
 	search_data->frame_txt = "2" ;
-      else if (set_data->frame == ZMAPFRAME_2)
+      else if (container->frame == ZMAPFRAME_2)
 	search_data->frame_txt = "3" ;
     }
 
diff --git a/src/zmapWindow/zmapWindowState.c b/src/zmapWindow/zmapWindowState.c
index 502f475a0bf346d2727898e97f57a152e15d26c2..5e159d6c01aec2c22611c00462efaf2a2acf3a25 100755
--- a/src/zmapWindow/zmapWindowState.c
+++ b/src/zmapWindow/zmapWindowState.c
@@ -27,17 +27,18 @@
  *
  * Exported functions: See XXXXXXXXXXXXX.h
  * HISTORY:
- * Last edited: Apr 27 12:40 2009 (edgrif)
+ * Last edited: Jun  4 08:02 2009 (rds)
  * Created: Mon Jun 11 09:49:16 2007 (rds)
- * CVS info:   $Id: zmapWindowState.c,v 1.19 2009-04-28 14:35:39 edgrif Exp $
+ * CVS info:   $Id: zmapWindowState.c,v 1.20 2009-06-05 13:37:29 rds Exp $
  *-------------------------------------------------------------------
  */
 
 #include <string.h>
 #include <ZMap/zmapUtils.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
 #include <zmapWindowState.h>
+#include <zmapWindowContainerUtils.h>
+#include <zmapWindowContainerFeatureSet_I.h>
 
 typedef struct
 {
@@ -325,33 +326,33 @@ gboolean zmapWindowStateSaveFocusItems(ZMapWindowState state,
   return state->focus_items_set;
 }
 
-static void get_bumped_columns(FooCanvasGroup        *container, 
-			       FooCanvasPoints       *unused_points,
-			       ZMapContainerLevelType level,
-			       gpointer               user_data)
+static void get_bumped_columns(ZMapWindowContainerGroup container, 
+			       FooCanvasPoints         *unused_points,
+			       ZMapContainerLevelType   level,
+			       gpointer                 user_data)
 {
   ZMapWindowBumpStateStruct *bump = (ZMapWindowBumpStateStruct *)user_data;
 
   if(level == ZMAPCONTAINER_LEVEL_FEATURESET)
     {
       StyleBumpModeStruct bump_data = {{0}, 0};
-      ZMapWindowItemFeatureSetData set_data;
+      ZMapWindowContainerFeatureSet container_set;
       ZMapStyleBumpMode default_bump;
       ZMapFeatureAny feature_any;
       char *style_name;
 
-      set_data = zmapWindowContainerGetData(container, ITEM_FEATURE_SET_DATA);
+      container_set = (ZMapWindowContainerFeatureSet)container;
 
-      if((feature_any = (ZMapFeatureAny)zmapWindowItemFeatureSetRecoverFeatureSet(set_data)))
+      if((feature_any = (ZMapFeatureAny)zmapWindowContainerFeatureSetRecoverFeatureSet(container_set)))
 	{
 	  bump_data.column.align_id   = feature_any->parent->parent->unique_id;
 	  bump_data.column.block_id   = feature_any->parent->unique_id;
 	  bump_data.column.set_id     = feature_any->unique_id;
-	  bump_data.column.feature_id = set_data->unique_id;
-	  bump_data.column.strand     = set_data->strand;
-	  bump_data.strand_specific   = zmapWindowItemFeatureSetIsStrandSpecific(set_data);
-	  bump_data.bump_mode         = zmapWindowItemFeatureSetGetBumpMode(set_data);
-	  default_bump                = zmapWindowItemFeatureSetGetDefaultBumpMode(set_data);
+	  bump_data.column.feature_id = container_set->unique_id;
+	  bump_data.column.strand     = container_set->strand;
+	  bump_data.strand_specific   = zmapWindowContainerFeatureSetIsStrandSpecific(container_set);
+	  bump_data.bump_mode         = zmapWindowContainerFeatureSetGetBumpMode(container_set);
+	  default_bump                = zmapWindowContainerFeatureSetGetDefaultBumpMode(container_set);
 	  
 	  style_name = (char *)g_quark_to_string(bump_data.column.set_id);
 	  
@@ -372,10 +373,10 @@ gboolean zmapWindowStateSaveBumpedColumns(ZMapWindowState state,
 
       state->bump.style_bump = g_array_new(FALSE, TRUE, 
 					   sizeof(StyleBumpModeStruct));
-      zmapWindowContainerExecute(window->feature_root_group,
-				 ZMAPCONTAINER_LEVEL_FEATURESET,
-				 get_bumped_columns,
-				 &(state->bump));
+      zmapWindowContainerUtilsExecute(window->feature_root_group,
+				      ZMAPCONTAINER_LEVEL_FEATURESET,
+				      get_bumped_columns,
+				      &(state->bump));
 
       if (zmapWindowMarkIsSet(window->mark))
 	compress_mode = ZMAPWINDOW_COMPRESS_MARK ;
@@ -619,16 +620,12 @@ static void state_bumped_columns_restore(ZMapWindow window, ZMapWindowBumpStateS
 						     column_state->column.frame,
 						     feature_id)))
 	    {
-	      ZMapWindowItemFeatureSetData set_data;
+	      ZMapWindowContainerFeatureSet container_set;
 	      FooCanvasGroup *container_parent = FOO_CANVAS_GROUP(container);
 
-	      set_data = zmapWindowContainerGetData(container_parent, ITEM_FEATURE_SET_DATA);
+	      container_set = (ZMapWindowContainerFeatureSet)(container_parent);
 
-	      if(!set_data->sorted)
-		{
-		  zmapWindowContainerSortFeatures(container_parent, 0);
-		  set_data->sorted = TRUE;
-		}
+	      zmapWindowContainerFeatureSetSortFeatures(container_set, 0);
 
 	      /* Only bump if it's different from current.
 	       * This _implicit_ test is the only way to currently check this as
@@ -638,7 +635,7 @@ static void state_bumped_columns_restore(ZMapWindow window, ZMapWindowBumpStateS
 	       * will almost certainly mean there will be odd results...
 	       */
 #warning WRONG_NEED_INITIAL_BUMP_MODE
-	      if(zmapWindowItemFeatureSetGetBumpMode(set_data) != column_state->bump_mode)
+	      if(zmapWindowContainerFeatureSetGetBumpMode(container_set) != column_state->bump_mode)
 		{
 		  /* I'm unsure on the cause of this, so this "fixes"
 		   * the crash at the expense on _not_ restoring the
@@ -687,28 +684,25 @@ static void print_position(ZMapWindowPositionStruct *position, char *from)
 
 static gboolean serialize_item(FooCanvasItem *item, SerializedItemStruct *serialize)
 {
-  FooCanvasGroup *item_container;
+  ZMapWindowContainerGroup container_group;
   ZMapFeature feature;
   gboolean serialized = FALSE;
 
   feature = g_object_get_data(G_OBJECT(item), ITEM_FEATURE_DATA);
 
-  if((item_container = zmapWindowContainerGetFromItem(item)))
+  if((container_group = zmapWindowContainerCanvasItemGetContainer(item)))
     {
-      ZMapWindowItemFeatureSetData set_data;
+      ZMapWindowContainerFeatureSet container_set;
       
-      if((set_data = zmapWindowContainerGetData(item_container, ITEM_FEATURE_SET_DATA)))
-	{
-	  serialize->strand     = set_data->strand;
-	  serialize->frame      = set_data->frame;
-	  serialize->align_id   = feature->parent->parent->parent->unique_id;
-	  serialize->block_id   = feature->parent->parent->unique_id;
-	  serialize->set_id     = feature->parent->unique_id;
-	  serialize->feature_id = feature->unique_id;
-	  serialized = TRUE;
-	}
-      else
-	serialized = FALSE;
+      container_set = (ZMapWindowContainerFeatureSet)container_group;
+
+      serialize->strand     = container_set->strand;
+      serialize->frame      = container_set->frame;
+      serialize->align_id   = feature->parent->parent->parent->unique_id;
+      serialize->block_id   = feature->parent->parent->unique_id;
+      serialize->set_id     = feature->parent->unique_id;
+      serialize->feature_id = feature->unique_id;
+      serialized = TRUE;
     }
 
   return serialized;
diff --git a/src/zmapWindow/zmapWindowTextPositioner.c b/src/zmapWindow/zmapWindowTextPositioner.c
index c2c2a00d73c4d528ee09cbb38625e11bd41a48d2..a0be2455c8d380ac2794bfd174d706470dee343b 100755
--- a/src/zmapWindow/zmapWindowTextPositioner.c
+++ b/src/zmapWindow/zmapWindowTextPositioner.c
@@ -29,16 +29,16 @@
  *
  * Exported functions: See XXXXXXXXXXXXX.h
  * HISTORY:
- * Last edited: Jun  5 17:14 2008 (rds)
+ * Last edited: Jun  4 21:22 2009 (rds)
  * Created: Thu Jan 18 16:19:10 2007 (rds)
- * CVS info:   $Id: zmapWindowTextPositioner.c,v 1.5 2008-06-05 16:47:32 rds Exp $
+ * CVS info:   $Id: zmapWindowTextPositioner.c,v 1.6 2009-06-05 13:37:38 rds Exp $
  *-------------------------------------------------------------------
  */
 
 #include <ZMap/zmapUtils.h>
 #include <zmapWindow_P.h>
-#include <zmapWindowContainer.h>
-
+#include <zmapWindowContainerUtils.h>
+#include <zmapWindowCanvasItem.h>
 
 enum
   {
@@ -184,7 +184,6 @@ ZMapWindowTextPositioner zmapWindowTextPositionerCreate(double column_min, doubl
 void zmapWindowTextPositionerAddItem(ZMapWindowTextPositioner positioner, 
                                      FooCanvasItem *item)
 {
-  FooCanvasGroup *container_parent;
   TextPositionerGroup group;
   TextCanvasSpanStruct span = {0,0};
   TextItem text;
@@ -210,16 +209,10 @@ void zmapWindowTextPositionerAddItem(ZMapWindowTextPositioner positioner,
 
   if(!positioner->container_overlay)
     {
-      if((container_parent = zmapWindowContainerGetParentContainerFromItem(item)))
-        positioner->container_overlay = zmapWindowContainerGetOverlays(container_parent);
-    }
-#ifdef RDS_ENFORCE_SAME_COLUMN
-  else
-    {
-      if((container_parent = zmapWindowContainerGetParentContainerFromItem(item)))
-        zMapAssert(positioner->container_overlay == zmapWindowContainerGetOverlays(container_parent));
+      ZMapWindowContainerGroup container_parent;
+      if((container_parent = zmapWindowContainerCanvasItemGetContainer(item)))
+        positioner->container_overlay = (FooCanvasGroup *)zmapWindowContainerGetOverlay(container_parent);
     }
-#endif
 
   if(debug_positioner_G)
     printf("item added \n");
@@ -337,7 +330,9 @@ static TextItem itemCreate(FooCanvasItem *text)
   TextItem item;
   double x1, x2, y1, y2;
 
-  zMapAssert(FOO_IS_CANVAS_TEXT(text));
+  //zMapAssert(FOO_IS_CANVAS_TEXT(text));
+  if(!ZMAP_IS_WINDOW_TEXT_FEATURE(text))
+    g_warning("Error");
 
   if(!(item = g_new0(TextItemStruct, 1)))
     zMapAssertNotReached();
diff --git a/src/zmapWindow/zmapWindowUtils.c b/src/zmapWindow/zmapWindowUtils.c
index f5bf3c4acb74cb2da8b1658d43c9f7e96e11b1d1..0ac82c328bfefcc9909ade6ddee9cb217848c9a0 100755
--- a/src/zmapWindow/zmapWindowUtils.c
+++ b/src/zmapWindow/zmapWindowUtils.c
@@ -26,9 +26,9 @@
  *              
  * Exported functions: See ZMap/zmapWindow.h
  * HISTORY:
- * Last edited: May  5 20:43 2009 (rds)
+ * Last edited: Jun  3 14:36 2009 (rds)
  * Created: Thu Jan 20 14:43:12 2005 (edgrif)
- * CVS info:   $Id: zmapWindowUtils.c,v 1.50 2009-05-06 08:59:22 rds Exp $
+ * CVS info:   $Id: zmapWindowUtils.c,v 1.51 2009-06-05 13:37:59 rds Exp $
  *-------------------------------------------------------------------
  */
 
@@ -39,7 +39,9 @@
 #include <zmapWindow_P.h>
 #include <ZMap/zmapConfig.h>
 #include <ZMap/zmapConfigLoader.h>
-#include <zmapWindowContainer.h>
+#ifdef NOT_REQUIRED
+#include <zmapWindowContainerUtils.h>
+#endif /* NOT_REQUIRED */
 
 /* Struct for style table callbacks. */
 typedef struct
@@ -635,7 +637,7 @@ static void window_cancel_cb(ZMapGuiNotebookAny notebook_any, gpointer user_data
 {
   return;
 }
-
+#ifdef NOT_REQUIRED
 static void recolour_backgrounds_cb(FooCanvasGroup *data, FooCanvasPoints *points, 
 				    ZMapContainerLevelType level, gpointer user_data)
 {
@@ -665,13 +667,15 @@ static void recolour_backgrounds_cb(FooCanvasGroup *data, FooCanvasPoints *point
 
   return ;
 }
+#endif /* NOT_REQUIRED */
 
 static void recolour_backgrounds(ZMapWindow window)
 {
-  zmapWindowContainerExecute(window->feature_root_group,
-			     ZMAPCONTAINER_LEVEL_FEATURESET,
-			     recolour_backgrounds_cb, window);
-
+#ifdef NOT_REQUIRED
+  zmapWindowContainerUtilsExecute(window->feature_root_group,
+				  ZMAPCONTAINER_LEVEL_FEATURESET,
+				  recolour_backgrounds_cb, window);
+#endif /* NOT_REQUIRED */
   return ;
 }
 static void window_apply_cb(ZMapGuiNotebookAny notebook_any, gpointer user_data)
diff --git a/src/zmapWindow/zmapWindow_P.h b/src/zmapWindow/zmapWindow_P.h
index 231a76f585d20c742c5d44d33673dd943dd15afc..9d8ba7a5a45657e308b8199e5a40216fcbd7acfd 100755
--- a/src/zmapWindow/zmapWindow_P.h
+++ b/src/zmapWindow/zmapWindow_P.h
@@ -25,9 +25,9 @@
  * Description: Defines internal interfaces/data structures of zMapWindow.
  *              
  * HISTORY:
- * Last edited: May  8 15:42 2009 (edgrif)
+ * Last edited: Jun  5 12:00 2009 (rds)
  * Created: Fri Aug  1 16:45:58 2003 (edgrif)
- * CVS info:   $Id: zmapWindow_P.h,v 1.243 2009-05-08 14:43:03 edgrif Exp $
+ * CVS info:   $Id: zmapWindow_P.h,v 1.244 2009-06-05 13:38:04 rds Exp $
  *-------------------------------------------------------------------
  */
 #ifndef ZMAP_WINDOW_P_H
@@ -41,9 +41,8 @@
 #include <ZMap/zmapWindow.h>
 #include <zmapWindowOverlays.h>
 #include <zmapWindowTextPositioner.h>
-#include <zmapWindowItemFeatureSet_I.h>
-#include <zmapWindowItemFeatureBlock.h>
-
+#include <zmapWindowContainerGroup.h>
+#include <zmapWindowContainerUtils.h>
 /* 
  *  This section details data that we attacht to the foocanvas items that represent
  *  contexts, aligns etc. Each data structure is accessed via a key given by the
@@ -61,8 +60,9 @@
 
 /* All Align/Block/Column/Feature FooCanvas objects have their corresponding ZMapFeatureAny struct
  * attached to them via this key. */
+#ifndef ITEM_FEATURE_DATA
 #define ITEM_FEATURE_DATA         ZMAP_WINDOW_P_H "item_feature_data"
-
+#endif /* !ITEM_FEATURE_DATA */
 
 
 /* All Align/Block/Column/Feature FooCanvas containers have stats blocks attached to them
@@ -272,7 +272,6 @@ enum
     ZMAP_WINDOW_MAX_WINDOW = 30000			    /* Largest canvas window. */
   } ;
 
-
 enum
   {
     ZMAP_WINDOW_INTRON_POINTS = 3			    /* Number of points to draw an intron. */
@@ -627,7 +626,7 @@ typedef struct _ZMapWindowStruct
 							       represent those parts. */
 
 
-  FooCanvasGroup *feature_root_group ;			    /* the root of our features. */
+  ZMapWindowContainerGroup feature_root_group ;	            /* The root of our features. (ZMapWindowContainerContext) */
 
   /* The stupid foocanvas can generate graphics items that are greater than the X Windows 32k
    * limit, so we have to keep a list of the canvas items that can generate graphics greater
@@ -829,6 +828,9 @@ void zmapWindowLongItemDestroy(ZMapWindowLongItems long_item) ;
 
 void zmapWindowDrawFeatures(ZMapWindow window, 
 			    ZMapFeatureContext current_context, ZMapFeatureContext new_context) ;
+void zmapWindowreDrawContainerExecute(ZMapWindow                 window,
+				      ZMapContainerUtilsExecFunc enter_cb,
+				      gpointer                   enter_data);
 
 gboolean zmapWindowDumpFile(ZMapWindow window, char *filename) ;
 
@@ -1023,7 +1025,7 @@ void zMapWindowUpdateInfoPanel(ZMapWindow window, ZMapFeature feature,
 			       gboolean replace_highlight_item, gboolean highlight_same_names) ;
 
 void zmapWindowDrawZoom(ZMapWindow window) ;
-
+void zmapWindowDrawManageWindowWidth(ZMapWindow window);
 
 void zmapWindowColumnConfigure(ZMapWindow window, FooCanvasGroup *column_group,
 			       ZMapWindowColConfigureMode configure_mode) ;
@@ -1048,12 +1050,6 @@ void zmapWindowColumnSetState(ZMapWindow window, FooCanvasGroup *column_group,
 			      ZMapStyleColumnDisplayState new_col_state, gboolean redraw_if_required) ;
 
 
-void zmapWindowItemFeatureBlockAddCompressedColumn(ZMapWindowItemFeatureBlockData block_data, 
-						   FooCanvasGroup *container) ;
-GList *zmapWindowItemFeatureBlockRemoveCompressedColumns(ZMapWindowItemFeatureBlockData block_data) ;
-void zmapWindowItemFeatureBlockAddBumpedColumn(ZMapWindowItemFeatureBlockData block_data, 
-					       FooCanvasGroup *container) ;
-GList *zmapWindowItemFeatureBlockRemoveBumpedColumns(ZMapWindowItemFeatureBlockData block_data) ;
 void zmapWindowToggleColumnInMultipleBlocks(ZMapWindow window, char *name,
                                             GQuark align_id, GQuark block_id, 
                                             gboolean force_to, gboolean force);
@@ -1291,8 +1287,8 @@ char *zmapWindowItemTextHighlightGetFullText(ZMapWindowItemHighlighter select_co
 void zmapWindowItemTextHighlightReset(ZMapWindowItemHighlighter select_control);
 #endif
 gboolean zmapWindowCreateSetColumns(ZMapWindow window, 
-                                    FooCanvasGroup *forward_strand_group, 
-                                    FooCanvasGroup *reverse_strand_group,
+                                    ZMapWindowContainerFeatures forward_strand_group, 
+                                    ZMapWindowContainerFeatures reverse_strand_group,
                                     ZMapFeatureBlock block, 
                                     ZMapFeatureSet feature_set,
 				    GData *styles,