diff --git a/src/include/ZMap/zmapConfigIni.h b/src/include/ZMap/zmapConfigIni.h
index 5e0020b177f0d37f1925bdc48f792480d42b8706..7b274e300db280cacb01476a40f0055fb71ab734 100755
--- a/src/include/ZMap/zmapConfigIni.h
+++ b/src/include/ZMap/zmapConfigIni.h
@@ -6,12 +6,12 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
@@ -23,13 +23,13 @@
  * 	Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk,
  *      Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk
  *
- * Description: 
+ * Description:
  *
  * Exported functions: See XXXXXXXXXXXXX.h
  * HISTORY:
  * Last edited: May 26 14:53 2009 (edgrif)
  * Created: Thu Sep 11 10:40:13 2008 (rds)
- * CVS info:   $Id: zmapConfigIni.h,v 1.10 2010-03-04 15:14:52 mh17 Exp $
+ * CVS info:   $Id: zmapConfigIni.h,v 1.11 2010-03-19 08:56:41 mh17 Exp $
  *-------------------------------------------------------------------
  */
 
@@ -68,10 +68,10 @@ gboolean zMapConfigIniContextIncludeFile(ZMapConfigIniContext context, char *fil
 gchar **zMapConfigIniContextGetAllStanzaNames(ZMapConfigIniContext context);
 //GList *zMapConfigIniContextGetStyleList(ZMapConfigIniContext context) ;
 
-gboolean zMapConfigIniContextAddGroup(ZMapConfigIniContext context, 
+gboolean zMapConfigIniContextAddGroup(ZMapConfigIniContext context,
 				      char *stanza_name, char *stanza_type,
 				      ZMapConfigIniContextKeyEntryStruct *keys);
-gboolean zMapConfigIniContextGetValue(ZMapConfigIniContext context, 
+gboolean zMapConfigIniContextGetValue(ZMapConfigIniContext context,
 				      char *stanza_name,
 				      char *stanza_type,
 				      char *key_name,
@@ -120,8 +120,8 @@ ZMapConfigIniContext zMapConfigIniContextDestroy(ZMapConfigIniContext context);
 
 GList *zMapConfigIniContextGetReferencedStanzas(ZMapConfigIniContext context,
 						ZMapConfigIniUserDataCreateFunc object_create_func,
-						char *parent_name, 
-						char *parent_type, 
+						char *parent_name,
+						char *parent_type,
 						char *parent_key,
 						char *child_type);
 
@@ -145,6 +145,7 @@ GList *zMapConfigIniContextGetNamed(ZMapConfigIniContext context, char *stanza_n
 GList *zMapConfigIniContextGetStyleList(ZMapConfigIniContext context,char *styles_list_in);
 
 gboolean zMapConfigIniGetStylesFromFile(char *styles_list, char *styles_file, GData **styles_out);
+GHashTable *zMapConfigIniGetSource2Featureset(ZMapConfigIniContext context);
 
 void zMapConfigSourcesFreeList(GList *config_sources_list);
 void zMapConfigStylesFreeList(GList *config_styles_list);
diff --git a/src/include/ZMap/zmapConfigStanzaStructs.h b/src/include/ZMap/zmapConfigStanzaStructs.h
index eb7ae4b9e638fd5d5a02ad2de5d453c0a06e283f..92b3d8c730d16a0edea3aea5a0f4e09df530fa12 100755
--- a/src/include/ZMap/zmapConfigStanzaStructs.h
+++ b/src/include/ZMap/zmapConfigStanzaStructs.h
@@ -28,7 +28,7 @@
  * HISTORY:
  * Last edited: Nov 13 08:58 2008 (edgrif)
  * Created: Tue Aug 26 12:38:28 2008 (rds)
- * CVS info:   $Id: zmapConfigStanzaStructs.h,v 1.5 2010-03-11 08:54:37 mh17 Exp $
+ * CVS info:   $Id: zmapConfigStanzaStructs.h,v 1.6 2010-03-19 08:56:41 mh17 Exp $
  *-------------------------------------------------------------------
  */
 
@@ -45,7 +45,7 @@ typedef struct _ZMapConfigSourceStruct
   char *styles_list, *stylesfile ;
   char *format ;
   int timeout ;
-  gboolean writeback, sequence, delayed ;
+  gboolean writeback, /* sequence,*/ delayed ;
 } ZMapConfigSourceStruct, *ZMapConfigSource;
 
 
diff --git a/src/include/ZMap/zmapConfigStrings.h b/src/include/ZMap/zmapConfigStrings.h
index d2416bd0e75894081172961fddefd1f63394b1ef..217425b11e272fb74ee5fb8e26652b17d535109b 100755
--- a/src/include/ZMap/zmapConfigStrings.h
+++ b/src/include/ZMap/zmapConfigStrings.h
@@ -40,7 +40,7 @@
  * HISTORY:
  * Last edited: Mar  2 14:19 2010 (edgrif)
  * Created: Tue Apr 25 14:36:16 2006 (edgrif)
- * CVS info:   $Id: zmapConfigStrings.h,v 1.25 2010-03-11 08:54:37 mh17 Exp $
+ * CVS info:   $Id: zmapConfigStrings.h,v 1.26 2010-03-19 08:56:41 mh17 Exp $
  *-------------------------------------------------------------------
  */
 #ifndef ZMAP_CONFIG_STRINGS_H
@@ -873,4 +873,7 @@
 
 
 
+#define ZMAPSTANZA_FEATURESET_CONFIG       "featuresets"
+
+
 #endif /* !ZMAP_CONFIG_STRINGS_H */
diff --git a/src/include/ZMap/zmapFeature.h b/src/include/ZMap/zmapFeature.h
index 55b2be191db0f7b7fe11fbf9473b36015e07023c..168609dc0be08f64480256231df2cce19518dd8a 100755
--- a/src/include/ZMap/zmapFeature.h
+++ b/src/include/ZMap/zmapFeature.h
@@ -6,12 +6,12 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
@@ -23,11 +23,11 @@
  *      Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk
  *
  * Description: Data structures describing a sequence feature.
- *              
+ *
  * HISTORY:
  * Last edited: Mar  3 13:40 2010 (edgrif)
  * Created: Fri Jun 11 08:37:19 2004 (edgrif)
- * CVS info:   $Id: zmapFeature.h,v 1.172 2010-03-04 15:25:56 mh17 Exp $
+ * CVS info:   $Id: zmapFeature.h,v 1.173 2010-03-19 08:56:41 mh17 Exp $
  *-------------------------------------------------------------------
  */
 #ifndef ZMAP_FEATURE_H
@@ -76,7 +76,7 @@ typedef int Coord ;					    /* we do need this here.... */
 
 
 typedef enum {ZMAPFEATURE_STRUCT_INVALID = 0,
-	      ZMAPFEATURE_STRUCT_CONTEXT, ZMAPFEATURE_STRUCT_ALIGN, 
+	      ZMAPFEATURE_STRUCT_CONTEXT, ZMAPFEATURE_STRUCT_ALIGN,
 	      ZMAPFEATURE_STRUCT_BLOCK, ZMAPFEATURE_STRUCT_FEATURESET,
 	      ZMAPFEATURE_STRUCT_FEATURE} ZMapFeatureStructType ;
 
@@ -91,9 +91,9 @@ typedef enum {
   ZMAPFEATURE_SUBPART_INVALID    = 0,
   ZMAPFEATURE_SUBPART_INTRON     = 1 << 0,
   ZMAPFEATURE_SUBPART_INTRON_CDS = 1 << 1,
-  ZMAPFEATURE_SUBPART_EXON       = 1 << 2, 
+  ZMAPFEATURE_SUBPART_EXON       = 1 << 2,
   ZMAPFEATURE_SUBPART_EXON_CDS   = 1 << 3,
-  ZMAPFEATURE_SUBPART_GAP        = 1 << 4, 
+  ZMAPFEATURE_SUBPART_GAP        = 1 << 4,
   ZMAPFEATURE_SUBPART_MATCH      = 1 << 5
 } ZMapFeatureSubpartType ;
 
@@ -107,14 +107,14 @@ typedef enum {ZMAPPHASE_NONE = 0,
 	      ZMAPPHASE_0, ZMAPPHASE_1, ZMAPPHASE_2} ZMapPhase ;
 
 /* as in BLAST*, i.e. target is DNA, Protein, DNA translated */
-typedef enum {ZMAPHOMOL_NONE = 0, 
+typedef enum {ZMAPHOMOL_NONE = 0,
 	      ZMAPHOMOL_N_HOMOL, ZMAPHOMOL_X_HOMOL, ZMAPHOMOL_TX_HOMOL} ZMapHomolType ;
 
 
 /* Used to specify the degree of colinearity between two alignment blocks. */
 typedef enum
   {
-    COLINEAR_INVALID, 
+    COLINEAR_INVALID,
     COLINEAR_NOT,					    /* blocks not colinear. */
     COLINEAR_IMPERFECT,					    /* blocks colinear but not contiguous. */
     COLINEAR_PERFECT					    /* blocks colinear and contiguous. */
@@ -200,7 +200,7 @@ typedef struct
 /*
  * Sequences and Block Coordinates
  *
- * In the context of displaying a single align with a single block, 
+ * In the context of displaying a single align with a single block,
  * given a chromosome and a sequence from that to look at *we have:
  *
  *  1                           X      chromosome bases
@@ -219,11 +219,11 @@ typedef struct
  * ZMap will always be run using a sequence of 1,Y; it will never start from a coordinate not equal to 1.
  * Y may be specified as 0 in various places which signifies 'the end'.
  *
- * Start and end coordinates may be specified by command line args, from the main window, 
+ * Start and end coordinates may be specified by command line args, from the main window,
  * from a GFF file header, from other servers (eg ACEDB, DAS) and these will refer to the block
  * coordinates not the sequence.
  *
- * Reverse complementing is a process that applies to blocks and this involves transforming 
+ * Reverse complementing is a process that applies to blocks and this involves transforming
  * the coordinates S,E in the context of the containing sequence 1,Y
  */
 
@@ -242,18 +242,18 @@ typedef struct ZMapFeatureAlignmentStruct_ *ZMapFeatureAlignment ;
 
 typedef struct ZMapFeatureAnyStruct_ *ZMapFeatureAny ;
 
-#define FEATURES_NEED_MAGIC 
+#define FEATURES_NEED_MAGIC
 
 
 /* WARNING: READ THIS BEFORE CHANGING ANY FEATURE STRUCTS:
- * 
+ *
  * This is the generalised feature struct which can be used to process any feature struct.
  * It helps with certain kinds of processing, e.g. in the hash searching code which relies
  * on these fields being common to all feature structs.
- * 
+ *
  * unique_id is used for the hash table that connects any feature struct to the canvas item
  * that represents it.
- * 
+ *
  * original_id is used for displaying a human readable name for the struct, e.g. the feature
  * name.
  *  */
@@ -274,10 +274,10 @@ typedef struct ZMapFeatureAnyStruct_
 
 
 /* Holds a set of data that is the complete "view" of the requested sequence.
- * 
+ *
  * This includes all the alignments which in the case of the original "fmap" like view
  * will be a single alignment containing a single block.
- * 
+ *
  */
 typedef struct ZMapFeatureContextStruct_
 {
@@ -300,7 +300,7 @@ typedef struct ZMapFeatureContextStruct_
   /* Hack...forced on us because GHash has a global destroy function per hash table, not one
    * per element of the hashtable (datalists have one per node but they have their own
    * problems as they are slow). There are two ways a context can be freed
-   * 
+   *
    * See the write up for the zMapFeatureContextMerge() for how this is used.
    */
   gboolean diff_context ;				    /* TRUE means this is a diff context. */
@@ -420,7 +420,7 @@ typedef struct ZMapFeatureSetStruct_
  *
  * Feature subtypes, homologies, transcripts, etc come first and then the ZMapFeatureStruct
  * in which they are embedded.
- * 
+ *
  */
 
 
@@ -510,7 +510,7 @@ typedef struct
 /* The Feature structure itsself. Describes a single feature, the feature may be compound
  * (e.g. have exons/introns *  etc.) or a single span or point, e.g. an allele.
  *  */
-typedef struct ZMapFeatureStruct_ 
+typedef struct ZMapFeatureStruct_
 {
   /* FeatureAny section. */
 #ifdef FEATURES_NEED_MAGIC
@@ -604,23 +604,23 @@ typedef struct
 			* very helpful, changed in favour of
 			* "Transcript" (could add feature_so_term) */
 
-  char *feature_start ; 
+  char *feature_start ;
   char *feature_end ;
   char *feature_length ;
   char *feature_strand ;
   char *feature_frame ;
 
-  char *feature_query_start ; 
-  char *feature_query_end ; 
-  char *feature_query_length ; 
+  char *feature_query_start ;
+  char *feature_query_end ;
+  char *feature_query_length ;
   char *feature_query_strand ;
 
-  
+
   /* sub feature details (still all strings) */
-  char *sub_feature_index ; 
-  char *sub_feature_start ; 
+  char *sub_feature_index ;
+  char *sub_feature_start ;
   char *sub_feature_end ;
-  char *sub_feature_query_start ; 
+  char *sub_feature_query_start ;
   char *sub_feature_query_end ;
   char *sub_feature_length ;
   char *sub_feature_none_txt ; /* If no subfeature, gives reason.... */
@@ -703,30 +703,30 @@ void zMapFeatureAnyDestroy(ZMapFeatureAny feature) ;
 
 
 /* ***************
- * FEATURE METHODS 
+ * FEATURE METHODS
  */
 
 
 #ifdef ED_G_NEVER_INCLUDE_THIS_CODE
-char *zMapFeatureCreateName(ZMapFeatureType feature_type, 
+char *zMapFeatureCreateName(ZMapFeatureType feature_type,
                             char *feature_name,
-			    ZMapStrand strand, 
-                            int start, int end, 
+			    ZMapStrand strand,
+                            int start, int end,
                             int query_start, int query_end) ;
-GQuark zMapFeatureCreateID(ZMapFeatureType feature_type, 
+GQuark zMapFeatureCreateID(ZMapFeatureType feature_type,
                            char *feature_name,
-			   ZMapStrand strand, 
+			   ZMapStrand strand,
                            int start, int end,
 			   int query_start, int query_end) ;
 #endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
-char *zMapFeatureCreateName(ZMapStyleMode feature_type, 
+char *zMapFeatureCreateName(ZMapStyleMode feature_type,
                             char *feature_name,
-			    ZMapStrand strand, 
-                            int start, int end, 
+			    ZMapStrand strand,
+                            int start, int end,
                             int query_start, int query_end) ;
-GQuark zMapFeatureCreateID(ZMapStyleMode feature_type, 
+GQuark zMapFeatureCreateID(ZMapStyleMode feature_type,
                            char *feature_name,
-			   ZMapStrand strand, 
+			   ZMapStrand strand,
                            int start, int end,
 			   int query_start, int query_end) ;
 
@@ -783,16 +783,16 @@ int      zMapFeatureLength(ZMapFeature feature, ZMapFeatureLengthType length_typ
 void     zMapFeatureDestroy(ZMapFeature feature) ;
 
 
-/* ******************* 
- * FEATURE SET METHODS 
+/* *******************
+ * FEATURE SET METHODS
  */
-GQuark zMapFeatureSetCreateID(char *feature_set_name) ; 
+GQuark zMapFeatureSetCreateID(char *feature_set_name) ;
 ZMapFeatureSet zMapFeatureSetCreate(char *source, GHashTable *features) ;
 ZMapFeatureSet zMapFeatureSetIDCreate(GQuark original_id, GQuark unique_id,
 				      ZMapFeatureTypeStyle style, GHashTable *features) ;
 gboolean zMapFeatureSetAddFeature(ZMapFeatureSet feature_set, ZMapFeature feature) ;
 gboolean zMapFeatureSetFindFeature(ZMapFeatureSet feature_set, ZMapFeature feature) ;
-ZMapFeature zMapFeatureSetGetFeatureByID(ZMapFeatureSet feature_set, 
+ZMapFeature zMapFeatureSetGetFeatureByID(ZMapFeatureSet feature_set,
                                          GQuark feature_id);
 gboolean zMapFeatureSetRemoveFeature(ZMapFeatureSet feature_set, ZMapFeature feature) ;
 void zMapFeatureSetDestroyFeatures(ZMapFeatureSet feature_set) ;
@@ -804,11 +804,11 @@ GList *zMapFeatureSetGetNamedFeatures(ZMapFeatureSet feature_set, GQuark origina
 
 
 /* *********************
- * FEATURE BLOCK METHODS 
+ * FEATURE BLOCK METHODS
  */
 GQuark zMapFeatureBlockCreateID(int ref_start, int ref_end, ZMapStrand ref_strand,
                                 int non_start, int non_end, ZMapStrand non_strand);
-gboolean zMapFeatureBlockDecodeID(GQuark id, 
+gboolean zMapFeatureBlockDecodeID(GQuark id,
                                   int *ref_start, int *ref_end, ZMapStrand *ref_strand,
                                   int *non_start, int *non_end, ZMapStrand *non_strand);
 ZMapFeatureBlock zMapFeatureBlockCreate(char *block_seq,
@@ -819,7 +819,7 @@ gboolean zMapFeatureBlockSetFeaturesCoords(ZMapFeatureBlock feature_block,
 gboolean zMapFeatureBlockAddFeatureSet(ZMapFeatureBlock feature_block, ZMapFeatureSet feature_set) ;
 gboolean zMapFeatureBlockFindFeatureSet(ZMapFeatureBlock feature_block,
                                         ZMapFeatureSet   feature_set);
-ZMapFeatureSet zMapFeatureBlockGetSetByID(ZMapFeatureBlock feature_block, 
+ZMapFeatureSet zMapFeatureBlockGetSetByID(ZMapFeatureBlock feature_block,
                                           GQuark set_id) ;
 gboolean zMapFeatureBlockRemoveFeatureSet(ZMapFeatureBlock feature_block,
                                           ZMapFeatureSet   feature_set);
@@ -832,13 +832,13 @@ gboolean zMapFeatureBlockDNA(ZMapFeatureBlock block,
 /* *************************
  * FEATURE ALIGNMENT METHODS
  */
-GQuark zMapFeatureAlignmentCreateID(char *align_sequence, gboolean master_alignment) ; 
+GQuark zMapFeatureAlignmentCreateID(char *align_sequence, gboolean master_alignment) ;
 ZMapFeatureAlignment zMapFeatureAlignmentCreate(char *align_name, gboolean master_alignment) ;
-gboolean zMapFeatureAlignmentAddBlock(ZMapFeatureAlignment feature_align, 
+gboolean zMapFeatureAlignmentAddBlock(ZMapFeatureAlignment feature_align,
 				      ZMapFeatureBlock     feature_block) ;
-gboolean zMapFeatureAlignmentFindBlock(ZMapFeatureAlignment feature_align, 
+gboolean zMapFeatureAlignmentFindBlock(ZMapFeatureAlignment feature_align,
                                        ZMapFeatureBlock     feature_block);
-ZMapFeatureBlock zMapFeatureAlignmentGetBlockByID(ZMapFeatureAlignment feature_align, 
+ZMapFeatureBlock zMapFeatureAlignmentGetBlockByID(ZMapFeatureAlignment feature_align,
                                                   GQuark block_id);
 gboolean zMapFeatureAlignmentRemoveBlock(ZMapFeatureAlignment feature_align,
                                          ZMapFeatureBlock     feature_block);
@@ -860,7 +860,7 @@ gboolean zMapFeatureContextErase(ZMapFeatureContext *current_context_inout,
 				 ZMapFeatureContext remove_context,
 				 ZMapFeatureContext *diff_context_out);
 gboolean zMapFeatureContextAddAlignment(ZMapFeatureContext feature_context,
-					ZMapFeatureAlignment alignment, 
+					ZMapFeatureAlignment alignment,
 					gboolean master) ;
 gboolean zMapFeatureContextFindAlignment(ZMapFeatureContext   feature_context,
                                          ZMapFeatureAlignment feature_align);
@@ -881,32 +881,32 @@ void zMapFeatureContextDestroy(ZMapFeatureContext context, gboolean free_data) ;
 GList *zMapFeatureString2QuarkList(char *string_list) ;
 GList *zMapFeatureCopyQuarkList(GList *quark_list_orig) ;
 
-void zMapFeatureContextExecute(ZMapFeatureAny feature_any, 
-                               ZMapFeatureStructType stop, 
-                               ZMapGDataRecurseFunc callback, 
+void zMapFeatureContextExecute(ZMapFeatureAny feature_any,
+                               ZMapFeatureStructType stop,
+                               ZMapGDataRecurseFunc callback,
                                gpointer data);
-void zMapFeatureContextExecuteFull(ZMapFeatureAny feature_any, 
-                                   ZMapFeatureStructType stop, 
-                                   ZMapGDataRecurseFunc callback, 
+void zMapFeatureContextExecuteFull(ZMapFeatureAny feature_any,
+                                   ZMapFeatureStructType stop,
+                                   ZMapGDataRecurseFunc callback,
                                    gpointer data);
-void zMapFeatureContextExecuteComplete(ZMapFeatureAny feature_any, 
-                                       ZMapFeatureStructType stop, 
-                                       ZMapGDataRecurseFunc start_callback, 
-                                       ZMapGDataRecurseFunc end_callback, 
+void zMapFeatureContextExecuteComplete(ZMapFeatureAny feature_any,
+                                       ZMapFeatureStructType stop,
+                                       ZMapGDataRecurseFunc start_callback,
+                                       ZMapGDataRecurseFunc end_callback,
                                        gpointer data);
-void zMapFeatureContextExecuteSubset(ZMapFeatureAny feature_any, 
-                                     ZMapFeatureStructType stop, 
-                                     ZMapGDataRecurseFunc callback, 
+void zMapFeatureContextExecuteSubset(ZMapFeatureAny feature_any,
+                                     ZMapFeatureStructType stop,
+                                     ZMapGDataRecurseFunc callback,
                                      gpointer data);
-void zMapFeatureContextExecuteRemoveSafe(ZMapFeatureAny feature_any, 
-					 ZMapFeatureStructType stop, 
-					 ZMapGDataRecurseFunc start_callback, 
-					 ZMapGDataRecurseFunc end_callback, 
+void zMapFeatureContextExecuteRemoveSafe(ZMapFeatureAny feature_any,
+					 ZMapFeatureStructType stop,
+					 ZMapGDataRecurseFunc start_callback,
+					 ZMapGDataRecurseFunc end_callback,
 					 gpointer data);
-void zMapFeatureContextExecuteStealSafe(ZMapFeatureAny feature_any, 
-					ZMapFeatureStructType stop, 
-					ZMapGDataRecurseFunc start_callback, 
-					ZMapGDataRecurseFunc end_callback, 
+void zMapFeatureContextExecuteStealSafe(ZMapFeatureAny feature_any,
+					ZMapFeatureStructType stop,
+					ZMapGDataRecurseFunc start_callback,
+					ZMapGDataRecurseFunc end_callback,
 					gpointer data);
 
 
@@ -929,11 +929,12 @@ gboolean zMapFeatureAnyForceModesToStyles(ZMapFeatureAny feature_any, GData *sty
 
 /* Probably should be merged at some time.... */
 gboolean zMapFeatureDumpStdOutFeatures(ZMapFeatureContext feature_context, GData *styles, GError **error_out) ;
+gboolean zMapFeatureDumpToFileName(ZMapFeatureContext feature_context,char *filename,char *header, GData *styles, GError **error_out);
 gboolean zMapFeatureContextDump(ZMapFeatureContext feature_context, GData *styles,
 				GIOChannel *file, GError **error_out) ;
 
 gboolean zMapFeatureContextDumpToFile(ZMapFeatureAny             feature_any,
-				      GData *styles, 
+				      GData *styles,
 				      ZMapFeatureDumpFeatureFunc dump_func,
 				      gpointer                   dump_user_data,
 				      GIOChannel                *dump_file,
@@ -946,13 +947,13 @@ gboolean zMapFeatureContextRangeDumpToFile(ZMapFeatureAny             dump_set,
 					   GIOChannel                *dump_file,
 					   GError                   **dump_error_out) ;
 gboolean zMapFeatureListDumpToFile(GList                     *feature_list,
-				   GData *styles, 
+				   GData *styles,
 				   ZMapFeatureDumpFeatureFunc dump_func,
 				   gpointer                   dump_user_data,
 				   GIOChannel                *dump_file,
 				   GError                   **dump_error_out);
 gboolean zMapFeatureListForeachDumperCreate(ZMapFeatureDumpFeatureFunc dump_func,
-					    GData *styles, 
+					    GData *styles,
 					    gpointer                   dump_user_data,
 					    GDestroyNotify             dump_user_free,
 					    GIOChannel                *dump_file,
@@ -970,7 +971,7 @@ void zMapFeature3FrameTranslationPopulate(ZMapFeatureSet feature_set);
 gboolean zMapFeature3FrameTranslationCreateSet(ZMapFeatureBlock block, ZMapFeatureSet *set_out);
 
 
-gboolean zMapFeatureWorld2Transcript(ZMapFeature feature, 
+gboolean zMapFeatureWorld2Transcript(ZMapFeature feature,
 				     int w1, int w2,
 				     int *t1, int *t2);
 ZMapFrame zMapFeatureTranscriptFrame(ZMapFeature feature);
@@ -1009,19 +1010,19 @@ char *zMapFeatureDNAFeatureName(ZMapFeatureBlock block);
 GQuark zMapFeatureDNAFeatureID(ZMapFeatureBlock block);
 gboolean zMapFeatureDNACreateFeatureSet(ZMapFeatureBlock block, ZMapFeatureSet *feature_set_out);
 void zMapFeatureDNAAddSequenceData(ZMapFeature dna_feature, char *dna_str, int sequence_length);
-ZMapFeature zMapFeatureDNACreateFeature(ZMapFeatureBlock     block, 
+ZMapFeature zMapFeatureDNACreateFeature(ZMapFeatureBlock     block,
 					ZMapFeatureTypeStyle style,
-					char *dna_str, 
+					char *dna_str,
 					int   sequence_length);
 
 void zMapFeature3FrameTranslationSetCreateFeatures(ZMapFeatureSet feature_set,
 						   ZMapFeatureTypeStyle style);
 
 
-GArray *zMapFeatureAnyAsXMLEvents(ZMapFeatureAny feature_any, 
+GArray *zMapFeatureAnyAsXMLEvents(ZMapFeatureAny feature_any,
                                   /* ZMapFeatureXMLType xml_type */
                                   int xml_type);
-gboolean zMapFeatureAnyAsXML(ZMapFeatureAny feature_any, 
+gboolean zMapFeatureAnyAsXML(ZMapFeatureAny feature_any,
                              ZMapXMLWriter xml_writer,
                              GArray **xml_events_out,
                              int xml_type);
@@ -1033,9 +1034,9 @@ ZMapFeatureAny zMapFeatureContextFindFeatureFromFeature(ZMapFeatureContext conte
 
 
 GType zMapFeatureDataGetType(void);
-gboolean zMapFeatureGetInfo(ZMapFeatureAny         feature_any, 
+gboolean zMapFeatureGetInfo(ZMapFeatureAny         feature_any,
 			    ZMapFeatureSubPartSpan sub_feature,
-			    const gchar           *first_property_name, 
+			    const gchar           *first_property_name,
 			    ...);
 
 
diff --git a/src/include/ZMap/zmapView.h b/src/include/ZMap/zmapView.h
index 4f8fd594fa7cf5d53515935b6b5788ac4f73a96b..55f53ea64d22b1b6aa823d58ce902be4ae34fe6b 100755
--- a/src/include/ZMap/zmapView.h
+++ b/src/include/ZMap/zmapView.h
@@ -6,12 +6,12 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
@@ -27,11 +27,11 @@
  *              collected from one or more servers. Hence the view
  *              interface controls both windows and connections to
  *              servers.
- *              
+ *
  * HISTORY:
  * Last edited: Jun 12 14:36 2009 (edgrif)
  * Created: Thu May 13 14:59:14 2004 (edgrif)
- * CVS info:   $Id: zmapView.h,v 1.56 2010-03-04 15:15:27 mh17 Exp $
+ * CVS info:   $Id: zmapView.h,v 1.57 2010-03-19 08:56:41 mh17 Exp $
  *-------------------------------------------------------------------
  */
 #ifndef ZMAPVIEW_H
@@ -134,6 +134,7 @@ typedef enum {
 
   ZMAPVIEW_LOADING,					    /* Loading data. */
   ZMAPVIEW_LOADED,					    /* Full view. */
+  ZMAPVIEW_UPDATING,                                /* after LOADED we can request more data */
 
   ZMAPVIEW_RESETTING,					    /* Returning to ZMAPVIEW_NOT_CONNECTED. */
 
diff --git a/src/zmapConfig/zmapConfigFile.c b/src/zmapConfig/zmapConfigFile.c
index f0794a31c7cc438710335b17dfe997bdecd7f176..af2e4fd0e6a915f9cea91e20efe331bc46b56f1d 100644
--- a/src/zmapConfig/zmapConfigFile.c
+++ b/src/zmapConfig/zmapConfigFile.c
@@ -6,12 +6,12 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
@@ -23,12 +23,12 @@
  * 	Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk,
  *      Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk
  *
- * Description: 
+ * Description:
  *
  * Exported functions: See XXXXXXXXXXXXX.h
  * HISTORY:
  * Created: 2009-12-09 12:09:18 (mgh)
- * CVS info:   $Id: zmapConfigFile.c,v 1.3 2010-03-04 15:09:42 mh17 Exp $
+ * CVS info:   $Id: zmapConfigFile.c,v 1.4 2010-03-19 08:56:41 mh17 Exp $
  *-------------------------------------------------------------------
  */
 
@@ -113,9 +113,9 @@ gboolean zMapConfigIniReadBuffer(ZMapConfigIni config, char *buffer)
     {
       config->buffer_key_file = g_key_file_new();
 
-      if(!(g_key_file_load_from_data(config->buffer_key_file, 
+      if(!(g_key_file_load_from_data(config->buffer_key_file,
 				     buffer, strlen(buffer),
-				     G_KEY_FILE_KEEP_COMMENTS, 
+				     G_KEY_FILE_KEEP_COMMENTS,
 				     &(config->buffer_key_error))))
 	{
 	  /* Do something with the error... */
@@ -227,13 +227,13 @@ gboolean zMapConfigIniSaveUser(ZMapConfigIni config)
 	  file_contents = NULL;
 	}
     }
-  
+
 
   return saved;
 }
 
 
-gboolean zMapConfigIniHasStanza(ZMapConfigIni config,char *stanza_name)
+gboolean zMapConfigIniHasStanza(ZMapConfigIni config,char *stanza_name,GKeyFile **which)
 {
   GKeyFile *files[FILE_COUNT];
   gboolean result = FALSE;
@@ -244,13 +244,17 @@ gboolean zMapConfigIniHasStanza(ZMapConfigIni config,char *stanza_name)
   files[2] = config->user_key_file;
   files[3] = config->extra_key_file;
   files[4] = config->buffer_key_file;
-  
-  for (i = 0; result == FALSE && i < FILE_COUNT; i++)
+
+  for (i = 0;i < FILE_COUNT; i++)
     {
       if(files[i])
-      result = g_key_file_has_group(files[i], stanza_name);
+        result = g_key_file_has_group(files[i], stanza_name);
+      if(result)
+            break;
     }
-  
+  if(result && which)
+      *which = files[i];
+
   return result;
 }
 
diff --git a/src/zmapConfig/zmapConfigIni_P.h b/src/zmapConfig/zmapConfigIni_P.h
index d187cc4fe52cc31099abfcf246686ee60a60c6cd..7b977899e66d172945086ebce8846a6cc1f4f72b 100644
--- a/src/zmapConfig/zmapConfigIni_P.h
+++ b/src/zmapConfig/zmapConfigIni_P.h
@@ -6,12 +6,12 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
@@ -23,12 +23,12 @@
  *      Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk,
  *      Rob Clack (Sanger Institute, UK) rnc@sanger.ac.uk
  *
- * Description: 
+ * Description:
  *
  * Exported functions: See ZMap/ConfigIni.h
  * HISTORY:
  * Created: 2009-12-09 13:10:58 (mgh)
- * CVS info:   $Id: zmapConfigIni_P.h,v 1.3 2010-03-04 15:09:44 mh17 Exp $
+ * CVS info:   $Id: zmapConfigIni_P.h,v 1.4 2010-03-19 08:56:42 mh17 Exp $
  *-------------------------------------------------------------------
  */
 #ifndef ZMAP_CONFIGINI_P_H
@@ -62,6 +62,7 @@ typedef struct _ZMapConfigIniStruct
 
 } ZMapConfigIniStruct, *ZMapConfigIni;
 
+#ifdef MH17_IN_CONFIG_H
 
 
 /*! @addtogroup zmapconfig
@@ -200,7 +201,7 @@ ZMapConfigStanza zMapConfigGetNextStanza(ZMapConfigStanzaSet stanzas, ZMapConfig
 ZMapConfigStanzaElement zMapConfigFindElement(ZMapConfigStanza stanza, char *element_name) ;
 
 void zMapConfigDestroyStanza(ZMapConfigStanza stanza) ;
-
+#endif
 
 
 ZMapConfigIni zMapConfigIniNew(void) ;
@@ -208,7 +209,7 @@ gboolean zMapConfigIniReadAll(ZMapConfigIni config);
 gboolean zMapConfigIniReadUser(ZMapConfigIni config);
 gboolean zMapConfigIniReadBuffer(ZMapConfigIni config, char *buffer);
 gboolean zMapConfigIniReadFile(ZMapConfigIni config, char *file);
-gboolean zMapConfigIniHasStanza(ZMapConfigIni config,char *stanza_name);
+gboolean zMapConfigIniHasStanza(ZMapConfigIni config,char *stanza_name,GKeyFile **which);
 void zMapConfigIniGetStanza(ZMapConfigIni config, char *stanza_name);
 void zMapConfigIniGetAllStanzas(ZMapConfigIni config);
 void zMapConfigIniGetStanzaValues(ZMapConfigIni, char *stanza_name);
@@ -222,9 +223,9 @@ gboolean zMapConfigIniGetValue(ZMapConfigIni config,
                          char * key_name,
                          GValue **value_out,
                          GType type);
-void zMapConfigIniSetValue(ZMapConfigIni config, 
-                     char *stanza_name, 
-                     char *key_name, 
+void zMapConfigIniSetValue(ZMapConfigIni config,
+                     char *stanza_name,
+                     char *key_name,
                      GValue *value);
 gboolean zMapConfigIniSaveUser(ZMapConfigIni config);
 void zMapConfigIniDestroy(ZMapConfigIni config, gboolean save_user);
diff --git a/src/zmapConfig/zmapConfigLoader.c b/src/zmapConfig/zmapConfigLoader.c
index c2d66701aecd85a5016136e2112eb50f1af50a7d..4a5f9b3df74c9b25aebfed66273e4f9e238cf5c1 100644
--- a/src/zmapConfig/zmapConfigLoader.c
+++ b/src/zmapConfig/zmapConfigLoader.c
@@ -31,7 +31,7 @@
  * HISTORY:
  * Last edited: Mar  2 14:47 2010 (edgrif)
  * Created: Thu Sep 25 14:12:05 2008 (rds)
- * CVS info:   $Id: zmapConfigLoader.c,v 1.8 2010-03-10 14:14:49 mh17 Exp $
+ * CVS info:   $Id: zmapConfigLoader.c,v 1.9 2010-03-19 08:56:42 mh17 Exp $
  *-------------------------------------------------------------------
  */
 
@@ -43,7 +43,7 @@
 #include <ZMap/zmapConfigIni.h>
 #include <ZMap/zmapConfigStrings.h>
 #include <ZMap/zmapConfigStanzaStructs.h>
-
+#include <ZMap/zmapGFF.h>
 
 
 static ZMapConfigIniContextKeyEntry get_app_group_data(char **stanza_name, char **stanza_type);
@@ -316,7 +316,7 @@ static void fetch_referenced_stanzas(gpointer list_data, gpointer user_data)
 
   full_data->current_stanza_name = stanza_name;
 
-  if (zMapConfigIniHasStanza(full_data->context->config, stanza_name) && (full_data->object_create_func))
+  if (zMapConfigIniHasStanza(full_data->context->config, stanza_name,NULL) && (full_data->object_create_func))
     {
       if ((full_data->current_object = (full_data->object_create_func)()))
       {
@@ -655,7 +655,43 @@ gboolean zMapConfigIniGetStylesFromFile(char *styles_list, char *styles_file, GD
 
 
 
+/*
+ * read the [featuresets] stanza and put it in a hash table
+ * NOTE: this function operates differently from normal ConfigIni in that we do not know
+ *  the names of the keys in the stanza and cannot create a struct to hold these and thier values
+ * So instead we have to use GLib directly.
+ * the strings need to be quarked first
+ */
+GHashTable *zMapConfigIniGetSource2Featureset(ZMapConfigIniContext context)
+{
+      GHashTable *hash = NULL;
+      GKeyFile *gkf;
+      gchar ** keys = NULL;
+      gsize len,n_source;
+      gchar **sources;
+      ZMapGFFSet GFFset;
+
+      if(zMapConfigIniHasStanza(context->config,ZMAPSTANZA_FEATURESET_CONFIG,&gkf))
+      {
+            hash = g_hash_table_new(NULL,NULL);
+
+            keys = g_key_file_get_keys(gkf,ZMAPSTANZA_FEATURESET_CONFIG,&len,NULL);
 
+            for(;len--;keys++)
+            {
+                  sources = g_key_file_get_string_list(gkf,ZMAPSTANZA_FEATURESET_CONFIG,*keys,&n_source,NULL);
+
+                  GFFset = g_new0(ZMapGFFSetStruct,1);
+                  GFFset->feature_set_id = g_quark_from_string(*keys);
+                  GFFset->description = g_strdup(*keys);
+
+                  while(n_source--)
+                        g_hash_table_insert(hash,GUINT_TO_POINTER(g_quark_from_string(*sources++)),GFFset);
+            }
+      }
+
+      return(hash);
+}
 
 
 
@@ -1016,7 +1052,7 @@ static ZMapConfigIniContextKeyEntry get_source_group_data(char **stanza_name, ch
     { ZMAPSTANZA_SOURCE_FEATURESETS,   G_TYPE_STRING,  source_set_property, FALSE },
     { ZMAPSTANZA_SOURCE_STYLES,        G_TYPE_STRING,  source_set_property, FALSE },
     { ZMAPSTANZA_SOURCE_NAVIGATORSETS, G_TYPE_STRING,  source_set_property, FALSE },
-    { ZMAPSTANZA_SOURCE_SEQUENCE,      G_TYPE_BOOLEAN, source_set_property, FALSE },
+//    { ZMAPSTANZA_SOURCE_SEQUENCE,      G_TYPE_BOOLEAN, source_set_property, FALSE },
     { ZMAPSTANZA_SOURCE_WRITEBACK,     G_TYPE_BOOLEAN, source_set_property, FALSE },
     { ZMAPSTANZA_SOURCE_FORMAT,        G_TYPE_STRING,  source_set_property, FALSE },
     { ZMAPSTANZA_SOURCE_DELAYED,       G_TYPE_BOOLEAN, source_set_property, FALSE },
@@ -1058,8 +1094,8 @@ static void source_set_property(char *current_stanza_name, char *key, GType type
 	str_ptr = &(config_source->navigatorsets) ;
       else if (g_ascii_strcasecmp(key, ZMAPSTANZA_SOURCE_TIMEOUT) == 0)
 	int_ptr = &(config_source->timeout) ;
-      else if (g_ascii_strcasecmp(key, ZMAPSTANZA_SOURCE_SEQUENCE) == 0)
-	bool_ptr = &(config_source->sequence) ;
+//      else if (g_ascii_strcasecmp(key, ZMAPSTANZA_SOURCE_SEQUENCE) == 0)
+//	bool_ptr = &(config_source->sequence) ;
       else if (g_ascii_strcasecmp(key, ZMAPSTANZA_SOURCE_WRITEBACK) == 0)
 	bool_ptr = &(config_source->writeback) ;
       else if (g_ascii_strcasecmp(key, ZMAPSTANZA_SOURCE_FORMAT) == 0)
diff --git a/src/zmapFeature/zmapFeature.c b/src/zmapFeature/zmapFeature.c
index 397a528a3b976da17c93201fbf7b972a3ce67009..c82811248a8a8cb5a88d7028ee52484795712422 100755
--- a/src/zmapFeature/zmapFeature.c
+++ b/src/zmapFeature/zmapFeature.c
@@ -6,12 +6,12 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
@@ -24,12 +24,12 @@
  *
  * Description: Implements feature contexts, sets and features themselves.
  *              Includes code to create/merge/destroy contexts and sets.
- *              
+ *
  * Exported functions: See zmapView_P.h
  * HISTORY:
  * Last edited: Dec 14 11:20 2009 (edgrif)
  * Created: Fri Jul 16 13:05:58 2004 (edgrif)
- * CVS info:   $Id: zmapFeature.c,v 1.122 2010-03-04 15:10:19 mh17 Exp $
+ * CVS info:   $Id: zmapFeature.c,v 1.123 2010-03-19 08:56:42 mh17 Exp $
  *-------------------------------------------------------------------
  */
 
@@ -46,9 +46,9 @@
 
 /*! @defgroup zmapfeatures   zMapFeatures: feature handling for ZMap
  * @{
- * 
+ *
  * \brief  Feature handling for ZMap.
- * 
+ *
  * zMapFeatures routines provide functions to create/modify/destroy individual
  * features, sets of features and feature contexts (contexts are sets of sets
  * of features with associated coordinate data for parent mapping etc.).
@@ -151,21 +151,21 @@ static void printDestroyDebugInfo(ZMapFeatureAny any, char *who) ;
 
 static gboolean checkForPerfectAlign(GArray *gaps, unsigned int align_error) ;
 
-static ZMapFeatureContextExecuteStatus eraseContextCB(GQuark key, 
-                                                      gpointer data, 
+static ZMapFeatureContextExecuteStatus eraseContextCB(GQuark key,
+                                                      gpointer data,
                                                       gpointer user_data,
                                                       char **err_out);
-static ZMapFeatureContextExecuteStatus destroyIfEmptyContextCB(GQuark key, 
-                                                               gpointer data, 
+static ZMapFeatureContextExecuteStatus destroyIfEmptyContextCB(GQuark key,
+                                                               gpointer data,
                                                                gpointer user_data,
                                                                char **err_out);
-static ZMapFeatureContextExecuteStatus mergePreCB(GQuark key, 
-                                                  gpointer data, 
+static ZMapFeatureContextExecuteStatus mergePreCB(GQuark key,
+                                                  gpointer data,
                                                   gpointer user_data,
                                                   char **err_out);
 
-static ZMapFeatureContextExecuteStatus addModeCB(GQuark key_id, 
-						 gpointer data, 
+static ZMapFeatureContextExecuteStatus addModeCB(GQuark key_id,
+						 gpointer data,
 						 gpointer user_data,
 						 char **error_out) ;
 static void addFeatureModeCB(gpointer key, gpointer data, gpointer user_data) ;
@@ -247,7 +247,7 @@ gboolean zMapFeatureAnyRemoveFeature(ZMapFeatureAny feature_parent, ZMapFeatureA
     {
       result = g_hash_table_steal(feature_parent->children, zmapFeature2HashKey(feature)) ;
       feature->parent = NULL;
-  
+
       switch(feature->struct_type)
 	{
 	case ZMAPFEATURE_STRUCT_CONTEXT:
@@ -283,10 +283,10 @@ gboolean zMapFeatureAnyRemoveFeature(ZMapFeatureAny feature_parent, ZMapFeatureA
 
 /* go through all the feature sets in the given AnyFeature (must be at least a feature set)
  * and set the style mode from that...a bit hacky really...think about this....
- * 
+ *
  * Really this is all acedb methods which are not rich enough for what we want to set
  * in our styles...
- * 
+ *
  *  */
 gboolean zMapFeatureAnyAddModesToStyles(ZMapFeatureAny feature_any, GData *styles)
 {
@@ -297,7 +297,7 @@ gboolean zMapFeatureAnyAddModesToStyles(ZMapFeatureAny feature_any, GData *style
   hack.force = FALSE ;
   hack.styles = styles ;
 
-  zMapFeatureContextExecuteSubset(feature_any, 
+  zMapFeatureContextExecuteSubset(feature_any,
                                   ZMAPFEATURE_STRUCT_FEATURESET,
                                   addModeCB,
                                   &hack) ;
@@ -326,7 +326,7 @@ gboolean zMapFeatureAnyForceModesToStyles(ZMapFeatureAny feature_any, GData *sty
 
 #warning This function should be removed... and zMapFeatureAnyAddModesToStyles used instead.
 
-  zMapFeatureContextExecuteSubset(feature_any, 
+  zMapFeatureContextExecuteSubset(feature_any,
                                   ZMAPFEATURE_STRUCT_FEATURESET,
                                   addModeCB,
                                   &hack) ;
@@ -409,12 +409,12 @@ ZMapFeatureAny zmapFeatureAnyCopy(ZMapFeatureAny orig_feature_any, GDestroyNotif
       }
     case ZMAPFEATURE_STRUCT_BLOCK:
       {
-	ZMapFeatureBlock new_block = (ZMapFeatureBlock)new_feature_any ;	
+	ZMapFeatureBlock new_block = (ZMapFeatureBlock)new_feature_any ;
 
 	new_block->sequence.type = ZMAPSEQUENCE_NONE ;
 	new_block->sequence.length = 0 ;
 	new_block->sequence.sequence = NULL ;
-	
+
 	break;
       }
     case ZMAPFEATURE_STRUCT_FEATURESET:
@@ -437,15 +437,15 @@ ZMapFeatureAny zmapFeatureAnyCopy(ZMapFeatureAny orig_feature_any, GDestroyNotif
 	      {
 		int i ;
 
-		new_feature->feature.homol.align = 
-		  g_array_sized_new(FALSE, TRUE, 
+		new_feature->feature.homol.align =
+		  g_array_sized_new(FALSE, TRUE,
 				    sizeof(ZMapAlignBlockStruct),
 				    orig_feature->feature.homol.align->len);
 
 		for (i = 0; i < orig_feature->feature.homol.align->len; i++)
 		  {
 		    align = g_array_index(orig_feature->feature.homol.align, ZMapAlignBlockStruct, i);
-		    new_feature->feature.homol.align = 
+		    new_feature->feature.homol.align =
 		      g_array_append_val(new_feature->feature.homol.align, align);
 		  }
 	      }
@@ -458,15 +458,15 @@ ZMapFeatureAny zmapFeatureAnyCopy(ZMapFeatureAny orig_feature_any, GDestroyNotif
 	    if (orig_feature->feature.transcript.exons != NULL
 		&& orig_feature->feature.transcript.exons->len > (guint)0)
 	      {
-		new_feature->feature.transcript.exons = 
-		  g_array_sized_new(FALSE, TRUE, 
+		new_feature->feature.transcript.exons =
+		  g_array_sized_new(FALSE, TRUE,
 				    sizeof(ZMapSpanStruct),
 				    orig_feature->feature.transcript.exons->len);
 
 		for (i = 0; i < orig_feature->feature.transcript.exons->len; i++)
 		  {
 		    span = g_array_index(orig_feature->feature.transcript.exons, ZMapSpanStruct, i);
-		    new_feature->feature.transcript.exons = 
+		    new_feature->feature.transcript.exons =
 		      g_array_append_val(new_feature->feature.transcript.exons, span);
 		  }
 	      }
@@ -474,15 +474,15 @@ ZMapFeatureAny zmapFeatureAnyCopy(ZMapFeatureAny orig_feature_any, GDestroyNotif
 	    if (orig_feature->feature.transcript.introns != NULL
 		&& orig_feature->feature.transcript.introns->len > (guint)0)
 	      {
-		new_feature->feature.transcript.introns = 
-		  g_array_sized_new(FALSE, TRUE, 
+		new_feature->feature.transcript.introns =
+		  g_array_sized_new(FALSE, TRUE,
 				    sizeof(ZMapSpanStruct),
 				    orig_feature->feature.transcript.introns->len);
 
 		for (i = 0; i < orig_feature->feature.transcript.introns->len; i++)
 		  {
 		    span = g_array_index(orig_feature->feature.transcript.introns, ZMapSpanStruct, i);
-		    new_feature->feature.transcript.introns = 
+		    new_feature->feature.transcript.introns =
 		      g_array_append_val(new_feature->feature.transcript.introns, span);
 		  }
 	      }
@@ -516,7 +516,7 @@ void zMapFeatureAnyDestroy(ZMapFeatureAny feature_any)
 
 /*!
  * Returns a single feature correctly intialised to be a "NULL" feature.
- * 
+ *
  * @param   void  None.
  * @return  ZMapFeature  A pointer to the new ZMapFeature.
  *  */
@@ -558,7 +558,7 @@ ZMapFeature zMapFeatureCreateFromStandardData(char *name, char *sequence, char *
       if ((feature_name_id = zMapFeatureCreateName(feature_type, name, strand,
 						   start, end, 0, 0)) != NULL)
         {
-          if ((good = zMapFeatureAddStandardData(feature, feature_name_id, 
+          if ((good = zMapFeatureAddStandardData(feature, feature_name_id,
 						 name, sequence, ontology,
 						 feature_type, style,
 						 start, end, has_score, score,
@@ -620,7 +620,7 @@ gboolean zMapFeatureAddStandardData(ZMapFeature feature, char *feature_name_id,
 /*!
  * Adds data to a feature which may be empty or may already have partial features,
  * e.g. transcript that does not yet have all its exons.
- * 
+ *
  * NOTE that really we need this to be a polymorphic function so that the arguments
  * are different for different features.
  *  */
@@ -649,7 +649,7 @@ gboolean zMapFeatureAddKnownName(ZMapFeature feature, char *known_name)
 /*!
  * Adds data to a feature which may be empty or may already have partial features,
  * e.g. transcript that does not yet have all its exons.
- * 
+ *
  * NOTE that really we need this to be a polymorphic function so that the arguments
  * are different for different features.
  *  */
@@ -683,7 +683,7 @@ gboolean zMapFeatureAddTranscriptData(ZMapFeature feature,
 /*!
  * Adds data to a feature which may be empty or may already have partial features,
  * e.g. transcript that does not yet have all its exons.
- * 
+ *
  * NOTE that really we need this to be a polymorphic function so that the arguments
  * are different for different features.
  *  */
@@ -811,7 +811,7 @@ gboolean zMapFeatureAddAlignmentData(ZMapFeature feature,
 
       feature->feature.homol.flags.perfect = checkForPerfectAlign(feature->feature.homol.align, align_error) ;
     }
-	  
+
   return result ;
 }
 
@@ -833,7 +833,7 @@ gboolean zMapFeatureAddAssemblyPathData(ZMapFeature feature,
 
       result = TRUE ;
     }
-	  
+
   return result ;
 }
 
@@ -895,7 +895,7 @@ gboolean zMapFeatureAddText(ZMapFeature feature, GQuark source_id, char *source_
 /*!
  * Returns the length of a feature. For a simple feature this is just (end - start + 1),
  * for transcripts and alignments the exons or blocks must be totalled up.
- * 
+ *
  * @param   feature      Feature for which length is required.
  * @param   length_type  Length in target sequence coords or query sequence coords or spliced length.
  * @return               nothing.
@@ -988,7 +988,7 @@ int zMapFeatureLength(ZMapFeature feature, ZMapFeatureLengthType length_type)
 
 /*!
  * Destroys a feature, freeing up all of its resources.
- * 
+ *
  * @param   feature      The feature to be destroyed.
  * @return               nothing.
  *  */
@@ -1007,7 +1007,7 @@ void zMapFeatureDestroy(ZMapFeature feature)
 
 
 
-/* 
+/*
  *                      Feature Set functions.
  */
 
@@ -1054,7 +1054,7 @@ ZMapFeatureSet zMapFeatureSetIDCreate(GQuark original_id, GQuark unique_id,
 
 /* Feature must not be null to be added we need at least the feature id and probably should.
  * check for more.
- * 
+ *
  * Returns FALSE if feature is already in set.
  *  */
 gboolean zMapFeatureSetAddFeature(ZMapFeatureSet feature_set, ZMapFeature feature)
@@ -1068,7 +1068,7 @@ gboolean zMapFeatureSetAddFeature(ZMapFeatureSet feature_set, ZMapFeature featur
 
 
 /* Returns TRUE if the feature could be found in the feature_set, FALSE otherwise. */
-gboolean zMapFeatureSetFindFeature(ZMapFeatureSet feature_set, 
+gboolean zMapFeatureSetFindFeature(ZMapFeatureSet feature_set,
                                    ZMapFeature    feature)
 {
   gboolean result = FALSE ;
@@ -1091,7 +1091,7 @@ ZMapFeature zMapFeatureSetGetFeatureByID(ZMapFeatureSet feature_set, GQuark feat
 
 
 /* Feature must exist in set to be removed.
- * 
+ *
  * Returns FALSE if feature is not in set.
  *  */
 gboolean zMapFeatureSetRemoveFeature(ZMapFeatureSet feature_set, ZMapFeature feature)
@@ -1192,7 +1192,7 @@ void zMapFeatureSetDestroyFeatures(ZMapFeatureSet feature_set)
 
 
 
-/* 
+/*
  *                Alignment functions
  */
 
@@ -1207,7 +1207,7 @@ GQuark zMapFeatureAlignmentCreateID(char *align_name, gboolean master_alignment)
     unique_name = g_strdup(align_name) ;
 
   id = g_quark_from_string(unique_name) ;
-  
+
   g_free(unique_name);
 
   return id;
@@ -1242,7 +1242,7 @@ gboolean zMapFeatureAlignmentAddBlock(ZMapFeatureAlignment alignment, ZMapFeatur
 }
 
 
-gboolean zMapFeatureAlignmentFindBlock(ZMapFeatureAlignment feature_align, 
+gboolean zMapFeatureAlignmentFindBlock(ZMapFeatureAlignment feature_align,
                                        ZMapFeatureBlock     feature_block)
 {
   gboolean result = FALSE;
@@ -1257,7 +1257,7 @@ gboolean zMapFeatureAlignmentFindBlock(ZMapFeatureAlignment feature_align,
 ZMapFeatureBlock zMapFeatureAlignmentGetBlockByID(ZMapFeatureAlignment feature_align, GQuark block_id)
 {
   ZMapFeatureBlock feature_block = NULL;
-  
+
   feature_block = (ZMapFeatureBlock)zMapFeatureAnyGetFeatureByID((ZMapFeatureAny)feature_align, block_id) ;
 
   return feature_block ;
@@ -1343,7 +1343,7 @@ gboolean zMapFeatureBlockSetFeaturesCoords(ZMapFeatureBlock feature_block,
 }
 
 
-gboolean zMapFeatureBlockAddFeatureSet(ZMapFeatureBlock feature_block, 
+gboolean zMapFeatureBlockAddFeatureSet(ZMapFeatureBlock feature_block,
 				       ZMapFeatureSet   feature_set)
 {
   gboolean result = FALSE  ;
@@ -1379,7 +1379,7 @@ ZMapFeatureSet zMapFeatureBlockGetSetByID(ZMapFeatureBlock feature_block, GQuark
 }
 
 
-gboolean zMapFeatureBlockRemoveFeatureSet(ZMapFeatureBlock feature_block, 
+gboolean zMapFeatureBlockRemoveFeatureSet(ZMapFeatureBlock feature_block,
                                           ZMapFeatureSet   feature_set)
 {
   gboolean result = FALSE;
@@ -1451,10 +1451,10 @@ gboolean zMapFeatureContextFindAlignment(ZMapFeatureContext   feature_context,
 
   result = zMapFeatureAnyFindFeature((ZMapFeatureAny)feature_context, (ZMapFeatureAny)feature_align) ;
 
-  return result;  
+  return result;
 }
 
-ZMapFeatureAlignment zMapFeatureContextGetAlignmentByID(ZMapFeatureContext feature_context, 
+ZMapFeatureAlignment zMapFeatureContextGetAlignmentByID(ZMapFeatureContext feature_context,
                                                         GQuark align_id)
 {
   ZMapFeatureAlignment feature_align ;
@@ -1475,7 +1475,7 @@ gboolean zMapFeatureContextRemoveAlignment(ZMapFeatureContext feature_context,
   if ((result = zMapFeatureAnyRemoveFeature((ZMapFeatureAny)feature_context, (ZMapFeatureAny)feature_alignment)))
     {
       if(feature_context->master_align == feature_alignment)
-        feature_context->master_align = NULL; 
+        feature_context->master_align = NULL;
     }
 
   return result;
@@ -1494,17 +1494,17 @@ gboolean zMapFeatureContextRemoveAlignment(ZMapFeatureContext feature_context,
  * of those in the current context. Hence we end up with a context where we
  * want to destroy some features (the duplicates) but not others (the ones that
  * are just pointers to features in the current context).
- * 
+ *
  * So for the diff_context we don't set destroy functions when the context
  * is created, instead we keep a separate hash of duplicate features to be destroyed.
- * 
+ *
  * If hashtables supported setting a destroy function for each element we
  * wouldn't need to do this, but they don't (unlike g_datalists, we don't
  * use those because they are too slow).
- * 
+ *
  * If all ok returns ZMAPFEATURE_CONTEXT_OK, merged context in merged_context_inout
  * and diff context in diff_context_out. Otherwise returns a code to show what went
- * wrong, unaltered original context in merged_context_inout and diff_context_out is NULL, 
+ * wrong, unaltered original context in merged_context_inout and diff_context_out is NULL,
  */
 
 /* N.B. under new scheme, new_context_inout will be always be destroyed && NULL'd.... */
@@ -1553,7 +1553,7 @@ ZMapFeatureContextMergeCode zMapFeatureContextMerge(ZMapFeatureContext *merged_c
       merge_data.diff_context      = diff_context ;
       merge_data.status            = ZMAP_CONTEXT_EXEC_STATUS_OK ;
       merge_data.new_features = FALSE ;
-      
+
 
       /* THIS LOOKS SUSPECT...WHY ISN'T THE NAMES LIST COPIED FROM NEW_CONTEXT....*/
       copy_features = g_list_copy(new_context->feature_set_names) ;
@@ -1595,12 +1595,19 @@ ZMapFeatureContextMergeCode zMapFeatureContextMerge(ZMapFeatureContext *merged_c
 		{
 		  /* Debug stuff... */
 		  GError *err = NULL ;
-	      
+
 		  printf("(Merge) full context:\n") ;
 		  zMapFeatureDumpStdOutFeatures(current_context, current_context->styles, &err) ;
 		}
 #endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
+#ifndef MH17_NEVER
+      {
+            GError *err = NULL;
 
+            zMapFeatureDumpToFileName(diff_context,"features.txt","(Merge) diff context:\n", NULL, &err) ;
+            zMapFeatureDumpToFileName(current_context,"features.txt","(Merge) full context:\n", NULL, &err) ;
+      }
+#endif
 	      status = ZMAPFEATURE_CONTEXT_OK ;
 	    }
 	  else
@@ -1652,7 +1659,7 @@ gboolean zMapFeatureContextErase(ZMapFeatureContext *current_context_inout,
   zMapAssert(current_context_inout && remove_context && diff_context_out) ;
 
   current_context = *current_context_inout ;
-  
+
   diff_context = zMapFeatureContextCreate(NULL, 0, 0, NULL);
   diff_context->diff_context        = TRUE;
   diff_context->elements_to_destroy = g_hash_table_new_full(NULL, NULL, NULL, destroyFeatureAny);
@@ -1671,7 +1678,7 @@ gboolean zMapFeatureContextErase(ZMapFeatureContext *current_context_inout,
   merge_data.iteration_context = remove_context;
   merge_data.diff_context      = diff_context;
   merge_data.status            = ZMAP_CONTEXT_EXEC_STATUS_OK;
-  
+
 
   /* LOOKS SUSPECT...SHOULD BE COPIED....*/
   diff_context->feature_set_names = g_list_copy(remove_context->feature_set_names) ;
@@ -1679,19 +1686,19 @@ gboolean zMapFeatureContextErase(ZMapFeatureContext *current_context_inout,
   copy_list = g_list_copy(remove_context->feature_set_names) ;
   current_context->feature_set_names = g_list_concat(current_context->feature_set_names,
                                                      copy_list) ;
-  
+
   /* Set the original and unique ids so that the context passes the feature validity checks */
-  diff_context_string = g_strdup_printf("%s vs %s\n", 
+  diff_context_string = g_strdup_printf("%s vs %s\n",
                                         g_quark_to_string(current_context->unique_id),
                                         g_quark_to_string(remove_context->unique_id));
-  diff_context->original_id = 
+  diff_context->original_id =
     diff_context->unique_id = g_quark_from_string(diff_context_string);
 
   g_free(diff_context_string);
-  
+
   zMapFeatureContextExecuteRemoveSafe((ZMapFeatureAny)remove_context, ZMAPFEATURE_STRUCT_FEATURE,
 				      eraseContextCB, destroyIfEmptyContextCB, &merge_data);
-  
+
 
   if(merge_data.status == ZMAP_CONTEXT_EXEC_STATUS_OK)
     {
@@ -1705,13 +1712,13 @@ gboolean zMapFeatureContextErase(ZMapFeatureContext *current_context_inout,
       if(merge_erase_dump_context_G)
 	{
 	  GError *err = NULL;
-	  
+
 	  printf("(Erase) diff context:\n") ;
 	  zMapFeatureDumpStdOutFeatures(diff_context, diff_context->styles, &err) ;
-	  
+
 	  printf("(Erase) full context:\n") ;
 	  zMapFeatureDumpStdOutFeatures(current_context, current_context->styles, &err) ;
-	  
+
 	}
 #endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
 
@@ -1745,8 +1752,8 @@ void zMapFeatureContextDestroy(ZMapFeatureContext feature_context, gboolean free
 
 
 
-/* 
- *            Internal routines. 
+/*
+ *            Internal routines.
  */
 
 
@@ -1892,11 +1899,11 @@ static gboolean withdrawFeatureAny(gpointer key, gpointer value, gpointer user_d
 
 /* Returns TRUE if the target blocks match coords are within align_error bases of each other, if
  * there are less than two blocks then FALSE is returned.
- * 
+ *
  * Sometimes, for reasons I don't understand, its possible to have two butting matches, i.e. they
  * should really be one continuous match. It may be that this happens at a clone boundary, I don't
  * try to correct this because really its a data entry problem.
- * 
+ *
  *  */
 static gboolean checkForPerfectAlign(GArray *gaps, unsigned int align_error)
 {
@@ -1947,8 +1954,8 @@ static gboolean checkForPerfectAlign(GArray *gaps, unsigned int align_error)
   return perfect_align ;
 }
 
-static ZMapFeatureContextExecuteStatus eraseContextCB(GQuark key, 
-                                                      gpointer data, 
+static ZMapFeatureContextExecuteStatus eraseContextCB(GQuark key,
+                                                      gpointer data,
                                                       gpointer user_data,
                                                       char **err_out)
 {
@@ -1967,18 +1974,18 @@ static ZMapFeatureContextExecuteStatus eraseContextCB(GQuark key,
     case ZMAPFEATURE_STRUCT_CONTEXT:
       break;
     case ZMAPFEATURE_STRUCT_ALIGN:
-      merge_data->current_view_align = 
-	(ZMapFeatureAny)(zMapFeatureContextGetAlignmentByID(merge_data->view_context, 
+      merge_data->current_view_align =
+	(ZMapFeatureAny)(zMapFeatureContextGetAlignmentByID(merge_data->view_context,
 							    key));
       break;
     case ZMAPFEATURE_STRUCT_BLOCK:
-      merge_data->current_view_block = zMapFeatureAnyGetFeatureByID(merge_data->current_view_align, 
+      merge_data->current_view_block = zMapFeatureAnyGetFeatureByID(merge_data->current_view_align,
 								    key);
       break;
     case ZMAPFEATURE_STRUCT_FEATURESET:
-      merge_data->current_view_set   = zMapFeatureAnyGetFeatureByID(merge_data->current_view_block, 
+      merge_data->current_view_set   = zMapFeatureAnyGetFeatureByID(merge_data->current_view_block,
 								    key);
-      break;      
+      break;
     case ZMAPFEATURE_STRUCT_FEATURE:
       /* look up in the current */
 
@@ -1990,10 +1997,10 @@ static ZMapFeatureContextExecuteStatus eraseContextCB(GQuark key,
           if(merge_debug_G)
             zMapLogWarning("%s","\tFeature in erase and current contexts...");
 
-          /* insert into the diff context. 
+          /* insert into the diff context.
            * BUT, need to check if the parents exist in the diff context first.
            */
-          if (!merge_data->current_diff_align) 
+          if (!merge_data->current_diff_align)
             {
               if(merge_debug_G)
                 zMapLogWarning("%s","\tno parent align... creating align in diff");
@@ -2001,12 +2008,12 @@ static ZMapFeatureContextExecuteStatus eraseContextCB(GQuark key,
 	      merge_data->current_diff_align
 		= featureAnyCreateFeature(merge_data->current_view_align->struct_type,
 					  NULL,
-					  merge_data->current_view_align->original_id, 
+					  merge_data->current_view_align->original_id,
 					  merge_data->current_view_align->unique_id,
 					  NULL) ;
-	      
-              zMapFeatureContextAddAlignment(merge_data->diff_context, 
-					     (ZMapFeatureAlignment)merge_data->current_diff_align, 
+
+              zMapFeatureContextAddAlignment(merge_data->diff_context,
+					     (ZMapFeatureAlignment)merge_data->current_diff_align,
 					     FALSE);
             }
           if (!merge_data->current_diff_block)
@@ -2021,7 +2028,7 @@ static ZMapFeatureContextExecuteStatus eraseContextCB(GQuark key,
 					  merge_data->current_view_block->unique_id,
 					  NULL) ;
 
-              zMapFeatureAlignmentAddBlock((ZMapFeatureAlignment)merge_data->current_diff_align, 
+              zMapFeatureAlignmentAddBlock((ZMapFeatureAlignment)merge_data->current_diff_align,
 					   (ZMapFeatureBlock)merge_data->current_diff_block);
             }
           if(!merge_data->current_diff_set)
@@ -2036,19 +2043,19 @@ static ZMapFeatureContextExecuteStatus eraseContextCB(GQuark key,
 					  merge_data->current_view_set->unique_id,
 					  NULL) ;
 
-              zMapFeatureBlockAddFeatureSet((ZMapFeatureBlock)merge_data->current_diff_block, 
-					    (ZMapFeatureSet)merge_data->current_diff_set); 
+              zMapFeatureBlockAddFeatureSet((ZMapFeatureBlock)merge_data->current_diff_block,
+					    (ZMapFeatureSet)merge_data->current_diff_set);
             }
 
           if(merge_debug_G)
             zMapLogWarning("%s","\tmoving feature from current to diff context ... removing ... and inserting.");
 
           /* remove from the current context.*/
-          remove_status = zMapFeatureSetRemoveFeature((ZMapFeatureSet)merge_data->current_view_set, 
+          remove_status = zMapFeatureSetRemoveFeature((ZMapFeatureSet)merge_data->current_view_set,
 						      erased_feature);
           zMapAssert(remove_status);
 
-          zMapFeatureSetAddFeature((ZMapFeatureSet)merge_data->current_diff_set, 
+          zMapFeatureSetAddFeature((ZMapFeatureSet)merge_data->current_diff_set,
 				   erased_feature);
 
 #ifdef MESSES_UP_HASH
@@ -2066,7 +2073,7 @@ static ZMapFeatureContextExecuteStatus eraseContextCB(GQuark key,
           if(merge_debug_G)
             zMapLogWarning("%s","\tFeature absent from current context, nothing to do...");
           /* no ...
-           * leave in the erase context. 
+           * leave in the erase context.
            */
         }
       break;
@@ -2077,8 +2084,8 @@ static ZMapFeatureContextExecuteStatus eraseContextCB(GQuark key,
   return status ;
 }
 
-static ZMapFeatureContextExecuteStatus destroyIfEmptyContextCB(GQuark key, 
-                                                               gpointer data, 
+static ZMapFeatureContextExecuteStatus destroyIfEmptyContextCB(GQuark key,
+                                                               gpointer data,
                                                                gpointer user_data,
                                                                char **err_out)
 {
@@ -2107,7 +2114,7 @@ static ZMapFeatureContextExecuteStatus destroyIfEmptyContextCB(GQuark key,
 #endif /* MESSES_UP_HASH */
 	  status = ZMAP_CONTEXT_EXEC_STATUS_OK_DELETE;
         }
-      merge_data->current_diff_align = 
+      merge_data->current_diff_align =
         merge_data->current_view_align = NULL;
       break;
     case ZMAPFEATURE_STRUCT_BLOCK:
@@ -2152,8 +2159,8 @@ static ZMapFeatureContextExecuteStatus destroyIfEmptyContextCB(GQuark key,
 
 /* It's very important to note that the diff context hash tables _do_not_ have destroy functions,
  * this is what prevents them from freeing their children. */
-static ZMapFeatureContextExecuteStatus mergePreCB(GQuark key, 
-                                                  gpointer data, 
+static ZMapFeatureContextExecuteStatus mergePreCB(GQuark key,
+                                                  gpointer data,
                                                   gpointer user_data,
                                                   char **err_out)
 {
@@ -2199,7 +2206,7 @@ static ZMapFeatureContextExecuteStatus mergePreCB(GQuark key,
     default:
       zMapAssertNotReached();
     }
-  
+
 
   switch(feature_any->struct_type)
     {
@@ -2249,7 +2256,7 @@ static ZMapFeatureContextExecuteStatus mergePreCB(GQuark key,
 
 		merge_data->new_features = new = TRUE;	/* This is a NEW feature. */
 
-		/* We would use featureAnyAddFeature, but it does another 
+		/* We would use featureAnyAddFeature, but it does another
 		 * g_hash_table_lookup... */
 		g_hash_table_insert((*view_path_parent_ptr)->children,
 				    zmapFeature2HashKey(feature_any),
@@ -2259,7 +2266,7 @@ static ZMapFeatureContextExecuteStatus mergePreCB(GQuark key,
 
 		/* update the path */
 		*view_path_ptr      = feature_any;
-		
+
 		diff_feature_any    = feature_any;
 
 		diff_feature_any->parent = *view_path_parent_ptr;
@@ -2275,7 +2282,7 @@ static ZMapFeatureContextExecuteStatus mergePreCB(GQuark key,
 
 		featureAnyAddToDestroyList(merge_data->diff_context, diff_feature_any);
 	      }
-            // mh17: 
+            // mh17:
             // 1) featureAnyAddFeature checks to see if it's there first, which we just did :-(
             // 2) look at the comment 25 lines above about not using featureAnyAddFeature
 	    featureAnyAddFeature(*diff_path_parent_ptr, diff_feature_any);
@@ -2297,7 +2304,7 @@ static ZMapFeatureContextExecuteStatus mergePreCB(GQuark key,
 	  }
 
 	/* general code stop */
-      
+
 
 #ifdef NO_IDEA_WHAT_SHOULD_HAPPEN_HERE
 	/* possibly nothing... unsure where the master alignment status [will] comes from. */
@@ -2305,7 +2312,7 @@ static ZMapFeatureContextExecuteStatus mergePreCB(GQuark key,
 	if(is_master_align && feature_any->struct_type == ZMAPFEATURE_STRUCT_ALIGN)
 	  {
 	    merge_data->diff_context->master_align = (ZMapFeatureAlignment)diff_feature_any;
-	  }	
+	  }
 #endif /* NO_IDEA_WHAT_SHOULD_HAPPEN_HERE */
       }
       break;
@@ -2313,14 +2320,14 @@ static ZMapFeatureContextExecuteStatus mergePreCB(GQuark key,
       {
 	zMapAssert(view_path_parent_ptr && *view_path_parent_ptr &&
 		   diff_path_parent_ptr && *diff_path_parent_ptr);
-	
+
 	feature_any->parent = NULL;
 	status = ZMAP_CONTEXT_EXEC_STATUS_OK_DELETE;
 
 	if (!(zMapFeatureAnyGetFeatureByID(*view_path_parent_ptr, feature_any->unique_id)))
 	  {
 	    merge_data->new_features = new = TRUE;
-	    
+
 	    featureAnyAddFeature(*diff_path_parent_ptr, feature_any);
 
 	    featureAnyAddFeature(*view_path_parent_ptr, feature_any);
@@ -2381,7 +2388,7 @@ static ZMapFeatureContextExecuteStatus mergePreCB(GQuark key,
 
                 /* but we need to reset parent pointer....*/
 		diff_align->parent = (ZMapFeatureAny)(merge_data->view_context) ;
-		
+
 		status = ZMAP_CONTEXT_EXEC_STATUS_DONT_DESCEND ;
 	      }
 	    else
@@ -2435,7 +2442,7 @@ static ZMapFeatureContextExecuteStatus mergePreCB(GQuark key,
 		/* add to the full context align */
 		zMapFeatureAlignmentAddBlock(merge_data->current_view_align, feature_block);
 		merge_data->current_view_block = feature_block ;
-		
+
 		merge_data->new_features = new = TRUE ;
 
 		/* If its new we can simply copy a pointer over to the diff context
@@ -2444,7 +2451,7 @@ static ZMapFeatureContextExecuteStatus mergePreCB(GQuark key,
 
 		/* but we need to reset parent pointer....*/
 		diff_block->parent = (ZMapFeatureAny)(merge_data->current_view_align) ;
-				
+
 		status = ZMAP_CONTEXT_EXEC_STATUS_DONT_DESCEND ;
 
 	      }
@@ -2497,10 +2504,10 @@ static ZMapFeatureContextExecuteStatus mergePreCB(GQuark key,
 		/* If its new we can simply copy a pointer over to the diff context
 		 * and stop recursing.... */
 		diff_set = (ZMapFeatureAny)feature_set ;
-		               
+
 		/* but we need to reset parent pointer....*/
 		diff_set->parent = (ZMapFeatureAny)(merge_data->current_view_block) ;
-				
+
 		status = ZMAP_CONTEXT_EXEC_STATUS_DONT_DESCEND ;
 
 	      }
@@ -2549,7 +2556,7 @@ static ZMapFeatureContextExecuteStatus mergePreCB(GQuark key,
 	     * and stop recursing.... */
 	    diff_feature = (ZMapFeatureAny)feature ;
 
-               
+
 #ifdef ED_G_NEVER_INCLUDE_THIS_CODE
 	    /* I don't think we need to do this because features do not have children. */
 
@@ -2557,7 +2564,7 @@ static ZMapFeatureContextExecuteStatus mergePreCB(GQuark key,
 	    status = ZMAP_CONTEXT_EXEC_STATUS_DONT_DESCEND ;
 #endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
 
-	    /* We need to reset parent pointer....and the style pointer.... 
+	    /* We need to reset parent pointer....and the style pointer....
 	     * order is critical here since featureany call resets parent... */
 	    featureAnyAddFeature((ZMapFeatureAny)merge_data->current_diff_set, diff_feature) ;
 
@@ -2569,7 +2576,7 @@ static ZMapFeatureContextExecuteStatus mergePreCB(GQuark key,
 	      zMapLogWarning("feature(%p)->parent = %p. current_view_set = %p",
 			     feature, feature->parent, merge_data->current_view_set);
 	  }
-        
+
 	break;
       }
 #endif /* GENERALISING */
@@ -2595,7 +2602,7 @@ static ZMapFeatureContextExecuteStatus mergePreCB(GQuark key,
 
 
 
-/* 
+/*
  *              Following functions all operate on any feature type,
  *              they were written to reduce duplication of code.
  */
@@ -2708,7 +2715,7 @@ static gboolean destroyFeatureAnyWithChildren(ZMapFeatureAny feature_any, gboole
 	  zMapAssert(g_hash_table_size(feature_any->children) == 0) ;
 	  result = TRUE ;
 	}
-    }  
+    }
 
   /* Now destroy the feature. */
   if (result)
@@ -2732,8 +2739,8 @@ static void featureAnyAddToDestroyList(ZMapFeatureContext context, ZMapFeatureAn
 }
 
 
-static ZMapFeatureContextExecuteStatus addModeCB(GQuark key_id, 
-						 gpointer data, 
+static ZMapFeatureContextExecuteStatus addModeCB(GQuark key_id,
+						 gpointer data,
 						 gpointer user_data,
 						 char **error_out)
 {
@@ -2755,7 +2762,7 @@ static ZMapFeatureContextExecuteStatus addModeCB(GQuark key_id,
     case ZMAPFEATURE_STRUCT_FEATURESET:
       {
         hack->feature_set = (ZMapFeatureSet)feature_any ;
-	
+
 	g_hash_table_foreach(hack->feature_set->features, addFeatureModeCB, hack) ;
 
 	break;
@@ -2779,10 +2786,10 @@ static ZMapFeatureContextExecuteStatus addModeCB(GQuark key_id,
  * this is not efficient as we go through all features but we would need more information
  * stored in the feature set to avoid this as there may be several different types of
  * feature stored in a feature set.
- * 
+ *
  * Note that I'm setting some other style data here because we need different default bumping
  * modes etc for different feature types....
- * 
+ *
  *  */
 static void addFeatureModeCB(gpointer key, gpointer data, gpointer user_data)
 {
@@ -2806,7 +2813,7 @@ static void addFeatureModeCB(gpointer key, gpointer data, gpointer user_data)
       else
 	g_warning("Force=TRUE and style '%s' has no mode (Could have used zMapFeatureAnyAddModesToStyles)", g_quark_to_string(feature->style_id));
     }
-  
+
   if (force || !zMapStyleHasMode(style))
     {
       ZMapStyleMode mode ;
diff --git a/src/zmapFeature/zmapFeatureOutput.c b/src/zmapFeature/zmapFeatureOutput.c
index 07ca72a122f96ecc17fc92b2b2792c5451759564..0957c41a8458f08b9640d503aefdd5b2b8053710 100755
--- a/src/zmapFeature/zmapFeatureOutput.c
+++ b/src/zmapFeature/zmapFeatureOutput.c
@@ -6,12 +6,12 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
@@ -23,17 +23,19 @@
  * 	Ed Griffiths (Sanger Institute, UK) edgrif@sanger.ac.uk,
  *      Roy Storey (Sanger Institute, UK) rds@sanger.ac.uk
  *
- * Description: 
+ * Description:
  *
  * Exported functions: See XXXXXXXXXXXXX.h
  * HISTORY:
  * Last edited: Apr  1 11:32 2009 (edgrif)
  * Created: Tue Oct 28 16:20:33 2008 (rds)
- * CVS info:   $Id: zmapFeatureOutput.c,v 1.8 2010-03-04 15:10:26 mh17 Exp $
+ * CVS info:   $Id: zmapFeatureOutput.c,v 1.9 2010-03-19 08:56:42 mh17 Exp $
  *-------------------------------------------------------------------
  */
 
 #include <unistd.h>		/* STDOUT_FILENO */
+#include <string.h>
+
 #include <ZMap/zmapFeature.h>
 
 typedef enum
@@ -72,18 +74,18 @@ typedef struct
 } DumpWithinRangeStruct, *DumpWithinRange;
 
 /* Internal functions */
-static ZMapFeatureContextExecuteStatus dump_features_cb(GQuark   key, 
-							gpointer data, 
+static ZMapFeatureContextExecuteStatus dump_features_cb(GQuark   key,
+							gpointer data,
 							gpointer user_data,
 							char   **err_out);
 static void invoke_dump_features_cb(gpointer list_data, gpointer user_data);
-static gboolean simple_context_print_cb(ZMapFeatureAny feature_any, 
+static gboolean simple_context_print_cb(ZMapFeatureAny feature_any,
 					GData         *styles,
 					GString       *dump_string_in_out,
 					GError       **error,
 					gpointer       user_data);
-static ZMapFeatureContextExecuteStatus range_invoke_dump_features_cb(GQuark   key, 
-								     gpointer data, 
+static ZMapFeatureContextExecuteStatus range_invoke_dump_features_cb(GQuark   key,
+								     gpointer data,
 								     gpointer user_data,
 								     char   **err_out);
 
@@ -137,6 +139,28 @@ gboolean zMapFeatureDumpStdOutFeatures(ZMapFeatureContext feature_context, GData
 }
 
 
+gboolean zMapFeatureDumpToFileName(ZMapFeatureContext feature_context,char *filename, char *header, GData *styles, GError **error_out)
+{
+  gboolean result = FALSE ;
+  GIOChannel *file ;
+  gssize len;
+
+  file = g_io_channel_new_file(filename,"a",error_out) ;
+
+  g_io_channel_write_chars(file,header,strlen(header),&len,error_out);
+
+  result = zMapFeatureContextDump(feature_context,  styles, file, error_out) ;
+
+  if (g_io_channel_flush(file, error_out) != G_IO_STATUS_NORMAL)
+    printf("cannot flush stdout\n") ;
+
+  if (g_io_channel_shutdown(file, TRUE, error_out) != G_IO_STATUS_NORMAL)
+    result = FALSE ;
+
+  return result ;
+}
+
+
 
 
 /*!
@@ -179,13 +203,13 @@ gboolean zMapFeatureListForeachDumperCreate(ZMapFeatureDumpFeatureFunc dump_func
       dump_data->dump_data   = dump_any       ;
       dump_data->dump_free   = dump_user_free ;
       dump_data->dump_string = g_string_sized_new(2000);
-      
+
       *dumper_func_out = invoke_dump_features_cb;
       *dumper_data_out = dump_data;
 
       result = dump_data->status;
     }
-  
+
   return result;
 }
 
@@ -207,7 +231,7 @@ gboolean zMapFeatureListForeachDumperDestroy(gpointer dumper_data)
       if (g_io_channel_flush(dump_data->channel, dump_data->dump_error) != G_IO_STATUS_NORMAL)
 	result = FALSE;
     }
-    
+
   if(dump_data->dump_free && dump_data->dump_data->user_data)
     (dump_data->dump_free)(dump_data->dump_data->user_data);
 
@@ -300,7 +324,7 @@ gboolean zMapFeatureContextDumpToFile(ZMapFeatureAny             dump_set,
   dump_data.dump_data   = &dump_any ;
   dump_data.dump_string = g_string_sized_new(2000);
 
-  zMapFeatureContextExecuteSubset(dump_set, ZMAPFEATURE_STRUCT_FEATURE,
+  zMapFeatureContextExecuteSubset(dump_set, ZMAPFEATURE_STRUCT_FEATURESET,
 				  dump_features_cb, &dump_data);
 
   g_string_free(dump_data.dump_string, TRUE);
@@ -383,8 +407,8 @@ GQuark zMapFeatureContextDumpErrorDomain(void)
 
 
 
-static ZMapFeatureContextExecuteStatus dump_features_cb(GQuark   key, 
-							gpointer data, 
+static ZMapFeatureContextExecuteStatus dump_features_cb(GQuark   key,
+							gpointer data,
 							gpointer user_data,
 							char   **err_out)
 {
@@ -462,7 +486,7 @@ static ZMapFeatureContextExecuteStatus dump_features_cb(GQuark   key,
 	{
 	  /* what does this mean?  We'll probably get round to the
 	   * data again, do we need to g_string_erase? */
-	  
+
 	  if(bytes_written != 0)
 	    dump_data->dump_string = g_string_erase(dump_data->dump_string, 0, bytes_written);
 	}
@@ -505,7 +529,7 @@ static gboolean simple_context_print_cb(ZMapFeatureAny feature_any,
 					gpointer       user_data)
 {
   gboolean result = TRUE;
-  
+
   switch(feature_any->struct_type)
     {
     case ZMAPFEATURE_STRUCT_CONTEXT:
@@ -514,7 +538,7 @@ static gboolean simple_context_print_cb(ZMapFeatureAny feature_any,
 
 	feature_context = (ZMapFeatureContext)feature_any;
 	g_string_append_printf(dump_string_in_out,
-			       "Feature Context:\t%s\t%s\t%s\t%s\t%d\t%d\t%d\t%d\t%d\t%d\n", 
+			       "Feature Context:\t%s\t%s\t%s\t%s\t%d\t%d\t%d\t%d\t%d\t%d\n",
 			       g_quark_to_string(feature_context->unique_id),
 			       g_quark_to_string(feature_context->original_id),
 			       g_quark_to_string(feature_context->sequence_name),
@@ -530,12 +554,12 @@ static gboolean simple_context_print_cb(ZMapFeatureAny feature_any,
     case ZMAPFEATURE_STRUCT_ALIGN:
       {
 	ZMapFeatureAlignment feature_align;
-	
+
 	feature_align = (ZMapFeatureAlignment)feature_any;
 	g_string_append_printf(dump_string_in_out,
-			       "\tAlignment:\t%s\n", 
+			       "\tAlignment:\t%s\n",
 			       g_quark_to_string(feature_align->unique_id)) ;
-	
+
       }
       break;
     case ZMAPFEATURE_STRUCT_BLOCK:
@@ -543,7 +567,7 @@ static gboolean simple_context_print_cb(ZMapFeatureAny feature_any,
 	ZMapFeatureBlock feature_block;
 	feature_block = (ZMapFeatureBlock)feature_any;
 	g_string_append_printf(dump_string_in_out,
-			       "\tBlock:\t%s\t%d\t%d\t%d\t%d\n", 
+			       "\tBlock:\t%s\t%d\t%d\t%d\t%d\n",
 			       g_quark_to_string(feature_block->unique_id),
 			       feature_block->block_to_sequence.t1,
 			       feature_block->block_to_sequence.t2,
@@ -564,19 +588,21 @@ static gboolean simple_context_print_cb(ZMapFeatureAny feature_any,
     case ZMAPFEATURE_STRUCT_FEATURE:
       {
 	ZMapFeature feature;
-	char *type, *strand, *phase;
+	char *type = "(type)", *strand, *phase;
 	ZMapFeatureTypeStyle style ;
 
 	feature = (ZMapFeature)feature_any;
 
-	style = zMapFindStyle(styles, feature->style_id) ;
-	type   = (char *)zMapStyleMode2ExactStr(zMapStyleGetMode(style)) ;
-
+      if(styles)
+      {
+	      style = zMapFindStyle(styles, feature->style_id) ;
+	      type   = (char *)zMapStyleMode2ExactStr(zMapStyleGetMode(style)) ;
+      }
         strand = zMapFeatureStrand2Str(feature->strand) ;
         phase  = zMapFeaturePhase2Str(feature->phase) ;
 
 	g_string_append_printf(dump_string_in_out,
-			       "\t\t%s\t%d\t%s\t%s\t%d\t%d\t%s\t%s\t%f", 
+			       "\t\t%s\t%d\t%s\t%s\t%d\t%d\t%s\t%s\t%f",
 			       (char *)g_quark_to_string(feature->unique_id),
 			       feature->db_id,
 			       (char *)g_quark_to_string(feature->original_id),
@@ -605,7 +631,7 @@ static gboolean simple_context_print_cb(ZMapFeatureAny feature_any,
 }
 
 static ZMapFeatureContextExecuteStatus range_invoke_dump_features_cb(GQuark   key,
-								     gpointer data, 
+								     gpointer data,
 								     gpointer user_data,
 								     char   **err_out)
 {
@@ -621,7 +647,7 @@ static ZMapFeatureContextExecuteStatus range_invoke_dump_features_cb(GQuark   ke
     case ZMAPFEATURE_STRUCT_FEATURESET:
       if(dump_data->status)
 	{
-	  status = dump_features_cb(key, data, user_data, err_out);	  
+	  status = dump_features_cb(key, data, user_data, err_out);
 	}
       break;
     case ZMAPFEATURE_STRUCT_FEATURE:
diff --git a/src/zmapServer/zmapServerProtocolHandler.c b/src/zmapServer/zmapServerProtocolHandler.c
index 87b383107928c24482888841978ab79ac92bd896..77c61b8effe74be70286bb5b2263d578f1706469 100755
--- a/src/zmapServer/zmapServerProtocolHandler.c
+++ b/src/zmapServer/zmapServerProtocolHandler.c
@@ -27,7 +27,7 @@
  * HISTORY:
  * Last edited: Jan 14 10:26 2010 (edgrif)
  * Created: Thu Jan 27 13:17:43 2005 (edgrif)
- * CVS info:   $Id: zmapServerProtocolHandler.c,v 1.57 2010-03-15 11:00:39 mh17 Exp $
+ * CVS info:   $Id: zmapServerProtocolHandler.c,v 1.58 2010-03-19 08:56:42 mh17 Exp $
  *-------------------------------------------------------------------
  */
 
@@ -740,11 +740,15 @@ static ZMapThreadReturnCode destroyServer(ZMapServer *server)
 
 
 
+// returns whether we have any of the needed styles and lists the ones we don't
 static gboolean haveRequiredStyles(GData *all_styles, GList *required_styles, char **missing_styles_out)
 {
   gboolean result = FALSE ;
   FindStylesStruct find_data = {NULL} ;
 
+  if(!required_styles)  // MH17: semantics -> don't need styles therefore have those that are required
+      return(TRUE);
+
   find_data.all_styles = all_styles ;
 
   g_list_foreach(required_styles, findStyleCB, &find_data) ;
@@ -767,7 +771,7 @@ static void findStyleCB(gpointer data, gpointer user_data)
   style_id = zMapStyleCreateID((char *)g_quark_to_string(style_id)) ;
 
   if ((zMapFindStyle(find_data->all_styles, style_id)))
-    find_data->found_style = TRUE ;
+      find_data->found_style = TRUE;
   else
     {
       if (!(find_data->missing_styles))
@@ -894,6 +898,7 @@ ZMapThreadReturnCode getStyles(ZMapServer server, ZMapServerReqStyles styles, ch
       /* Make sure that all the styles that are required for the feature sets were found.
       * (This check should be controlled from analysing the number of feature servers or
       * flags set for servers.....) */
+
       if (thread_rc == ZMAPTHREAD_RETURNCODE_OK
             && !haveRequiredStyles(tmp_styles, styles->required_styles_in, &missing_styles))
       {
@@ -904,7 +909,7 @@ ZMapThreadReturnCode getStyles(ZMapServer server, ZMapServerReqStyles styles, ch
       }
       else if(missing_styles)
       {
-            g_free(missing_styles);	/* haveRequiredStyles return == TRUE doesn't mean missing_styles == NULL */
+            g_free(missing_styles);	   /* haveRequiredStyles return == TRUE doesn't mean missing_styles == NULL */
       }
 
       /* Find out if the styles will need to have their mode set from the features.
diff --git a/src/zmapThreads/zmapThreads.c b/src/zmapThreads/zmapThreads.c
index 4f438183e13cbf9d99e6e4adedcd2edf472e10c4..15d9d4c4a3fd7e7e5cf3e2ec64220658e60de6af 100755
--- a/src/zmapThreads/zmapThreads.c
+++ b/src/zmapThreads/zmapThreads.c
@@ -6,12 +6,12 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
@@ -26,12 +26,12 @@
  *              thread and a slave thread. This code knows nothing
  *              about what it is passing, it just handles the passing
  *              and returning of data.
- *              
+ *
  * Exported functions: See ZMap/zmapThread.h
  * HISTORY:
  * Last edited: Mar 20 12:09 2009 (edgrif)
  * Created: Thu Jan 27 11:25:37 2005 (edgrif)
- * CVS info:   $Id: zmapThreads.c,v 1.8 2010-03-04 15:10:53 mh17 Exp $
+ * CVS info:   $Id: zmapThreads.c,v 1.9 2010-03-19 08:56:42 mh17 Exp $
  *-------------------------------------------------------------------
  */
 
@@ -52,9 +52,9 @@ static void destroyThread(ZMapThread thread) ;
 
 /*! @defgroup zmapthreads   zMapThreads: creating, controlling and destroying slave threads
  * @{
- * 
+ *
  * \brief  Slave Threads
- * 
+ *
  * zMapThreads routines create, issue requests to, and destroy slave threads.
  * On creation slave threads are given a routine that they will call whenever
  * they receive a request. This routine handles the request and returns the
@@ -146,9 +146,9 @@ void zMapThreadRequest(ZMapThread thread, void *request)
 gboolean zMapThreadGetReply(ZMapThread thread, ZMapThreadReply *state)
 {
   gboolean got_value ;
-  
+
   got_value = zmapVarGetValue(&(thread->reply), state) ;
-  
+
   return got_value ;
 }
 
@@ -166,9 +166,9 @@ gboolean zMapThreadGetReplyWithData(ZMapThread thread, ZMapThreadReply *state,
 				  void **data, char **err_msg)
 {
   gboolean got_value ;
-  
+
   got_value = zmapVarGetValueWithData(&(thread->reply), state, data, err_msg) ;
-  
+
   return got_value ;
 }
 
@@ -222,8 +222,9 @@ void zMapThreadKill(ZMapThread thread)
   int status ;
 
   ZMAPTHREAD_DEBUG(("GUI: killing and destroying thread for thread %s\n", zMapThreadGetThreadID(thread))) ;
+zMapLogWarning("GUI: killing and destroying thread for thread %s\n", zMapThreadGetThreadID(thread)) ;
 
-  /* we could signal an exit here by setting a condvar of EXIT...but that might lead to 
+  /* we could signal an exit here by setting a condvar of EXIT...but that might lead to
    * deadlocks, think about this bit.. */
 
   /* Signal the thread to cancel it */
@@ -254,7 +255,7 @@ void zMapThreadDestroy(ZMapThread thread)
 
 
 
-/* 
+/*
  * ---------------------  Internal routines  ------------------------------
  */
 
diff --git a/src/zmapView/zmapView.c b/src/zmapView/zmapView.c
index b87773238bb42082e3edca7f9118103ea562df05..d86f7bdf723c253f466f42d8584dc39117571326 100755
--- a/src/zmapView/zmapView.c
+++ b/src/zmapView/zmapView.c
@@ -29,7 +29,7 @@
  * HISTORY:
  * Last edited: Mar 11 14:55 2010 (edgrif)
  * Created: Thu May 13 15:28:26 2004 (edgrif)
- * CVS info:   $Id: zmapView.c,v 1.183 2010-03-15 11:17:15 mh17 Exp $
+ * CVS info:   $Id: zmapView.c,v 1.184 2010-03-19 08:56:42 mh17 Exp $
  *-------------------------------------------------------------------
  */
 
@@ -79,7 +79,7 @@ typedef struct
   GData *curr_styles ;					    /* Styles for this context. */
   ZMapFeatureContext curr_context ;
 
-  ZMapServerReqType last_request ;
+  ZMapServerReqType display_after ;
 } ConnectionDataStruct, *ConnectionData ;
 
 
@@ -141,7 +141,7 @@ static ZMapViewConnection createConnection(ZMapView zmap_view,
 					   GList *req_featuresets,
 					   gboolean dna_requested, gboolean writeback_server,
                                  gboolean terminate);
-static void destroyConnection(ZMapViewConnection *view_conn) ;
+static void destroyConnection(ZMapView view, ZMapViewConnection view_conn) ;
 static void killGUI(ZMapView zmap_view) ;
 static void killConnections(ZMapView zmap_view) ;
 
@@ -322,6 +322,7 @@ ZMapViewWindow zMapViewCreate(GtkWidget *xremote_widget, GtkWidget *view_contain
    * in config file and next time they create a view the debugging will go on/off. */
   zMapUtilsConfigDebug();
 
+
   /* Set up sequence to be fetched, in this case server defaults to whatever is set in config. file. */
   sequence_fetch = g_new0(ZMapViewSequenceMapStruct, 1) ;
   sequence_fetch->sequence = g_strdup(sequence) ;
@@ -366,6 +367,26 @@ void zMapViewSetupNavigator(ZMapViewWindow view_window, GtkWidget *canvas_widget
 
 
 
+static GHashTable *zmapViewGetIniFeaturesets(char *config_str)
+{
+      ZMapConfigIniContext context ;
+      GHashTable *hash = NULL;
+
+      if ((context = zMapConfigIniContextProvide()))
+      {
+        if(config_str)
+            zMapConfigIniContextIncludeBuffer(context, config_str);
+
+        hash = zMapConfigIniGetSource2Featureset(context);
+
+        zMapConfigIniContextDestroy(context);
+      }
+
+      return(hash);
+}
+
+
+
 /* Connect a View to its databases via threads, at this point the View is blank and waiting
  * to be called to load some data. */
 gboolean zMapViewConnect(ZMapView zmap_view, char *config_str)
@@ -403,23 +424,11 @@ gboolean zMapViewConnect(ZMapView zmap_view, char *config_str)
         /* There are a number of predefined methods that we require so add these in as well
          * as the mapping for "feature set" -> style for these. */
         addPredefined(&(zmap_view->orig_styles), &(zmap_view->featureset_2_stylelist)) ;
-
-#ifdef MH17_NOT_NEEDED
-        if(stylesfile)
-        {
-            // each server will either return styles or read in the ones on styles file
-            // so no need to do this here and merge them in
-            GData *styles;
-
-            if(zMapConfigIniGetStylesFromFile(NULL,stylesfile,&styles))
-            {
-                  zmap_view->orig_styles =
-                       zMapStyleMergeStyles(zmap_view->orig_styles,styles,ZMAPSTYLE_MERGE_MERGE) ;
-            }
-        }
-#endif
       }
 
+      // as we have not connected yet we just assign this mapping if it's there, no need to merge
+      zmap_view->source_2_featureset = zmapViewGetIniFeaturesets(config_str);
+
       /* Set up connections to the named servers. */
       if (settings_list)
 	{
@@ -482,7 +491,7 @@ gboolean zMapViewConnect(ZMapView zmap_view, char *config_str)
 
 
 #ifdef NOT_REQUIRED_ATM
-	      /* This will become redundant with step stuff..... */
+	      /* Thvmrna ; tris will become redundant with step stuff..... */
 
 	      else if (!checkSequenceToServerMatch(zmap_view->sequence_2_server, &tmp_seq))
 		{
@@ -531,21 +540,23 @@ gboolean zMapViewConnect(ZMapView zmap_view, char *config_str)
 						   (char *)current_server->styles_list,
 						   (char *)stylesfile,
 						   req_featuresets,
-						   dna_requested,       // current_server->sequence,
+						   dna_requested,             // current_server->sequence,
 						   current_server->writeback,
-                                       FALSE )))               // (has to be) current_server->delayed,
+                                       FALSE )))                  // (has to be) current_server->delayed,
 		    {
-		      connections++ ;
+                  connections++ ;
 
                   /* If at least one connection succeeded then we are up and running, if not then the zmap
                   * returns to the init state. */
                   zmap_view->state = ZMAPVIEW_LOADING ;
 
                   /* THESE NEED TO GO WHEN STEP LIST STUFF IS DONE PROPERLY.... */
-		      if (current_server->sequence)
-			zmap_view->sequence_server  = view_con ;
+                     // this is an optimisation: the server supports DNA so no point in searching for it
+                     // if we implement multiple sources then we can remove this
+		      if (dna_requested)
+			  zmap_view->sequence_server  = view_con ;
 		      if (current_server->writeback)
-			zmap_view->writeback_server = view_con ;
+			  zmap_view->writeback_server = view_con ;
 		    }
 		}
 
@@ -951,8 +962,6 @@ gboolean zMapViewReset(ZMapView zmap_view)
 	 sequence. */
       killConnections(zmap_view) ;
 
-      zmap_view->connections_loaded = 0 ;
-
       result = TRUE ;
     }
 
@@ -1093,7 +1102,7 @@ char *zMapViewGetStatusStr(ZMapViewState state)
   /* Array must be kept in synch with ZmapState enum in zmapView.h */
   static char *zmapStates[] = {"",
 			       "Connecting", "Connected",
-			       "Data loading", "Data loaded",
+			       "Data loading", "Data loaded","Columns loading",
 			       "Resetting", "Dying"} ;
   char *state_str ;
 
@@ -1250,9 +1259,9 @@ char *zmapViewGetStatusAsStr(ZMapViewState state)
 {
   /* Array must be kept in synch with ZmapState enum in ZMap.h */
   static char *zmapStates[] = {"ZMAPVIEW_INIT",
-			       "ZMAPVIEW_NOT_CONNECTED", "ZMAPVIEW_NO_WINDOW",
+//			       "ZMAPVIEW_NOT_CONNECTED", "ZMAPVIEW_NO_WINDOW",
 			       "ZMAPVIEW_CONNECTING", "ZMAPVIEW_CONNECTED",
-			       "ZMAPVIEW_LOADING", "ZMAPVIEW_LOADED",
+			       "ZMAPVIEW_LOADING", "ZMAPVIEW_LOADED", "ZMAPVIEW_UPDATING",
 			       "ZMAPVIEW_RESETTING", "ZMAPVIEW_DYING"} ;
   char *state_str ;
 
@@ -1309,17 +1318,22 @@ static GHashTable *zmapViewGetFeatureSourceHash(GList *sources)
       src = sources->data;
       if(!src->featuresets)
             continue;
-      features = g_strsplit_set(src->featuresets,"; \t",0); // this will give null entries eg 'aaa ; bbbb' -> 5 strings
+      features = g_strsplit(src->featuresets,";",0); // this will give null entries eg 'aaa ; bbbb' -> 5 strings
       if(!features)
             continue;
-
       for(feats = features;*feats;feats++)
         {
           GQuark q;
           // the data we want to lookup happens to have been quarked
           if(**feats)
           {
-            q = g_quark_from_string(*feats);
+            gchar *feature;
+
+            feature = *feats;
+            feature = g_strstrip(feature);
+            if(!feature)
+                  continue;
+            q =  zMapFeatureSetCreateID(feature);
             g_hash_table_insert(hash,GUINT_TO_POINTER(q), (gpointer) src);
           }
         }
@@ -1348,82 +1362,114 @@ static GHashTable *zmapViewGetFeatureSourceHash(GList *sources)
 void zmapViewLoadFeatures(ZMapView view, ZMapFeatureBlock block_orig, GList *req_sources,
 			  int features_start, int features_end)
 {
-  ZMapFeatureContext orig_context, context ;
+  ZMapFeatureContext context ;
   ZMapFeatureBlock block ;
-  GList *req_featuresets ;
   GHashTable *hash = NULL;
-  GList * sources;
+  GList * sources = NULL;
   ZMapConfigSource server;
-  char *stylesfile;
+  char *stylesfile = NULL;
   gboolean requested = FALSE;
 
   sources = zmapViewGetIniSources(NULL,&stylesfile);
   hash = zmapViewGetFeatureSourceHash(sources);
 
 
-  orig_context = (ZMapFeatureContext)zMapFeatureGetParentGroup((ZMapFeatureAny)block_orig,
-							       ZMAPFEATURE_STRUCT_CONTEXT) ;
+//  orig_context = (ZMapFeatureContext)zMapFeatureGetParentGroup((ZMapFeatureAny)block_orig,
+//							       ZMAPFEATURE_STRUCT_CONTEXT) ;
 
   /* Copy the original context from the target block upwards setting feature set names
    * and the range of features to be copied. */
-  context = zMapFeatureContextCopyWithParents((ZMapFeatureAny)block_orig) ;
+//  context = zMapFeatureContextCopyWithParents((ZMapFeatureAny)block_orig) ;
 
 
   /* ok...need to look up col here.... */
-  req_featuresets = zmapViewSrc2FSetGetList(view->source_2_featureset, req_sources) ;
-  context->feature_set_names = req_featuresets ;
+//  req_featuresets = zmapViewSrc2FSetGetList(view->source_2_featureset, req_sources) ;
 
 
-  block = zMapFeatureAlignmentGetBlockByID(context->master_align, block_orig->unique_id) ;
+//  block = zMapFeatureAlignmentGetBlockByID(context->master_align, block_orig->unique_id) ;
 
-  zMapFeatureBlockSetFeaturesCoords(block, features_start, features_end) ;
+//  zMapFeatureBlockSetFeaturesCoords(block, features_start, features_end) ;
 
   for(;req_sources;req_sources = g_list_next(req_sources))
   {
-      GQuark featureset = GPOINTER_TO_INT(req_sources->data);
+      GQuark featureset = GPOINTER_TO_UINT(req_sources->data);
 
-      // MH17: a question: we are requesting source not featuresets: is this right?
       server = zmapViewGetSourceFromFeatureset(hash,featureset);
+
       if(server)
       {
-            GList *req_feature = NULL;
+            GList *req_featuresets = NULL;
             int existing = FALSE;
             ZMapViewConnection view_conn = NULL;
-            GList *view_con_list;
+//            GList *view_con_list;
+#warning include this when thread cleanup debugged
 
             // make a list of one feature only
-            req_feature = g_list_append(req_feature,req_sources->data);
-
+            req_featuresets = g_list_append(req_featuresets,GUINT_TO_POINTER(featureset));
+#ifdef MH17_ONLY_WHEN_THREAD_CLEANUP_IS_DEBUGGED
             // look for server in view->connections list
             for(view_con_list = view->connection_list;view_con_list;view_con_list = g_list_next(view_con_list))
             {
                   view_conn = (ZMapViewConnection) view_con_list->data;
                   if(!strcmp(view_conn->url,server->url))
+                  {
+                        existing = TRUE;
                         break;
+                  }
             }
-            if(!view_con_list)
-                  view_conn = NULL;       // (not found)
+#endif
+            /* Copy the original context from the target block upwards setting feature set names
+             * and the range of features to be copied.
+             * We need one for each featureset/ request
+             */
+#if 1
+            // This loads but does not display appear in stats or in columns list, but it does get merged into the view
+            // using this as it may be necessaru for Blixem
+            context = zMapFeatureContextCopyWithParents((ZMapFeatureAny)block_orig) ;
+            context->feature_set_names = req_featuresets ;
+
+            block = zMapFeatureAlignmentGetBlockByID(context->master_align, block_orig->unique_id) ;
+            zMapFeatureBlockSetFeaturesCoords(block, features_start, features_end) ;
+
+#else
+/*
+      try the exact stuff fron startup that works
+      it's a lot simpler and fails in exactly the same way
+*/
+            context = createContext(view->sequence, view->start, view->end, req_featuresets) ;
+#endif
+            // make the windows have the same list of featuresets so that they display
+            g_list_foreach(view->window_list, invoke_merge_in_names, req_featuresets);
 
-printf("request featureset %s from %s\n",g_quark_to_string(GPOINTER_TO_UINT(req_feature->data)),server->url);
+
+printf("request featureset %s from %s\n",g_quark_to_string(GPOINTER_TO_UINT(req_featuresets->data)),server->url);
             // start a new server connection
             // can optionally use an existing one -> pass in second arg
-            createConnection(view, view_conn, context, server->url,
+            if(createConnection(view, existing ? view_conn : NULL,
+                                       context, server->url,
                                        (char *)server->format,
                                        server->timeout,
                                        (char *)server->version,
                                        (char *)server->styles_list,
                                        stylesfile,
-                                       req_feature,
+                                       req_featuresets,
                                        FALSE,
                                        server->writeback,
-                                       !existing );
-            g_list_free(req_feature);
-            requested = TRUE;       // set even if create fails: wiil get unset in check connection state
+                                       !existing ))
+              {
+                  requested = TRUE;
+              }
+            // g_list_free(req_featuresets); no! this list gets used by threads
+            req_featuresets = NULL;
       }
   }
 
   if(requested)
+  {
       zmapViewBusy(view, TRUE) ;     // gets unset when all step lists finish
+      view->state = ZMAPVIEW_UPDATING;
+      (*(view_cbs_G->state_change))(view, view->app_data, NULL) ;
+  }
 
   if(sources)
     zMapConfigSourcesFreeList(sources);
@@ -1517,7 +1563,7 @@ static void scrollCB(ZMapWindow window, void *caller_data, void *window_data)
 
   printf("In View, in window scroll callback\n") ;
 
-
+//
   return ;
 }
 
@@ -1880,7 +1926,8 @@ static gboolean checkStateConnections(ZMapView zmap_view)
 {
   gboolean call_again = TRUE ;		/* Normally we want to called continuously. */
   gboolean state_change = TRUE ;          /* Has view state changed ?. */
-  gboolean has_step_list = FALSE;         // any requests still active?
+  gboolean reqs_finished = FALSE;
+  int has_step_list = 0;                 // any requests still active?
 
   if (zmap_view->connection_list)
     {
@@ -1983,10 +2030,9 @@ static gboolean checkStateConnections(ZMapView zmap_view)
 			  }
 			else
 			  {
-			    threadDebugMsg(thread, "GUI: thread %s, got data\n", NULL) ;
+			    // threadDebugMsg(thread, "GUI: thread %s, got data\n", NULL) ;
 
-			    /* Really we should only be loading stuff if we are LOADING.... */
-			    if (zmap_view->state != ZMAPVIEW_LOADING && zmap_view->state != ZMAPVIEW_LOADED)
+			    if (zmap_view->state != ZMAPVIEW_LOADING && zmap_view->state != ZMAPVIEW_UPDATING)
 			      {
 				threadDebugMsg(thread, "GUI: thread %s, got data but ZMap state is - %s\n",
 					       zmapViewGetStatusAsStr(zMapViewGetStatus(zmap_view))) ;
@@ -2015,7 +2061,7 @@ static gboolean checkStateConnections(ZMapView zmap_view)
 			/* Warn the user ! */
 			zMapWarning("Source \"%s\" is being cancelled, check log for details.", view_con->url) ;
 
-			zMapLogCritical("Source \"%s\" is being cancelled"
+			zMapLogCritical("Source \"%s\" is being cancelled"//
 					" because a request to it has failed,"
 					" error was: %s", view_con->url, err_msg) ;
 
@@ -2053,7 +2099,7 @@ static gboolean checkStateConnections(ZMapView zmap_view)
 		  }
 		default:
 		  {
-		    zMapLogFatalLogicErr("switch(), unknown value: %d", reply) ;
+                zMapLogFatalLogicErr("switch(), unknown value: %d", reply) ;
 
 		    break ;
 		  }
@@ -2061,32 +2107,46 @@ static gboolean checkStateConnections(ZMapView zmap_view)
 
 	    }
 
-          /* Check for more connection steps and dispatch them or clear up if finished. */
+
+	  /* If the thread has died then remove it's connection. */
+        // do this before counting up the number of step lists
+	  if (thread_has_died)
+	    {
+	      /* We are going to remove an item from the list so better move on from
+	       * this item. */
+
+	      list_item = g_list_next(list_item) ;
+	      zmap_view->connection_list = g_list_remove(zmap_view->connection_list, view_con) ;
+printf("thread died %s -> %d %x\n", view_con->url,g_list_length(zmap_view->connection_list), GPOINTER_TO_INT(zmap_view->connection_list));
+zMapLogWarning("thread died %s -> %d %x\n", view_con->url,g_list_length(zmap_view->connection_list), GPOINTER_TO_INT(zmap_view->connection_list));
+
+            if(view_con->step_list)
+              reqs_finished = TRUE;
+
+	      destroyConnection(zmap_view,view_con) ;
+
+	    }
+
+            /* Check for more connection steps and dispatch them or clear up if finished. */
         if ((view_con->step_list))
           {
             /* If there were errors then all connections may have been removed from
             * step list or if we have finished then destroy step_list. */
             if (zmapViewStepListIsNext(view_con->step_list))
             {
+
                   zmapViewStepListIter(view_con) ;
-                  has_step_list = TRUE;
+                  has_step_list++;
             }
             else
             {
                   zmapViewStepListDestroy(view_con) ;
+                  reqs_finished = TRUE;
+printf("step list %s finished\n",view_con->url);
+zMapLogWarning("step list %s finished\n",view_con->url);
             }
           }
 
-	  /* If the thread has died then remove it's connection. */
-	  if (thread_has_died)
-	    {
-	      /* We are going to remove an item from the list so better move on from
-	       * this item. */
-	      list_item = g_list_next(list_item) ;
-	      zmap_view->connection_list = g_list_remove(zmap_view->connection_list, view_con) ;
-
-	      destroyConnection(&view_con) ;
-	    }
 
 	  if (err_msg)
 	    g_free(err_msg) ;
@@ -2095,22 +2155,28 @@ static gboolean checkStateConnections(ZMapView zmap_view)
     }
 
 
+      /* Try this here..... */
+  if(!has_step_list && reqs_finished)
+    {
+      zmapViewBusy(zmap_view, FALSE) ;
+      /*
+       * rather than count up the number loaded we say 'LOADED' if there's no LOADING active
+       * This accounts for failures as well as completed loads
+       */
+      zmap_view->state = ZMAPVIEW_LOADED ;
+      state_change = TRUE;
+printf("state set to loaded\n");
+    }
+
+  if (state_change)
+    (*(view_cbs_G->state_change))(zmap_view, zmap_view->app_data, NULL) ;
 
   /* At this point if we have connections then we carry on looping looking for
    * replies from the views. If there are no threads left then we need to examine
    * our state and take action depending on whether we are dying or threads
    * have died or whatever.... */
-  if (zmap_view->connection_list)
-    {
-      /* Signal layer above us if view has changed state. */
-      if (state_change)
-	(*(view_cbs_G->state_change))(zmap_view, zmap_view->app_data, NULL) ;
 
-      /* Try this here..... */
-      if(!has_step_list)
-            zmapViewBusy(zmap_view, FALSE) ;
-    }
-  else
+  if (!zmap_view->connection_list)
     {
       /* Decide if we need to be called again or if everythings dead. */
       call_again = checkContinue(zmap_view) ;
@@ -2145,7 +2211,7 @@ static gboolean dispatchContextRequests(ZMapViewConnection connection, ZMapServe
 	ZMapServerReqFeatureSets feature_sets = (ZMapServerReqFeatureSets)req_any ;
 
 	feature_sets->featureset_2_stylelist_out = connect_data->featureset_2_stylelist ;
-
+// MH17: if this is an output parameter why do we set it on dispatch?
 
 	break ;
       }
@@ -2223,6 +2289,9 @@ static gboolean processDataRequests(ZMapViewConnection view_con, ZMapServerReqAn
   ZMapView zmap_view = view_con->parent_view ;
 
   /* Process the different types of data coming back. */
+printf("%s: response to %d was %d\n",view_con->url,req_any->type,req_any->response);
+zMapLogWarning("%s: response to %d was %d\n",view_con->url,req_any->type,req_any->response);
+
   switch (req_any->type)
     {
     case ZMAP_SERVERREQ_CREATE:
@@ -2247,6 +2316,7 @@ static gboolean processDataRequests(ZMapViewConnection view_con, ZMapServerReqAn
 
 	break ;
       }
+
     case ZMAP_SERVERREQ_FEATURESETS:
       {
 	ZMapServerReqFeatureSets feature_sets = (ZMapServerReqFeatureSets)req_any ;
@@ -2315,12 +2385,17 @@ static gboolean processDataRequests(ZMapViewConnection view_con, ZMapServerReqAn
 	    feature_sets->featureset_2_stylelist_out = NULL;
 	  }
 
-	/* Hack, stick the source to featureset mapping in the first time only for now...should be merged in
-	 * the end....and also the data one.... */
+	/* merge these in, the base mapping is defined in config ZMap [featuresets] */
+      // NB these are not supplied by pipeServers and we assume a 1-1 mapping
+      // of source to display featureset and source to style.
+      // See zmapViewRemoteReceive.c/xml_featureset_start_cb()
+// needs sorting; not implemented, we just get the first one
+
 	if (!(zmap_view->source_2_featureset))
 	  zmap_view->source_2_featureset = feature_sets->source_2_featureset_out ;
 
 	if (!(zmap_view->source_2_sourcedata))
+
 	  zmap_view->source_2_sourcedata = feature_sets->source_2_sourcedata_out ;
 
 
@@ -2406,19 +2481,13 @@ static gboolean processDataRequests(ZMapViewConnection view_con, ZMapServerReqAn
 	  }
 
 	/* ok...once we are here we can display stuff.... */
-	if (result && req_any->type == connect_data->last_request)
+	if (result && req_any->type == connect_data->display_after)
 	  {
 	    /* Isn't there a problem here...which bit of info goes with which server ???? */
 	    zmapViewSessionAddServerInfo(zmap_view->session_data, connect_data->database_path) ;
 
 	    getFeatures(zmap_view, get_features, connect_data->curr_styles) ;
 
-	    zmap_view->connections_loaded++ ;
-
-	    /* This will need to be more sophisticated, we will need to time
-	     * connections out. */
-	    if (zmap_view->connections_loaded == g_list_length(zmap_view->connection_list))
-	      zmap_view->state = ZMAPVIEW_LOADED ;
 	  }
 
 	break ;
@@ -2472,6 +2541,7 @@ static gboolean processGetSeqRequests(ZMapViewConnection view_con, ZMapServerReq
 				       get_sequence->sequences,
 				       get_sequence->flags,
 				       &blixem_pid,
+
 				       &(zmap_view->kill_blixems))))
 	zmap_view->spawned_processes = g_list_append(zmap_view->spawned_processes,
 						     GINT_TO_POINTER(blixem_pid)) ;
@@ -2510,7 +2580,8 @@ static void killConnections(ZMapView zmap_view)
 {
   GList* list_item ;
 
-  zMapAssert(zmap_view->connection_list) ;
+  if(!(zmap_view->connection_list))
+      return;
 
   list_item = g_list_first(zmap_view->connection_list) ;
   do
@@ -2569,6 +2640,14 @@ static ZMapViewConnection createConnection(ZMapView zmap_view,
   int url_parse_error ;
   ZMapURL urlObj;
 
+     /* Parse the url and create connection. */
+  if (!(urlObj = url_parse(server_url, &url_parse_error)))
+   {
+      zMapLogWarning("GUI: url %s did not parse. Parse error < %s >\n",
+            server_url, url_error(url_parse_error)) ;
+      return(NULL);
+   }
+
   if(view_con)
     {
           // use existing connection if not busy
@@ -2581,13 +2660,6 @@ if(existing) printf("using existing connection %s\n",view_con->url);
 
   if(!view_con)
     {
-      /* Parse the url and create connection. */
-      if (!(urlObj = url_parse(server_url, &url_parse_error)))
-        {
-          zMapLogWarning("GUI: url %s did not parse. Parse error < %s >\n",
-                  server_url, url_error(url_parse_error)) ;
-          return(NULL);
-        }
       /* Create the thread to service the connection requests, we give it a function that it will call
       * to decode the requests we send it and a terminate function. */
       if ((thread = zMapThreadCreate(zMapServerRequestHandler,
@@ -2597,7 +2669,7 @@ if(existing) printf("using existing connection %s\n",view_con->url);
             view_con = g_new0(ZMapViewConnectionStruct, 1) ;
             view_con->parent_view = zmap_view ;
             view_con->thread = thread ;
-            view_con->url = g_strdup(urlObj->url) ;
+            view_con->url = g_strdup(server_url) ;
 printf("create thread for %s\n",view_con->url);
         }
       else
@@ -2614,8 +2686,9 @@ printf("create thread for %s\n",view_con->url);
 
       connect_data = g_new0(ConnectionDataStruct, 1) ;
       connect_data->curr_context = context ;
-      if(terminate)           // ie server->delayed
-            connect_data->dynamic_loading = TRUE ;
+      if(terminate)           // ie server->delayed -> called after startup
+           connect_data->dynamic_loading = TRUE ;
+
       connect_data->featureset_2_stylelist = zMap_g_hashlist_create() ;
 
       view_con->request_data = connect_data ;
@@ -2629,7 +2702,7 @@ printf("create thread for %s\n",view_con->url);
       /* Record info. for this session. */
       zmapViewSessionAddServer(zmap_view->session_data,urlObj,format) ;
 
-      connect_data->last_request = ZMAP_SERVERREQ_INVALID;
+      connect_data->display_after = ZMAP_SERVERREQ_FEATURES;
 
       /* Set up this connection in the step list. */
       if(!existing)
@@ -2640,8 +2713,6 @@ printf("create thread for %s\n",view_con->url);
             zmapViewStepListAddServerReq(view_con->step_list, view_con, ZMAP_SERVERREQ_OPEN, req_any) ;
             req_any = zMapServerRequestCreate(ZMAP_SERVERREQ_GETSERVERINFO) ;
             zmapViewStepListAddServerReq(view_con->step_list, view_con, ZMAP_SERVERREQ_GETSERVERINFO, req_any) ;
-            // how can this be? maybe we want to connect and req data later on. Right now not likely
-            connect_data->last_request = ZMAP_SERVERREQ_GETSERVERINFO ;
       }
 
       if(req_featuresets)
@@ -2654,27 +2725,24 @@ printf("create thread for %s\n",view_con->url);
         zmapViewStepListAddServerReq(view_con->step_list, view_con, ZMAP_SERVERREQ_NEWCONTEXT, req_any) ;
         req_any = zMapServerRequestCreate(ZMAP_SERVERREQ_FEATURES) ;
         zmapViewStepListAddServerReq(view_con->step_list, view_con, ZMAP_SERVERREQ_FEATURES, req_any) ;
-        connect_data->last_request = ZMAP_SERVERREQ_FEATURES ;
       }
 
       if (dna_requested)
 	{
 	  req_any = zMapServerRequestCreate(ZMAP_SERVERREQ_SEQUENCE) ;
 	  zmapViewStepListAddServerReq(view_con->step_list, view_con, ZMAP_SERVERREQ_SEQUENCE, req_any) ;
-        connect_data->last_request = ZMAP_SERVERREQ_SEQUENCE ;
+        connect_data->display_after = ZMAP_SERVERREQ_SEQUENCE ;
       }
 
       if(terminate)
-
       {
         req_any = zMapServerRequestCreate(ZMAP_SERVERREQ_TERMINATE) ;
         zmapViewStepListAddServerReq(view_con->step_list, view_con, ZMAP_SERVERREQ_TERMINATE, req_any) ;
-        connect_data->last_request = ZMAP_SERVERREQ_TERMINATE ;
       }
 
       if(!existing)
-        zmap_view->connection_list = g_list_append(zmap_view->connection_list, view_con) ;
-
+          zmap_view->connection_list = g_list_append(zmap_view->connection_list, view_con) ;
+printf("view_con: %s -> %d %x\n", view_con->url,g_list_length(zmap_view->connection_list), GPOINTER_TO_INT(zmap_view->connection_list));
       /* Start the connection to the source. */
       zmapViewStepListIter(view_con) ;
     }
@@ -2692,9 +2760,15 @@ printf("create thread for %s\n",view_con->url);
 
 
 
-static void destroyConnection(ZMapViewConnection *view_conn_ptr)
+static void destroyConnection(ZMapView view, ZMapViewConnection view_conn)
 {
-  ZMapViewConnection view_conn = *view_conn_ptr ;
+
+  zMapLogWarning("destroyConnection\n",NULL);
+
+  if(view->sequence_server == view_conn)
+      view->sequence_server = NULL;
+  if(view->writeback_server == view_conn)
+      view->writeback_server = NULL;
 
   zMapThreadDestroy(view_conn->thread) ;
 
@@ -2707,8 +2781,6 @@ static void destroyConnection(ZMapViewConnection *view_conn_ptr)
 
   g_free(view_conn) ;
 
-  *view_conn_ptr = NULL ;
-
   return ;
 }
 
@@ -2918,6 +2990,15 @@ static gboolean justMergeContext(ZMapView view, ZMapFeatureContext *context_inou
     }
 
   merge = zMapFeatureContextMerge(&(view->features), &new_features, &diff_context) ;
+#ifndef MH17_NEVER
+      {
+            GError *err = NULL;
+
+            zMapFeatureDumpToFileName(diff_context,"features.txt","(justMerge) diff context:\n", NULL, &err) ;
+            zMapFeatureDumpToFileName(view->features,"features.txt","(justMerge) view->Features:\n", NULL, &err) ;
+
+      }
+#endif
 
   if (merge == ZMAPFEATURE_CONTEXT_OK)
     {
@@ -3022,7 +3103,7 @@ static void commandCB(ZMapWindow window, void *caller_data, void *window_data)
 
 		view_con = view->sequence_server ;
 
-		if (!view_con || !view_con->sequence_server)
+		if (!view_con) // || !view_con->sequence_server)
 		  {
 		    zMapWarning("%s", "Sequence server incorrectly specified in config file"
 				" so cannot fetch local sequences for blixem.") ;
@@ -3034,6 +3115,8 @@ static void commandCB(ZMapWindow window, void *caller_data, void *window_data)
               }
             else
 		  {
+                zmapViewBusy(view, TRUE) ;
+
 		    /* Create the step list that will be used to fetch the sequences. */
 		    view_con->step_list = zmapViewStepListCreate(NULL, processGetSeqRequests, NULL) ;
 		    zmapViewStepListAddStep(view_con->step_list, ZMAP_SERVERREQ_GETSEQUENCE,
@@ -3459,7 +3542,8 @@ static void threadDebugMsg(ZMapThread thread, char *format_str, char *msg)
   thread_id = zMapThreadGetThreadID(thread) ;
   full_msg = g_strdup_printf(format_str, thread_id, msg ? msg : "") ;
 
-  zMapDebug("%s", full_msg) ;
+//  zMapDebug("%s", full_msg) ;
+  zMapLogWarning("%s",full_msg);
 
   g_free(full_msg) ;
   g_free(thread_id) ;
@@ -3478,6 +3562,7 @@ static gboolean checkContinue(ZMapView zmap_view)
     {
     case ZMAPVIEW_INIT:
     case ZMAPVIEW_LOADED:           // delayed servers get cleared up, we do not need connections to run
+
       {
 	/* Nothing to do here I think.... */
 	connections = TRUE ;
@@ -3520,6 +3605,19 @@ static gboolean checkContinue(ZMapView zmap_view)
 
 	break ;
       }
+    case ZMAPVIEW_UPDATING:
+      {
+      /* zmap is ok but a  new column didn't come through */
+      zmap_view->state = ZMAPVIEW_LOADED;
+
+      /* Signal layer above us because the view has stopped loading. */
+      (*(view_cbs_G->state_change))(zmap_view, zmap_view->app_data, NULL) ;
+printf("check continue thread died while updating\n");
+zMapLogWarning("check continue thread died while updating\n",NULL);
+      connections = TRUE ;
+
+      break;
+      }
     case ZMAPVIEW_RESETTING:
       {
 	/* zmap is ok but user has reset it and all threads have died so we need to stop
@@ -3562,7 +3660,7 @@ static gboolean checkContinue(ZMapView zmap_view)
 	break ;
       }
     }
-
+if(!connections) printf("checkContinue returns FALSE\n");
   return connections ;
 }
 
diff --git a/src/zmapView/zmapViewRemoteReceive.c b/src/zmapView/zmapViewRemoteReceive.c
index 80e73330e5d1721e68b3c97028dec1c4c932e16e..9f372d0c649c0dc9940bc51d4c969b15a9d02142 100755
--- a/src/zmapView/zmapViewRemoteReceive.c
+++ b/src/zmapView/zmapViewRemoteReceive.c
@@ -6,12 +6,12 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
@@ -27,11 +27,11 @@
  *              a peer application set up to interact with zmap.
  *
  * Exported functions: See zmapView_P.h
- *              
+ *
  * HISTORY:
  * Last edited: Jan 27 15:46 2010 (edgrif)
  * Created: Tue Jul 10 21:02:42 2007 (rds)
- * CVS info:   $Id: zmapViewRemoteReceive.c,v 1.41 2010-03-04 15:11:36 mh17 Exp $
+ * CVS info:   $Id: zmapViewRemoteReceive.c,v 1.42 2010-03-19 08:56:42 mh17 Exp $
  *-------------------------------------------------------------------
  */
 
@@ -80,7 +80,7 @@ typedef enum
 typedef struct
 {
   ZMapViewValidXRemoteActions action ;
-  gboolean edit_action ;				    /* 
+  gboolean edit_action ;				    /*
 							       Does this action edit the feature context ? */
 
 
@@ -169,8 +169,8 @@ static ZMapFeatureContextExecuteStatus mark_matching_invalid(GQuark key, gpointe
 static ZMapFeatureContextExecuteStatus sanity_check_context(GQuark key, gpointer data, gpointer user_data, char **error_out);
 
 static void zoomWindowToFeature(ZMapView view, RequestData input_data, ResponseData output_data) ;
-static ZMapFeatureContextExecuteStatus zoomToFeatureCB(GQuark key, 
-                                                       gpointer data, 
+static ZMapFeatureContextExecuteStatus zoomToFeatureCB(GQuark key,
+                                                       gpointer data,
                                                        gpointer user_data,
                                                        char **error_out) ;
 
@@ -203,10 +203,10 @@ static void copyAddFeature(gpointer key, gpointer value, gpointer user_data) ;
 /* Descriptor table of action attributes */
 static ActionDescriptorStruct action_table_G[] =
   {
-    
 
 
-    {ZMAPVIEW_REMOTE_INVALID} 
+
+    {ZMAPVIEW_REMOTE_INVALID}
   } ;
 #endif
 
@@ -260,11 +260,11 @@ static char *actions_G[ZMAPVIEW_REMOTE_UNKNOWN + 1] =
 /* Where is all starts from. Everything else should be static */
 void zmapViewSetupXRemote(ZMapView view, GtkWidget *widget)
 {
-  zMapXRemoteInitialiseWidgetFull(widget, PACKAGE_NAME, 
-				  ZMAP_DEFAULT_REQUEST_ATOM_NAME, 
-				  ZMAP_DEFAULT_RESPONSE_ATOM_NAME, 
-				  view_execute_command, 
-				  view_post_execute, 
+  zMapXRemoteInitialiseWidgetFull(widget, PACKAGE_NAME,
+				  ZMAP_DEFAULT_REQUEST_ATOM_NAME,
+				  ZMAP_DEFAULT_RESPONSE_ATOM_NAME,
+				  view_execute_command,
+				  view_post_execute,
 				  view);
   return ;
 }
@@ -273,8 +273,8 @@ char *zMapViewRemoteReceiveAccepts(ZMapView view)
 {
   char *xml = NULL;
 
-  xml = zMapXRemoteClientAcceptsActionsXML(zMapXRemoteWidgetGetXID(view->xremote_widget), 
-                                           &actions_G[ZMAPVIEW_REMOTE_INVALID + 1], 
+  xml = zMapXRemoteClientAcceptsActionsXML(zMapXRemoteWidgetGetXID(view->xremote_widget),
+                                           &actions_G[ZMAPVIEW_REMOTE_INVALID + 1],
                                            ZMAPVIEW_REMOTE_UNKNOWN - 1);
 
   return xml;
@@ -283,7 +283,7 @@ char *zMapViewRemoteReceiveAccepts(ZMapView view)
 
 
 
-/* 
+/*
  *                       Internal functions.
  */
 
@@ -363,7 +363,7 @@ static char *view_execute_command(char *command_text, gpointer user_data, int *s
 					   g_quark_to_string(input_data.feature->original_id)) ;
 		    output_data.code = ZMAPXREMOTE_FAILED ;
 		  }
-		else 
+		else
 #endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
 
 		  if (drawNewFeatures(view, &input_data, &output_data)
@@ -375,8 +375,8 @@ static char *view_execute_command(char *command_text, gpointer user_data, int *s
 		    post_data->action       = input.common.action;
 		    post_data->edit_context = input_data.edit_context;
 
-		    g_object_set_data(G_OBJECT(view->xremote_widget), 
-				      VIEW_POST_EXECUTE_DATA, 
+		    g_object_set_data(G_OBJECT(view->xremote_widget),
+				      VIEW_POST_EXECUTE_DATA,
 				      post_data);
 		  }
 
@@ -406,7 +406,7 @@ static char *view_execute_command(char *command_text, gpointer user_data, int *s
           output_data.code = ZMAPXREMOTE_UNKNOWNCMD;
           break;
         }
-      
+
       *statusCode = output_data.code;
       response    = g_string_free(output_data.messages, FALSE);
     }
@@ -430,14 +430,14 @@ static char *view_execute_command(char *command_text, gpointer user_data, int *s
       zMapLogWarning("%s", response);
       g_free(response);
 
-      response = g_strdup("Broken code. Check zmap.log file"); 
+      response = g_strdup("Broken code. Check zmap.log file");
     }
 
   if (response == NULL)
     {
       response = g_strdup("Broken code.") ;
     }
-    
+
   return response;
 }
 
@@ -459,10 +459,10 @@ static char *view_post_execute(char *command_text, gpointer user_data, int *stat
 	case ZMAPVIEW_REMOTE_CREATE_FEATURE:
 	  {
 	    status = zmapViewDrawDiffContext(view, &(post_data->edit_context));
-	    
+
 	    if(!status)
 	      post_data->edit_context = NULL; /* So the view->features context doesn't get destroyed */
-	    
+
 	    if(post_data->edit_context)
 	      zMapFeatureContextDestroy(post_data->edit_context, TRUE);
 	  }
@@ -657,12 +657,12 @@ static gboolean drawNewFeatures(ZMapView view, RequestData input_data, ResponseD
     }
   else
     {
-      zMapFeatureContextExecute((ZMapFeatureAny)(input_data->edit_context), 
+      zMapFeatureContextExecute((ZMapFeatureAny)(input_data->edit_context),
 				ZMAPFEATURE_STRUCT_FEATURE,
 				delete_from_list,
 				&(input_data->feature_list));
 
-      zMapFeatureContextExecute((ZMapFeatureAny)(view->features), 
+      zMapFeatureContextExecute((ZMapFeatureAny)(view->features),
 				ZMAPFEATURE_STRUCT_FEATURE,
 				mark_matching_invalid,
 				&(input_data->feature_list));
@@ -703,7 +703,7 @@ static void draw_failed_make_message(gpointer list_data, gpointer user_data)
       g_string_append_printf(response_data->messages,
 			     "Failed to draw feature '%s' [%s]. Unknown reason.\n",
 			     (char *)g_quark_to_string(feature_any->original_id),
-			     (char *)g_quark_to_string(feature_any->unique_id));      
+			     (char *)g_quark_to_string(feature_any->unique_id));
     }
 
   return ;
@@ -732,13 +732,13 @@ static gint matching_unique_id(gconstpointer list_data, gconstpointer user_data)
   ZMapFeatureAny a = (ZMapFeatureAny)list_data, b = (ZMapFeatureAny)user_data ;
 
   match = !(a->unique_id == b->unique_id);
-    
+
   return match;
 }
 
-static ZMapFeatureContextExecuteStatus delete_from_list(GQuark key, 
-                                                        gpointer data, 
-                                                        gpointer user_data, 
+static ZMapFeatureContextExecuteStatus delete_from_list(GQuark key,
+                                                        gpointer data,
+                                                        gpointer user_data,
                                                         char **error_out)
 {
   ZMapFeatureAny any = (ZMapFeatureAny)data;
@@ -755,8 +755,8 @@ static ZMapFeatureContextExecuteStatus delete_from_list(GQuark key,
   return ZMAP_CONTEXT_EXEC_STATUS_OK;
 }
 
-static ZMapFeatureContextExecuteStatus mark_matching_invalid(GQuark key, 
-                                                             gpointer data, 
+static ZMapFeatureContextExecuteStatus mark_matching_invalid(GQuark key,
+                                                             gpointer data,
                                                              gpointer user_data,
                                                              char **error_out)
 {
@@ -775,8 +775,8 @@ static ZMapFeatureContextExecuteStatus mark_matching_invalid(GQuark key,
   return ZMAP_CONTEXT_EXEC_STATUS_OK;
 }
 
-static ZMapFeatureContextExecuteStatus sanity_check_context(GQuark key, 
-                                                            gpointer data, 
+static ZMapFeatureContextExecuteStatus sanity_check_context(GQuark key,
+                                                            gpointer data,
                                                             gpointer user_data,
                                                             char **error_out)
 {
@@ -800,7 +800,7 @@ static ZMapFeatureContextExecuteStatus sanity_check_context(GQuark key,
 static void populate_data_from_view(ZMapView view, RequestData xml_data)
 {
   xml_data->orig_context = zMapViewGetFeatures(view) ;
-  
+
   /* Copy basics of original context. */
   xml_data->edit_context = (ZMapFeatureContext)zMapFeatureAnyCopy((ZMapFeatureAny)(xml_data->orig_context)) ;
 
@@ -808,15 +808,15 @@ static void populate_data_from_view(ZMapView view, RequestData xml_data)
   xml_data->edit_context->styles = NULL ;
 #endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
 
-  
+
 
 #ifdef ED_G_NEVER_INCLUDE_THIS_CODE
   xml_data->styles  = xml_data->orig_context->styles ;
 #endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
   xml_data->styles  = view->orig_styles ;
-  
 
-  
+
+
   return ;
 }
 
@@ -827,7 +827,7 @@ static void populate_data_from_view(ZMapView view, RequestData xml_data)
 /*                 XML_TAG_HANDLERS                       */
 /* ====================================================== */
 
-/* 
+/*
  *
  * <zmap action="create_feature">
  *   <featureset name="Coding">
@@ -924,7 +924,7 @@ static gboolean xml_request_start_cb(gpointer user_data, ZMapXMLElement set_elem
 	      {
 		GQuark load_id ;
 		RequestData request_data = (RequestData)(xml_data->user_data);
-		  
+
 		load_id = zMapXMLAttributeGetValue(attr) ;
 
 		if (zMapLogQuarkIsStr(load_id, "mark"))
@@ -942,7 +942,7 @@ static gboolean xml_request_start_cb(gpointer user_data, ZMapXMLElement set_elem
 	  }
 
 	result = TRUE ;
-	
+
 	break;
       }
 
@@ -1007,7 +1007,7 @@ static gboolean xml_align_start_cb(gpointer user_data, ZMapXMLElement set_elemen
 	      err_msg = g_strdup_printf("Unknown Align \"%s\":  not found in original_context", align_name) ;
 	      zMapXMLParserRaiseParsingError(parser, err_msg) ;
 	      g_free(err_msg) ;
-		  
+
 	      result = FALSE ;
 	    }
 	  else
@@ -1076,7 +1076,7 @@ static gboolean xml_block_start_cb(gpointer user_data, ZMapXMLElement set_elemen
 	      err_msg = g_strdup_printf("Bad Format Block name: \"%s\"", block_name) ;
 	      zMapXMLParserRaiseParsingError(parser, err_msg) ;
 	      g_free(err_msg) ;
-		  
+
 	      result = FALSE ;
 	    }
 	  else
@@ -1090,7 +1090,7 @@ static gboolean xml_block_start_cb(gpointer user_data, ZMapXMLElement set_elemen
 		  err_msg = g_strdup_printf("Unknown Block \"%s\":  not found in original_context", block_name) ;
 		  zMapXMLParserRaiseParsingError(parser, err_msg) ;
 		  g_free(err_msg) ;
-		  
+
 		  result = FALSE ;
 		}
 	      else
@@ -1157,17 +1157,25 @@ static gboolean xml_featureset_start_cb(gpointer user_data, ZMapXMLElement set_e
 	  request_data->source_id = set_id ;
 
 	  /* Check to see if we can find this source name in any of the featuresets. */
-	  if (!(set_data = g_hash_table_lookup(request_data->view->source_2_featureset,
+	  if (!request_data->view->source_2_featureset ||
+           !(set_data = g_hash_table_lookup(request_data->view->source_2_featureset,
 					       GINT_TO_POINTER(set_id))))
-	    {
-	      char *err_msg ;
+          {
+            // if not defined assume featureset name = source name
 
-	      err_msg = g_strdup_printf("Source %s not found in view->source_2_feature_set",
-					g_quark_to_string(set_id)) ;
+            featureset_id = set_id;
+            featureset_name = set_name;
+
+#if MH17_NOT_NEEDED
+            char *err_msg ;
+
+            err_msg = g_strdup_printf("Source %s not found in view->source_2_feature_set",
+			g_quark_to_string(set_id)) ;
 	      zMapXMLParserRaiseParsingError(parser, err_msg) ;
 	      g_free(err_msg) ;
-		  
+
 	      result = FALSE ;
+#endif
 	    }
 	  else
 	    {
@@ -1197,7 +1205,7 @@ static gboolean xml_featureset_start_cb(gpointer user_data, ZMapXMLElement set_e
 	  request_data->orig_feature_set = zMap_g_hash_table_nth(request_data->orig_block->feature_sets, 0) ;
 	  request_data->feature_set
 	    = (ZMapFeatureSet)zMapFeatureAnyCopy((ZMapFeatureAny)(request_data->orig_feature_set)) ;
-	  
+
 	  result = TRUE ;
 	}
 
@@ -1207,33 +1215,40 @@ static gboolean xml_featureset_start_cb(gpointer user_data, ZMapXMLElement set_e
 	{
 	  ZMapGFFSource source_data ;
 
-	  if (!(source_data = g_hash_table_lookup(request_data->view->source_2_sourcedata,
+	  if (!request_data->view->source_2_sourcedata ||
+           !(source_data = g_hash_table_lookup(request_data->view->source_2_sourcedata,
 						  GINT_TO_POINTER(set_id))))
 	    {
+            // if not defined assume style name = source name
+
+           request_data->style_id = request_data->source_id;
+
+#if MH17_NOT_NEEDED
 	      char *err_msg ;
 
 	      err_msg = g_strdup_printf("Source %s not found in view->source_2_sourcedata",
 					g_quark_to_string(set_id)) ;
 	      zMapXMLParserRaiseParsingError(parser, err_msg) ;
 	      g_free(err_msg) ;
-		  
+
 	      result = FALSE ;
-	    }
+#endif
+          }
 	  else
 	    {
 	      request_data->style_id = source_data->style_id ;
+          }
 
-	      if (!(request_data->style = zMapFindStyle(request_data->view->orig_styles, request_data->style_id)))
-		{
-		  char *err_msg ;
+        if (!(request_data->style = zMapFindStyle(request_data->view->orig_styles, request_data->style_id)))
+          {
+		char *err_msg ;
 
-		  err_msg = g_strdup_printf("Style %s not found in view->orig_styles",
-					  g_quark_to_string(request_data->style_id)) ;
-		  zMapXMLParserRaiseParsingError(parser, err_msg) ;
-		  g_free(err_msg) ;
+		err_msg = g_strdup_printf("Style %s not found in view->orig_styles",
+			  g_quark_to_string(request_data->style_id)) ;
+		zMapXMLParserRaiseParsingError(parser, err_msg) ;
+		g_free(err_msg) ;
 
-		  result = FALSE ;
-		}
+		result = FALSE ;
 	    }
 	}
 
@@ -1260,7 +1275,7 @@ static gboolean xml_featureset_start_cb(gpointer user_data, ZMapXMLElement set_e
 
 		if (result && (attr = zMapXMLElementGetAttributeByName(set_element, "start")))
 		  {
-		    request_data->start = strtol((char *)g_quark_to_string(zMapXMLAttributeGetValue(attr)), 
+		    request_data->start = strtol((char *)g_quark_to_string(zMapXMLAttributeGetValue(attr)),
 						 (char **)NULL, 10);
 		  }
 		else
@@ -1268,10 +1283,10 @@ static gboolean xml_featureset_start_cb(gpointer user_data, ZMapXMLElement set_e
 		    zMapXMLParserRaiseParsingError(parser, "start is a required attribute for feature.");
 		    result = FALSE ;
 		  }
-      
+
 		if (result && (attr = zMapXMLElementGetAttributeByName(set_element, "end")))
 		  {
-		    request_data->end = strtol((char *)g_quark_to_string(zMapXMLAttributeGetValue(attr)), 
+		    request_data->end = strtol((char *)g_quark_to_string(zMapXMLAttributeGetValue(attr)),
 					       (char **)NULL, 10);
 		  }
 		else
@@ -1290,12 +1305,12 @@ static gboolean xml_featureset_start_cb(gpointer user_data, ZMapXMLElement set_e
 		  {
 		    /* If we can't find the featureset it's a serious error and we can't carry on. */
 		    char *err_msg ;
- 
+
 		    err_msg = g_strdup_printf("Unknown FeatureSet \"%s\":  not found in original_block",
 					      featureset_name) ;
 		    zMapXMLParserRaiseParsingError(parser, err_msg) ;
 		    g_free(err_msg) ;
- 		  
+
 		    result = FALSE ;
 		  }
 
@@ -1375,9 +1390,9 @@ static gboolean xml_feature_start_cb(gpointer user_data, ZMapXMLElement feature_
 	result = TRUE ;
 
         zMapXMLParserCheckIfTrueErrorReturn(request_data->block == NULL,
-                                            parser, 
+                                            parser,
                                             "feature tag not contained within featureset tag");
-        
+
         if (result && (attr = zMapXMLElementGetAttributeByName(feature_element, "name")))
           {
             feature_name_q = zMapXMLAttributeGetValue(attr);
@@ -1387,11 +1402,11 @@ static gboolean xml_feature_start_cb(gpointer user_data, ZMapXMLElement feature_
 	    zMapXMLParserRaiseParsingError(parser, "name is a required attribute for feature.");
 	    result = FALSE ;
 	  }
-        
+
 
         if (result && (attr = zMapXMLElementGetAttributeByName(feature_element, "start")))
           {
-            start = strtol((char *)g_quark_to_string(zMapXMLAttributeGetValue(attr)), 
+            start = strtol((char *)g_quark_to_string(zMapXMLAttributeGetValue(attr)),
                            (char **)NULL, 10);
           }
         else
@@ -1399,10 +1414,10 @@ static gboolean xml_feature_start_cb(gpointer user_data, ZMapXMLElement feature_
 	    zMapXMLParserRaiseParsingError(parser, "start is a required attribute for feature.");
 	    result = FALSE ;
 	  }
-      
+
         if (result && (attr = zMapXMLElementGetAttributeByName(feature_element, "end")))
           {
-            end = strtol((char *)g_quark_to_string(zMapXMLAttributeGetValue(attr)), 
+            end = strtol((char *)g_quark_to_string(zMapXMLAttributeGetValue(attr)),
                          (char **)NULL, 10);
           }
         else
@@ -1418,7 +1433,7 @@ static gboolean xml_feature_start_cb(gpointer user_data, ZMapXMLElement feature_
 		zMapFeatureFormatStrand((char *)g_quark_to_string(zMapXMLAttributeGetValue(attr)),
 					&(strand));
 	      }
-        
+
 	    if((attr = zMapXMLElementGetAttributeByName(feature_element, "score")))
 	      {
 		score = zMapXMLAttributeValueToDouble(attr);
@@ -1427,7 +1442,7 @@ static gboolean xml_feature_start_cb(gpointer user_data, ZMapXMLElement feature_
 
 	    if ((attr = zMapXMLElementGetAttributeByName(feature_element, "start_not_found")))
 	      {
-		start_phase = strtol((char *)g_quark_to_string(zMapXMLAttributeGetValue(attr)), 
+		start_phase = strtol((char *)g_quark_to_string(zMapXMLAttributeGetValue(attr)),
 				     (char **)NULL, 10);
 		start_not_found = TRUE;
 
@@ -1463,13 +1478,13 @@ static gboolean xml_feature_start_cb(gpointer user_data, ZMapXMLElement feature_
 		zMapXMLAttributeGetValue(attr);
 	      }
 	  }
-        
+
         if (result && !zMapXMLParserLastErrorMsg(parser))
           {
             feature_name = (char *)g_quark_to_string(feature_name_q);
 
             if (result
-		&& (request_data->feature = zMapFeatureCreateFromStandardData(feature_name, NULL, "", 
+		&& (request_data->feature = zMapFeatureCreateFromStandardData(feature_name, NULL, "",
 									      ZMAPSTYLE_MODE_BASIC,
 									      request_data->style,
 									      start, end, has_score,
@@ -1488,7 +1503,7 @@ static gboolean xml_feature_start_cb(gpointer user_data, ZMapXMLElement feature_
 		    zMapFeatureAddTranscriptStartEnd(request_data->feature, start_not_found,
 						     start_phase, end_not_found);
 		  }
-		
+
 		if ((attr = zMapXMLElementGetAttributeByName(feature_element, "locus")))
 		  {
 		    ZMapFeatureSet locus_feature_set = NULL;
@@ -1498,7 +1513,7 @@ static gboolean xml_feature_start_cb(gpointer user_data, ZMapXMLElement feature_
 		    GQuark locus_set_id  = zMapStyleCreateID(ZMAP_FIXED_STYLE_LOCUS_NAME);
 		    char *new_locus_name = (char *)g_quark_to_string(new_locus_id);
 		    ZMapFeatureTypeStyle locus_style ;
-		    
+
 		    if (!(locus_style
 			  = zMapFindStyle(request_data->styles, zMapStyleCreateID(ZMAP_FIXED_STYLE_LOCUS_NAME))))
 		      {
@@ -1515,7 +1530,7 @@ static gboolean xml_feature_start_cb(gpointer user_data, ZMapXMLElement feature_
 			    locus_feature_set = zMapFeatureSetCreate(ZMAP_FIXED_STYLE_LOCUS_NAME, NULL);
 			    zMapFeatureBlockAddFeatureSet(request_data->block, locus_feature_set);
 			  }
-		    
+
 			/* For some reason lace passes over odd xml here...
 			   <zmap action="delete_feature">
 			   <featureset>
@@ -1529,10 +1544,10 @@ static gboolean xml_feature_start_cb(gpointer user_data, ZMapXMLElement feature_
 			   i.e. deleting the locus name it's creating!
 			*/
 
-			old_feature = 
+			old_feature =
 			  (ZMapFeature)zMapFeatureContextFindFeatureFromFeature(request_data->orig_context,
 										(ZMapFeatureAny)request_data->feature);
-		    
+
 			if ((old_feature) && (old_feature->type == ZMAPSTYLE_MODE_TRANSCRIPT)
 			    && (old_feature->locus_id != 0) && (old_feature->locus_id != new_locus_id))
 			  {
@@ -1547,22 +1562,22 @@ static gboolean xml_feature_start_cb(gpointer user_data, ZMapXMLElement feature_
 			     * 2 - We are modifying an existing feature.
 			     * 3 - Lace has passed a locus="name" which does not = existing feature locus name.
 			     * 4 - Locus start and end are based on feature start end.
-			     *     If they are the extent of the locus as they should be... 
-			     *     The unique_id will be different and therefore the next 
+			     *     If they are the extent of the locus as they should be...
+			     *     The unique_id will be different and therefore the next
 			     *     zMapFeatureContextFindFeatureFromFeature will fail.
 			     *     This means the locus won't be deleted as it should be.
 			     */
 			    zMapLogMessage("loci '%s' & '%s' don't match will delete '%s'",
 					   old_locus_name, new_locus_name, old_locus_name);
-			
+
 			    tmp_locus_feature = zMapFeatureCreateFromStandardData(old_locus_name,
 										  NULL, "",
 										  ZMAPSTYLE_MODE_BASIC, locus_style,
-										  start, end, FALSE, 0.0, 
+										  start, end, FALSE, 0.0,
 										  ZMAPSTRAND_NONE,
 										  ZMAPPHASE_NONE);
 			    zMapFeatureSetAddFeature(locus_feature_set, tmp_locus_feature);
-			
+
 			    if ((old_locus_feature
 				 = zMapFeatureContextFindFeatureFromFeature(request_data->orig_context,
 									    (ZMapFeatureAny)tmp_locus_feature)))
@@ -1577,11 +1592,11 @@ static gboolean xml_feature_start_cb(gpointer user_data, ZMapXMLElement feature_
 				locus_feature = zMapFeatureCreateFromStandardData(old_locus_name,
 										  NULL, "",
 										  ZMAPSTYLE_MODE_BASIC, locus_style,
-										  start, end, FALSE, 0.0, 
+										  start, end, FALSE, 0.0,
 										  ZMAPSTRAND_NONE,
 										  ZMAPPHASE_NONE);
 			      }
-			
+
 			    zMapFeatureDestroy(tmp_locus_feature);
 			  }
 			else
@@ -1590,27 +1605,27 @@ static gboolean xml_feature_start_cb(gpointer user_data, ZMapXMLElement feature_
 			    locus_feature = zMapFeatureCreateFromStandardData(new_locus_name,
 									      NULL, "",
 									      ZMAPSTYLE_MODE_BASIC, locus_style,
-									      start, end, FALSE, 0.0, 
+									      start, end, FALSE, 0.0,
 									      ZMAPSTRAND_NONE,
 									      ZMAPPHASE_NONE);
-			
-			  }			
-		    
+
+			  }
+
 			/* The feature set and feature need to have their styles set... */
-		    
-			/* managed to get the styles set up. Add the feature to 
+
+			/* managed to get the styles set up. Add the feature to
 			 * feature set and finish up the locus. */
-			zMapFeatureSetAddFeature(locus_feature_set, 
+			zMapFeatureSetAddFeature(locus_feature_set,
 						 locus_feature);
 			zMapFeatureAddLocus(locus_feature, new_locus_id);
-		    
+
 			/* We'll still add the locus to the transcript
 			 * feature so at least this information is
 			 * preserved whatever went on with the styles */
 			zMapFeatureAddLocus(request_data->feature, new_locus_id);
 		      }
 		  }
-		
+
 
 		/* THIS DOESN'T DO A DEEP ENOUGH COPY, WE FAIL LATER FOR SOME ACTIONS
 		 * BECAUSE STUFF LIKE THE HOMOL DATA IS NOT COPIED SO WE CAN'T FIND
@@ -1657,7 +1672,7 @@ static gboolean xml_export_start_cb(gpointer user_data, ZMapXMLElement export_el
 }
 
 
-static gboolean xml_subfeature_end_cb(gpointer user_data, ZMapXMLElement sub_element, 
+static gboolean xml_subfeature_end_cb(gpointer user_data, ZMapXMLElement sub_element,
                                       ZMapXMLParser parser)
 {
   ZMapXMLAttribute attr = NULL;
@@ -1668,8 +1683,8 @@ static gboolean xml_subfeature_end_cb(gpointer user_data, ZMapXMLElement sub_ele
   if(xml_data->common.action == ZMAPVIEW_REMOTE_INVALID)
     return FALSE;
 
-  zMapXMLParserCheckIfTrueErrorReturn(request_data->feature == NULL, 
-                                      parser, 
+  zMapXMLParserCheckIfTrueErrorReturn(request_data->feature == NULL,
+                                      parser,
                                       "a feature end tag without a created feature.");
   feature = request_data->feature;
 
@@ -1678,12 +1693,12 @@ static gboolean xml_subfeature_end_cb(gpointer user_data, ZMapXMLElement sub_ele
       GQuark ontology = zMapXMLAttributeGetValue(attr);
       ZMapSpanStruct span = {0,0};
       ZMapSpan exon_ptr = NULL, intron_ptr = NULL;
-      
+
       feature->type = ZMAPSTYLE_MODE_TRANSCRIPT;
 
       if((attr = zMapXMLElementGetAttributeByName(sub_element, "start")))
         {
-          span.x1 = strtol((char *)g_quark_to_string(zMapXMLAttributeGetValue(attr)), 
+          span.x1 = strtol((char *)g_quark_to_string(zMapXMLAttributeGetValue(attr)),
                            (char **)NULL, 10);
         }
       else
@@ -1691,7 +1706,7 @@ static gboolean xml_subfeature_end_cb(gpointer user_data, ZMapXMLElement sub_ele
 
       if((attr = zMapXMLElementGetAttributeByName(sub_element, "end")))
         {
-          span.x2 = strtol((char *)g_quark_to_string(zMapXMLAttributeGetValue(attr)), 
+          span.x2 = strtol((char *)g_quark_to_string(zMapXMLAttributeGetValue(attr)),
                            (char **)NULL, 10);
         }
       else
@@ -1713,8 +1728,8 @@ static gboolean xml_subfeature_end_cb(gpointer user_data, ZMapXMLElement sub_ele
   return TRUE;                  /* tell caller to clean us up. */
 }
 
-static gboolean xml_return_true_cb(gpointer user_data, 
-                                   ZMapXMLElement zmap_element, 
+static gboolean xml_return_true_cb(gpointer user_data,
+                                   ZMapXMLElement zmap_element,
                                    ZMapXMLParser parser)
 {
   return TRUE;
@@ -1765,18 +1780,18 @@ static void zoomWindowToFeature(ZMapView view, RequestData input_data, ResponseD
 
       span = (ZMapSpan)(list->data);
 
-      zMapWindowZoomToWorldPosition(view_window->window, FALSE, 
+      zMapWindowZoomToWorldPosition(view_window->window, FALSE,
                                     0.0, span->x1,
                                     100.0, span->x2);
 
-      g_string_append_printf(output_data->messages, 
+      g_string_append_printf(output_data->messages,
                              "Zoom to location %d-%d executed",
                              span->x1, span->x2);
     }
   else
     {
-      g_string_append_printf(output_data->messages, 
-                             "No data for %s action", 
+      g_string_append_printf(output_data->messages,
+                             "No data for %s action",
                              actions_G[ZMAPVIEW_REMOTE_ZOOM_TO]);
 
       output_data->code = ZMAPXREMOTE_BADREQUEST;
@@ -1786,8 +1801,8 @@ static void zoomWindowToFeature(ZMapView view, RequestData input_data, ResponseD
 }
 
 
-static ZMapFeatureContextExecuteStatus zoomToFeatureCB(GQuark key, 
-                                                       gpointer data, 
+static ZMapFeatureContextExecuteStatus zoomToFeatureCB(GQuark key,
+                                                       gpointer data,
                                                        gpointer user_data,
                                                        char **error_out)
 {
diff --git a/src/zmapView/zmapViewUtils.c b/src/zmapView/zmapViewUtils.c
index 367b2b8f977c9e1e38d2306466d6b13b122ce473..d5b80d8acba3be0162ec497a288022403c8a7e8d 100755
--- a/src/zmapView/zmapViewUtils.c
+++ b/src/zmapView/zmapViewUtils.c
@@ -30,7 +30,7 @@
  * HISTORY:
  * Last edited: Mar 11 13:27 2010 (edgrif)
  * Created: Mon Sep 20 10:29:15 2004 (edgrif)
- * CVS info:   $Id: zmapViewUtils.c,v 1.19 2010-03-15 11:00:39 mh17 Exp $
+ * CVS info:   $Id: zmapViewUtils.c,v 1.20 2010-03-19 08:56:42 mh17 Exp $
  *-------------------------------------------------------------------
  */
 
@@ -75,20 +75,8 @@ typedef struct
 
 static void cwh_destroy_key(gpointer cwh_data) ;
 static void cwh_destroy_value(gpointer cwh_data) ;
-
-//static void stepDispatch(gpointer data, gpointer user_data) ;
-//static void stepFinished(gpointer data, gpointer user_data) ;
 static ZMapViewConnectionStep stepListFindStep(ZMapViewConnectionStepList step_list, ZMapServerReqType request_type) ;
-//static void stepFind(gpointer data, gpointer user_data) ;
-//static void reqFind(gpointer data, gpointer user_data) ;
-//static void connectionRemove(gpointer data, gpointer user_data) ;
 static void stepDestroy(gpointer data, gpointer user_data) ;
-//static void requestDestroy(gpointer data, gpointer user_data) ;
-//static void isConnection(gpointer data, gpointer user_data) ;
-//static void removeFailedConnections(ZMapViewConnectionStepList step_list, ZMapViewConnectionStep step) ;
-//static GList *findFailedRequests(ZMapViewConnectionStep step) ;
-//static void findFailed(gpointer data, gpointer user_data) ;
-//static void removeFailed(gpointer data, gpointer user_data) ;
 
 static void getSetCB(void *data, void *user_data) ;
 
@@ -772,13 +760,15 @@ GQuark zmapViewSrc2FSetGetID(GHashTable *source_2_featureset, char *source_name)
   GQuark source_id ;
   ZMapGFFSet set_data ;
 
-  source_id = zMapFeatureSetCreateID(source_name) ;
-
-  if ((set_data = g_hash_table_lookup(source_2_featureset, GINT_TO_POINTER(set_id))))
-    {
-      set_id = set_data->feature_set_id ;
-    }
+  if(source_2_featureset)
+  {
+    source_id = zMapFeatureSetCreateID(source_name) ;
 
+    if ((set_data = g_hash_table_lookup(source_2_featureset, GINT_TO_POINTER(set_id))))
+      {
+        set_id = set_data->feature_set_id ;
+      }
+  }
   return set_id ;
 }
 
@@ -863,6 +853,8 @@ static void getSetCB(void *data, void *user_data)
   GList *set_list = set_data_cb->set_list ;
   ZMapGFFSet set_data ;
 
+  if(!set_data_cb->source_2_featureset)
+    return;
 
   if ((set_data = g_hash_table_lookup(set_data_cb->source_2_featureset, GINT_TO_POINTER(source_id))))
     {
diff --git a/src/zmapView/zmapView_P.h b/src/zmapView/zmapView_P.h
index b45435d8b9e21ee27d9a0086b117695f786f4fc4..161e714ed884df580512e2be3086cea5be124480 100755
--- a/src/zmapView/zmapView_P.h
+++ b/src/zmapView/zmapView_P.h
@@ -26,7 +26,7 @@
  * HISTORY:
  * Last edited: Mar 11 13:27 2010 (edgrif)
  * Created: Thu May 13 15:06:21 2004 (edgrif)
- * CVS info:   $Id: zmapView_P.h,v 1.57 2010-03-15 11:00:39 mh17 Exp $
+ * CVS info:   $Id: zmapView_P.h,v 1.58 2010-03-19 08:56:42 mh17 Exp $
  *-------------------------------------------------------------------
  */
 #ifndef ZMAP_VIEW_P_H
@@ -176,8 +176,8 @@ typedef struct _ZMapViewConnectionStruct
 
   /* THESE SHOULD GO, THEY NEED TO BE REPLACED BY THE NEW STEP STRUCT STUFF....... */
   /* Record whether this connection will serve up raw sequence or deal with feature edits. */
-  gboolean sequence_server ;
-  gboolean writeback_server ;
+//  gboolean sequence_server ;
+//  gboolean writeback_server ;
   /*                                                                               */
 
   ZMapView parent_view ;
@@ -198,7 +198,7 @@ typedef struct _ZMapViewConnectionStruct
 /* A "View" is a set of one or more windows that display data retrieved from one or
  * more servers. Note that the "View" windows are _not_ top level windows, they are panes
  * within a container widget that is supplied as a parent of the View then the View
- * is first created.
+ * is first created.zMapFeatureSetCreateID
  * Each View has lists of windows and lists of connections, the view handles these lists
  * using zmapWindow and zmapConnection calls.
  * */
@@ -248,15 +248,11 @@ typedef struct _ZMapViewStruct
 #endif /* NOT_REQUIRED_ATM */
 
 
-  int connections_loaded ;				    /* Record of number of connections
-							     * loaded so for each reload. */
   GList *connection_list ;				    /* Of ZMapViewConnection. */
   ZMapViewConnection sequence_server ;			    /* Which connection to get raw
 							       sequence from. */
   ZMapViewConnection writeback_server ;			    /* Which connection to send edits to. */
 
-//  ZMapViewConnectionStepList step_list ;		    /* List of steps required to get data from server. */
-
   /* The features....needs thought as to how this updated/constructed..... */
   ZMapFeatureContext features ;
 
@@ -266,11 +262,11 @@ typedef struct _ZMapViewStruct
   GData *orig_styles ;
 
   GHashTable *featureset_2_stylelist ;			    /* Mapping of each feature_set to all
-							       the styles it requires. */
+							       the styles it requires. using a GHashTable of GLists of style quark id's.*/
 
-  GHashTable *source_2_featureset ;			    /* Mapping of a feature source to a featureset. */
+  GHashTable *source_2_featureset ;			    /* Mapping of a feature source to a featureset using ZMapGFFSet */
 
-  GHashTable *source_2_sourcedata ;			    /* Mapping of a feature source to its data. */
+  GHashTable *source_2_sourcedata ;			    /* Mapping of a feature source to its data.using ZMapGFFSource */
 
   /* We need to know if the user has done a revcomp for a few reasons to do with coord
    * transforms and the way annotation is done....*/
diff --git a/src/zmapWindow/zmapWindowItem.c b/src/zmapWindow/zmapWindowItem.c
index 66fe12f3b490d780d838733ac9ed52007627593d..13079e87fef505ac67f575ad339999346a44ac53 100755
--- a/src/zmapWindow/zmapWindowItem.c
+++ b/src/zmapWindow/zmapWindowItem.c
@@ -6,12 +6,12 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
@@ -28,7 +28,7 @@
  * HISTORY:
  * Last edited: Feb 15 14:06 2010 (edgrif)
  * Created: Thu Sep  8 10:37:24 2005 (edgrif)
- * CVS info:   $Id: zmapWindowItem.c,v 1.128 2010-03-04 15:13:00 mh17 Exp $
+ * CVS info:   $Id: zmapWindowItem.c,v 1.129 2010-03-19 08:56:42 mh17 Exp $
  *-------------------------------------------------------------------
  */
 
@@ -81,8 +81,8 @@ typedef struct
 
 
 #if NOT_USED
-static gboolean simple_highlight_region(FooCanvasPoints **points_out, 
-                                        FooCanvasItem    *subject, 
+static gboolean simple_highlight_region(FooCanvasPoints **points_out,
+                                        FooCanvasItem    *subject,
                                         gpointer          user_data);
 #endif
 static void highlightCB(gpointer data, gpointer user_data) ;
@@ -98,11 +98,11 @@ static void getVisibleCanvas(ZMapWindow window,
 			     double *screenx1_out, double *screeny1_out,
 			     double *screenx2_out, double *screeny2_out) ;
 
-static FooCanvasItem *translation_item_from_block_frame(ZMapWindow window, char *column_name, 
+static FooCanvasItem *translation_item_from_block_frame(ZMapWindow window, char *column_name,
 							gboolean require_visible,
 							ZMapFeatureBlock block, ZMapFrame frame) ;
 
-static void fill_workaround_struct(ZMapWindowContainerGroup container, 
+static void fill_workaround_struct(ZMapWindowContainerGroup container,
 				   FooCanvasPoints         *points,
 				   ZMapContainerLevelType   level,
 				   gpointer                 user_data);
@@ -129,7 +129,7 @@ GList *zmapWindowItemSortByPostion(GList *feature_item_list)
 
 
 gboolean zmapWindowItemGetStrandFrame(FooCanvasItem *item, ZMapStrand *set_strand, ZMapFrame *set_frame)
-{                                               
+{
   ZMapWindowContainerFeatureSet container;
   ZMapFeature feature ;
   gboolean result = FALSE ;
@@ -158,7 +158,7 @@ GList *zmapWindowItemListToFeatureList(GList *item_list)
 }
 
 
-/* 
+/*
    (TYPE)zmapWindowItemGetFeatureAny(ITEM, STRUCT_TYPE)
 
 #define zmapWindowItemGetFeatureSet(ITEM)   (ZMapFeatureContext)zmapWindowItemGetFeatureAnyType((ITEM), ZMAPFEATURE_STRUCT_CONTEXT)
@@ -210,16 +210,16 @@ ZMapFeatureAny zmapWindowItemGetFeatureAnyType(FooCanvasItem *item, ZMapFeatureS
 }
 
 /*
- *                     Feature Item highlighting.... 
+ *                     Feature Item highlighting....
  */
 
 
 /* Highlight a feature or list of related features (e.g. all hits for same query sequence).
- * 
+ *
  *  */
 void zMapWindowHighlightObject(ZMapWindow window, FooCanvasItem *item,
 			       gboolean replace_highlight_item, gboolean highlight_same_names)
-{                                               
+{
   zmapWindowHighlightObject(window, item, replace_highlight_item, highlight_same_names) ;
 
   return ;
@@ -240,24 +240,24 @@ static ZMapFeatureContextExecuteStatus highlight_feature(GQuark key, gpointer da
       if(highlight_data->multiple_select || highlight_data->highlighted == 0)
         {
           replace_highlight = !(highlight_data->multiple_select);
-          
+
           if((feature_item = zmapWindowFToIFindFeatureItem(highlight_data->window->context_to_item,
                                                            feature_in->strand, ZMAPFRAME_NONE,
                                                            feature_in)))
             {
               if(highlight_data->multiple_select)
                 replace_highlight = !(zmapWindowFocusIsItemInHotColumn(highlight_data->window->focus, feature_item));
-              
+
               feature_current = zmapWindowItemGetFeature(feature_item);
               zMapAssert(feature_current);
 
-              if(feature_in->type == ZMAPSTYLE_MODE_TRANSCRIPT && 
+              if(feature_in->type == ZMAPSTYLE_MODE_TRANSCRIPT &&
                  feature_in->feature.transcript.exons->len > 0 &&
                  feature_in->feature.transcript.exons->len != feature_current->feature.transcript.exons->len)
                 {
                   ZMapSpan span;
                   int i;
-                  
+
                   /* need to do something to find sub feature items??? */
                   for(i = 0; i < feature_in->feature.transcript.exons->len; i++)
                     {
@@ -288,7 +288,7 @@ static ZMapFeatureContextExecuteStatus highlight_feature(GQuark key, gpointer da
               else
                 /* we need to highlight the full feature */
                 zmapWindowHighlightObject(highlight_data->window, feature_item, replace_highlight, TRUE);
-              
+
               if(replace_highlight)
                 highlight_data->highlighted = 0;
               else
@@ -307,7 +307,7 @@ void zMapWindowHighlightObjects(ZMapWindow window, ZMapFeatureContext context, g
 
   highlight_data.window          = window;
   highlight_data.multiple_select = multiple_select;
-  highlight_data.highlighted     = 
+  highlight_data.highlighted     =
     highlight_data.feature_count = 0;
 
   zMapFeatureContextExecute((ZMapFeatureAny)context, ZMAPFEATURE_STRUCT_FEATURE,
@@ -318,7 +318,7 @@ void zMapWindowHighlightObjects(ZMapWindow window, ZMapFeatureContext context, g
 
 void zmapWindowHighlightObject(ZMapWindow window, FooCanvasItem *item,
 			       gboolean replace_highlight_item, gboolean highlight_same_names)
-{                                               
+{
   ZMapWindowCanvasItem canvas_item ;
   ZMapFeature feature ;
   GList *set_items ;
@@ -346,7 +346,7 @@ void zmapWindowHighlightObject(ZMapWindow window, FooCanvasItem *item,
 	if (highlight_same_names)
 	  {
 	    char *set_strand, *set_frame ;
-	
+
 	    set_strand = set_frame = "*" ;
 
 	    set_items = zmapWindowFToIFindSameNameItems(window->context_to_item, set_strand, set_frame, feature) ;
@@ -386,11 +386,11 @@ void zmapWindowHighlightObject(ZMapWindow window, FooCanvasItem *item,
 								       FOO_CANVAS_ITEM(canvas_item), frame_itr)))
 	  {
 	    FooCanvasGroup *container;
-	    
+
 	    container = (FooCanvasGroup *)zmapWindowContainerCanvasItemGetContainer(framed_3ft);
-	    
+
 	  }
-	  
+
       }
   }
 
@@ -400,7 +400,7 @@ void zmapWindowHighlightObject(ZMapWindow window, FooCanvasItem *item,
 }
 
 void zMapWindowHighlightFocusItems(ZMapWindow window)
-{                                               
+{
   FooCanvasItem *hot_item ;
   FooCanvasGroup *hot_column = NULL;
 
@@ -417,7 +417,7 @@ void zMapWindowHighlightFocusItems(ZMapWindow window)
 
 
 void zMapWindowUnHighlightFocusItems(ZMapWindow window)
-{                                               
+{
   FooCanvasItem *hot_item ;
   FooCanvasGroup *hot_column ;
 
@@ -429,7 +429,7 @@ void zMapWindowUnHighlightFocusItems(ZMapWindow window)
     zmapWindowFocusForEachFocusItem(window->focus, unhighlightCB, window) ;
 
   if (hot_column || hot_item)
-    zmapWindowFocusReset(window->focus) ;    
+    zmapWindowFocusReset(window->focus) ;
 
   return ;
 }
@@ -482,7 +482,7 @@ FooCanvasItem *zmapWindowItemGetNthChild(FooCanvasGroup *compound_item, int chil
 }
 
 /* Need to test whether this works for groups...it should do....
- * 
+ *
  * For simple features or the parent of a compound feature the raise is done on the item
  * directly, for compound objects we want to raise the parent so that the whole item
  * is still raised.
@@ -524,18 +524,18 @@ FooCanvasItem *zmapWindowItemGetDNAParentItem(ZMapWindow window, FooCanvasItem *
 
   if((feature = zmapWindowItemGetFeature(item)))
     {
-      if((block = (ZMapFeatureBlock)(zMapFeatureGetParentGroup((ZMapFeatureAny)feature, ZMAPFEATURE_STRUCT_BLOCK))) && 
+      if((block = (ZMapFeatureBlock)(zMapFeatureGetParentGroup((ZMapFeatureAny)feature, ZMAPFEATURE_STRUCT_BLOCK))) &&
          (feature_name = zMapFeatureDNAFeatureName(block)))
         {
-          dna_id = zMapFeatureCreateID(ZMAPSTYLE_MODE_RAW_SEQUENCE, 
-                                       feature_name, 
+          dna_id = zMapFeatureCreateID(ZMAPSTYLE_MODE_RAW_SEQUENCE,
+                                       feature_name,
                                        ZMAPSTRAND_FORWARD, /* ALWAYS FORWARD */
                                        block->block_to_sequence.q1,
                                        block->block_to_sequence.q2,
                                        0,0);
           g_free(feature_name);
         }
-      
+
       if((dna_item = zmapWindowFToIFindItemFull(window->context_to_item,
 						block->parent->unique_id,
 						block->unique_id,
@@ -604,9 +604,9 @@ FooCanvasItem *zmapWindowItemGetDNATextItem(ZMapWindow window, FooCanvasItem *it
 
 /* highlights the dna given any foocanvasitem (with a feature) and a start and end */
 /* This _only_ highlights in the current window! */
-void zmapWindowItemHighlightDNARegion(ZMapWindow window, 
-				      FooCanvasItem *item, 
-				      int region_start, 
+void zmapWindowItemHighlightDNARegion(ZMapWindow window,
+				      FooCanvasItem *item,
+				      int region_start,
 				      int region_end)
 {
   ZMapWindowSequenceFeature sequence_feature;
@@ -652,7 +652,7 @@ FooCanvasItem *zmapWindowItemGetTranslationItemFromItemFrame(ZMapWindow window,
     {
       /* First go up to block... */
       block = (ZMapFeatureBlock)
-        (zMapFeatureGetParentGroup((ZMapFeatureAny)(feature), 
+        (zMapFeatureGetParentGroup((ZMapFeatureAny)(feature),
                                    ZMAPFEATURE_STRUCT_BLOCK));
       zMapAssert(block);
 
@@ -667,7 +667,7 @@ FooCanvasItem *zmapWindowItemGetTranslationItemFromItemFrame(ZMapWindow window,
   return translation;
 }
 
-void zmapWindowItemHighlightRegionTranslations(ZMapWindow window, FooCanvasItem *item, 
+void zmapWindowItemHighlightRegionTranslations(ZMapWindow window, FooCanvasItem *item,
 					       int region_start, int region_end)
 {
   int frame;
@@ -683,7 +683,7 @@ void zmapWindowItemHighlightRegionTranslations(ZMapWindow window, FooCanvasItem
 /* highlights the translation given any foocanvasitem (with a
  * feature), frame and a start and end (protein seq coords) */
 /* This _only_ highlights in the current window! */
-void zmapWindowItemHighlightTranslationRegion(ZMapWindow window, FooCanvasItem *item, 
+void zmapWindowItemHighlightTranslationRegion(ZMapWindow window, FooCanvasItem *item,
 					      ZMapFrame required_frame,
 					      int region_start, int region_end)
 {
@@ -692,7 +692,7 @@ void zmapWindowItemHighlightTranslationRegion(ZMapWindow window, FooCanvasItem *
   if((translation_item = zmapWindowItemGetTranslationItemFromItemFrame(window, item, required_frame)))
     {
       FooCanvasGroup *container;
-      
+
       container = (FooCanvasGroup *)zmapWindowContainerCanvasItemGetContainer(translation_item);
 
       /* we just want to call sequenceSelect() */
@@ -755,7 +755,7 @@ FooCanvasGroup *zmapWindowItemGetTranslationColumnFromBlock(ZMapWindow window, Z
                                            feature_set,
                                            ZMAPSTRAND_FORWARD, /* STILL ALWAYS FORWARD */
                                            ZMAPFRAME_NONE);
-  
+
 
   return FOO_CANVAS_GROUP(translation);
 }
@@ -793,7 +793,7 @@ FooCanvasItem *zmapWindowItemGetShowTranslationColumn(ZMapWindow window, FooCanv
 	  //feature_set->style = style;
 	  zMapFeatureBlockAddFeatureSet(block, feature_set);
 	}
-      
+
       if (feature_set)
 	{
 	  ZMapWindowContainerGroup parent_container;
@@ -812,12 +812,12 @@ FooCanvasItem *zmapWindowItemGetShowTranslationColumn(ZMapWindow window, FooCanv
 #endif /* SIMPLIER */
 
 	  parent_container = zmapWindowContainerUtilsItemGetParentLevel(item, ZMAPCONTAINER_LEVEL_BLOCK);
-	  
+
 	  /* Get the Forward Group Parent Container... */
 	  forward_container = zmapWindowContainerBlockGetContainerStrand((ZMapWindowContainerBlock)parent_container, ZMAPSTRAND_FORWARD);
 	  /* zmapWindowCreateSetColumns needs the Features not the Parent. */
 	  forward_features  = zmapWindowContainerGetFeatures((ZMapWindowContainerGroup)forward_container);
-	  
+
 	  /* make the column... */
 	  if (zmapWindowCreateSetColumns(window,
 					 forward_features,
@@ -840,7 +840,7 @@ FooCanvasItem *zmapWindowItemGetShowTranslationColumn(ZMapWindow window, FooCanv
   return translation;
 }
 
-static FooCanvasItem *translation_item_from_block_frame(ZMapWindow window, char *column_name, 
+static FooCanvasItem *translation_item_from_block_frame(ZMapWindow window, char *column_name,
 							gboolean require_visible,
 							ZMapFeatureBlock block, ZMapFrame frame)
 {
@@ -891,7 +891,7 @@ FooCanvasItem *zmapWindowItemGetTranslationItemFromItem(ZMapWindow window, FooCa
     {
       /* First go up to block... */
       block = (ZMapFeatureBlock)
-        (zMapFeatureGetParentGroup((ZMapFeatureAny)(feature), 
+        (zMapFeatureGetParentGroup((ZMapFeatureAny)(feature),
                                    ZMAPFEATURE_STRUCT_BLOCK));
       zMapAssert(block);
 
@@ -915,7 +915,7 @@ ZMapFeatureTypeStyle zmapWindowItemGetStyle(ZMapWindow window, FooCanvasItem *it
   ZMapFeature feature = NULL;
 
   canvas_item = zMapWindowCanvasItemIntervalGetTopLevelObject(item);
-  
+
   if((canvas_item != NULL) &&
      (feature = zMapWindowCanvasItemGetFeature(canvas_item)))
     {
@@ -931,10 +931,10 @@ ZMapFeatureTypeStyle zmapWindowItemGetStyle(ZMapWindow window, FooCanvasItem *it
 
 /* Finds the feature item in a window corresponding to the supplied feature item..which is
  * usually one from a different window....
- * 
+ *
  * This routine can return NULL if the user has two different sequences displayed and hence
  * there will be items in one window that are not present in another.
- * 
+ *
  *  */
 FooCanvasItem *zMapWindowFindFeatureItemByItem(ZMapWindow window, FooCanvasItem *item)
 {
@@ -1035,7 +1035,7 @@ gboolean zmapWindowItemIsOnScreen(ZMapWindow window, FooCanvasItem *item, gboole
 
 
 /* Scrolls to an item if that item is not visible on the scren.
- * 
+ *
  * NOTE: scrolling is only done in the axis in which the item is completely
  * invisible, the other axis is left unscrolled so that the visible portion
  * of the feature remains unaltered.
@@ -1117,7 +1117,7 @@ gboolean zmapWindowItemRegionIsVisible(ZMapWindow window, FooCanvasItem *item)
 
   feature = (ZMapFeature) zmapWindowItemGetFeatureAnyType(item, -1) ;
   zMapAssert(feature) ;
-  
+
   /* Get the features canvas coords (may be very different for align block features... */
   zMapFeature2MasterCoords(feature, &feature_x1, &feature_x2);
 
@@ -1130,7 +1130,7 @@ gboolean zmapWindowItemRegionIsVisible(ZMapWindow window, FooCanvasItem *item)
     {
       visible = TRUE;
     }
-  
+
   return visible;
 }
 
@@ -1154,7 +1154,7 @@ void zmapWindowItemCentreOnItemSubPart(ZMapWindow window, FooCanvasItem *item,
 {
   double ix1, ix2, iy1, iy2;
   int    cx1, cx2, cy1, cy2;
-  int final_canvasx, final_canvasy, 
+  int final_canvasx, final_canvasy,
     tmpx, tmpy, cheight, cwidth;
   gboolean debug = FALSE;
 
@@ -1252,8 +1252,8 @@ void zmapWindowItemCentreOnItemSubPart(ZMapWindow window, FooCanvasItem *item,
 
 
       /* get canvas coords to work with */
-      foo_canvas_w2c(item->canvas, ix1, iy1, &cx1, &cy1); 
-      foo_canvas_w2c(item->canvas, ix2, iy2, &cx2, &cy2); 
+      foo_canvas_w2c(item->canvas, ix1, iy1, &cx1, &cy1);
+      foo_canvas_w2c(item->canvas, ix2, iy2, &cx2, &cy2);
 
       if(debug)
 	{
@@ -1269,7 +1269,7 @@ void zmapWindowItemCentreOnItemSubPart(ZMapWindow window, FooCanvasItem *item,
 	tmpy += 1;
       final_canvasx = cx1 + (tmpx / 2);
       final_canvasy = cy1 + (tmpy / 2);
-  
+
       tmpx = GTK_WIDGET(window->canvas)->allocation.width;
       tmpy = GTK_WIDGET(window->canvas)->allocation.height;
       if(tmpx & 1)
@@ -1277,14 +1277,14 @@ void zmapWindowItemCentreOnItemSubPart(ZMapWindow window, FooCanvasItem *item,
       if(tmpy & 1)
 	tmpy -= 1;
       cwidth = tmpx / 2; cheight = tmpy / 2;
-      final_canvasx -= cwidth; 
+      final_canvasx -= cwidth;
       final_canvasy -= cheight;
 
       if(debug)
 	{
 	  printf("[zmapWindowItemCentreOnItem] cwidth=%d  cheight=%d\n", cwidth, cheight);
 	  printf("[zmapWindowItemCentreOnItem] scrolling to"
-		 " canvas x=%d y=%d\n", 
+		 " canvas x=%d y=%d\n",
 		 final_canvasx, final_canvasy);
 	}
 
@@ -1391,7 +1391,7 @@ void zmapWindowPrintI2W(FooCanvasItem *item, char *text, double x1_in, double y1
 
 
 /* moves a feature to new coordinates */
-void zMapWindowMoveItem(ZMapWindow window, ZMapFeature origFeature, 
+void zMapWindowMoveItem(ZMapWindow window, ZMapFeature origFeature,
 			ZMapFeature modFeature, FooCanvasItem *item)
 {
   double top, bottom, offset;
@@ -1402,11 +1402,11 @@ void zMapWindowMoveItem(ZMapWindow window, ZMapFeature origFeature,
       top = modFeature->x1;
       bottom = modFeature->x2;
       zmapWindowSeq2CanOffset(&top, &bottom, offset);
-      
+
       if (modFeature->type == ZMAPSTYLE_MODE_TRANSCRIPT)
 	{
 	  zMapAssert(origFeature);
-	  
+
 	  foo_canvas_item_set(item->parent, "y", top, NULL);
 	}
       else
@@ -1421,7 +1421,7 @@ void zMapWindowMoveItem(ZMapWindow window, ZMapFeature origFeature,
 
 
 /* Returns the sequence coords that correspond to the given _world_ foocanvas coords.
- * 
+ *
  * NOTE that although we only return y coords, we need the world x coords as input
  * in order to find the right foocanvas item from which to get the sequence coords. */
 gboolean zmapWindowWorld2SeqCoords(ZMapWindow window,
@@ -1436,8 +1436,7 @@ gboolean zmapWindowWorld2SeqCoords(ZMapWindow window,
     {
       FooCanvasGroup *block_container ;
       ZMapFeatureBlock block ;
-      
-zMapLogWarning("got foo item at %f %f %f %f",wx1,wy1,wx2,wy2);
+
       /* Getting the block struct as well is a bit belt and braces...we could return it but
        * its redundant info. really. */
       if ((block_container = FOO_CANVAS_GROUP(zmapWindowContainerUtilsItemGetParentLevel(item, ZMAPCONTAINER_LEVEL_BLOCK)))
@@ -1448,7 +1447,7 @@ zMapLogWarning("got foo item at %f %f %f %f",wx1,wy1,wx2,wy2);
 	  offset = (double)(block->block_to_sequence.q1 - 1) ; /* - 1 for 1 based coord system. */
 
 	  my_foo_canvas_world_bounds_to_item(FOO_CANVAS_ITEM(block_container), &wx1, &wy1, &wx2, &wy2) ;
-zMapLogWarning("%s","got block");
+
 
 	  if (block_grp_out)
 	    *block_grp_out = block_container ;
@@ -1462,7 +1461,7 @@ zMapLogWarning("%s","got block");
       else
 	zMapLogWarning("%s", "No Block Container");
     }
-  else 
+  else
     {
       get_item_at_workaround_struct workaround_struct = {NULL};
       double scroll_x2;
@@ -1471,7 +1470,6 @@ zMapLogWarning("%s","got block");
       workaround_struct.wx2 = wx2;
       workaround_struct.wy1 = wy1;
       workaround_struct.wy2 = wy2;
-zMapLogWarning("Workaround %f %f %f %f",wx1,wy1,wx2,wy2);
 
       /* For some reason foo_canvas_get_item_at() fails to find items
        * a lot of the time even when it shouldn't and so we need a solution. */
@@ -1530,8 +1528,8 @@ gboolean zmapWindowItem2SeqCoords(FooCanvasItem *item, int *y1, int *y2)
 
 
 #if NOT_USED
-static gboolean simple_highlight_region(FooCanvasPoints **points_out, 
-                                        FooCanvasItem    *subject, 
+static gboolean simple_highlight_region(FooCanvasPoints **points_out,
+                                        FooCanvasItem    *subject,
                                         gpointer          user_data)
 {
   StartEndTextHighlight high_data = (StartEndTextHighlight)user_data;
@@ -1540,7 +1538,7 @@ static gboolean simple_highlight_region(FooCanvasPoints **points_out,
   int index1, index2;
   gboolean first_found, last_found;
   gboolean redraw = FALSE;
-  
+
   points = foo_canvas_points_new(8);
 
   index1 = high_data->start;
@@ -1786,7 +1784,7 @@ void my_foo_canvas_item_goto(FooCanvasItem *item, double *x, double *y)
 
   if (x || y)
     {
-      x1 = y1 = x2 = y2 = 0.0 ; 
+      x1 = y1 = x2 = y2 = 0.0 ;
       dx = dy = 0.0 ;
 
       foo_canvas_item_get_bounds(item, &x1, &y1, &x2, &y2) ;
@@ -1820,7 +1818,7 @@ gboolean zmapWindowItemIsVisible(FooCanvasItem *item)  // mh17:not called from a
         {
           visible = zmapWindowItemIsShown(FOO_CANVAS_ITEM(parent));
           /* how many parents we got? */
-          parent  = FOO_CANVAS_GROUP(FOO_CANVAS_ITEM(parent)->parent); 
+          parent  = FOO_CANVAS_GROUP(FOO_CANVAS_ITEM(parent)->parent);
         }
     }
 #endif
@@ -1831,17 +1829,17 @@ gboolean zmapWindowItemIsVisible(FooCanvasItem *item)  // mh17:not called from a
 gboolean zmapWindowItemIsShown(FooCanvasItem *item)
 {
   gboolean visible = FALSE;
-  
+
   zMapAssert(FOO_IS_CANVAS_ITEM(item)) ;
 
-  g_object_get(G_OBJECT(item), 
+  g_object_get(G_OBJECT(item),
                "visible", &visible,
                NULL);
 
   return visible;
 }
 
-void zmapWindowItemGetVisibleCanvas(ZMapWindow window, 
+void zmapWindowItemGetVisibleCanvas(ZMapWindow window,
                                     double *wx1, double *wy1,
                                     double *wx2, double *wy2)
 {
@@ -1853,7 +1851,7 @@ void zmapWindowItemGetVisibleCanvas(ZMapWindow window,
 
 
 
-/* 
+/*
  *                  Internal routines.
  */
 
@@ -1905,7 +1903,7 @@ static void highlightItem(ZMapWindow window, FooCanvasItem *item, gboolean highl
   if(highlight)
     {
       if(window->highlights_set.item)
-	zMapWindowCanvasItemSetIntervalColours(item, ZMAPSTYLE_COLOURTYPE_SELECTED, 
+	zMapWindowCanvasItemSetIntervalColours(item, ZMAPSTYLE_COLOURTYPE_SELECTED,
 					       &(window->colour_item_highlight));
       else
 	zMapWindowCanvasItemSetIntervalColours(item, ZMAPSTYLE_COLOURTYPE_SELECTED, NULL);
@@ -1926,10 +1924,10 @@ static gint sortByPositionCB(gconstpointer a, gconstpointer b)
   FooCanvasItem *item_b = (FooCanvasItem *)b ;
   ZMapFeature feat_a ;
   ZMapFeature feat_b ;
-      
+
   feat_a = zmapWindowItemGetFeature(item_a);
   zMapAssert(feat_a) ;
-  
+
   feat_b = zmapWindowItemGetFeature(item_b);
   zMapAssert(feat_b) ;
 
@@ -1987,7 +1985,7 @@ static void getVisibleCanvas(ZMapWindow window,
 }
 
 /* workaround for a failing foo_canvas_item_at(). Actually only looks for blocks! */
-static void fill_workaround_struct(ZMapWindowContainerGroup container, 
+static void fill_workaround_struct(ZMapWindowContainerGroup container,
 				   FooCanvasPoints       *points,
 				   ZMapContainerLevelType level,
 				   gpointer               user_data)
@@ -2008,10 +2006,10 @@ if(!container) return;
 	if((cont_backgrd = (FooCanvasItem *)zmapWindowContainerGetBackground(container)))
 	  {
 	    double offset;
-	    AreaStruct area_src = {workaround->wx1, workaround->wy1, workaround->wx2, workaround->wy2}, 
+	    AreaStruct area_src = {workaround->wx1, workaround->wy1, workaround->wx2, workaround->wy2},
 	      area_block = {};
 	    foo_canvas_item_get_bounds(cont_backgrd,
-				       &(area_block.x1), &(area_block.y1), 
+				       &(area_block.x1), &(area_block.y1),
 				       &(area_block.x2), &(area_block.y2));
 
 	    /* The original size of the block needs to be used, not the longitem resized size. */
@@ -2019,7 +2017,7 @@ if(!container) return;
 	      {
 		double long_y1, long_y2;
 		/* Get the original size of the block's background, see caller & RT #75034 */
-		if(zmapWindowLongItemCoords(workaround->window->long_items, cont_backgrd, 
+		if(zmapWindowLongItemCoords(workaround->window->long_items, cont_backgrd,
 					    &long_y1, &long_y2))
 		  {
 		    area_block.y1 = long_y1;
@@ -2028,7 +2026,7 @@ if(!container) return;
 	      }
 
 	    if((workaround->wx1 >= area_block.x1 && workaround->wx2 <= area_block.x2 &&
-		workaround->wy1 >= area_block.y1 && workaround->wy2 <= area_block.y2) || 
+		workaround->wy1 >= area_block.y1 && workaround->wy2 <= area_block.y2) ||
 	       areas_intersect_gt_threshold(&area_src, &area_block, 0.55))
 	      {
 		/* We're inside */
@@ -2037,8 +2035,8 @@ if(!container) return;
 
 		offset = (double)(block->block_to_sequence.q1 - 1) ; /* - 1 for 1 based coord system. */
 
-		my_foo_canvas_world_bounds_to_item(FOO_CANVAS_ITEM(cont_backgrd), 
-						   &(workaround->wx1), &(workaround->wy1), 
+		my_foo_canvas_world_bounds_to_item(FOO_CANVAS_ITEM(cont_backgrd),
+						   &(workaround->wx1), &(workaround->wy1),
 						   &(workaround->wx2), &(workaround->wy2)) ;
 
 		workaround->seq_x  = floor(workaround->wy1 - offset + 0.5) ;
@@ -2055,7 +2053,7 @@ if(!container) return;
 			     workaround->wx2, workaround->wy2);
             }
 	  }
-	
+
       }
       break;
     default:
@@ -2084,7 +2082,7 @@ static gboolean areas_intersection(AreaStruct *area_1, AreaStruct *area_2, AreaS
       overlap = TRUE;
     }
   else
-    intersect->x1 = intersect->y1 = 
+    intersect->x1 = intersect->y1 =
       intersect->x2 = intersect->y2 = 0.0;
 
   return overlap;
@@ -2102,7 +2100,7 @@ static gboolean areas_intersect_gt_threshold(AreaStruct *area_1, AreaStruct *are
     {
       aI = (inter.x2 - inter.x1 + 1.0) * (inter.y2 - inter.y1 + 1.0);
       a1 = (area_1->x2 - area_1->x1 + 1.0) * (area_1->y2 - area_1->y1 + 1.0);
-      
+
       if(threshold > 0.0 && threshold < 1.0)
 	threshold = 1.0 - threshold;
       else
@@ -2131,17 +2129,17 @@ static gboolean areas_intersect_gt_threshold(AreaStruct *area_1, AreaStruct *are
 static gboolean foo_canvas_items_get_intersect(FooCanvasItem *i1, FooCanvasItem *i2, FooCanvasPoints **points_out)
 {
   gboolean intersect = FALSE;
-  
+
   if(points_out)
     {
       AreaStruct a1 = {};
       AreaStruct a2 = {};
       AreaStruct i  = {};
-      
-      foo_canvas_item_get_bounds(i1, 
+
+      foo_canvas_item_get_bounds(i1,
 				 &(a1.x1), (&a1.y1),
 				 &(a1.x2), (&a1.y2));
-      foo_canvas_item_get_bounds(i2, 
+      foo_canvas_item_get_bounds(i2,
 				 &(a2.x1), (&a2.y1),
 				 &(a2.x2), (&a2.y2));
 
@@ -2166,10 +2164,10 @@ static gboolean foo_canvas_items_intersect(FooCanvasItem *i1, FooCanvasItem *i2,
   AreaStruct a2 = {};
   gboolean intersect = FALSE;
 
-  foo_canvas_item_get_bounds(i1, 
+  foo_canvas_item_get_bounds(i1,
 			     &(a1.x1), (&a1.y1),
 			     &(a1.x2), (&a1.y2));
-  foo_canvas_item_get_bounds(i2, 
+  foo_canvas_item_get_bounds(i2,
 			     &(a2.x1), (&a2.y1),
 			     &(a2.x2), (&a2.y2));