diff --git a/pd/src/s_file.c b/pd/src/s_file.c
index 23b574ef8e0710acf4b04289319b5c3f6c353e47..cc27cb2e8046a6daa26e58327d891cd3ce118a77 100644
--- a/pd/src/s_file.c
+++ b/pd/src/s_file.c
@@ -53,21 +53,21 @@ static void sys_initloadpreferences( void)
 {
     char filenamebuf[FILENAME_MAX], *homedir = getenv("HOME");
     int fd, length;
-	char user_prefs_file[FILENAME_MAX]; /* user prefs file */
+    char user_prefs_file[FILENAME_MAX]; /* user prefs file */
         /* default prefs embedded in the package */
-	char default_prefs_file[FILENAME_MAX];
+    char default_prefs_file[FILENAME_MAX];
     struct stat statbuf;
 
-	snprintf(default_prefs_file, FILENAME_MAX, "%s/default.pdl2ork", 
-			 sys_libdir->s_name);
+    snprintf(default_prefs_file, FILENAME_MAX, "%s/default.pdl2ork", 
+             sys_libdir->s_name);
 
     if (homedir)
-		snprintf(user_prefs_file, FILENAME_MAX, "%s/.pdl2ork", homedir);
-	if (stat(user_prefs_file, &statbuf) == 0) 
-		strncpy(filenamebuf, user_prefs_file, FILENAME_MAX);
-	else if (stat(default_prefs_file, &statbuf) == 0)
-		strncpy(filenamebuf, default_prefs_file, FILENAME_MAX);
-	else
+        snprintf(user_prefs_file, FILENAME_MAX, "%s/.pdl2ork", homedir);
+    if (stat(user_prefs_file, &statbuf) == 0) 
+        strncpy(filenamebuf, user_prefs_file, FILENAME_MAX);
+    else if (stat(default_prefs_file, &statbuf) == 0)
+        strncpy(filenamebuf, default_prefs_file, FILENAME_MAX);
+    else
         return;
     filenamebuf[FILENAME_MAX-1] = 0;
     if ((fd = open(filenamebuf, 0)) < 0)
@@ -240,38 +240,38 @@ static int sys_getpreference(const char *key, char *value, int size)
 {
     char cmdbuf[256];
     int nread = 0, nleft = size;
-	char default_prefs[FILENAME_MAX]; // default prefs embedded in the package
-	char embedded_prefs[FILENAME_MAX]; // overrides others for standalone app
-	char embedded_prefs_file[FILENAME_MAX];
-	char user_prefs_file[FILENAME_MAX];
-	char *homedir = getenv("HOME");
+    char default_prefs[FILENAME_MAX]; // default prefs embedded in the package
+    char embedded_prefs[FILENAME_MAX]; // overrides others for standalone app
+    char embedded_prefs_file[FILENAME_MAX];
+    char user_prefs_file[FILENAME_MAX];
+    char *homedir = getenv("HOME");
     struct stat statbuf;
-	/* the 'defaults' command expects the filename without .plist at the end */
-	snprintf(default_prefs, FILENAME_MAX, "%s/../org.puredata.pdl2ork.default", 
-			 sys_libdir->s_name);
-	snprintf(embedded_prefs, FILENAME_MAX, "%s/../org.puredata.pdl2ork", 
-			 sys_libdir->s_name);
-	snprintf(embedded_prefs_file, FILENAME_MAX, "%s.plist", embedded_prefs);
-	snprintf(user_prefs_file, FILENAME_MAX, 
-			 "%s/Library/Preferences/org.puredata.pdl2ork.plist", homedir);
-	if (stat(embedded_prefs_file, &statbuf) == 0) 
-	{
-		snprintf(cmdbuf, FILENAME_MAX + 20, 
-				 "defaults read '%s' %s 2> /dev/null\n", embedded_prefs, key);
+    /* the 'defaults' command expects the filename without .plist at the end */
+    snprintf(default_prefs, FILENAME_MAX, "%s/../org.puredata.pdl2ork.default", 
+             sys_libdir->s_name);
+    snprintf(embedded_prefs, FILENAME_MAX, "%s/../org.puredata.pdl2ork", 
+             sys_libdir->s_name);
+    snprintf(embedded_prefs_file, FILENAME_MAX, "%s.plist", embedded_prefs);
+    snprintf(user_prefs_file, FILENAME_MAX, 
+             "%s/Library/Preferences/org.puredata.pdl2ork.plist", homedir);
+    if (stat(embedded_prefs_file, &statbuf) == 0) 
+    {
+        snprintf(cmdbuf, FILENAME_MAX + 20, 
+                 "defaults read '%s' %s 2> /dev/null\n", embedded_prefs, key);
         strncpy(current_prefs, embedded_prefs, FILENAME_MAX);
-	}
-	else if (stat(user_prefs_file, &statbuf) == 0) 
-	{
-		snprintf(cmdbuf, FILENAME_MAX + 20, 
-				 "defaults read org.puredata.pdl2ork %s 2> /dev/null\n", key);
+    }
+    else if (stat(user_prefs_file, &statbuf) == 0) 
+    {
+        snprintf(cmdbuf, FILENAME_MAX + 20, 
+                 "defaults read org.puredata.pdl2ork %s 2> /dev/null\n", key);
         strcpy(current_prefs, "org.puredata.pdl2ork");
-	}
-	else 
-	{
-		snprintf(cmdbuf, FILENAME_MAX + 20, 
-				 "defaults read '%s' %s 2> /dev/null\n", default_prefs, key);
+    }
+    else 
+    {
+        snprintf(cmdbuf, FILENAME_MAX + 20, 
+                 "defaults read '%s' %s 2> /dev/null\n", default_prefs, key);
         strcpy(current_prefs, "org.puredata.pdl2ork");
-	}
+    }
     FILE *fp = popen(cmdbuf, "r");
     while (nread < size)
     {
diff --git a/pd/src/s_inter.c b/pd/src/s_inter.c
index 4dd9f84a30feb2a8e4d88cd40f02db1b0931eb49..fc6bc1d98fa96f6c87843bf3c136a2199c429620 100644
--- a/pd/src/s_inter.c
+++ b/pd/src/s_inter.c
@@ -705,9 +705,9 @@ void sys_vgui(char *fmt, ...)
             msglen = sys_guibufsize - sys_guibufhead;
     }
     if (sys_debuglevel & DEBUG_MESSUP) {
-		//blargh();
+        //blargh();
         fprintf(stderr, "%s",  sys_guibuf + sys_guibufhead);
-	}
+    }
     sys_guibufhead += msglen;
     sys_bytessincelastping += msglen;
 }
@@ -861,8 +861,8 @@ void sys_unqueuegui(void *client)
 int sys_pollgui(void)
 {
     // return (sys_domicrosleep(0, 1) || sys_poll_togui());
-	// "fix" for sluggish gui proposed by Miller on 12/16/2012
-	return (sys_domicrosleep(0, 1) + sys_poll_togui());
+    // "fix" for sluggish gui proposed by Miller on 12/16/2012
+    return (sys_domicrosleep(0, 1) + sys_poll_togui());
 }
 
 
@@ -1182,7 +1182,7 @@ int sys_startgui(const char *guidir)
     if (sys_hipriority == -1)
         sys_hipriority = 1; //(!getuid() || !geteuid());
     
-	sprintf(cmdbuf, "%s/pd-watchdog\n", guidir);
+    sprintf(cmdbuf, "%s/pd-watchdog\n", guidir);
     if (sys_hipriority)
     {
             /* To prevent lockup, we fork off a watchdog process with
@@ -1326,16 +1326,19 @@ extern int do_not_redraw;
 
 void glob_quit(void *dummy)
 {
-	//If we're going to try to cleanly close everything here, we should do the same for all open
-	//patches and that is currently not the case, so for the time being, let's just leave OS to deal
-	//with freeing of all memory when the program exits...
-
-	//let's try to cleanly remove invisible template canvases
-	//if (garray_arraytemplatecanvas) canvas_free( (t_canvas *)garray_arraytemplatecanvas);
-	//if (garray_floattemplatecanvas) canvas_free( (t_canvas *)garray_floattemplatecanvas);
-	canvas_suspend_dsp();
-	do_not_redraw = 1;
-	glob_closeall(0, 1);
+    /* If we're going to try to cleanly close everything here, we should
+       do the same for all open patches and that is currently not the case,
+       so for the time being, let's just leave OS to deal with freeing of all
+       memory when the program exits... */
+
+    /* Let's try to cleanly remove invisible template canvases */
+    //if (garray_arraytemplatecanvas)
+    //    canvas_free((t_canvas *)garray_arraytemplatecanvas);
+    //if (garray_floattemplatecanvas)
+    //    canvas_free( (t_canvas *)garray_floattemplatecanvas);
+    canvas_suspend_dsp();
+    do_not_redraw = 1;
+    glob_closeall(0, 1);
     sys_vgui("exit\n");
     if (!sys_nogui)
     {
diff --git a/pd/src/s_main.c b/pd/src/s_main.c
index cd03175278f82f7f5eeda1ffdceaf939be22bc92..d9901706ba5975cc6b09292d70317a6aee28e915 100644
--- a/pd/src/s_main.c
+++ b/pd/src/s_main.c
@@ -47,11 +47,11 @@ int sys_noloadbang;
 int sys_nogui;
 int sys_hipriority = -1;    /* -1 = don't care; 0 = no; 1 = yes */
 int sys_guisetportnumber;   /* if started from the GUI, this is the port # */
-int sys_nosleep = 0;  	/* skip all "sleep" calls and spin instead */
-int sys_console = 0;	/* default settings for the console is off */
-int sys_k12_mode = 0;	/* by default k12 mode is off */
-int sys_unique = 0;     /* by default off, prevents multiple instances of pd-l2ork */
-
+int sys_nosleep = 0;    /* skip all "sleep" calls and spin instead */
+int sys_console = 0;    /* default settings for the console is off */
+int sys_k12_mode = 0;   /* by default k12 mode is off */
+int sys_unique = 0;     /* by default off, prevents multiple instances
+                           of pd-l2ork */
 char *sys_guicmd;
 t_symbol *sys_libdir;
 t_symbol *sys_guidir;
@@ -167,18 +167,24 @@ static void openit(const char *dirname, const char *filename)
     {
         close (fd);
         glob_evalfile(0, gensym(nameptr), gensym(dirbuf));
-		sys_vgui("pdtk_set_current_dir %s\n", filename);
+        sys_vgui("pdtk_set_current_dir %s\n", filename);
         //sys_vgui("::pd_menus::update_recentfiles_menu .mbar.file 0\n");
-        if (strstr(filename, dirname) != NULL) {
-        // when opening files from a command line (at startup), filename contains full path
-        // so, if dirname is already included in filename we only pass filename variable
-        // otherwise combine the two and send them together
+        if (strstr(filename, dirname) != NULL)
+        {
+            /* when opening files from a command line (at startup), filename
+               contains full path so, if dirname is already included in
+               filename we only pass filename variable otherwise combine the
+               two and send them together */
 #ifndef MSW
-            sys_vgui("::pd_guiprefs::update_recentfiles %s/%s 1\n", dirname, filename);
+            sys_vgui("::pd_guiprefs::update_recentfiles %s/%s 1\n",
+                dirname, filename);
 #else
-            sys_vgui("::pd_guiprefs::update_recentfiles %s\%s 1\n", dirname, filename);
+            sys_vgui("::pd_guiprefs::update_recentfiles %s\%s 1\n",
+                dirname, filename);
 #endif
-        } else {
+        }
+        else
+        {
             sys_vgui("::pd_guiprefs::update_recentfiles %s 1\n", filename);
         }
     }
@@ -218,8 +224,8 @@ void glob_initfromgui(void *dummy, t_symbol *s, int argc, t_atom *argv)
         sys_fontlist[i].fi_hostfontsize = atom_getintarg(3 * best + 2, argc, argv);
         sys_fontlist[i].fi_width = atom_getintarg(3 * best + 3, argc, argv);
         sys_fontlist[i].fi_height = atom_getintarg(3 * best + 4, argc, argv);
-		sys_fontlist[i].fi_maxwidth = sys_fontlist[i].fi_width;
-		sys_fontlist[i].fi_maxheight = sys_fontlist[i].fi_height;
+        sys_fontlist[i].fi_maxwidth = sys_fontlist[i].fi_width;
+        sys_fontlist[i].fi_maxheight = sys_fontlist[i].fi_height;
     }
 #if 0
     for (i = 0; i < 6; i++)
@@ -258,8 +264,9 @@ static void pd_makeversion(void)
 {
     char foo[100];
 
-    //snprintf(foo, sizeof(foo), "Pd-l2ork version %d.%d-%d%s\n", PD_MAJOR_VERSION,
-    //    PD_MINOR_VERSION, PD_BUGFIX_VERSION, PD_TEST_VERSION);	
+    //snprintf(foo, sizeof(foo), "Pd-l2ork version %d.%d-%d%s\n",
+    //    PD_MAJOR_VERSION, PD_MINOR_VERSION,
+    //    PD_BUGFIX_VERSION, PD_TEST_VERSION);    
 
     snprintf(foo, sizeof(foo), "Pd-L2Ork version %s\n", PD_TEST_VERSION);
 
@@ -300,28 +307,35 @@ int sys_main(int argc, char **argv)
         return(1);
         /* check if we are unique, otherwise, just focus existing
         instance, and if necessary open file inside it */\
-    if (sys_openlist) {
+    if (sys_openlist)
+    {
         // let's create one continuous string from all files
         int length = 0;
         t_namelist *nl;
         for (nl = sys_openlist; nl; nl = nl->nl_next)
             length = length + strlen(nl->nl_string) + 1;
-        if((filenames = malloc(length)) != NULL) {
+        if((filenames = malloc(length)) != NULL)
+        {
             filenames[0] = '\0';   // ensures the memory is an empty string
-            if (sys_openlist) {
-                for (nl = sys_openlist; nl; nl = nl->nl_next) {
+            if (sys_openlist)
+            {
+                for (nl = sys_openlist; nl; nl = nl->nl_next)
+                {
                     strcat(filenames,nl->nl_string);
                     if (nl->nl_next)
                         strcat(filenames," ");
                 }
             }
             //fprintf(stderr,"final list: <%s>\n", filenames);
-        } else {
+        }
+        else
+        {
             error("filelist malloc failed!\n");
             return(1);
         }
     }
-    sys_vgui("pdtk_check_unique %d %s\n", sys_unique, (filenames ? filenames : "0"));
+    sys_vgui("pdtk_check_unique %d %s\n", sys_unique,
+        (filenames ? filenames : "0"));
     if (sys_externalschedlib)
         return (sys_run_scheduler(sys_externalschedlibname,
             sys_extraflagsstring));
@@ -333,13 +347,14 @@ int sys_main(int argc, char **argv)
         sys_reopen_midi();
         sys_reopen_audio();
 
-		if (sys_console) sys_vgui("pdtk_toggle_console 1\n");
-		if (sys_k12_mode) {
-			t_namelist *path = pd_extrapath;
-			while (path->nl_next)
-				path = path->nl_next;
-			sys_vgui("pdtk_enable_k12_mode %s\n", path->nl_string);
-		}
+        if (sys_console) sys_vgui("pdtk_toggle_console 1\n");
+        if (sys_k12_mode)
+        {
+            t_namelist *path = pd_extrapath;
+            while (path->nl_next)
+                path = path->nl_next;
+            sys_vgui("pdtk_enable_k12_mode %s\n", path->nl_string);
+        }
 
          /* run scheduler until it quits */
         return (m_mainloop());
@@ -533,7 +548,8 @@ void sys_findprogdir(char *progname)
     sys_guidir = &s_;   /* in MSW the guipath just depends on the libdir */
 #else
     char *res = realpath(sbuf2, sbuf);
-    if (!res) {
+    if (!res)
+    {
         error("%s: Cannot get a real path", sbuf2);
     }
     strncpy(sbuf2, sbuf, FILENAME_MAX-30);
@@ -612,7 +628,8 @@ int sys_argparse(int argc, char **argv)
 
             argc -= 2; argv += 2;
         }
-        else if (!strcmp(*argv, "-soundbuf") || !strcmp(*argv, "-audiobuf") && (argc > 1))
+        else if (!strcmp(*argv, "-soundbuf") ||
+                 !strcmp(*argv, "-audiobuf") && (argc > 1))
         {
             sys_main_advance = atoi(argv[1]);
             argc -= 2; argv += 2;
@@ -822,12 +839,12 @@ int sys_argparse(int argc, char **argv)
             sys_printtostderr = sys_nogui = 1;
             argc--; argv++;
         }
-		else if (!strcmp(*argv, "-console"))
+        else if (!strcmp(*argv, "-console"))
         {
             sys_console = 1;
             argc--; argv++;
         }
-		else if (!strcmp(*argv, "-k12"))
+        else if (!strcmp(*argv, "-k12"))
         {
             sys_k12_mode = 1;
             argc--; argv++;
diff --git a/pd/src/s_path.c b/pd/src/s_path.c
index 8feef4e79d03a3a32b38172b9de6ecb85428e621..59454b46cd8911069df62ced2c606ecf318079cf 100644
--- a/pd/src/s_path.c
+++ b/pd/src/s_path.c
@@ -80,43 +80,43 @@ static void sys_path_replace(
     char const * const pattern, 
     char const * const replacement
 ) {
-	size_t const replen = strlen(replacement);
-	size_t const patlen = strlen(pattern);
-	size_t const orilen = strlen(original);
-
-	size_t patcnt = 0;
-	const char * oriptr;
-	const char * patloc;
-
-	// find how many times the pattern occurs in the original string
-	for (oriptr = original; patloc = strstr(oriptr, pattern); oriptr = patloc + patlen)
-	{
-		patcnt++;
-	}
-
-	{
-		// allocate memory for the new string
-		size_t const retlen = orilen + patcnt * (replen - patlen);
-
-		if (returned != NULL)
-		{
-			// copy the original string, 
-			// replacing all the instances of the pattern
-			char *retptr = returned;
-			for (oriptr = original; patloc = strstr(oriptr, pattern); oriptr = patloc + patlen)
-			{
-				size_t const skplen = patloc - oriptr;
-				// copy the section until the occurence of the pattern
-				strncpy(retptr, oriptr, skplen);
-				retptr += skplen;
-				// copy the replacement 
-				strncpy(retptr, replacement, replen);
-				retptr += replen;
-			}
-			// copy the rest of the string.
-			strcpy(retptr, oriptr);
-		}
-	}
+    size_t const replen = strlen(replacement);
+    size_t const patlen = strlen(pattern);
+    size_t const orilen = strlen(original);
+
+    size_t patcnt = 0;
+    const char * oriptr;
+    const char * patloc;
+
+    // find how many times the pattern occurs in the original string
+    for (oriptr = original; patloc = strstr(oriptr, pattern); oriptr = patloc + patlen)
+    {
+        patcnt++;
+    }
+
+    {
+        // allocate memory for the new string
+        size_t const retlen = orilen + patcnt * (replen - patlen);
+
+        if (returned != NULL)
+        {
+            // copy the original string, 
+            // replacing all the instances of the pattern
+            char *retptr = returned;
+            for (oriptr = original; patloc = strstr(oriptr, pattern); oriptr = patloc + patlen)
+            {
+                size_t const skplen = patloc - oriptr;
+                // copy the section until the occurence of the pattern
+                strncpy(retptr, oriptr, skplen);
+                retptr += skplen;
+                // copy the replacement 
+                strncpy(retptr, replacement, replen);
+                retptr += replen;
+            }
+            // copy the rest of the string.
+            strcpy(retptr, oriptr);
+        }
+    }
 }
 
 /* expand env vars and ~ at the beginning of a path and make a copy to return */
@@ -148,21 +148,24 @@ static void sys_expandpath(const char *from, char *to)
 /* used for expanding paths for various objects */
 void sys_expandpathelems(const char *name, char *result)
 {
-	//check for expandable elements in path (e.g. @pd_extra, ~/) and replace
-	//fprintf(stderr,"sys_expandpathelems name=<%s>\n", name);
-	char interim[FILENAME_MAX];
-	if (strstr(name, "@pd_extra") != NULL) {
-		t_namelist *path = pd_extrapath;
-		while (path->nl_next)
-			path = path->nl_next;
-		sys_path_replace(name, interim, "@pd_extra", path->nl_string);
-		//fprintf(stderr,"path->nl_string=<%s>\n", path->nl_string);
-	} else {
-		strcpy(interim, name);
-	}
-	//fprintf(stderr,"sys_expandpathelems interim=<%s>\n", interim);
-	sys_expandpath(interim, result);
-	//fprintf(stderr,"sys_expandpathelems result=<%s>\n", result);
+    //check for expandable elements in path (e.g. @pd_extra, ~/) and replace
+    //fprintf(stderr,"sys_expandpathelems name=<%s>\n", name);
+    char interim[FILENAME_MAX];
+    if (strstr(name, "@pd_extra") != NULL)
+    {
+        t_namelist *path = pd_extrapath;
+        while (path->nl_next)
+            path = path->nl_next;
+        sys_path_replace(name, interim, "@pd_extra", path->nl_string);
+        //fprintf(stderr,"path->nl_string=<%s>\n", path->nl_string);
+    }
+    else
+    {
+        strcpy(interim, name);
+    }
+    //fprintf(stderr,"sys_expandpathelems interim=<%s>\n", interim);
+    sys_expandpath(interim, result);
+    //fprintf(stderr,"sys_expandpathelems result=<%s>\n", result);
 }
 
 /* test if path is absolute or relative, based on leading /, env vars, ~, etc */
@@ -420,10 +423,10 @@ static int do_open_via_path(const char *dir, const char *name,
 {
     t_namelist *nl;
     int fd = -1;
-	char final_name[FILENAME_MAX];
+    char final_name[FILENAME_MAX];
 
-		/* first check for @ and ~ (and later others) and replace */
-	sys_expandpathelems(name, final_name);	
+        /* first check for @ and ~ (and later others) and replace */
+    sys_expandpathelems(name, final_name);    
 
         /* first check if "name" is absolute (and if so, try to open) */
     if (sys_open_absolute(final_name, ext, dirresult, nameresult, size, bin, &fd))
@@ -438,7 +441,7 @@ static int do_open_via_path(const char *dir, const char *name,
     for (nl = searchpath; nl; nl = nl->nl_next)
         if ((fd = sys_trytoopenone(nl->nl_string, final_name, ext,
             dirresult, nameresult, size, bin)) >= 0)
-				goto do_open_via_path_end;
+                goto do_open_via_path_end;
 
         /* next look in built-in paths like "extra" */
     if (sys_usestdpath)
@@ -451,7 +454,7 @@ static int do_open_via_path(const char *dir, const char *name,
     *nameresult = dirresult;
     return (-1);
 do_open_via_path_end:
-	return (fd);
+    return (fd);
 }
 
     /* open via path, using the global search path. */
diff --git a/pd/src/t_tkcmd.c b/pd/src/t_tkcmd.c
index 42ca639df764c08b2fdb4e9988ddd5bf12863614..777b182ed46bc220bb4d3877fe5d0e27518fbaa1 100644
--- a/pd/src/t_tkcmd.c
+++ b/pd/src/t_tkcmd.c
@@ -558,12 +558,12 @@ void tcl_mess(char *s)
     int result;
 
     // PRODUCTION VERSION
-	char catch_s[strlen(s)+10];
-	sprintf(catch_s, "catch { %s }", s);
+    char catch_s[strlen(s)+10];
+    sprintf(catch_s, "catch { %s }", s);
 
     // DEBUGGING VERSION
-	//char catch_s[strlen(s)];
-	//sprintf(catch_s, "%s", s);
+    //char catch_s[strlen(s)];
+    //sprintf(catch_s, "%s", s);
 
     Tcl_Obj *messageObjPtr = Tcl_NewStringObj(catch_s,-1);
     Tcl_IncrRefCount(messageObjPtr);
@@ -590,8 +590,8 @@ void pdgui_doevalfile(Tcl_Interp *interp, char *s)
     if (Tcl_EvalFile(interp, buf) != TCL_OK)
     {
         char buf2[1000];
-		const char *trace = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);
-		printf("error in file %s: %s\n", buf, trace);
+        const char *trace = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);
+        printf("error in file %s: %s\n", buf, trace);
         sprintf(buf2, "puts [concat tcl: %s: can't open script]\n",
             buf);
         tcl_mess(buf2);
diff --git a/pd/src/x_arithmetic.c b/pd/src/x_arithmetic.c
index da8bd9303699fc92717f50de25651e727dbe5742..a5a4627ba5b3371d9b12b50a7c5b547d851ca8d2 100644
--- a/pd/src/x_arithmetic.c
+++ b/pd/src/x_arithmetic.c
@@ -156,31 +156,32 @@ static void *binop1_pow_new(t_floatarg f)
 
 static void binop1_pow_bang(t_binop *x)
 {
-	if (x->x_f1 >= 0)
-    	outlet_float(x->x_obj.ob_outlet,
-        	powf(x->x_f1, x->x_f2));
-	else if (x->x_f2 <= -1 || x->x_f2 >= 1 || x->x_f2 == 0)
-    	outlet_float(x->x_obj.ob_outlet,
-        	powf(x->x_f1, x->x_f2));
-	else {
-		pd_error(x, "pow: calculation resulted in a NaN");
-    	outlet_float(x->x_obj.ob_outlet, 0);
-	}
+    if (x->x_f1 >= 0)
+        outlet_float(x->x_obj.ob_outlet,
+            powf(x->x_f1, x->x_f2));
+    else if (x->x_f2 <= -1 || x->x_f2 >= 1 || x->x_f2 == 0)
+        outlet_float(x->x_obj.ob_outlet,
+            powf(x->x_f1, x->x_f2));
+    else
+    {
+        pd_error(x, "pow: calculation resulted in a NaN");
+        outlet_float(x->x_obj.ob_outlet, 0);
+    }
 }
 
 static void binop1_pow_float(t_binop *x, t_float f)
 {
     x->x_f1 = f;
-	if (x->x_f1 >= 0)
-    	outlet_float(x->x_obj.ob_outlet,
-        	powf(x->x_f1, x->x_f2));
-	else if (x->x_f2 <= -1 || x->x_f2 >= 1 || x->x_f2 == 0)
-    	outlet_float(x->x_obj.ob_outlet,
-        	powf(x->x_f1, x->x_f2));
-	else {
-		pd_error(x, "pow: calculation resulted in a NaN");
-    	outlet_float(x->x_obj.ob_outlet, 0);
-	}
+    if (x->x_f1 >= 0)
+        outlet_float(x->x_obj.ob_outlet,
+            powf(x->x_f1, x->x_f2));
+    else if (x->x_f2 <= -1 || x->x_f2 >= 1 || x->x_f2 == 0)
+        outlet_float(x->x_obj.ob_outlet,
+            powf(x->x_f1, x->x_f2));
+    else {
+        pd_error(x, "pow: calculation resulted in a NaN");
+        outlet_float(x->x_obj.ob_outlet, 0);
+    }
 }
 
 /* ------------------------ max -------------------------------- */
diff --git a/pd/src/x_connective.c b/pd/src/x_connective.c
index ff12b689a45a985e6c043689dd2466089f7028ec..3c5a7cfc25665cc07e09b0616eba4f9b84f30ea7 100644
--- a/pd/src/x_connective.c
+++ b/pd/src/x_connective.c
@@ -381,7 +381,7 @@ static void sel1_symbol(t_sel1 *x, t_symbol *s)
 
 static void sel1_bang(t_sel1 *x)
 {
-	sel1_symbol(x, gensym("bang"));
+    sel1_symbol(x, gensym("bang"));
 }
 
 static t_class *sel2_class;
@@ -436,7 +436,7 @@ static void sel2_symbol(t_sel2 *x, t_symbol *s)
 
 static void sel2_bang(t_sel2 *x)
 {
-	sel2_symbol(x, gensym("bang"));
+    sel2_symbol(x, gensym("bang"));
 }
 
 static void sel2_free(t_sel2 *x)
@@ -513,7 +513,7 @@ void select_setup(void)
         sizeof(t_sel2), 0, 0);
     class_addfloat(sel2_class, sel2_float);
     class_addsymbol(sel2_class, sel2_symbol);
-	class_addbang(sel2_class, sel2_bang);
+    class_addbang(sel2_class, sel2_bang);
 
     class_addcreator((t_newmethod)select_new, gensym("select"),  A_GIMME, 0);
     class_addcreator((t_newmethod)select_new, gensym("sel"),  A_GIMME, 0);
@@ -545,7 +545,7 @@ typedef struct _route
     t_routeelement *x_vec;
     t_outlet *x_rejectout;
     t_route_proxy x_pxy;
-	t_int x_mixed;
+    t_int x_mixed;
 } t_route;
 
 static void route_proxy_init(t_route_proxy *x, t_route *p)
@@ -557,15 +557,15 @@ static void route_proxy_init(t_route_proxy *x, t_route *p)
 static void route_proxy_float(t_route_proxy *x, t_float f)
 {
     t_route *p = (t_route *)x->parent;
-	p->x_type = A_FLOAT;
-	p->x_vec->e_w.w_float = f;
+    p->x_type = A_FLOAT;
+    p->x_vec->e_w.w_float = f;
 }
 
 static void route_proxy_symbol(t_route_proxy *x, t_symbol *s)
 {
     t_route *p = (t_route *)x->parent;
-	p->x_type = A_SYMBOL;
-	p->x_vec->e_w.w_symbol = s;
+    p->x_type = A_SYMBOL;
+    p->x_vec->e_w.w_symbol = s;
 }
 
 static void route_anything(t_route *x, t_symbol *sel, int argc, t_atom *argv)
@@ -589,7 +589,7 @@ static void route_anything(t_route *x, t_symbol *sel, int argc, t_atom *argv)
 
 static void route_list(t_route *x, t_symbol *sel, int argc, t_atom *argv)
 {
-	//fprintf(stderr,"route_list\n");
+    //fprintf(stderr,"route_list\n");
     t_routeelement *e;
     int nelement;
     if (x->x_type == A_FLOAT || x->x_mixed)
@@ -605,12 +605,13 @@ static void route_list(t_route *x, t_symbol *sel, int argc, t_atom *argv)
             if (argc > 1 && argv[1].a_type == A_SYMBOL)
                 outlet_anything(e->e_outlet, argv[1].a_w.w_symbol,
                     argc-2, argv+2);
-            else {
-				if (argc > 1)
-					outlet_list(e->e_outlet, 0, argc-1, argv+1);
-				else
-					outlet_bang(e->e_outlet);
-			}
+            else
+            {
+                if (argc > 1)
+                    outlet_list(e->e_outlet, 0, argc-1, argv+1);
+                else
+                    outlet_bang(e->e_outlet);
+            }
             return;
         }
     }
@@ -687,40 +688,43 @@ static void *route_new(t_symbol *s, int argc, t_atom *argv)
         SETFLOAT(&a, 0);
         argv = &a;
     }
-	x->x_type = argv[0].a_type;
+    x->x_type = argv[0].a_type;
     x->x_nelement = argc;
     x->x_vec = (t_routeelement *)getbytes(argc * sizeof(*x->x_vec));
     for (n = 0, e = x->x_vec; n < argc; n++, e++)
     {
         e->e_outlet = outlet_new(&x->x_obj, &s_list);
-        if (argv[n].a_type == A_FLOAT) {
+        if (argv[n].a_type == A_FLOAT)
+        {
             e->e_w.w_float = atom_getfloatarg(n, argc, argv);
-			flt = 1;
-		} else {
-			e->e_w.w_symbol = atom_getsymbolarg(n, argc, argv);
-			sym = 1;
-		}
+            flt = 1;
+        }
+        else
+        {
+            e->e_w.w_symbol = atom_getsymbolarg(n, argc, argv);
+            sym = 1;
+        }
     }
     if (argc == 1)
     {
-		route_proxy_init(&x->x_pxy, x);
-		inlet_new(&x->x_obj, &x->x_pxy.l_pd, 0, 0);
+        route_proxy_init(&x->x_pxy, x);
+        inlet_new(&x->x_obj, &x->x_pxy.l_pd, 0, 0);
         /*if (argv->a_type == A_FLOAT)
             floatinlet_new(&x->x_obj, &x->x_vec->e_w.w_float);
-		else
-			symbolinlet_new(&x->x_obj, &x->x_vec->e_w.w_symbol);*/
+        else
+            symbolinlet_new(&x->x_obj, &x->x_vec->e_w.w_symbol);*/
     }
-	x->x_mixed = flt * sym;
+    x->x_mixed = flt * sym;
     x->x_rejectout = outlet_new(&x->x_obj, &s_list);
     return (x);
 }
 
 void route_setup(void)
 {
-	route_proxy_class = class_new(gensym("route_inlet"),
-		0, 0, sizeof(t_route_proxy), 0, 0);
-	class_addfloat(route_proxy_class, (t_method)route_proxy_float);
-	class_addsymbol(route_proxy_class, (t_method)route_proxy_symbol);
+    route_proxy_class = class_new(gensym("route_inlet"),
+        0, 0, sizeof(t_route_proxy), 0, 0);
+    class_addfloat(route_proxy_class, (t_method)route_proxy_float);
+    class_addsymbol(route_proxy_class, (t_method)route_proxy_symbol);
     route_class = class_new(gensym("route"), (t_newmethod)route_new,
         (t_method)route_free, sizeof(t_route), 0, A_GIMME, 0);
     class_addlist(route_class, route_list);
@@ -870,10 +874,10 @@ static void pack_symbol(t_pack *x, t_symbol *s)
 
 static void pack_list(t_pack *x, t_symbol *s, int ac, t_atom *av)
 {
-	if (ac==0)
-		pack_bang(x);
-	else
-	    obj_list(&x->x_obj, 0, ac, av);
+    if (ac==0)
+        pack_bang(x);
+    else
+        obj_list(&x->x_obj, 0, ac, av);
 }
 
 static void pack_anything(t_pack *x, t_symbol *s, int ac, t_atom *av)
@@ -1034,8 +1038,8 @@ static t_class *trigger_class;
 typedef struct triggerout
 {
     int u_type;         /* outlet type from above */
-	t_symbol u_sym; 	/* static value */
-	t_float u_float;	/* static value */
+    t_symbol u_sym;     /* static value */
+    t_float u_float;    /* static value */
     t_outlet *u_outlet;
 } t_triggerout;
 
@@ -1068,25 +1072,26 @@ static void *trigger_new(t_symbol *s, int argc, t_atom *argv)
     {
         t_atomtype thistype = ap->a_type;
         char c;
-        if (thistype == TR_SYMBOL) {
-			if (strlen(ap->a_w.w_symbol->s_name) == 1)
-				c = ap->a_w.w_symbol->s_name[0];
-			else if (strcmp(ap->a_w.w_symbol->s_name, "anything") == 0)
-				c = 'a';
-			else if (strcmp(ap->a_w.w_symbol->s_name, "bang") == 0)
-				c = 'b';
-			else if (strcmp(ap->a_w.w_symbol->s_name, "float") == 0)
-				c = 'f';
-			else if (strcmp(ap->a_w.w_symbol->s_name, "list") == 0)
-				c = 'l';
-			else if (strcmp(ap->a_w.w_symbol->s_name, "pointer") == 0)
-				c = 'p';			
-			else if (strcmp(ap->a_w.w_symbol->s_name, "symbol") == 0)
-				c = 's';
-			else c = 'S';
-		}
+        if (thistype == TR_SYMBOL)
+        {
+            if (strlen(ap->a_w.w_symbol->s_name) == 1)
+                c = ap->a_w.w_symbol->s_name[0];
+            else if (strcmp(ap->a_w.w_symbol->s_name, "anything") == 0)
+                c = 'a';
+            else if (strcmp(ap->a_w.w_symbol->s_name, "bang") == 0)
+                c = 'b';
+            else if (strcmp(ap->a_w.w_symbol->s_name, "float") == 0)
+                c = 'f';
+            else if (strcmp(ap->a_w.w_symbol->s_name, "list") == 0)
+                c = 'l';
+            else if (strcmp(ap->a_w.w_symbol->s_name, "pointer") == 0)
+                c = 'p';            
+            else if (strcmp(ap->a_w.w_symbol->s_name, "symbol") == 0)
+                c = 's';
+            else c = 'S';
+        }
         else if (thistype == TR_FLOAT)
-			c = 'F';
+            c = 'F';
         else c = 0;
         if (c == 'p')
             u->u_type = TR_POINTER,
@@ -1103,18 +1108,22 @@ static void *trigger_new(t_symbol *s, int argc, t_atom *argv)
         else if (c == 'a')
             u->u_type = TR_ANYTHING,
                 u->u_outlet = outlet_new(&x->x_obj, &s_symbol);
-		else if (c == 'F') {
-			//static float
-			u->u_float = ap->a_w.w_float;
-			u->u_type = TR_STATIC_FLOAT;
-			u->u_outlet = outlet_new(&x->x_obj, &s_float);
-		}
-        else if (c == 'S') {
-			//static symbol
-			u->u_sym = *ap->a_w.w_symbol;
+        else if (c == 'F')
+        {
+            //static float
+            u->u_float = ap->a_w.w_float;
+            u->u_type = TR_STATIC_FLOAT;
+            u->u_outlet = outlet_new(&x->x_obj, &s_float);
+        }
+        else if (c == 'S')
+        {
+            //static symbol
+            u->u_sym = *ap->a_w.w_symbol;
             u->u_type = TR_STATIC_SYMBOL;
-	        u->u_outlet = outlet_new(&x->x_obj, &s_symbol);
-		} else {
+            u->u_outlet = outlet_new(&x->x_obj, &s_symbol);
+        }
+        else
+        {
             pd_error(x, "trigger: %s: bad type", ap->a_w.w_symbol->s_name);
             u->u_type = TR_FLOAT, u->u_outlet = outlet_new(&x->x_obj, &s_float);
         }
@@ -1143,40 +1152,41 @@ static void trigger_list(t_trigger *x, t_symbol *s, int argc, t_atom *argv)
                 pd_error(x, "unpack: bad pointer");
             else outlet_pointer(u->u_outlet, argv->a_w.w_gpointer);
         }
-		else if (u->u_type == TR_STATIC_FLOAT)
-		{
-			outlet_float(u->u_outlet, u->u_float);	
-		}
-		else if (u->u_type == TR_STATIC_SYMBOL)
-		{
-			outlet_symbol(u->u_outlet, &u->u_sym);
-		}
+        else if (u->u_type == TR_STATIC_FLOAT)
+        {
+            outlet_float(u->u_outlet, u->u_float);    
+        }
+        else if (u->u_type == TR_STATIC_SYMBOL)
+        {
+            outlet_symbol(u->u_outlet, &u->u_sym);
+        }
         else outlet_list(u->u_outlet, &s_list, argc, argv);
     }
 }
 
 static void trigger_anything(t_trigger *x, t_symbol *s, int argc, t_atom *argv)
 {
-	//fprintf(stderr,"trigger_anything %s\n", s->s_name);
+    //fprintf(stderr,"trigger_anything %s\n", s->s_name);
     t_triggerout *u;
     int i;
     for (i = x->x_n, u = x->x_vec + i; u--, i--;)
     {
         if (u->u_type == TR_BANG)
             outlet_bang(u->u_outlet);
-        else if (u->u_type == TR_ANYTHING) {
-			//fprintf(stderr,"TR_ANYTHING\n");
+        else if (u->u_type == TR_ANYTHING)
+        {
+            //fprintf(stderr,"TR_ANYTHING\n");
             outlet_anything(u->u_outlet, s, argc, argv);
-		}
-		else if (u->u_type == TR_STATIC_FLOAT)
-		{
-			outlet_float(u->u_outlet, u->u_float);	
-		}
-		else if (u->u_type == TR_STATIC_SYMBOL)
-		{
-			outlet_symbol(u->u_outlet, &u->u_sym);
-		}        
-		else trigger_symbol(x, s);
+        }
+        else if (u->u_type == TR_STATIC_FLOAT)
+        {
+            outlet_float(u->u_outlet, u->u_float);    
+        }
+        else if (u->u_type == TR_STATIC_SYMBOL)
+        {
+            outlet_symbol(u->u_outlet, &u->u_sym);
+        }        
+        else trigger_symbol(x, s);
     }
 }
 
@@ -1387,25 +1397,31 @@ static void makefilename_scanformat(t_makefilename *x)
     char *str,*chr;
     if (!x->x_format) return;
     x->x_accept = A_NULL;
-    for (str=x->x_format->s_name; *str; str++) {
-        if (!infmt && *str=='%') {
+    for (str=x->x_format->s_name; *str; str++)
+    {
+        if (!infmt && *str=='%')
+        {
             infmt=1;
             continue;
         }
-        if (infmt) {
+        if (infmt)
+        {
             if (strchr("-.#0123456789",*str)!=0)
                 continue;
-            if (*str=='s') {
+            if (*str=='s')
+            {
                 x->x_accept = A_SYMBOL;
                 x->x_intconvert = 0;
                 break;
             }
-            if (strchr("fgGeE",*str)!=0) {
+            if (strchr("fgGeE",*str)!=0)
+            {
                 x->x_accept = A_FLOAT;
                 x->x_intconvert = 0;
                 break;
             }
-            if (strchr("xXdiouc",*str)!=0) {
+            if (strchr("xXdiouc",*str)!=0)
+            {
                 x->x_accept = A_FLOAT;
                 x->x_intconvert = 1;
                 break;
@@ -1431,7 +1447,8 @@ static void *makefilename_new(t_symbol *s)
 static void makefilename_float(t_makefilename *x, t_floatarg f)
 {
     char buf[MAXPDSTRING];
-    if (x->x_accept == A_FLOAT) {
+    if (x->x_accept == A_FLOAT)
+    {
         if (x->x_intconvert)
             sprintf(buf, x->x_format->s_name, (int)f);
         else sprintf(buf, x->x_format->s_name, f);
diff --git a/pd/src/x_gui.c b/pd/src/x_gui.c
index 9ae8a85d8882488da5407e8489aad66db3f623b0..4fa11894f48f2fde784c1cb91d715a01bb4f3cc4 100644
--- a/pd/src/x_gui.c
+++ b/pd/src/x_gui.c
@@ -87,14 +87,17 @@ void gfxstub_new(t_pd *owner, void *key, const char *cmd)
     sys_gui(buf);
 }
 
-int gfxstub_haveproperties(void *key) {
+int gfxstub_haveproperties(void *key)
+{
     t_gfxstub *x;
-    for (x = gfxstub_list; x; x = x->x_next) {
-        if (x->x_key == key) {
+    for (x = gfxstub_list; x; x = x->x_next)
+    {
+        if (x->x_key == key)
+        {
             return (t_int)x;
-		}
-	}
-	return 0;
+        }
+    }
+    return 0;
 }
 
 static void gfxstub_offlist(t_gfxstub *x)
diff --git a/pd/src/x_interface.c b/pd/src/x_interface.c
index a7fba91bd7ca9656e7895c9d3256cfbef206a0db..739f46df9ba5b67d8076a06bb9feecf4e146f014 100644
--- a/pd/src/x_interface.c
+++ b/pd/src/x_interface.c
@@ -73,7 +73,7 @@ static void print_list(t_print *x, t_symbol *s, int argc, t_atom *argv)
 {
     int i;
     if (argc && argv->a_type != A_SYMBOL)
-		startpost("%s%s%g", x->x_sym->s_name,
+        startpost("%s%s%g", x->x_sym->s_name,
             (*x->x_sym->s_name ? ": " : ""),
             atom_getfloatarg(0, argc--, argv++));
     else startpost("%s: %s", x->x_sym->s_name,
@@ -148,7 +148,8 @@ void info_out(t_text *te, t_symbol *s, int argc, t_atom *argv)
             postatom(argc, argv);
         endpost();
     }
-    else {
+    else
+    {
         outlet_list(te->ob_outlet,
             &s_list, argc, argv);
     }
diff --git a/pd/src/x_list.c b/pd/src/x_list.c
index 3142b381b01b7304e2561ac2ab1925d17d309d16..bd8e4d4468c82c2bb32bd55dce7e81c5d76b6ad6 100644
--- a/pd/src/x_list.c
+++ b/pd/src/x_list.c
@@ -64,18 +64,19 @@ void alist_init(t_alist *x)
 
 void alist_clear(t_alist *x)
 {
-	if (x->l_n) {
-    	int i;
-		for (i = 0; i < x->l_n; i++)
-		{
-		    if (x->l_vec[i].l_a.a_type == A_POINTER)
-		        gpointer_unset(x->l_vec[i].l_a.a_w.w_gpointer);
-		}
-		if (x->l_vec)
-		    freebytes(x->l_vec, x->l_n * sizeof(*x->l_vec));
-	}
-	x->l_n = 0;
-	x->l_npointer = 0;
+    if (x->l_n)
+    {
+        int i;
+        for (i = 0; i < x->l_n; i++)
+        {
+            if (x->l_vec[i].l_a.a_type == A_POINTER)
+                gpointer_unset(x->l_vec[i].l_a.a_w.w_gpointer);
+        }
+        if (x->l_vec)
+            freebytes(x->l_vec, x->l_n * sizeof(*x->l_vec));
+    }
+    x->l_n = 0;
+    x->l_npointer = 0;
 }
 
 void alist_list(t_alist *x, t_symbol *s, int argc, t_atom *argv)
@@ -262,7 +263,7 @@ typedef struct _list_cat
 {
     t_object x_obj;
     t_alist x_alist;
-	t_list_cat_proxy x_pxy;
+    t_list_cat_proxy x_pxy;
 } t_list_cat;
 
 static void list_cat_clear(t_list_cat *x);
@@ -309,14 +310,14 @@ static void list_cat_list(t_list_cat *x, t_symbol *s,
         alist_toatoms(&x->x_alist, outv);
         outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv);
     }
-	alist_list(&x->x_alist, s, outc, outv);
+    alist_list(&x->x_alist, s, outc, outv);
     XL_ATOMS_FREEA(outv, outc);
 }
 
 static void list_cat_anything(t_list_cat *x, t_symbol *s,
     int argc, t_atom *argv)
 {
-	t_atom *outv;
+    t_atom *outv;
     int n, outc = x->x_alist.l_n + argc + 1;
     XL_ATOMS_ALLOCA(outv, outc);
     SETSYMBOL(outv + x->x_alist.l_n, s);
@@ -334,10 +335,10 @@ static void list_cat_anything(t_list_cat *x, t_symbol *s,
         alist_toatoms(&x->x_alist, outv);
         outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv);
     }
-	if (x->x_alist.l_n <= 1)
-		alist_anything(&x->x_alist, s, outc, outv);
-	else
-		alist_list(&x->x_alist, s, outc, outv);
+    if (x->x_alist.l_n <= 1)
+        alist_anything(&x->x_alist, s, outc, outv);
+    else
+        alist_list(&x->x_alist, s, outc, outv);
     XL_ATOMS_FREEA(outv, outc);
 }
 
@@ -362,7 +363,8 @@ static void list_cat_setup(void)
 
     list_cat_proxy_class = class_new(gensym("list cat pxy"), 0, 0,
         sizeof(t_list_cat_proxy), 0, 0);
-	class_addmethod(list_cat_proxy_class, (t_method)list_cat_proxy_clear, gensym("clear"), 0);
+    class_addmethod(list_cat_proxy_class, (t_method)list_cat_proxy_clear,
+        gensym("clear"), 0);
 }
 
 /* ------------- list prepend --------------------- */
diff --git a/pd/src/x_misc.c b/pd/src/x_misc.c
index f867f4135a0ec1f08e04f267391c9155bdd89298..f313041026ea6d0ec14b1553aa271febf20d4730 100644
--- a/pd/src/x_misc.c
+++ b/pd/src/x_misc.c
@@ -127,7 +127,7 @@ static void loadbang_setup(void)
         sizeof(t_loadbang), CLASS_NOINLET, 0);
     class_addmethod(loadbang_class, (t_method)loadbang_loadbang,
         gensym("loadbang"), 0);
-	class_addmethod(loadbang_class, (t_method)loadbang_click, gensym("click"),
+    class_addmethod(loadbang_class, (t_method)loadbang_click, gensym("click"),
         A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
 }
 
diff --git a/pd/src/x_net.c b/pd/src/x_net.c
index 62cf656eec470e9c301b879ca3ff41158b9353b1..3fa1fa779963dc6ccebd56ae6d3664cab78ee8e1 100644
--- a/pd/src/x_net.c
+++ b/pd/src/x_net.c
@@ -245,7 +245,7 @@ static void netreceive_connectpoll(t_netreceive *x)
             (t_socketnotifier)netreceive_notify,
                 (x->x_msgout ? netreceive_doit : 0), 0);
         sys_addpollfn(fd, (t_fdpollfn)socketreceiver_read, y);
-		x->x_acceptsocket = fd;
+        x->x_acceptsocket = fd;
         outlet_float(x->x_connectout, ++x->x_nconnections);
     }
 }
@@ -310,7 +310,7 @@ static void *netreceive_new(t_symbol *compatflag,
     }
     else x->x_msgout = outlet_new(&x->x_obj, &s_anything);
 
-	x->x_acceptsocket = -1;
+    x->x_acceptsocket = -1;
 
     if (udp)        /* datagram protocol */
     {
@@ -347,8 +347,8 @@ static void netreceive_free(t_netreceive *x)
     if (x->x_connectsocket >= 0)
     {
         sys_rmpollfn(x->x_connectsocket);
-		if (x->x_acceptsocket >= 0)
-			sys_rmpollfn(x->x_acceptsocket);
+        if (x->x_acceptsocket >= 0)
+            sys_rmpollfn(x->x_acceptsocket);
         sys_closesocket(x->x_connectsocket);
     }
 }
diff --git a/pd/src/x_preset.c b/pd/src/x_preset.c
index dcf59b5708fabf48558da97286d223ed6ad4421e..bdef493490f57f9e7d1dfd91d5872a791828adf3 100644
--- a/pd/src/x_preset.c
+++ b/pd/src/x_preset.c
@@ -1,5 +1,6 @@
-/*	preset_node and preset_hub implementation by Ivica Ico Bukvic <ico@vt.edu> (c) 2012
-	distributed under GPL v3 license or newer
+/*  preset_node and preset_hub implementation by
+    Ivica Ico Bukvic <ico@vt.edu> (c) 2012
+     distributed under GPL v3 license or newer
 */
 
 #include <stdio.h>
@@ -12,33 +13,34 @@
 
 #define PH_DEBUG 0
 
-//		changes in order happen when doing one of the following: cut, 
-//		undo cut, delete, undo delete, to front, and to back.
-//		this will trigger cascading check for all preset_nodes 
-//		is there a way to limit it to ones that are affected?
-//		potentially... by taking all the ordinal values above the one moved
-//		e.g. if object 1,5 was moved, everything above it
-//			 (1,5,1 or 1,6 etc.) needs to be reevaluated BEFORE
-//			 reevaluating moved object (if applicable)
-//			 this does not affect objects like 2 or 2,7
-//			 since it is a different branch altogether
-//			 this is however, not currently implemented as said changes
-//			 typically occur during editing and as such have little to no
-//			 impact on the cpu optimization. live-coding may be affected,
-//			 however, and further investigation there may be warranted.
-
-/*	gl_loc int array explanation:
-
-	Each number corresponds to object or parent's location starting with root window.
-	This ensures that each object has a unique ID within the preset even when using
-	multiple instances of the same abstraction within the same patch.
-	This also means that if the object has changed its location within the gl_list
-	(e.g. via to_front/to_back), all corresponding IDs have to be updated in the parent.
-
-	EXAMPLE:
-	1,4,7 means the preset_node is 8th object in the subpatch or abstraction that is a
-	child of 5th object in a parent patch, that is a child of 2nd object of the root
-	patch.
+/*      changes in order happen when doing one of the following: cut, 
+        undo cut, delete, undo delete, to front, and to back.
+        this will trigger cascading check for all preset_nodes 
+        is there a way to limit it to ones that are affected?
+        potentially... by taking all the ordinal values above the one moved
+        e.g. if object 1,5 was moved, everything above it
+             (1,5,1 or 1,6 etc.) needs to be reevaluated BEFORE
+             reevaluating moved object (if applicable)
+             this does not affect objects like 2 or 2,7
+             since it is a different branch altogether
+             this is however, not currently implemented as said changes
+             typically occur during editing and as such have little to no
+             impact on the cpu optimization. live-coding may be affected,
+             however, and further investigation there may be warranted. */
+
+/*  gl_loc int array explanation:
+
+    Each number corresponds to object or parent's location starting with
+    root window. This ensures that each object has a unique ID within the
+    preset even when using multiple instances of the same abstraction within
+    the same patch. This also means that if the object has changed its location
+    within the gl_list (e.g. via to_front/to_back), all corresponding IDs have
+    to be updated in the parent.
+
+    EXAMPLE:
+    1,4,7 means the preset_node is 8th object in the subpatch or abstraction
+    that is a child of 5th object in a parent patch, that is a child of 2nd
+    object of the root patch.
 */
 
 //==================== forward declarations ========================//
@@ -63,9 +65,9 @@ static void preset_node_update_my_glist_location(t_preset_node *x);
 
 //======================== global vars =============================//
 
-/*	following contains a linear list of all hubs and nodes which ensures easy access,
-	pairing, deletion, etc. of all nodes and hubs regardless whether they are a part of
-	subpatches, root canvases, or abstractions.
+/* following contains a linear list of all hubs and nodes which ensures easy
+   access, pairing, deletion, etc. of all nodes and hubs regardless whether
+   they are a part of subpatches, root canvases, or abstractions.
 */
 
 t_glob_preset_node_list *gpnl;
@@ -73,195 +75,241 @@ t_glob_preset_hub_list *gphl;
 
 int glob_preset_node_list_add(t_preset_node *x)
 {
-	if(PH_DEBUG) fprintf(stderr,"glob_preset_node_list_add\n");
-	t_glob_preset_node_list *n1, *n2;
-
-	if (!gpnl) {
-		gpnl = (t_glob_preset_node_list *)t_getbytes(sizeof(*gpnl));
-		n2 = gpnl;
-	} else {
-		n1 = gpnl;
-		while(n1->gpnl_next)
-			n1 = n1->gpnl_next;
-		n2 = (t_glob_preset_node_list *)t_getbytes(sizeof(*n2));
-		n1->gpnl_next = n2;
-	}
-	n2->gpnl_paired = 0;
-	n2->gpnl_node = x;
-	return(0);
+    if(PH_DEBUG) fprintf(stderr,"glob_preset_node_list_add\n");
+    t_glob_preset_node_list *n1, *n2;
+
+    if (!gpnl)
+    {
+        gpnl = (t_glob_preset_node_list *)t_getbytes(sizeof(*gpnl));
+        n2 = gpnl;
+    }
+    else
+    {
+        n1 = gpnl;
+        while(n1->gpnl_next)
+            n1 = n1->gpnl_next;
+        n2 = (t_glob_preset_node_list *)t_getbytes(sizeof(*n2));
+        n1->gpnl_next = n2;
+    }
+    n2->gpnl_paired = 0;
+    n2->gpnl_node = x;
+    return(0);
 }
 
 int glob_preset_node_list_delete(t_preset_node *x)
 {
-	if(PH_DEBUG) fprintf(stderr,"glob_preset_node_list_delete\n");
-	t_glob_preset_node_list *n1, *n2;
-	int found;
-
-	if (!gpnl)
-		return(1);
-
-	n1 = gpnl;
-	n2 = gpnl;
-
-	// first check if we are the first gpnl
-	if (n2->gpnl_node == x) {
-		if(PH_DEBUG) fprintf(stderr,"	we are first\n");
-		gpnl = n2->gpnl_next;
-		freebytes(n2, sizeof(*n2));
-	} 
-	else {
-		if(PH_DEBUG) fprintf(stderr,"	we are NOT first\n");
-		while (n2->gpnl_node != x && n2->gpnl_next) {
-			n1 = n2;
-			n2 = n2->gpnl_next;
-		}
-		if (n2->gpnl_node == x) {
-			n1->gpnl_next = n2->gpnl_next;
-			freebytes(n2, sizeof(*n2));
-		} else {
-			// we should never get here
-			if(PH_DEBUG) fprintf(stderr,"error, could not find appropriate gpnl to delete\n");
-			return(1);
-		}
-	}
-	
-	return(0);
+    if(PH_DEBUG) fprintf(stderr,"glob_preset_node_list_delete\n");
+    t_glob_preset_node_list *n1, *n2;
+    int found;
+
+    if (!gpnl)
+        return(1);
+
+    n1 = gpnl;
+    n2 = gpnl;
+
+    // first check if we are the first gpnl
+    if (n2->gpnl_node == x)
+    {
+        if(PH_DEBUG) fprintf(stderr,"    we are first\n");
+        gpnl = n2->gpnl_next;
+        freebytes(n2, sizeof(*n2));
+    } 
+    else
+    {
+        if(PH_DEBUG) fprintf(stderr,"    we are NOT first\n");
+        while (n2->gpnl_node != x && n2->gpnl_next)
+        {
+            n1 = n2;
+            n2 = n2->gpnl_next;
+        }
+        if (n2->gpnl_node == x)
+        {
+            n1->gpnl_next = n2->gpnl_next;
+            freebytes(n2, sizeof(*n2));
+        }
+        else
+        {
+            // we should never get here
+            if(PH_DEBUG)
+                fprintf(stderr,
+                    "error, could not find appropriate gpnl to delete\n");
+            return(1);
+        }
+    }
+    
+    return(0);
 }
 
 int glob_preset_node_list_update_paired(t_preset_node *x, int paired)
 {
-	if(PH_DEBUG) fprintf(stderr,"glob_preset_node_list_update_paired %d\n", paired);
-	t_glob_preset_node_list *n;
-
-	if (!gpnl)
-		return(1);
-
-	n = gpnl;
-
-	while (n->gpnl_node != x && n->gpnl_next) {
-		n = n->gpnl_next;
-	}
-	if (n->gpnl_node == x) {
-		n->gpnl_paired = paired;
-	}
-	else {
-		// we should never get here
-		if(PH_DEBUG) fprintf(stderr,"error, could not find appropriate gpnl to pair\n");
-		return(1);
-	}
-	
-	return(0);
+    if(PH_DEBUG)
+        fprintf(stderr, "glob_preset_node_list_update_paired %d\n",
+            paired);
+    t_glob_preset_node_list *n;
+
+    if (!gpnl)
+        return(1);
+
+    n = gpnl;
+
+    while (n->gpnl_node != x && n->gpnl_next)
+    {
+        n = n->gpnl_next;
+    }
+    if (n->gpnl_node == x)
+    {
+        n->gpnl_paired = paired;
+    }
+    else
+    {
+        // we should never get here
+        if (PH_DEBUG)
+            fprintf(stderr, "error, could not find appropriate gpnl to pair\n");
+        return(1);
+    }
+    
+    return(0);
 }
 
 void glob_preset_node_list_seek_hub(void)
 {
-	if(PH_DEBUG) fprintf(stderr,"glob_preset_node_list_seek_hub\n");
-	if (we_are_undoing)
-		return;
-	t_glob_preset_node_list *nl;
-
-	if (gpnl) {
-		nl = gpnl;
-		while(nl) {
-			if(PH_DEBUG) fprintf(stderr,"	got node\n");
-			if (!nl->gpnl_paired) {
-				if(PH_DEBUG) fprintf(stderr,"	seeking\n");
-				preset_node_seek_hub(nl->gpnl_node);
-			}
-			nl = nl->gpnl_next;
-		}
-	}
-	if(PH_DEBUG) fprintf(stderr,"	done\n");
+    if (PH_DEBUG) fprintf(stderr,"glob_preset_node_list_seek_hub\n");
+    if (we_are_undoing)
+        return;
+    t_glob_preset_node_list *nl;
+
+    if (gpnl)
+    {
+        nl = gpnl;
+        while(nl)
+        {
+            if(PH_DEBUG) fprintf(stderr,"    got node\n");
+            if (!nl->gpnl_paired)
+            {
+                if(PH_DEBUG) fprintf(stderr,"    seeking\n");
+                preset_node_seek_hub(nl->gpnl_node);
+            }
+            nl = nl->gpnl_next;
+        }
+    }
+    if(PH_DEBUG) fprintf(stderr,"    done\n");
 }
 
-// this should be called whenever glist has been changed (tofront/back, cut, delete, undo/redo cut/delete)
+/* this should be called whenever glist has been changed
+   (tofront/back, cut, delete, undo/redo cut/delete) */
 void glob_preset_node_list_check_loc_and_update(void)
 {
-	if(PH_DEBUG) fprintf(stderr,"glob_preset_node_list_check_loc_and_update\n");
-	t_glob_preset_hub_list *hl;
-	t_preset_hub_data *hd;
-	int i = 0;
-
-	if (gphl) {
-		hl = gphl;
-		while(hl) {
-			if(PH_DEBUG) fprintf(stderr,"	searching\n");
-			hd = hl->gphl_hub->ph_data;
-			while (hd) {
-				if(PH_DEBUG) fprintf(stderr,"	checking data\n");
-				if (hd->phd_node) {
-					if(PH_DEBUG) fprintf(stderr,"	node is active\n");
-					preset_node_update_my_glist_location(hd->phd_node);
-					if (preset_node_location_changed(hd->phd_node)) {
-						if(PH_DEBUG) fprintf(stderr,"	location changed...adjusting length %d to %d\n", hd->phd_pn_gl_loc_length, hd->phd_node->pn_gl_loc_length);
-						hd->phd_pn_gl_loc_length = hd->phd_node->pn_gl_loc_length;
-						hd->phd_pn_gl_loc = (int*)realloc(hd->phd_pn_gl_loc, hd->phd_pn_gl_loc_length*sizeof(int));
-						for (i=0; i < hd->phd_pn_gl_loc_length; i++) {
-							if(PH_DEBUG) fprintf(stderr,"	loc old:%d new:%d\n", hd->phd_pn_gl_loc[i], hd->phd_node->pn_gl_loc[i]);
-							hd->phd_pn_gl_loc[i] = hd->phd_node->pn_gl_loc[i];
-						}
-					}
-				}
-				hd = hd->phd_next;
-			}
-			hl = hl->gphl_next;
-		}
-	}
+    if(PH_DEBUG) fprintf(stderr,"glob_preset_node_list_check_loc_and_update\n");
+    t_glob_preset_hub_list *hl;
+    t_preset_hub_data *hd;
+    int i = 0;
+
+    if (gphl)
+    {
+        hl = gphl;
+        while(hl)
+        {
+            if(PH_DEBUG) fprintf(stderr,"    searching\n");
+            hd = hl->gphl_hub->ph_data;
+            while (hd)
+            {
+                if(PH_DEBUG) fprintf(stderr,"    checking data\n");
+                if (hd->phd_node)
+                {
+                    if(PH_DEBUG) fprintf(stderr,"    node is active\n");
+                    preset_node_update_my_glist_location(hd->phd_node);
+                    if (preset_node_location_changed(hd->phd_node))
+                    {
+                        if(PH_DEBUG)
+                            fprintf(stderr, "    location changed...adjusting "
+                                            "length %d to %d\n",
+                                hd->phd_pn_gl_loc_length,
+                                hd->phd_node->pn_gl_loc_length);
+                        hd->phd_pn_gl_loc_length =
+                            hd->phd_node->pn_gl_loc_length;
+                        hd->phd_pn_gl_loc = (int*)realloc(hd->phd_pn_gl_loc,
+                            hd->phd_pn_gl_loc_length*sizeof(int));
+                        for (i=0; i < hd->phd_pn_gl_loc_length; i++)
+                        {
+                            if(PH_DEBUG)
+                                fprintf(stderr,"    loc old:%d new:%d\n",
+                                    hd->phd_pn_gl_loc[i],
+                                    hd->phd_node->pn_gl_loc[i]);
+                            hd->phd_pn_gl_loc[i] = hd->phd_node->pn_gl_loc[i];
+                        }
+                    }
+                }
+                hd = hd->phd_next;
+            }
+            hl = hl->gphl_next;
+        }
+    }
 }
 
 int glob_preset_hub_list_add(t_preset_hub *x)
 {
-	if(PH_DEBUG) fprintf(stderr,"glob_preset_hub_list_add\n");
-	t_glob_preset_hub_list *h1, *h2;
-
-	if (!gphl) {
-		gphl = (t_glob_preset_hub_list *)t_getbytes(sizeof(*gphl));
-		h2 = gphl;
-	} else {
-		h1 = gphl;
-		while(h1->gphl_next)
-			h1 = h1->gphl_next;
-		h2 = (t_glob_preset_hub_list *)t_getbytes(sizeof(*h2));
-		h1->gphl_next = h2;
-	}
-	h2->gphl_hub = x;
-	return(0);
+    if(PH_DEBUG) fprintf(stderr,"glob_preset_hub_list_add\n");
+    t_glob_preset_hub_list *h1, *h2;
+
+    if (!gphl)
+    {
+        gphl = (t_glob_preset_hub_list *)t_getbytes(sizeof(*gphl));
+        h2 = gphl;
+    }
+    else
+    {
+        h1 = gphl;
+        while(h1->gphl_next)
+            h1 = h1->gphl_next;
+        h2 = (t_glob_preset_hub_list *)t_getbytes(sizeof(*h2));
+        h1->gphl_next = h2;
+    }
+    h2->gphl_hub = x;
+    return(0);
 }
 
 int glob_preset_hub_list_delete(t_preset_hub *x)
 {
-	if(PH_DEBUG) fprintf(stderr,"glob_preset_hub_list_delete\n");
-	t_glob_preset_hub_list *h1, *h2;
-	int found;
-
-	if (!gphl)
-		return(1);
-
-	h1 = gphl;
-	h2 = gphl;
-
-	// first check if we are the first gphl
-	if (h2->gphl_hub == x) {
-		gphl = h2->gphl_next;
-		freebytes(h2, sizeof(*h2));
-	} 
-	else {
-		while (h2->gphl_hub != x && h2->gphl_next) {
-			h1 = h2;
-			h2 = h2->gphl_next;
-		}
-		if (h2->gphl_hub == x) {
-			h1->gphl_next = h2->gphl_next;
-			freebytes(h2, sizeof(*h2));
-		}
-		else {
-			// we should never get here
-			if(PH_DEBUG) fprintf(stderr,"error, could not find appropriate gphl to delete\n");
-			return(1);
-		}
-	}	
-	
-	return(0);
+    if(PH_DEBUG) fprintf(stderr,"glob_preset_hub_list_delete\n");
+    t_glob_preset_hub_list *h1, *h2;
+    int found;
+
+    if (!gphl)
+        return(1);
+
+    h1 = gphl;
+    h2 = gphl;
+
+    // first check if we are the first gphl
+    if (h2->gphl_hub == x)
+    {
+        gphl = h2->gphl_next;
+        freebytes(h2, sizeof(*h2));
+    } 
+    else
+    {
+        while (h2->gphl_hub != x && h2->gphl_next)
+        {
+            h1 = h2;
+            h2 = h2->gphl_next;
+        }
+        if (h2->gphl_hub == x)
+        {
+            h1->gphl_next = h2->gphl_next;
+            freebytes(h2, sizeof(*h2));
+        }
+        else
+        {
+            // we should never get here
+            if(PH_DEBUG)
+                fprintf(stderr, "error, could not find appropriate "
+                                "gphl to delete\n");
+            return(1);
+        }
+    }    
+    
+    return(0);
 }
 
 //====================== end global vars ===========================//
@@ -270,459 +318,544 @@ int glob_preset_hub_list_delete(t_preset_hub *x)
 
 static int compare_hub_node_names(t_atom *a, t_atom *b)
 {
-	if(PH_DEBUG) {
-		fprintf(stderr,"	comparing: ");
-		if (a->a_type == A_SYMBOL)
-			fprintf(stderr,"A_SYMBOL %s |", atom_getsymbol(a)->s_name);
-		else
-			fprintf(stderr,"A_FLOAT %f |", atom_getfloat(a));
-		if (b->a_type == A_SYMBOL)
-			fprintf(stderr," A_SYMBOL %s\n", atom_getsymbol(b)->s_name);
-		else
-			fprintf(stderr," A_FLOAT %f\n", atom_getfloat(b));
-	}
-	if (a->a_type == A_SYMBOL && b->a_type == A_SYMBOL) {
-		if (!strcmp(atom_getsymbol(a)->s_name, atom_getsymbol(b)->s_name)) {
-			return(0);
-		}
-	}
-	else if (a->a_type == A_FLOAT && b->a_type == A_FLOAT) {
-		if (atom_getfloat(a) == atom_getfloat(b)) {
-			return(0);
-		}
-	}
-	return 1;
+    if(PH_DEBUG)
+    {
+        fprintf(stderr,"    comparing: ");
+        if (a->a_type == A_SYMBOL)
+            fprintf(stderr,"A_SYMBOL %s |", atom_getsymbol(a)->s_name);
+        else
+            fprintf(stderr,"A_FLOAT %f |", atom_getfloat(a));
+        if (b->a_type == A_SYMBOL)
+            fprintf(stderr," A_SYMBOL %s\n", atom_getsymbol(b)->s_name);
+        else
+            fprintf(stderr," A_FLOAT %f\n", atom_getfloat(b));
+    }
+    if (a->a_type == A_SYMBOL && b->a_type == A_SYMBOL)
+    {
+        if (!strcmp(atom_getsymbol(a)->s_name, atom_getsymbol(b)->s_name))
+        {
+            return(0);
+        }
+    }
+    else if (a->a_type == A_FLOAT && b->a_type == A_FLOAT)
+    {
+        if (atom_getfloat(a) == atom_getfloat(b))
+        {
+            return(0);
+        }
+    }
+    return 1;
 }
 
 //==================== end helper functions ========================//
 
 //======================== preset_node =============================//
 
-// we declare this class as part of the g_canvas.h (to expose it to the rest of the code)
+/* we declare this class as part of the g_canvas.h (to expose it to the
+   rest of the code) */
 
 static void preset_node_update_my_glist_location(t_preset_node *x)
 {
-	if(PH_DEBUG) fprintf(stderr,"node_update_glist_location\n");
-	// location is calculated in respect to the hub (if any), otherwise it is 0
-	t_preset_hub *h;
-	t_canvas *c = x->pn_canvas;
-	int found = 0;
-
-	// do all this only if we are already paired with a hub
-	if (x->pn_hub) {
-
-		if (x->pn_old_gl_loc && x->pn_old_gl_loc != x->pn_gl_loc) free(x->pn_old_gl_loc);
-		x->pn_old_gl_loc = x->pn_gl_loc;
-		x->pn_old_gl_loc_length = x->pn_gl_loc_length;
-	
-		x->pn_gl_loc = NULL;
-		x->pn_gl_loc_length = 0;
-
-		// let's try to find our hub (if any)
-		int depth = 0;
-		while (!found && c) {
-			if (c->gl_phub) {
-				if(PH_DEBUG) fprintf(stderr,"	gl_phub != NULL\n");
-				h = c->gl_phub;
-				while (h) {
-					if(PH_DEBUG) fprintf(stderr,"	analyzing hub\n");
-					if (!compare_hub_node_names(h->ph_name, x->pn_hub_name)) {
-						if(PH_DEBUG) fprintf(stderr,"	found a match\n");
-						found = 1;
-						break;
-					}
-					h = h->ph_next;
-				}
-			}
-			if (found) break; 	// need to stop the main while loop here
-								// before we increase depth unnecessarily below
-								// otherwise hubs in subpatches will fail to pair
-								// its local nodes
-			c = c->gl_owner;
-			if (c)
-				depth++;
-		}
-
-		if (found) {
-
-			if(PH_DEBUG) fprintf(stderr,"	depth = %d\n", depth);
-	
-			// allocate depth array
-			x->pn_gl_loc = (int*)calloc(depth+1, sizeof(x->pn_gl_loc));
-
-			// now let's figure out where each of the child gobj's location is
-			// starting from the back
-			int i = 0; 					// iteration within each gl_list
-			int j = 0; 					// number of gl_list to traverse
-			c = x->pn_canvas;
-			t_gobj *g = c->gl_list;
-			t_gobj *target = (t_gobj *)x;
-
-			for (j = depth; j >= 0; j--) {
-
-				while (g && g != target) // have to do sanity check for g in the event this is run at patch creation time
-				{
-					g = g->g_next;
-					i++;
-					//if(PH_DEBUG) fprintf(stderr,"	searching... %d\n", i);
-				}
-				// even if the g fails sanity check due to creation time, it will still land on the last created element whose
-				// pointer at this point is still null since this means this is being called at the end of the preset_node_new call
-				if(PH_DEBUG) fprintf(stderr,"	location = %d %lx %lx\n", i, (t_int)g, (t_int)target);
-				x->pn_gl_loc[j] = i;
-
-				// now readjust the target, c, g, and i variables for the next level up
-				if (c->gl_owner) {
-					target = (t_gobj *)c;
-					c = c->gl_owner;
-					g = c->gl_list;
-					i = 0;
-				}
-			}
-			x->pn_gl_loc_length = depth+1;
-
-			if(PH_DEBUG) fprintf(stderr,"	final structure:\n");
-			for (j = 0; j < x->pn_gl_loc_length; j++) {
-				if(PH_DEBUG) fprintf(stderr,"	%d: %d\n", j, x->pn_gl_loc[j]);
-			}
-		}
-		else {
-			if(PH_DEBUG) fprintf(stderr,"	preset_node: no matching hub found\n");
-		}
-
-		// finally if this is the first time we are creating the object, old_location should be the same as the current location
-		if (x->pn_old_gl_loc_length == 0) {
-			x->pn_old_gl_loc = x->pn_gl_loc;
-			x->pn_old_gl_loc_length = x->pn_gl_loc_length;
-		}
-	}
+    if(PH_DEBUG) fprintf(stderr,"node_update_glist_location\n");
+    // location is calculated in respect to the hub (if any), otherwise it is 0
+    t_preset_hub *h;
+    t_canvas *c = x->pn_canvas;
+    int found = 0;
+
+    // do all this only if we are already paired with a hub
+    if (x->pn_hub)
+    {
+        if (x->pn_old_gl_loc && x->pn_old_gl_loc != x->pn_gl_loc)
+            free(x->pn_old_gl_loc);
+        x->pn_old_gl_loc = x->pn_gl_loc;
+        x->pn_old_gl_loc_length = x->pn_gl_loc_length;
+    
+        x->pn_gl_loc = NULL;
+        x->pn_gl_loc_length = 0;
+
+        // let's try to find our hub (if any)
+        int depth = 0;
+        while (!found && c)
+        {
+            if (c->gl_phub)
+            {
+                if(PH_DEBUG) fprintf(stderr,"    gl_phub != NULL\n");
+                h = c->gl_phub;
+                while (h)
+                {
+                    if(PH_DEBUG) fprintf(stderr,"    analyzing hub\n");
+                    if (!compare_hub_node_names(h->ph_name, x->pn_hub_name))
+                    {
+                        if(PH_DEBUG) fprintf(stderr,"    found a match\n");
+                        found = 1;
+                        break;
+                    }
+                    h = h->ph_next;
+                }
+            }
+            if (found) break; /* need to stop the main while loop here
+                                 before we increase depth unnecessarily below
+                                 otherwise hubs in subpatches will fail to pair
+                                 its local nodes */
+            c = c->gl_owner;
+            if (c)
+                depth++;
+        }
+
+        if (found)
+        {
+
+            if(PH_DEBUG) fprintf(stderr,"    depth = %d\n", depth);
+    
+            // allocate depth array
+            x->pn_gl_loc = (int*)calloc(depth+1, sizeof(x->pn_gl_loc));
+
+            // now let's figure out where each of the child gobj's location is
+            // starting from the back
+            int i = 0;    // iteration within each gl_list
+            int j = 0;    // number of gl_list to traverse
+            c = x->pn_canvas;
+            t_gobj *g = c->gl_list;
+            t_gobj *target = (t_gobj *)x;
+
+            for (j = depth; j >= 0; j--)
+            {
+                /* have to do sanity check for g in the event this is run at
+                   patch creation time */
+                while (g && g != target)
+                {
+                    g = g->g_next;
+                    i++;
+                    //if(PH_DEBUG) fprintf(stderr,"    searching... %d\n", i);
+                }
+                /* even if the g fails sanity check due to creation time,
+                   it will still land on the last created element whose pointer
+                   at this point is still null since this means this is being
+                   called at the end of the preset_node_new call */
+                if (PH_DEBUG)
+                    fprintf(stderr,"    location = %d %lx %lx\n",
+                        i, (t_int)g, (t_int)target);
+                x->pn_gl_loc[j] = i;
+
+                /* now readjust the target, c, g, and i variables for the
+                   next level up */
+                if (c->gl_owner)
+                {
+                    target = (t_gobj *)c;
+                    c = c->gl_owner;
+                    g = c->gl_list;
+                    i = 0;
+                }
+            }
+            x->pn_gl_loc_length = depth+1;
+
+            if(PH_DEBUG) fprintf(stderr,"    final structure:\n");
+            for (j = 0; j < x->pn_gl_loc_length; j++)
+            {
+                if(PH_DEBUG) fprintf(stderr,"    %d: %d\n", j, x->pn_gl_loc[j]);
+            }
+        }
+        else
+        {
+            if(PH_DEBUG)
+                fprintf(stderr,"    preset_node: no matching hub found\n");
+        }
+
+        /* finally if this is the first time we are creating the object,
+           old_location should be the same as the current location */
+        if (x->pn_old_gl_loc_length == 0)
+        {
+            x->pn_old_gl_loc = x->pn_gl_loc;
+            x->pn_old_gl_loc_length = x->pn_gl_loc_length;
+        }
+    }
 }
 
-// this is called during the canvas creation (e.g. at load time) as part of pre-loadbang event,
-// during object creation (in case it is manually created), as well as when hubs try to query
-// nodes that have not been paired yet. 
+/* this is called during the canvas creation (e.g. at load time) as part of
+   pre-loadbang event, during object creation (in case it is manually created),
+   as well as when hubs try to query nodes that have not been paired yet.  */
 void preset_node_seek_hub(t_preset_node *x)
 {
-	if(PH_DEBUG) fprintf(stderr,"preset_node_seek_hub %lx\n", (t_int)x->pn_hub);
-	if (we_are_undoing)
-		return;
-	t_canvas *y = x->pn_canvas;
-	t_preset_hub *h;
-
-	if (!x->pn_hub) {
-		if(PH_DEBUG) fprintf(stderr,"	have to seek\n");
-		while (!x->pn_hub && y) {
-			h = y->gl_phub;
-			while (h) {
-				if (!compare_hub_node_names(h->ph_name, x->pn_hub_name)) {
-					x->pn_hub = h;
-					if(PH_DEBUG) fprintf(stderr,"	node found hub\n");
-					// update our location in respect to the newfound hub
-					preset_node_update_my_glist_location(x);
-					// add a node on the hub's list of nodes and copy location to its struct
-					preset_hub_add_a_node(x->pn_hub, x);
-					// reflect that this node is paired in the global list of all existing nodes
-					glob_preset_node_list_update_paired(x, 1);		
-					break;
-				}
-				h = h->ph_next;			
-			}
-			y = y->gl_owner;
-		}
-	}
+    if(PH_DEBUG) fprintf(stderr,"preset_node_seek_hub %lx\n", (t_int)x->pn_hub);
+    if (we_are_undoing)
+        return;
+    t_canvas *y = x->pn_canvas;
+    t_preset_hub *h;
+
+    if (!x->pn_hub)
+    {
+        if(PH_DEBUG) fprintf(stderr,"    have to seek\n");
+        while (!x->pn_hub && y)
+        {
+            h = y->gl_phub;
+            while (h)
+            {
+                if (!compare_hub_node_names(h->ph_name, x->pn_hub_name))
+                {
+                    x->pn_hub = h;
+                    if(PH_DEBUG) fprintf(stderr,"    node found hub\n");
+                    // update our location in respect to the newfound hub
+                    preset_node_update_my_glist_location(x);
+                    /* add a node on the hub's list of nodes and copy
+                       location to its struct */
+                    preset_hub_add_a_node(x->pn_hub, x);
+                    /* reflect that this node is paired in the global list
+                       of all existing nodes */
+                    glob_preset_node_list_update_paired(x, 1);        
+                    break;
+                }
+                h = h->ph_next;            
+            }
+            y = y->gl_owner;
+        }
+    }
 }
 
 static int preset_node_location_changed(t_preset_node *x)
 {
-	int i;
-	if (x->pn_old_gl_loc_length != x->pn_gl_loc_length) {
-		return(1);
-	}
-	for (i = 0; i < x->pn_gl_loc_length; i++) {
-		if (x->pn_gl_loc[i] != x->pn_old_gl_loc[i])
-			return(1);
-	}
-	return(0);
+    int i;
+    if (x->pn_old_gl_loc_length != x->pn_gl_loc_length)
+    {
+        return(1);
+    }
+    for (i = 0; i < x->pn_gl_loc_length; i++)
+    {
+        if (x->pn_gl_loc[i] != x->pn_old_gl_loc[i])
+            return(1);
+    }
+    return(0);
 }
 
 static void preset_node_anything(t_preset_node *x, t_symbol *s, int argc, t_atom *argv)
 {
-	if (PH_DEBUG) fprintf(stderr,"preset_node_anything %lx\n", (t_int)x);
-	int i;
-	alist_list(&x->pn_val, 0, argc, argv);
-	if(PH_DEBUG) {
-		if (x->pn_val.l_vec->l_a.a_type == A_SYMBOL)
-			fprintf(stderr,"	%lx data is %s\n", (t_int)x, x->pn_val.l_vec->l_a.a_w.w_symbol->s_name);
-		else if (x->pn_val.l_vec->l_a.a_type == A_FLOAT)
-			fprintf(stderr,"	%lx data is %f\n", (t_int)x, x->pn_val.l_vec->l_a.a_w.w_float);
-	}
-	// check for pointers and warn user presetting them has not been tested
+    if (PH_DEBUG) fprintf(stderr,"preset_node_anything %lx\n", (t_int)x);
+    int i;
+    alist_list(&x->pn_val, 0, argc, argv);
+    if (PH_DEBUG)
+    {
+        if (x->pn_val.l_vec->l_a.a_type == A_SYMBOL)
+            fprintf(stderr,"    %lx data is %s\n",
+                (t_int)x, x->pn_val.l_vec->l_a.a_w.w_symbol->s_name);
+        else if (x->pn_val.l_vec->l_a.a_type == A_FLOAT)
+            fprintf(stderr,"    %lx data is %f\n",
+                (t_int)x, x->pn_val.l_vec->l_a.a_w.w_float);
+    }
+    // check for pointers and warn user presetting them has not been tested
     for (i = 0; i < x->pn_val.l_n; i++)
     {
         if (x->pn_val.l_vec[i].l_a.a_type == A_POINTER)
         {
-			pd_error(x, "preset_node preset received a pointer as part of a list--this has not been tested, use at your own risk and please report any successes/failures. thank you!");
-			break;
+            pd_error(x, "preset_node preset received a pointer as part "
+                        "of a list--this has not been tested, use at your "
+                        "own risk and please report any successes/failures. "
+                        "Thank you!");
+            break;
         }
     }
-	
+    
 }
 
-	//=============== following functions are for interaction with the hub/pd =================//
+//======== following functions are for interaction with the hub/pd =======//
 
 int preset_node_check_location(t_preset_node *x)
 {
-	int result;
-	if (x->pn_hub) {
-		preset_node_update_my_glist_location(x);
-		return(preset_node_location_changed(x));
-	}
-	return(0);
+    int result;
+    if (x->pn_hub)
+    {
+        preset_node_update_my_glist_location(x);
+        return(preset_node_location_changed(x));
+    }
+    return(0);
 }
 
 void preset_node_request_hub_recall(t_preset_node *x, t_float f)
 {
-	if (x->pn_hub)
-		preset_hub_recall(x->pn_hub, f);
+    if (x->pn_hub)
+        preset_hub_recall(x->pn_hub, f);
 }
 
 void preset_node_request_hub_store(t_preset_node *x, t_float f)
 {
-	if (x->pn_hub)
-		preset_hub_store(x->pn_hub, f);
+    if (x->pn_hub)
+        preset_hub_store(x->pn_hub, f);
 }
 
 void preset_node_request_hub_read(t_preset_node *x, t_symbol *filename)
 {
-	if (x->pn_hub)
-		preset_hub_read(x->pn_hub, filename);
+    if (x->pn_hub)
+        preset_hub_read(x->pn_hub, filename);
 }
 
 void preset_node_request_hub_write(t_preset_node *x, t_symbol *filename)
 {
-	if (x->pn_hub)
-		preset_hub_write(x->pn_hub, filename);
+    if (x->pn_hub)
+        preset_hub_write(x->pn_hub, filename);
 }
 
 void preset_node_request_hub_readpreset(t_preset_node *x, t_symbol *filename)
 {
-	if (x->pn_hub)
-		preset_hub_readpreset(x->pn_hub, filename);
+    if (x->pn_hub)
+        preset_hub_readpreset(x->pn_hub, filename);
 }
 
-void preset_node_request_hub_writepreset(t_preset_node *x, t_symbol *filename, float preset)
+void preset_node_request_hub_writepreset(t_preset_node *x, t_symbol *filename,
+    float preset)
 {
-	if (x->pn_hub)
-		preset_hub_writepreset(x->pn_hub, filename, preset);
+    if (x->pn_hub)
+        preset_hub_writepreset(x->pn_hub, filename, preset);
 }
 
 void preset_node_set_and_output_value(t_preset_node *x, t_alist val)
 {
-	if(PH_DEBUG) fprintf(stderr,"preset_node_set_and_output_value %lx\n", (t_int)x);
-	t_atom *outv;
-	if (val.l_n > 0) {
-		alist_clear(&x->pn_val);
-		alist_clone(&val, &x->pn_val);
-		XL_ATOMS_ALLOCA(outv, x->pn_val.l_n);
-		alist_toatoms(&x->pn_val, outv);
-		outlet_list(x->pn_outlet, &s_list, x->pn_val.l_n, outv);
-		if(PH_DEBUG) {
-			if (outv->a_type == A_SYMBOL)
-				fprintf(stderr,"	%lx outputs %s\n", (t_int)x, outv->a_w.w_symbol->s_name);
-			else if (outv->a_type == A_FLOAT)
-				fprintf(stderr,"	%lx outputs %f\n", (t_int)x, outv->a_w.w_float);
-		}
-		XL_ATOMS_FREEA(outv, x->pn_val.l_n);
-	}
+    if(PH_DEBUG)
+        fprintf(stderr,"preset_node_set_and_output_value %lx\n", (t_int)x);
+    t_atom *outv;
+    if (val.l_n > 0)
+    {
+        alist_clear(&x->pn_val);
+        alist_clone(&val, &x->pn_val);
+        XL_ATOMS_ALLOCA(outv, x->pn_val.l_n);
+        alist_toatoms(&x->pn_val, outv);
+        outlet_list(x->pn_outlet, &s_list, x->pn_val.l_n, outv);
+        if(PH_DEBUG)
+        {
+            if (outv->a_type == A_SYMBOL)
+                fprintf(stderr,"    %lx outputs %s\n",
+                    (t_int)x, outv->a_w.w_symbol->s_name);
+            else if (outv->a_type == A_FLOAT)
+                fprintf(stderr,"    %lx outputs %f\n",
+                    (t_int)x, outv->a_w.w_float);
+        }
+        XL_ATOMS_FREEA(outv, x->pn_val.l_n);
+    }
 }
 
 void preset_node_clear(t_preset_node *x, t_float f)
 {
-	t_atom ap[2];
-	t_preset_hub_data *hd2;
-	t_node_preset *np1, *np2;
-	int changed = 0;
-
-	if(PH_DEBUG) fprintf(stderr,"preset_node_clear %d\n", (int)f);
-
-	if (x->pn_hub) {
-		hd2 = x->pn_hub->ph_data;
-
-		// only remove this object's preset
-		if (hd2) {
-			if(PH_DEBUG) fprintf(stderr,"	got ph_data\n");
-			while (hd2 && hd2->phd_node != x) {
-				hd2 = hd2->phd_next;
-			}
-			if (hd2) {
-				np1 = hd2->phd_npreset;
-				// if it is first one
-				if (np1->np_preset == (int)f) {
-					hd2->phd_npreset = np1->np_next;
-					if (np1->np_val.l_n)
-						alist_clear(&np1->np_val);
-					freebytes(np1, sizeof(*np1));
-					changed = 1;
-					if(PH_DEBUG) fprintf(stderr,"	found preset to delete (first)\n");
-				} else {
-					while (np1) {
-						np2 = np1->np_next;
-						if (np2 && np2->np_preset == (int)f) {
-							np1->np_next = np2->np_next;
-							if (np2->np_val.l_n)
-								alist_clear(&np2->np_val);
-							freebytes(np2, sizeof(*np2));
-							changed = 1;
-							if(PH_DEBUG) fprintf(stderr,"	found preset to delete\n");
-							break;
-						}
-						np1 = np1->np_next;
-					}
-				}
-			}
-		}
-	}
-	if (changed && !x->pn_hub->ph_extern_file) canvas_dirty(x->pn_hub->ph_canvas, 1);
-
-	SETFLOAT(ap+0, f);
-	SETFLOAT(ap+1, (t_float)changed);
-	outlet_anything(x->pn_hub->ph_outlet, gensym("node_clear"), 2, ap);
+    t_atom ap[2];
+    t_preset_hub_data *hd2;
+    t_node_preset *np1, *np2;
+    int changed = 0;
+
+    if(PH_DEBUG) fprintf(stderr,"preset_node_clear %d\n", (int)f);
+
+    if (x->pn_hub)
+    {
+        hd2 = x->pn_hub->ph_data;
+
+        // only remove this object's preset
+        if (hd2)
+        {
+            if(PH_DEBUG) fprintf(stderr,"    got ph_data\n");
+            while (hd2 && hd2->phd_node != x)
+            {
+                hd2 = hd2->phd_next;
+            }
+            if (hd2)
+            {
+                np1 = hd2->phd_npreset;
+                // if it is first one
+                if (np1->np_preset == (int)f)
+                {
+                    hd2->phd_npreset = np1->np_next;
+                    if (np1->np_val.l_n)
+                        alist_clear(&np1->np_val);
+                    freebytes(np1, sizeof(*np1));
+                    changed = 1;
+                    if(PH_DEBUG)
+                        fprintf(stderr,"    found preset to delete (first)\n");
+                }
+                else
+                {
+                    while (np1)
+                    {
+                        np2 = np1->np_next;
+                        if (np2 && np2->np_preset == (int)f)
+                        {
+                            np1->np_next = np2->np_next;
+                            if (np2->np_val.l_n)
+                                alist_clear(&np2->np_val);
+                            freebytes(np2, sizeof(*np2));
+                            changed = 1;
+                            if(PH_DEBUG)
+                                fprintf(stderr,"    found preset to delete\n");
+                            break;
+                        }
+                        np1 = np1->np_next;
+                    }
+                }
+            }
+        }
+    }
+    if (changed && !x->pn_hub->ph_extern_file)
+        canvas_dirty(x->pn_hub->ph_canvas, 1);
+
+    SETFLOAT(ap+0, f);
+    SETFLOAT(ap+1, (t_float)changed);
+    outlet_anything(x->pn_hub->ph_outlet, gensym("node_clear"), 2, ap);
 }
 
 
-void preset_node_clearall(t_preset_node *x, t_float f) {
-	if (x->pn_hub)
-		preset_hub_clear(x->pn_hub, f);
+void preset_node_clearall(t_preset_node *x, t_float f)
+{
+    if (x->pn_hub)
+        preset_hub_clear(x->pn_hub, f);
 }
 
-void preset_node_reset(t_preset_node *x) {
-	if (x->pn_hub)
-		preset_hub_reset(x->pn_hub);
+void preset_node_reset(t_preset_node *x)
+{
+    if (x->pn_hub)
+        preset_hub_reset(x->pn_hub);
 }
 
-void preset_node_purge(t_preset_node *x) {
-	if (x->pn_hub)
-		preset_hub_purge(x->pn_hub);
+void preset_node_purge(t_preset_node *x)
+{
+    if (x->pn_hub)
+        preset_hub_purge(x->pn_hub);
 }
 
-void preset_node_sort(t_preset_node *x, t_float f) {
-	if (x->pn_hub)
-		preset_hub_sort(x->pn_hub, f);
+void preset_node_sort(t_preset_node *x, t_float f)
+{
+    if (x->pn_hub)
+        preset_hub_sort(x->pn_hub, f);
 }
 
-	//==================== end functions are for interaction with the hub =====================//
+//=========== end functions are for interaction with the hub ============//
 
-static void preset_node_set(t_preset_node *x, t_symbol *s, int argc, t_atom *argv)
+static void preset_node_set(t_preset_node *x, t_symbol *s, int argc,
+    t_atom *argv)
 {
-	if(PH_DEBUG) fprintf(stderr,"preset_node_set %d\n", argc);
-
-	if (argc == 0) {
-		x->pn_hub_name->a_type = A_SYMBOL;
-		x->pn_hub_name->a_w.w_symbol = &s_;
-		if (PH_DEBUG) fprintf(stderr,"	name is null symbol\n");		
-	} else {
-		if (argv[0].a_type == A_SYMBOL)
-			SETSYMBOL(x->pn_hub_name, atom_getsymbolarg(0, argc, argv));
-		else
-			SETFLOAT(x->pn_hub_name, atom_getfloatarg(0, argc, argv));
-		if(PH_DEBUG) {
-			if (x->pn_hub_name->a_type == A_SYMBOL) fprintf(stderr,"	name is a symbol %s\n", atom_getsymbol(x->pn_hub_name)->s_name);
-			else fprintf(stderr,"	name is a float %f\n", atom_getfloat(x->pn_hub_name));
-		}
-	}
-
-	if (x->pn_hub) {
-		preset_hub_delete_a_node(x->pn_hub, x);
-		glob_preset_node_list_update_paired(x, 1);
-	}
-
-	x->pn_hub = NULL;
-	preset_node_seek_hub(x);
+    if(PH_DEBUG) fprintf(stderr,"preset_node_set %d\n", argc);
+
+    if (argc == 0)
+    {
+        x->pn_hub_name->a_type = A_SYMBOL;
+        x->pn_hub_name->a_w.w_symbol = &s_;
+        if (PH_DEBUG) fprintf(stderr,"    name is null symbol\n");        
+    }
+    else
+    {
+        if (argv[0].a_type == A_SYMBOL)
+            SETSYMBOL(x->pn_hub_name, atom_getsymbolarg(0, argc, argv));
+        else
+            SETFLOAT(x->pn_hub_name, atom_getfloatarg(0, argc, argv));
+        if(PH_DEBUG)
+        {
+            if (x->pn_hub_name->a_type == A_SYMBOL)
+                fprintf(stderr,"    name is a symbol %s\n",
+                    atom_getsymbol(x->pn_hub_name)->s_name);
+            else fprintf(stderr,"    name is a float %f\n",
+                atom_getfloat(x->pn_hub_name));
+        }
+    }
+
+    if (x->pn_hub)
+    {
+        preset_hub_delete_a_node(x->pn_hub, x);
+        glob_preset_node_list_update_paired(x, 1);
+    }
+
+    x->pn_hub = NULL;
+    preset_node_seek_hub(x);
 }
 
 static void *preset_node_new(t_symbol *s, int argc, t_atom *argv)
 {
-	if(PH_DEBUG) fprintf(stderr,"===preset_node_new===\n");
-	t_glist *glist=(t_glist *)canvas_getcurrent();
-	t_canvas *canvas = (t_canvas *)glist_getcanvas(glist);
+    if (PH_DEBUG) fprintf(stderr,"===preset_node_new===\n");
+    t_glist *glist=(t_glist *)canvas_getcurrent();
+    t_canvas *canvas = (t_canvas *)glist_getcanvas(glist);
 
     t_preset_node *x = (t_preset_node *)pd_new(preset_node_class);
 
-	x->pn_hub_name = (t_atom *)getbytes(sizeof(t_atom));
-
-	// read creation arguments and substitute default for objects without optional arguments
-    if (argc == 0) {	
-		x->pn_hub_name->a_type = A_SYMBOL;
-		x->pn_hub_name->a_w.w_symbol = &s_;
-		if (PH_DEBUG) fprintf(stderr,"	name is null symbol\n");
-	} else {
-		if (argv[0].a_type == A_SYMBOL)
-			SETSYMBOL(x->pn_hub_name, atom_getsymbolarg(0, argc, argv));
-		else
-			SETFLOAT(x->pn_hub_name, atom_getfloatarg(0, argc, argv));
-		if(PH_DEBUG) {
-			if (x->pn_hub_name->a_type == A_SYMBOL) fprintf(stderr,"	name is a symbol %s\n", atom_getsymbol(x->pn_hub_name)->s_name);
-			else fprintf(stderr,"	name is a float %f\n", atom_getfloat(x->pn_hub_name));
-		}
-	}
-
-	x->pn_canvas = canvas;
-	t_canvas *y = x->pn_canvas;
-	//t_preset_hub *h;
-	alist_init(&x->pn_val);
-
-	x->pn_hub = NULL;
-	x->pn_gl_loc_length = 0;
-	x->pn_gl_loc = NULL;
-	x->pn_old_gl_loc_length = 0;  
-	x->pn_old_gl_loc = NULL;
- 	x->pn_outlet = outlet_new(&x->pn_obj, 0);
-
-	glob_preset_node_list_add(x);
-
-	// now we seek our potential hub (if it exists), this is also called as part of 
-	// pre-loadbang if the patch is being loaded (this one is for manually created objects)
-	// do this only if we are not undoing, otherwise, we'll have the undo do it for us
-	// once it has repositioned objects to their original locations
-	// (the undo check is done inside the preset_node_seek_hub)
-	preset_node_seek_hub(x);
+    x->pn_hub_name = (t_atom *)getbytes(sizeof(t_atom));
+
+    /* read creation arguments and substitute default for objects without
+       optional arguments */
+    if (argc == 0)
+    {    
+        x->pn_hub_name->a_type = A_SYMBOL;
+        x->pn_hub_name->a_w.w_symbol = &s_;
+        if (PH_DEBUG) fprintf(stderr,"    name is null symbol\n");
+    }
+    else
+    {
+        if (argv[0].a_type == A_SYMBOL)
+            SETSYMBOL(x->pn_hub_name, atom_getsymbolarg(0, argc, argv));
+        else
+            SETFLOAT(x->pn_hub_name, atom_getfloatarg(0, argc, argv));
+        if(PH_DEBUG)
+        {
+            if (x->pn_hub_name->a_type == A_SYMBOL)
+                fprintf(stderr,"    name is a symbol %s\n",
+                    atom_getsymbol(x->pn_hub_name)->s_name);
+            else fprintf(stderr,"    name is a float %f\n",
+                atom_getfloat(x->pn_hub_name));
+        }
+    }
+
+    x->pn_canvas = canvas;
+    t_canvas *y = x->pn_canvas;
+    //t_preset_hub *h;
+    alist_init(&x->pn_val);
+
+    x->pn_hub = NULL;
+    x->pn_gl_loc_length = 0;
+    x->pn_gl_loc = NULL;
+    x->pn_old_gl_loc_length = 0;  
+    x->pn_old_gl_loc = NULL;
+     x->pn_outlet = outlet_new(&x->pn_obj, 0);
+
+    glob_preset_node_list_add(x);
+
+    /* now we seek our potential hub (if it exists), this is also called as
+       part of pre-loadbang if the patch is being loaded (this one is for
+       manually created objects) do this only if we are not undoing, otherwise,
+       we'll have the undo do it for us once it has repositioned objects to
+       their original locations (the undo check is done inside the
+       preset_node_seek_hub) */
+    preset_node_seek_hub(x);
 
     return(x);
 }
 
 static void preset_node_free(t_preset_node* x)
 {
-	// deactivate a node on the hub's list of nodes
-	if (x->pn_hub)
-		preset_hub_delete_a_node(x->pn_hub, x);
-	glob_preset_node_list_delete(x);
-
-	alist_clear(&x->pn_val);
-
-	// the two arrays can point to same locations so here we prevent double free
-	// (this is only possible initially when the object is first instantiated)
-	if (x->pn_gl_loc != x->pn_old_gl_loc) {
-		free(x->pn_gl_loc);
-		free(x->pn_old_gl_loc);
-	} else {
-		free(x->pn_gl_loc);
-	}	
-	//if (x->pn_hub_name->a_type == A_SYMBOL && x->pn_hub_name->a_w.w_symbol == &s_)
-	if (x->pn_hub_name)
-		freebytes(x->pn_hub_name, sizeof(t_atom));
+    // deactivate a node on the hub's list of nodes
+    if (x->pn_hub)
+        preset_hub_delete_a_node(x->pn_hub, x);
+    glob_preset_node_list_delete(x);
+
+    alist_clear(&x->pn_val);
+
+    /* the two arrays can point to same locations so here we prevent double
+       free (this is only possible initially when the object is first
+       instantiated) */
+    if (x->pn_gl_loc != x->pn_old_gl_loc)
+    {
+        free(x->pn_gl_loc);
+        free(x->pn_old_gl_loc);
+    }
+    else
+    {
+        free(x->pn_gl_loc);
+    }    
+    //if (x->pn_hub_name->a_type == A_SYMBOL &&
+    //    x->pn_hub_name->a_w.w_symbol == &s_)
+    if (x->pn_hub_name)
+        freebytes(x->pn_hub_name, sizeof(t_atom));
 }
 
 void preset_node_setup(void)
 {
-	preset_node_class = class_new(gensym("preset_node"), 
-	    (t_newmethod)preset_node_new, (t_method)preset_node_free, 
-	    sizeof(t_preset_node), 0, A_GIMME, 0);
-
-	// have to call this after everything has loaded, otherwise, the hub may not yet exist
-	// we do this using pre-loadbang call that is issued before other loadbangs, otherwise
-	// out-of-order loadbangs can issue preset recall before the preset has been properly
-	// configured
-	class_addmethod(preset_node_class, (t_method)preset_node_seek_hub,
+    preset_node_class = class_new(gensym("preset_node"), 
+        (t_newmethod)preset_node_new, (t_method)preset_node_free, 
+        sizeof(t_preset_node), 0, A_GIMME, 0);
+
+    /* have to call this after everything has loaded, otherwise, the hub may
+       not yet exist we do this using pre-loadbang call that is issued before
+       other loadbangs, otherwise out-of-order loadbangs can issue preset
+       recall before the preset has been properly configured */
+    class_addmethod(preset_node_class, (t_method)preset_node_seek_hub,
         gensym("pre-loadbang"), 0);
 
     class_addmethod(preset_node_class, (t_method)preset_node_request_hub_recall,
@@ -747,13 +880,15 @@ void preset_node_setup(void)
         gensym("read"), A_DEFSYM, 0);
     class_addmethod(preset_node_class, (t_method)preset_node_request_hub_write,
         gensym("write"), A_DEFSYM, 0);
-    class_addmethod(preset_node_class, (t_method)preset_node_request_hub_readpreset,
+    class_addmethod(preset_node_class,
+        (t_method)preset_node_request_hub_readpreset,
         gensym("readpreset"), A_DEFSYM, A_DEFFLOAT, 0);
-    class_addmethod(preset_node_class, (t_method)preset_node_request_hub_writepreset,
+    class_addmethod(preset_node_class,
+        (t_method)preset_node_request_hub_writepreset,
         gensym("writepreset"), A_DEFSYM, A_DEFFLOAT, 0);
 
-	// we use anything to cover virtually all presetable types of data
-	class_addanything(preset_node_class, preset_node_anything);
+    // we use anything to cover virtually all presetable types of data
+    class_addanything(preset_node_class, preset_node_anything);
 }
 
 //====================== end preset_node ===========================//
@@ -764,1445 +899,1867 @@ void preset_node_setup(void)
 
 typedef enum
 {
-	H_NONE,
+    H_NONE,
     H_NODE,
-	H_LOCATION,
+    H_LOCATION,
     H_PRESET,
     H_PRESET_DATA
 }  t_hub_parser;
 
-/*	syntax for saving a preset hub (all in a single line, here it is
-	separated for legibility sakes):
-	#X obj X Y preset_hub NAME(optional) file(optional) 1(optional) %hidden%
-	%node% LOCATION_ARRAY_LENGTH LOCATION_ARRAY_(INT) 1 2 3 etc.
-	%preset% 1 data
-	%preset% 2 4
-	etc
-	%node% 2 0
-	%preset% 1 5.561
-	%preset% 3 7.00001 anything including lists
-	%preset% 5 some_text
-	;
-
-	NB: %hidden% is used to hide optional arguments following that argument
-		it can be used by any other object as well
-
-	file(optional) arg is used to tell hub it will be dealing exclusively with
-	external files (this prevents dirty flag when storing new presets)
-	
-	1(optional) arg is used for k12 mode to prevent copying and pasting
-	multiple hubs with same names
+/*    syntax for saving a preset hub (all in a single line, here it is
+    separated for legibility sakes):
+    #X obj X Y preset_hub NAME(optional) file(optional) 1(optional) %hidden%
+    %node% LOCATION_ARRAY_LENGTH LOCATION_ARRAY_(INT) 1 2 3 etc.
+    %preset% 1 data
+    %preset% 2 4
+    etc
+    %node% 2 0
+    %preset% 1 5.561
+    %preset% 3 7.00001 anything including lists
+    %preset% 5 some_text
+    ;
+
+    NB: %hidden% is used to hide optional arguments following that argument
+        it can be used by any other object as well
+
+    file(optional) arg is used to tell hub it will be dealing exclusively with
+    external files (this prevents dirty flag when storing new presets)
+    
+    1(optional) arg is used for k12 mode to prevent copying and pasting
+    multiple hubs with same names
 */
 
 void preset_hub_save(t_gobj *z, t_binbuf *b)
 {
-	if(PH_DEBUG) fprintf(stderr,"preset_hub_save\n");
-	t_atom *outv;
-	int i;
-	t_preset_hub_data *phd;
-	t_node_preset *np;
-
-	t_preset_hub *x = (t_preset_hub *)z;
-
-	binbuf_addv(b, "ssii", gensym("#X"), gensym("obj"), (int)x->ph_obj.te_xpix,
-		(int)x->ph_obj.te_ypix);
-
-	binbuf_addbinbuf(b, x->ph_obj.te_binbuf);
-
-	binbuf_addv(b, "s", gensym("%hidden%"));
-
-	// save preset data with the patch only if we are not
-	// saving into an external file
-	if (!x->ph_extern_file) {
-
-		phd = x->ph_data;
-		while (phd) {
-			if(PH_DEBUG) fprintf(stderr,"	saving phd\n");
-			// designate a node and state whether it is active or disabled
-			// (disabled nodes are ones that have presets saved but have been deleted since--
-			// we keep these in the case of undo actions during the session that may go beyond
-			// saving something into a file)
-			binbuf_addv(b, "si", gensym("%node%"), phd->phd_pn_gl_loc_length);
-
-			// gather info about the length of the node's location and store it
-			for (i = 0; i < phd->phd_pn_gl_loc_length; i++) {
-				binbuf_addv(b,"i", (int)phd->phd_pn_gl_loc[i]);
-			}
-
-			// save preset data
-			np = phd->phd_npreset;
-			while (np) {
-				if (np->np_val.l_n > 0) {
-					binbuf_addv(b, "si", gensym("%preset%"), (int)np->np_preset);
-					for (i = 0; i < np->np_val.l_n; i++) {
-						if (np->np_val.l_vec[i].l_a.a_type == A_FLOAT)
-							binbuf_addv(b, "f", np->np_val.l_vec[i].l_a.a_w.w_float);
-						else if (np->np_val.l_vec[i].l_a.a_type == A_SYMBOL)
-							binbuf_addv(b, "s", np->np_val.l_vec[i].l_a.a_w.w_symbol);	
-					}
-				}
-				np = np->np_next;
-			}
-
-			phd = phd->phd_next;
-		}
-	}
-	if(PH_DEBUG) fprintf(stderr,"	done\n");
-	binbuf_addv(b, ";");
+    if(PH_DEBUG) fprintf(stderr,"preset_hub_save\n");
+    t_atom *outv;
+    int i;
+    t_preset_hub_data *phd;
+    t_node_preset *np;
+
+    t_preset_hub *x = (t_preset_hub *)z;
+
+    binbuf_addv(b, "ssii", gensym("#X"), gensym("obj"), (int)x->ph_obj.te_xpix,
+        (int)x->ph_obj.te_ypix);
+
+    binbuf_addbinbuf(b, x->ph_obj.te_binbuf);
+
+    binbuf_addv(b, "s", gensym("%hidden%"));
+
+    /* save preset data with the patch only if we are not
+       saving into an external file */
+    if (!x->ph_extern_file)
+    {
+
+        phd = x->ph_data;
+        while (phd)
+        {
+            if(PH_DEBUG) fprintf(stderr,"    saving phd\n");
+            /* designate a node and state whether it is active or disabled
+               (disabled nodes are ones that have presets saved but have been
+               deleted since-- we keep these in the case of undo actions during
+               the session that may go beyond saving something into a file) */
+            binbuf_addv(b, "si", gensym("%node%"), phd->phd_pn_gl_loc_length);
+
+            // gather info about the length of the node's location and store it
+            for (i = 0; i < phd->phd_pn_gl_loc_length; i++)
+            {
+                binbuf_addv(b,"i", (int)phd->phd_pn_gl_loc[i]);
+            }
+
+            // save preset data
+            np = phd->phd_npreset;
+            while (np)
+            {
+                if (np->np_val.l_n > 0)
+                {
+                    binbuf_addv(b, "si", gensym("%preset%"),
+                        (int)np->np_preset);
+                    for (i = 0; i < np->np_val.l_n; i++)
+                    {
+                        if (np->np_val.l_vec[i].l_a.a_type == A_FLOAT)
+                            binbuf_addv(b, "f",
+                                np->np_val.l_vec[i].l_a.a_w.w_float);
+                        else if (np->np_val.l_vec[i].l_a.a_type == A_SYMBOL)
+                            binbuf_addv(b, "s",
+                                np->np_val.l_vec[i].l_a.a_w.w_symbol);    
+                    }
+                }
+                np = np->np_next;
+            }
+
+            phd = phd->phd_next;
+        }
+    }
+    if (PH_DEBUG) fprintf(stderr,"    done\n");
+    binbuf_addv(b, ";");
 }
 
 void preset_hub_bang(t_preset_hub *x)
 {
-	t_atom ap[1];
-	SETFLOAT(ap+0, (t_float)x->ph_preset);
+    t_atom ap[1];
+    SETFLOAT(ap+0, (t_float)x->ph_preset);
     outlet_anything(x->ph_outlet, gensym("current"), 1, ap);
 }
 
 void preset_hub_recall(t_preset_hub *x, t_float f)
 {
-	if(PH_DEBUG) fprintf(stderr,"hub_recall\n");
-	t_atom ap[2];
-	t_preset_hub_data *hd;
-	t_node_preset *np;
-	t_float valid = 0;
-
-	if (f>=0) {
-		// check if preset exists and apply it
-		if (x->ph_data) {
-			hd = x->ph_data;
-			while (hd) {
-				if(PH_DEBUG) fprintf(stderr,"   searching\n");
-				// now check if the object is active (node pointer is not NULL)
-				if (hd->phd_node) {
-					if(PH_DEBUG) fprintf(stderr,"	object active\n");
-					if (hd->phd_npreset) {
-						if(PH_DEBUG) fprintf(stderr,"	object has presets\n");
-						np = hd->phd_npreset;
-						while (np) {
-							if(PH_DEBUG) fprintf(stderr,"	searching presets\n");
-							if (np->np_preset == (int)f) {
-								valid = 1;
-								if(PH_DEBUG) fprintf(stderr,"	valid %d\n", (hd->phd_node ? 1:0));
-								if (np->np_val.l_n > 0)
-									preset_node_set_and_output_value(hd->phd_node, np->np_val);
-								break;
-							}
-							np = np->np_next;
-						}
-					}
-				}
-				hd = hd->phd_next;
-			}
-		}
-		if (valid)
-			x->ph_preset = f;
-		if(PH_DEBUG) fprintf(stderr,"	done\n");
-
-		SETFLOAT(ap+0, f);
-		SETFLOAT(ap+1, (t_float)valid);
-		outlet_anything(x->ph_outlet, gensym("recall"), 2, ap);
-	}
+    if(PH_DEBUG) fprintf(stderr,"hub_recall\n");
+    t_atom ap[2];
+    t_preset_hub_data *hd;
+    t_node_preset *np;
+    t_float valid = 0;
+
+    if (f>=0)
+    {
+        // check if preset exists and apply it
+        if (x->ph_data)
+        {
+            hd = x->ph_data;
+            while (hd)
+            {
+                if(PH_DEBUG) fprintf(stderr,"   searching\n");
+                // now check if the object is active (node pointer is not NULL)
+                if (hd->phd_node)
+                {
+                    if(PH_DEBUG) fprintf(stderr,"    object active\n");
+                    if (hd->phd_npreset)
+                    {
+                        if(PH_DEBUG) fprintf(stderr,"    object has presets\n");
+                        np = hd->phd_npreset;
+                        while (np)
+                        {
+                            if(PH_DEBUG)
+                                fprintf(stderr,"    searching presets\n");
+                            if (np->np_preset == (int)f)
+                            {
+                                valid = 1;
+                                if(PH_DEBUG)
+                                    fprintf(stderr,"    valid %d\n",
+                                        (hd->phd_node ? 1:0));
+                                if (np->np_val.l_n > 0)
+                                    preset_node_set_and_output_value(
+                                        hd->phd_node, np->np_val);
+                                break;
+                            }
+                            np = np->np_next;
+                        }
+                    }
+                }
+                hd = hd->phd_next;
+            }
+        }
+        if (valid)
+            x->ph_preset = f;
+        if(PH_DEBUG) fprintf(stderr,"    done\n");
+
+        SETFLOAT(ap+0, f);
+        SETFLOAT(ap+1, (t_float)valid);
+        outlet_anything(x->ph_outlet, gensym("recall"), 2, ap);
+    }
 }
 
 void preset_hub_store(t_preset_hub *h, t_float f)
 {
-	if(PH_DEBUG) fprintf(stderr,"preset_hub_store\n");
-	t_atom ap[2];
-	t_preset_hub_data *hd1;
-	t_node_preset *np1, *np2;
-	int overwrite;
-	t_atom val;
-	int changed = 0;
-
-	np1 = NULL;
-	np2 = NULL;
-
-	int dspstate = canvas_suspend_dsp();
-
-	if (f>=0) {
-		//check if there are any existing nodes
-		if (h->ph_data) {
-			hd1 = h->ph_data;
-			while (hd1) {
-				if(PH_DEBUG) fprintf(stderr,"	analyzing phd\n");
-				if (hd1->phd_node) {
-					if(PH_DEBUG) fprintf(stderr,"	node is active\n");
-					// only if the node is active (not NULL/disabled)
-
-					// reset np1 and np2 from the previous run
-					// (if we have more phd_nodes, stale data will append
-					// new presets to the last phd_node eventually resulting in crash)
-					np1 = NULL;
-					np2 = NULL;
-
-					overwrite = 0;
-					if (hd1->phd_npreset) {
-						// if this node has already pre-existing presets
-						// first check if there is already one we need to overwrite
-						np2 = hd1->phd_npreset;
-						while (np2) {
-							if (np2->np_preset == (int)f) {
-								if(PH_DEBUG) fprintf(stderr,"	overwriting\n");
-								overwrite = 1;
-								break;
-							}
-							np1 = np2;
-							np2 = np2->np_next;
-						}
-					}
-
-					if (!overwrite && hd1->phd_node->pn_val.l_n > 0) {
-						// we need to create a new preset (this is also true if hd1->phd_npreset is NULL)
-						changed = 1;
-						if(PH_DEBUG) fprintf(stderr,"	creating new preset\n");
-						np2 = (t_node_preset *)t_getbytes(sizeof(*np2));
-						if (np1)
-							np1->np_next = np2;
-						else hd1->phd_npreset = np2;
-						np2->np_preset = (int)f;
-						np2->np_next = NULL;
-					}
-
-					if (hd1->phd_node->pn_val.l_n > 0) {
-						changed = 1;
-						if(PH_DEBUG) {
-							fprintf(stderr,"	node data len = %d, old hub data len = %d\n", hd1->phd_node->pn_val.l_n, np2->np_val.l_n);
-							if (hd1->phd_node->pn_val.l_vec->l_a.a_type == A_SYMBOL)
-								fprintf(stderr,"	%lx outputs %s\n", (t_int)hd1->phd_node, hd1->phd_node->pn_val.l_vec->l_a.a_w.w_symbol->s_name);
-							else if (hd1->phd_node->pn_val.l_vec->l_a.a_type == A_FLOAT)
-								fprintf(stderr,"	%lx outputs %f\n", (t_int)hd1->phd_node, hd1->phd_node->pn_val.l_vec->l_a.a_w.w_float);
-						}
-						alist_clear(&np2->np_val);
-						alist_clone(&hd1->phd_node->pn_val, &np2->np_val);
-						if(PH_DEBUG) {
-							fprintf(stderr,"	node data len = %d, NEW hub data len = %d\n", hd1->phd_node->pn_val.l_n, np2->np_val.l_n);
-							if (hd1->phd_node->pn_val.l_vec->l_a.a_type == A_SYMBOL)
-								fprintf(stderr,"	%lx outputs %s\n", (t_int)hd1->phd_node, np2->np_val.l_vec->l_a.a_w.w_symbol->s_name);
-							else if (hd1->phd_node->pn_val.l_vec->l_a.a_type == A_FLOAT)
-								fprintf(stderr,"	%lx outputs %f\n", (t_int)hd1->phd_node, np2->np_val.l_vec->l_a.a_w.w_float);
-						}
-						// finally if this is the first preset, hd1->phd_npreset will be NULL so,
-						// let's have it point to the newly created n2
-						if (!hd1->phd_npreset)
-							hd1->phd_npreset = np2;
-					}
-				}
-				hd1 = hd1->phd_next;
-			}
-		}
-		canvas_resume_dsp(dspstate);
-
-		if (changed && !h->ph_extern_file) canvas_dirty(h->ph_canvas, 1);
-
-		SETFLOAT(ap+0, f);
-		SETFLOAT(ap+1, 1);
-		outlet_anything(h->ph_outlet, gensym("store"), 2, ap);
-	} else {
-		SETFLOAT(ap+0, f);
-		SETFLOAT(ap+1, 0);
-		outlet_anything(h->ph_outlet, gensym("store"), 2, ap);
-	}
+    if(PH_DEBUG) fprintf(stderr,"preset_hub_store\n");
+    t_atom ap[2];
+    t_preset_hub_data *hd1;
+    t_node_preset *np1, *np2;
+    int overwrite;
+    t_atom val;
+    int changed = 0;
+
+    np1 = NULL;
+    np2 = NULL;
+
+    int dspstate = canvas_suspend_dsp();
+
+    if (f>=0)
+    {
+        //check if there are any existing nodes
+        if (h->ph_data)
+        {
+            hd1 = h->ph_data;
+            while (hd1)
+            {
+                if(PH_DEBUG) fprintf(stderr,"    analyzing phd\n");
+                if (hd1->phd_node)
+                {
+                    if(PH_DEBUG) fprintf(stderr,"    node is active\n");
+                    /* only if the node is active (not NULL/disabled)
+
+                       reset np1 and np2 from the previous run
+                       (if we have more phd_nodes, stale data will append
+                       new presets to the last phd_node eventually resulting
+                       in crash) */
+                    np1 = NULL;
+                    np2 = NULL;
+
+                    overwrite = 0;
+                    if (hd1->phd_npreset)
+                    {
+                        /* if this node has already pre-existing presets
+                           first check if there is already one we need to
+                           overwrite */
+                        np2 = hd1->phd_npreset;
+                        while (np2)
+                        {
+                            if (np2->np_preset == (int)f)
+                            {
+                                if(PH_DEBUG)
+                                    fprintf(stderr,"    overwriting\n");
+                                overwrite = 1;
+                                break;
+                            }
+                            np1 = np2;
+                            np2 = np2->np_next;
+                        }
+                    }
+
+                    if (!overwrite && hd1->phd_node->pn_val.l_n > 0)
+                    {
+                        /* we need to create a new preset (this is also true
+                           if hd1->phd_npreset is NULL) */
+                        changed = 1;
+                        if (PH_DEBUG)
+                            fprintf(stderr,"    creating new preset\n");
+                        np2 = (t_node_preset *)t_getbytes(sizeof(*np2));
+                        if (np1)
+                            np1->np_next = np2;
+                        else hd1->phd_npreset = np2;
+                        np2->np_preset = (int)f;
+                        np2->np_next = NULL;
+                    }
+
+                    if (hd1->phd_node->pn_val.l_n > 0)
+                    {
+                        changed = 1;
+                        if(PH_DEBUG)
+                        {
+                            fprintf(stderr,"    node data len = %d, "
+                                           "old hub data len = %d\n",
+                                hd1->phd_node->pn_val.l_n, np2->np_val.l_n);
+                            if (hd1->phd_node->pn_val.l_vec->l_a.a_type ==
+                                A_SYMBOL)
+                            {
+                                fprintf(stderr,"    %lx outputs %s\n",
+                                    (t_int)hd1->phd_node,
+                                    hd1->phd_node->pn_val.l_vec->l_a.a_w.w_symbol->s_name);
+                            }
+                            else if (hd1->phd_node->pn_val.l_vec->l_a.a_type ==
+                                     A_FLOAT)
+                            {
+                                fprintf(stderr,"    %lx outputs %f\n",
+                                (t_int)hd1->phd_node,
+                                hd1->phd_node->pn_val.l_vec->l_a.a_w.w_float);
+                            }
+                        }
+                        alist_clear(&np2->np_val);
+                        alist_clone(&hd1->phd_node->pn_val, &np2->np_val);
+                        if (PH_DEBUG)
+                        {
+                            fprintf(stderr,"    node data len = %d, "
+                                           "NEW hub data len = %d\n",
+                                hd1->phd_node->pn_val.l_n, np2->np_val.l_n);
+                            if (hd1->phd_node->pn_val.l_vec->l_a.a_type ==
+                                A_SYMBOL)
+                            {
+                                fprintf(stderr,"    %lx outputs %s\n",
+                                    (t_int)hd1->phd_node,
+                                    np2->np_val.l_vec->l_a.a_w.w_symbol->s_name);
+                            }
+                            else if (hd1->phd_node->pn_val.l_vec->l_a.a_type ==
+                                     A_FLOAT)
+                            {
+                                fprintf(stderr,"    %lx outputs %f\n",
+                                    (t_int)hd1->phd_node,
+                                    np2->np_val.l_vec->l_a.a_w.w_float);
+                            }
+                        }
+                        /* finally if this is the first preset,
+                           hd1->phd_npreset will be NULL so, let's have it
+                           point to the newly created n2 */
+                        if (!hd1->phd_npreset)
+                            hd1->phd_npreset = np2;
+                    }
+                }
+                hd1 = hd1->phd_next;
+            }
+        }
+        canvas_resume_dsp(dspstate);
+
+        if (changed && !h->ph_extern_file) canvas_dirty(h->ph_canvas, 1);
+
+        SETFLOAT(ap+0, f);
+        SETFLOAT(ap+1, 1);
+        outlet_anything(h->ph_outlet, gensym("store"), 2, ap);
+    }
+    else
+    {
+        SETFLOAT(ap+0, f);
+        SETFLOAT(ap+1, 0);
+        outlet_anything(h->ph_outlet, gensym("store"), 2, ap);
+    }
 }
 
-int preset_hub_compare_loc(int *h_loc, int h_loc_length, int *n_loc, int n_loc_length)
+int preset_hub_compare_loc(int *h_loc, int h_loc_length, int *n_loc,
+    int n_loc_length)
 {
-	int i;
-	if (h_loc_length != n_loc_length)
-		return(1);
-	for (i = 0; i < h_loc_length; i++) {
-		if (h_loc[i] != n_loc[i])
-			return(1);
-	}
-	return(0);
+    int i;
+    if (h_loc_length != n_loc_length)
+        return(1);
+    for (i = 0; i < h_loc_length; i++)
+    {
+        if (h_loc[i] != n_loc[i])
+            return(1);
+    }
+    return(0);
 }
 
 void preset_hub_add_a_node(t_preset_hub *h, t_preset_node *x)
 {
-	t_preset_hub_data *hd1, *hd2;
-	int found = 0;
-	int i;
-
-	hd1 = NULL;
-	hd2 = NULL;
-
-	if(PH_DEBUG) fprintf(stderr,"preset_hub_add_a_node\n");
-	if (h->ph_data) {
-		// first check for disabled nodes and reenable them if they match location
-		hd1 = h->ph_data;
-		while (hd1) {
-			if (!hd1->phd_node) {
-				// only if the node is disabled (NULL)
-				if (!preset_hub_compare_loc(hd1->phd_pn_gl_loc, hd1->phd_pn_gl_loc_length, x->pn_gl_loc, x->pn_gl_loc_length))
-				{
-					// if this hub node data's location matches that of the node
-					if(PH_DEBUG) fprintf(stderr,"	found disabled -> enabling\n");
-					found = 1;
-					hd1->phd_node = x;
-					break;
-				}
-			}
-			hd1 = hd1->phd_next;
-		}
-	}
-
-	if (!found) {
-		// we have no stored node data (or none that match node's location) so let's create a new one
-		if(PH_DEBUG) fprintf(stderr,"	creating a new\n");
-		// create a new data struct
-		hd2 = (t_preset_hub_data *)t_getbytes(sizeof(*hd2));
-		// reconstruct the dynamic location array
-		hd2->phd_pn_gl_loc_length = x->pn_gl_loc_length;
-		hd2->phd_pn_gl_loc = (int*)calloc(hd2->phd_pn_gl_loc_length, sizeof(hd2->phd_pn_gl_loc));
-		for (i=0; i < hd2->phd_pn_gl_loc_length; i++) {
-			if(PH_DEBUG) fprintf(stderr,"	loc %d\n", x->pn_gl_loc[i]);
-			hd2->phd_pn_gl_loc[i] = x->pn_gl_loc[i];
-		}
-		// assign node value
-		hd2->phd_node = x;
-		hd2->phd_next = NULL;
-
-		// adjust pointers
-		if (!h->ph_data) {
-			h->ph_data = hd2;
-		} else {
-			hd1 = h->ph_data;
-			while (hd1->phd_next) {
-				hd1 = hd1->phd_next;	
-			}
-			hd1->phd_next = hd2;
-		}
-	}
+    t_preset_hub_data *hd1, *hd2;
+    int found = 0;
+    int i;
+
+    hd1 = NULL;
+    hd2 = NULL;
+
+    if (PH_DEBUG) fprintf(stderr,"preset_hub_add_a_node\n");
+    if (h->ph_data)
+    {
+        /* first check for disabled nodes and reenable them if they match
+           location */
+        hd1 = h->ph_data;
+        while (hd1)
+        {
+            if (!hd1->phd_node)
+            {
+                // only if the node is disabled (NULL)
+                if (!preset_hub_compare_loc(hd1->phd_pn_gl_loc,
+                    hd1->phd_pn_gl_loc_length,
+                    x->pn_gl_loc, x->pn_gl_loc_length))
+                {
+                    // if this hub node data's location matches that of the node
+                    if(PH_DEBUG) fprintf(stderr,"    found disabled -> "
+                                                "enabling\n");
+                    found = 1;
+                    hd1->phd_node = x;
+                    break;
+                }
+            }
+            hd1 = hd1->phd_next;
+        }
+    }
+
+    if (!found)
+    {
+        /* we have no stored node data (or none that match node's location) so
+           let's create a new one */
+        if (PH_DEBUG) fprintf(stderr,"    creating a new\n");
+        // create a new data struct
+        hd2 = (t_preset_hub_data *)t_getbytes(sizeof(*hd2));
+        // reconstruct the dynamic location array
+        hd2->phd_pn_gl_loc_length = x->pn_gl_loc_length;
+        hd2->phd_pn_gl_loc = (int*)calloc(hd2->phd_pn_gl_loc_length,
+            sizeof(hd2->phd_pn_gl_loc));
+        for (i=0; i < hd2->phd_pn_gl_loc_length; i++)
+        {
+            if(PH_DEBUG) fprintf(stderr,"    loc %d\n", x->pn_gl_loc[i]);
+            hd2->phd_pn_gl_loc[i] = x->pn_gl_loc[i];
+        }
+        // assign node value
+        hd2->phd_node = x;
+        hd2->phd_next = NULL;
+
+        // adjust pointers
+        if (!h->ph_data)
+        {
+            h->ph_data = hd2;
+        }
+        else
+        {
+            hd1 = h->ph_data;
+            while (hd1->phd_next)
+            {
+                hd1 = hd1->phd_next;    
+            }
+            hd1->phd_next = hd2;
+        }
+    }
 }
 
 void preset_hub_delete_a_node(t_preset_hub *h, t_preset_node *x)
 {
-	t_preset_hub_data *hd1;
-	hd1 = NULL;
-
-	if(PH_DEBUG) fprintf(stderr,"preset_hub_delete_a_node\n");
-	if (h->ph_data) {
-		// check for enabled nodes only
-		hd1 = h->ph_data;
-		while (hd1) {
-			if (hd1->phd_node && hd1->phd_node == x) {
-				// only if the node is enabled and matches ours
-				if(PH_DEBUG) fprintf(stderr,"	found enabled -> disabling\n");
-				hd1->phd_node = NULL;
-				break;
-			}
-			hd1 = hd1->phd_next;
-		}
-	}
+    t_preset_hub_data *hd1;
+    hd1 = NULL;
+
+    if(PH_DEBUG) fprintf(stderr,"preset_hub_delete_a_node\n");
+    if (h->ph_data)
+    {
+        // check for enabled nodes only
+        hd1 = h->ph_data;
+        while (hd1)
+        {
+            if (hd1->phd_node && hd1->phd_node == x)
+            {
+                // only if the node is enabled and matches ours
+                if(PH_DEBUG) fprintf(stderr,"    found enabled -> disabling\n");
+                hd1->phd_node = NULL;
+                break;
+            }
+            hd1 = hd1->phd_next;
+        }
+    }
 }
 
 void preset_hub_reset(t_preset_hub *h)
 {
-	t_atom ap[1];
-	t_glob_preset_node_list *nl;
-	t_preset_hub_data *hd1, *hd2;
-	t_node_preset *np1, *np2;
-	t_preset_hub *h1, *h2;
-	int changed = 0;
-
-	if(PH_DEBUG) fprintf(stderr,"preset_hub_reset\n");
-
-	// inform all nodes that the hub is letting go of them
-	if (gpnl) {
-		if(PH_DEBUG) fprintf(stderr,"	we got gpnl\n");
-		nl = gpnl;
-		while(nl) {
-			if(PH_DEBUG) fprintf(stderr,"	analyzing gpnl entry %d\n", nl->gpnl_paired);
-			if (nl->gpnl_paired && nl->gpnl_node->pn_hub == h) {
-				nl->gpnl_paired = 0;
-				nl->gpnl_node->pn_hub = NULL;
-				if(PH_DEBUG) fprintf(stderr,"	removed gpnl reference\n");
-			}
-			nl = nl->gpnl_next;
-		}
-	}
-
-	// deallocate all the dynamically-allocated memory
-	if (h->ph_data) {
-		if(PH_DEBUG) fprintf(stderr,"	got ph_data\n");
-		hd1 = h->ph_data;
-		while (hd1) {
-			if (hd1->phd_npreset) {
-				np1 = hd1->phd_npreset;
-				while (np1) {
-					np2 = np1->np_next;
-					if (np1->np_val.l_n)
-						alist_clear(&np1->np_val);
-					freebytes(np1, sizeof(*np1));
-					changed = 1;
-					if(PH_DEBUG) fprintf(stderr,"	deleting preset\n");
-					np1 = np2;
-				}
-			}
-			hd2 = hd1->phd_next;
-			freebytes(hd1, sizeof(*hd1));
-			changed = 1;
-			if(PH_DEBUG) fprintf(stderr,"	deleting ph_data\n");
-			hd1 = hd2;
-		}
-	}
-
-	h->ph_data = NULL;
-
-	// and finally request pairing with nodes (since we deleted all our references)
-	glob_preset_node_list_seek_hub();
-
-	if (changed && !h->ph_extern_file) canvas_dirty(h->ph_canvas, 1);
-
-	SETFLOAT(ap+0, (t_float)changed);
-	outlet_anything(h->ph_outlet, gensym("reset"), 1, ap);
+    t_atom ap[1];
+    t_glob_preset_node_list *nl;
+    t_preset_hub_data *hd1, *hd2;
+    t_node_preset *np1, *np2;
+    t_preset_hub *h1, *h2;
+    int changed = 0;
+
+    if(PH_DEBUG) fprintf(stderr,"preset_hub_reset\n");
+
+    // inform all nodes that the hub is letting go of them
+    if (gpnl)
+    {
+        if(PH_DEBUG) fprintf(stderr,"    we got gpnl\n");
+        nl = gpnl;
+        while(nl)
+        {
+            if(PH_DEBUG)
+                fprintf(stderr,"    analyzing gpnl entry %d\n",
+                    nl->gpnl_paired);
+            if (nl->gpnl_paired && nl->gpnl_node->pn_hub == h)
+            {
+                nl->gpnl_paired = 0;
+                nl->gpnl_node->pn_hub = NULL;
+                if(PH_DEBUG) fprintf(stderr,"    removed gpnl reference\n");
+            }
+            nl = nl->gpnl_next;
+        }
+    }
+
+    // deallocate all the dynamically-allocated memory
+    if (h->ph_data)
+    {
+        if(PH_DEBUG) fprintf(stderr,"    got ph_data\n");
+        hd1 = h->ph_data;
+        while (hd1)
+        {
+            if (hd1->phd_npreset)
+            {
+                np1 = hd1->phd_npreset;
+                while (np1)
+                {
+                    np2 = np1->np_next;
+                    if (np1->np_val.l_n)
+                        alist_clear(&np1->np_val);
+                    freebytes(np1, sizeof(*np1));
+                    changed = 1;
+                    if(PH_DEBUG) fprintf(stderr,"    deleting preset\n");
+                    np1 = np2;
+                }
+            }
+            hd2 = hd1->phd_next;
+            freebytes(hd1, sizeof(*hd1));
+            changed = 1;
+            if(PH_DEBUG) fprintf(stderr,"    deleting ph_data\n");
+            hd1 = hd2;
+        }
+    }
+
+    h->ph_data = NULL;
+
+    /* and finally request pairing with nodes (since we deleted all our
+       references) */
+    glob_preset_node_list_seek_hub();
+
+    if (changed && !h->ph_extern_file) canvas_dirty(h->ph_canvas, 1);
+
+    SETFLOAT(ap+0, (t_float)changed);
+    outlet_anything(h->ph_outlet, gensym("reset"), 1, ap);
 }
 
 void preset_hub_clear(t_preset_hub *h, t_float f)
 {
-	t_atom ap[1];
-	t_preset_hub_data *hd2;
-	t_node_preset *np1, *np2;
-	int changed = 0;
-
-	if(PH_DEBUG) fprintf(stderr,"preset_hub_clear\n");
-
-	if (h->ph_data) {
-		if(PH_DEBUG) fprintf(stderr,"	got ph_data\n");
-		hd2 = h->ph_data;
-		while (hd2) {
-			// all nodes will get their preset cleared regardless whether they are active or disabled
-			if (hd2->phd_npreset) {
-				np1 = hd2->phd_npreset;
-				// if it is first one
-				if (np1->np_preset == (int)f) {
-					hd2->phd_npreset = np1->np_next;
-					if (np1->np_val.l_n)
-						alist_clear(&np1->np_val);
-					freebytes(np1, sizeof(*np1));
-					changed = 1;
-					if(PH_DEBUG) fprintf(stderr,"	found preset to delete (first)\n");
-				} else {
-					while (np1) {
-						np2 = np1->np_next;
-						if (np2 && np2->np_preset == (int)f) {
-							np1->np_next = np2->np_next;
-							if (np2->np_val.l_n)
-								alist_clear(&np2->np_val);
-							freebytes(np2, sizeof(*np2));
-							changed = 1;
-							if(PH_DEBUG) fprintf(stderr,"	found preset to delete\n");
-							break;
-						}
-						np1 = np1->np_next;
-					}
-				}
-			}
-			hd2 = hd2->phd_next;
-		}
-	}
-	if (changed && !h->ph_extern_file) canvas_dirty(h->ph_canvas, 1);
-
-	SETFLOAT(ap+0, (t_float)changed);
-	outlet_anything(h->ph_outlet, gensym("clear"), 1, ap);
+    t_atom ap[1];
+    t_preset_hub_data *hd2;
+    t_node_preset *np1, *np2;
+    int changed = 0;
+
+    if(PH_DEBUG) fprintf(stderr,"preset_hub_clear\n");
+
+    if (h->ph_data)
+    {
+        if(PH_DEBUG) fprintf(stderr,"    got ph_data\n");
+        hd2 = h->ph_data;
+        while (hd2)
+        {
+            /* all nodes will get their preset cleared regardless whether
+               they are active or disabled */
+            if (hd2->phd_npreset)
+            {
+                np1 = hd2->phd_npreset;
+                // if it is first one
+                if (np1->np_preset == (int)f)
+                {
+                    hd2->phd_npreset = np1->np_next;
+                    if (np1->np_val.l_n)
+                        alist_clear(&np1->np_val);
+                    freebytes(np1, sizeof(*np1));
+                    changed = 1;
+                    if (PH_DEBUG)
+                        fprintf(stderr,"    found preset to delete (first)\n");
+                }
+                else
+                {
+                    while (np1)
+                    {
+                        np2 = np1->np_next;
+                        if (np2 && np2->np_preset == (int)f)
+                        {
+                            np1->np_next = np2->np_next;
+                            if (np2->np_val.l_n)
+                                alist_clear(&np2->np_val);
+                            freebytes(np2, sizeof(*np2));
+                            changed = 1;
+                            if(PH_DEBUG)
+                                fprintf(stderr,"    found preset to delete\n");
+                            break;
+                        }
+                        np1 = np1->np_next;
+                    }
+                }
+            }
+            hd2 = hd2->phd_next;
+        }
+    }
+    if (changed && !h->ph_extern_file) canvas_dirty(h->ph_canvas, 1);
+
+    SETFLOAT(ap+0, (t_float)changed);
+    outlet_anything(h->ph_outlet, gensym("clear"), 1, ap);
 }
 
 void preset_hub_purge(t_preset_hub *h)
 {
-	t_atom ap[1];
-	t_preset_hub_data *hd1, *hd2;
-	t_node_preset *np1, *np2;
-	int changed = 0;
-
-	hd1 = NULL;
-	hd2 = NULL;
-
-	if(PH_DEBUG) fprintf(stderr,"preset_hub_purge\n");
-
-	// deallocate all the dynamically-allocated memory for disabled nodes
-	if (h->ph_data) {
-		if(PH_DEBUG) fprintf(stderr,"	got ph_data\n");
-		hd2 = h->ph_data;
-		while (hd2) {
-			if (!hd2->phd_node) {
-				if (hd2->phd_npreset) {
-					np1 = hd2->phd_npreset;
-					while (np1) {
-						np2 = np1->np_next;
-						if (np1->np_val.l_n)
-							alist_clear(&np1->np_val);
-						freebytes(np1, sizeof(*np1));
-						changed = 1;
-						if(PH_DEBUG) fprintf(stderr,"	deleting preset\n");
-						np1 = np2;
-					}
-				}
-				if (hd1 && hd1 != hd2) {
-					hd1->phd_next = hd2->phd_next;
-				}
-				hd1 = hd2;
-				if (hd2 == h->ph_data)
-					h->ph_data = hd2->phd_next;
-				hd2 = hd2->phd_next;
-				freebytes(hd1, sizeof(*hd1));
-				changed = 1;
-				if(PH_DEBUG) fprintf(stderr,"	deleting ph_data\n");
-			} else {
-				hd1 = hd2;
-				hd2 = hd2->phd_next;
-			}
-		}
-	}
-	if (changed && !h->ph_extern_file) canvas_dirty(h->ph_canvas, 1);
-
-	SETFLOAT(ap+0, (t_float)changed);
-	outlet_anything(h->ph_outlet, gensym("purge"), 1, ap);
+    t_atom ap[1];
+    t_preset_hub_data *hd1, *hd2;
+    t_node_preset *np1, *np2;
+    int changed = 0;
+
+    hd1 = NULL;
+    hd2 = NULL;
+
+    if(PH_DEBUG) fprintf(stderr,"preset_hub_purge\n");
+
+    // deallocate all the dynamically-allocated memory for disabled nodes
+    if (h->ph_data)
+    {
+        if(PH_DEBUG) fprintf(stderr,"    got ph_data\n");
+        hd2 = h->ph_data;
+        while (hd2)
+        {
+            if (!hd2->phd_node)
+            {
+                if (hd2->phd_npreset)
+                {
+                    np1 = hd2->phd_npreset;
+                    while (np1)
+                    {
+                        np2 = np1->np_next;
+                        if (np1->np_val.l_n)
+                            alist_clear(&np1->np_val);
+                        freebytes(np1, sizeof(*np1));
+                        changed = 1;
+                        if(PH_DEBUG) fprintf(stderr,"    deleting preset\n");
+                        np1 = np2;
+                    }
+                }
+                if (hd1 && hd1 != hd2)
+                {
+                    hd1->phd_next = hd2->phd_next;
+                }
+                hd1 = hd2;
+                if (hd2 == h->ph_data)
+                    h->ph_data = hd2->phd_next;
+                hd2 = hd2->phd_next;
+                freebytes(hd1, sizeof(*hd1));
+                changed = 1;
+                if(PH_DEBUG) fprintf(stderr,"    deleting ph_data\n");
+            }
+            else
+            {
+                hd1 = hd2;
+                hd2 = hd2->phd_next;
+            }
+        }
+    }
+    if (changed && !h->ph_extern_file) canvas_dirty(h->ph_canvas, 1);
+
+    SETFLOAT(ap+0, (t_float)changed);
+    outlet_anything(h->ph_outlet, gensym("purge"), 1, ap);
 }
 
 void preset_hub_sort(t_preset_hub *h, t_float f)
 {
-	t_atom ap[1];
-	t_preset_hub_data *hd2;
-	t_node_preset *np1;
-	int changed = 0;
-	int lowest = 0;
-	int highest = 0;
-	int i = 0;
-	int target = (int)f;
-	int gotpreset = 0;
-
-	if(PH_DEBUG) fprintf(stderr,"preset_hub_sort\n");
-
-	if (h->ph_data) {
-		if(PH_DEBUG) fprintf(stderr,"	got ph_data\n");
-		hd2 = h->ph_data;
-		np1 = hd2->phd_npreset;
-		lowest = np1->np_preset;
-		// first let's find the lowest and highest preset
-		// numbers that we'll remap to the new target value
-		while (hd2) {
-			np1 = hd2->phd_npreset;
-			while(np1) {
-				if (np1->np_preset < lowest) lowest = np1->np_preset;
-				if (np1->np_preset > highest) highest = np1->np_preset;
-				np1 = np1->np_next;
-			}
-			hd2 = hd2->phd_next;
-		}
-		if(PH_DEBUG) fprintf(stderr,"	lowest = %d highest = %d\n", lowest, highest);
-
-		// now that we have the lowest and highest we'll do a for loop
-		// from one to the other and reassign preset numbers
-		for (i = lowest; i <= highest; i++) {
-			gotpreset = 0;
-			hd2 = h->ph_data;
-			while (hd2) {
-				np1 = hd2->phd_npreset;
-				while (np1) {
-					if (np1->np_preset == i) {
-						if(PH_DEBUG) fprintf(stderr,"	changing preset %d to %d\n", np1->np_preset, target);
-						// we give altered presets temporarily negative value to 
-						// distinguish it from others that haven't yet been changed
-						// this is important for sequential changes where things can
-						// otherwise go out of order (e.g. in first pass 1 is changed to 2
-						// and then in the second  pass the same 2 is changed to 3 before
-						// reaching some other 2 that follows it). We will revert all
-						// to positive values after this step
-						np1->np_preset = -target;
-						gotpreset = 1;
-						changed = 1;
-						break;
-					}
-					np1 = np1->np_next;
-				}
-				hd2 = hd2->phd_next;
-			}
-			if (gotpreset) target++;
-		}
-		// now revert negative values to positive
-		hd2 = h->ph_data;
-		while (hd2) {
-			np1 = hd2->phd_npreset;
-			while(np1) {
-				if (np1->np_preset < 0) np1->np_preset = -np1->np_preset;
-				np1 = np1->np_next;
-			}
-			hd2 = hd2->phd_next;
-		}
-	}
-
-	if (changed && !h->ph_extern_file) canvas_dirty(h->ph_canvas, 1);
-
-	SETFLOAT(ap+0, (t_float)changed);
-	outlet_anything(h->ph_outlet, gensym("sort"), 1, ap);
+    t_atom ap[1];
+    t_preset_hub_data *hd2;
+    t_node_preset *np1;
+    int changed = 0;
+    int lowest = 0;
+    int highest = 0;
+    int i = 0;
+    int target = (int)f;
+    int gotpreset = 0;
+
+    if(PH_DEBUG) fprintf(stderr,"preset_hub_sort\n");
+
+    if (h->ph_data)
+    {
+        if(PH_DEBUG) fprintf(stderr,"    got ph_data\n");
+        hd2 = h->ph_data;
+        np1 = hd2->phd_npreset;
+        lowest = np1->np_preset;
+        // first let's find the lowest and highest preset
+        // numbers that we'll remap to the new target value
+        while (hd2)
+        {
+            np1 = hd2->phd_npreset;
+            while(np1)
+            {
+                if (np1->np_preset < lowest) lowest = np1->np_preset;
+                if (np1->np_preset > highest) highest = np1->np_preset;
+                np1 = np1->np_next;
+            }
+            hd2 = hd2->phd_next;
+        }
+        if (PH_DEBUG) fprintf(stderr,"    lowest = %d highest = %d\n",
+            lowest, highest);
+
+        /* now that we have the lowest and highest we'll do a for loop
+           from one to the other and reassign preset numbers */
+        for (i = lowest; i <= highest; i++)
+        {
+            gotpreset = 0;
+            hd2 = h->ph_data;
+            while (hd2)
+            {
+                np1 = hd2->phd_npreset;
+                while (np1)
+                {
+                    if (np1->np_preset == i)
+                    {
+                        if(PH_DEBUG)
+                            fprintf(stderr,"    changing preset %d to %d\n",
+                                np1->np_preset, target);
+                        /* we give altered presets temporarily negative value
+                           to distinguish it from others that haven't yet been
+                           changed this is important for sequential changes
+                           where things can otherwise go out of order (e.g. in
+                           first pass 1 is changed to 2 and then in the second
+                           pass the same 2 is changed to 3 before reaching some
+                           other 2 that follows it). We will revert all to
+                           positive values after this step */
+                        np1->np_preset = -target;
+                        gotpreset = 1;
+                        changed = 1;
+                        break;
+                    }
+                    np1 = np1->np_next;
+                }
+                hd2 = hd2->phd_next;
+            }
+            if (gotpreset) target++;
+        }
+        // now revert negative values to positive
+        hd2 = h->ph_data;
+        while (hd2)
+        {
+            np1 = hd2->phd_npreset;
+            while(np1)
+            {
+                if (np1->np_preset < 0) np1->np_preset = -np1->np_preset;
+                np1 = np1->np_next;
+            }
+            hd2 = hd2->phd_next;
+        }
+    }
+
+    if (changed && !h->ph_extern_file) canvas_dirty(h->ph_canvas, 1);
+
+    SETFLOAT(ap+0, (t_float)changed);
+    outlet_anything(h->ph_outlet, gensym("sort"), 1, ap);
 }
 
 void preset_hub_read(t_preset_hub *x, t_symbol *filename)
 {
-	if(PH_DEBUG) fprintf(stderr,"preset_hub_read\n");
-
-	t_atom ap[1];
-	int result = 0;
-	int pos = 0;
-	t_atom *argv = NULL;
-	t_binbuf *b = NULL;
-	int natom = 0;
-	int i = 0;
-
-	t_preset_hub_data *hd1, *hd2;
-	t_node_preset *np1, *np2;
-	t_hub_parser h_cur = H_NONE;
-	int loc_length = 0;
-	int *loc_data = NULL;
-	int loc_pos = 0;
-	int node_preset = -1;
-	int found_node = 0;
-	int found_preset = 0;
-	int ignore_entry = 0;
-	int data_count = 0;
-
-	if (filename == &s_) {
-		pd_error(x, "no read filename given\n");
-		goto preset_hub_read_fail;
-	}
-
-	// we only try to do this if we have valid paired nodes
-	// otherwise, we'll be filling the hub with bunch of
-	// disabled nodes that are unlikely to be paired properly
-	if (x->ph_data) {
-
-		b = binbuf_new();
-
-		if (binbuf_read_via_canvas(b, filename->s_name, x->ph_canvas, 1)) {
-			pd_error(x, "%s: read failed", filename->s_name);
-		} else {
-			hd1 = NULL;
-			hd2 = NULL;
-			np1 = NULL;
-			np2 = NULL;
-			ignore_entry = 0;
-
-			// load the data from the buffer and add to the preset db
-			natom = binbuf_getnatom(b);
-			if (pos < natom && natom > 1) {
-				argv = binbuf_getvec(b);
-				if (argv->a_type != A_SYMBOL || strcmp(atom_getsymbol(argv)->s_name, "#hub")) {
-					pd_error(x, "%s: malformed file", filename->s_name);
-					goto preset_hub_read_fail;
-				} else {
-					// detected proper preset file format, let's continue
-					argv++;
-					for (pos = 1; pos < natom; pos++, argv++) {
-						if(PH_DEBUG) fprintf(stderr,"	atom\n");
-						// SYMBOL ANALYSIS
-						if (argv->a_type == A_SYMBOL) {
-							if(PH_DEBUG) fprintf(stderr,"	data = %s\n", atom_getsymbol(argv)->s_name);
-							if (!strcmp(atom_getsymbol(argv)->s_name, "%node%")) {
-								// beginning of a new node
-								ignore_entry = 0;
-								if(PH_DEBUG) fprintf(stderr,"	new node\n");
-								loc_length = 0;
-								h_cur = H_NODE;
-							}
-							else if (!strcmp(atom_getsymbol(argv)->s_name, "%preset%") && !ignore_entry) {
-								// beginning of a new preset
-								if(PH_DEBUG) fprintf(stderr,"	new preset\n");
-								h_cur = H_PRESET;
-							}
-						}
-						// FLOAT ANALYSIS
-						else if (argv->a_type == A_FLOAT && !ignore_entry) {
-							if(PH_DEBUG) fprintf(stderr,"	data = %g\n", atom_getfloat(argv));
-							if (h_cur == H_NODE) {
-								// node location length
-								loc_length = (int)atom_getfloat(argv);
-								// reconstruct the dynamic location array
-								if (!loc_data)
-									loc_data = (int*)calloc(loc_length, sizeof(loc_data));
-								loc_data[loc_length-1] = (int)atom_getfloat(&argv[i]);
-								if(PH_DEBUG) fprintf(stderr,"	loc length = %d\n", loc_length);
-								loc_pos = 0;
-								h_cur = H_LOCATION;
-							}
-							else if (h_cur == H_LOCATION) {
-								// node location data
-								loc_data[loc_pos] = (int)atom_getfloat(argv);
-								if(PH_DEBUG) fprintf(stderr,"	loc = %d\n", loc_data[loc_pos]);
-								loc_pos++;
-								if (loc_pos == loc_length) {
-									//the location data has been collected, now check if such a node already exists
-									found_node = 0;
-
-									hd1 = NULL;
-									hd2 = NULL;
-
-									// we use hd1 to navigate and hd2 to populate
-									// first check for existing nodes and reenable them if they match location
-									hd1 = x->ph_data;
-									while (hd1) {
-										if (!preset_hub_compare_loc(hd1->phd_pn_gl_loc, hd1->phd_pn_gl_loc_length,
-											loc_data, loc_length))
-										{
-											// if this hub node data's location matches that of the node
-											if(PH_DEBUG) fprintf(stderr,"	found matching node\n");
-											found_node = 1;
-											break;
-										}
-										hd1 = hd1->phd_next;
-									}
-
-									if (!found_node) {
-										// we failed locating matching ph_data so we ignore the said data
-										// as there is no way the user will be able to predictably recreate
-										// node locations even if they wanted to
-										if(PH_DEBUG) fprintf(stderr,"	failed to find matching node\n");
-										ignore_entry = 1;
-									}
-
-									if (found_node) {
-										hd2 = hd1;
-									}
-
-									// free loc_data as we don't need it any more
-									free(loc_data);
-									loc_data = NULL;
-								}
-							}
-							else if (h_cur == H_PRESET) {
-								// preset number
-								if(PH_DEBUG) fprintf(stderr,"	preset %g\n", atom_getfloat(argv));
-								node_preset = (int)atom_getfloat(argv);
-
-								np1 = NULL;
-								np2 = NULL;
-
-								// check if the preset already exists
-								np1 = hd2->phd_npreset;
-								while (np1 && np1->np_preset != node_preset) {
-									np1 = np1->np_next;
-								}
-								if (!np1) {
-									// we need to create a new preset for the node
-									np2 = (t_node_preset *)t_getbytes(sizeof(*np2));
-									if (!hd2->phd_npreset) {
-										hd2->phd_npreset = np2;
-									} else {
-										np1 = hd2->phd_npreset;
-										while(np1->np_next) {
-											np1 = np1->np_next;
-										}
-										np1->np_next = np2;
-									}
-									np2->np_preset = node_preset;
-								} else {
-									// otherwise we simply make np2 point to np1 (which is our matching preset)
-									np2 = np1;
-									// clear old preset data
-									if (np2->np_val.l_n)
-										alist_clear(&np2->np_val);
-								}
-
-								data_count = 0;
-								argv++;
-
-								// figure out how long of variable data list follows the preset descriptor
-								while (data_count < natom && strcmp(atom_getsymbol(argv+data_count)->s_name, "%preset%") && strcmp(atom_getsymbol(argv+data_count)->s_name, "%node%")) {
-									data_count++;
-								}
-								if(PH_DEBUG) fprintf(stderr,"	found preset? %d found node? %d\n", !strcmp(atom_getsymbol(argv+data_count)->s_name, "%preset%"), !strcmp(atom_getsymbol(argv+data_count)->s_name, "%node%"));
-								if(PH_DEBUG) fprintf(stderr,"	data_count = %d starting @ %d out of %d\n", data_count, pos+1, natom);
-								alist_init(&np2->np_val);
-								alist_list(&np2->np_val, 0, data_count, argv);
-
-								if(PH_DEBUG) {
-									if ((argv)->a_type == A_SYMBOL)
-										fprintf(stderr,"	1st_element = %s\n", atom_getsymbol(argv)->s_name);
-									else if ((argv)->a_type == A_FLOAT)
-										fprintf(stderr,"	1st_element = %f\n", atom_getfloat(argv));
-									else fprintf(stderr,"	1st_element = unknown format\n");
-								}
-
-								pos = pos + data_count;
-								// we already incremented it above before figuring out
-								// how long data list is so we do one less
-								argv = argv + data_count - 1;
-								h_cur = H_PRESET_DATA;
-							}
-						}
-					}
-				}
-			} else {
-				pd_error(x, "%s: malformed/incomplete file", filename->s_name);
-				goto preset_hub_read_fail;
-			}
-		}
-		result = 1;
-	}
-
-	preset_hub_read_fail:
-	if (b) binbuf_free(b);
-	SETFLOAT(ap+0, (t_float)result);
+    if(PH_DEBUG) fprintf(stderr,"preset_hub_read\n");
+
+    t_atom ap[1];
+    int result = 0;
+    int pos = 0;
+    t_atom *argv = NULL;
+    t_binbuf *b = NULL;
+    int natom = 0;
+    int i = 0;
+
+    t_preset_hub_data *hd1, *hd2;
+    t_node_preset *np1, *np2;
+    t_hub_parser h_cur = H_NONE;
+    int loc_length = 0;
+    int *loc_data = NULL;
+    int loc_pos = 0;
+    int node_preset = -1;
+    int found_node = 0;
+    int found_preset = 0;
+    int ignore_entry = 0;
+    int data_count = 0;
+
+    if (filename == &s_)
+    {
+        pd_error(x, "no read filename given\n");
+        goto preset_hub_read_fail;
+    }
+
+    // we only try to do this if we have valid paired nodes
+    // otherwise, we'll be filling the hub with bunch of
+    // disabled nodes that are unlikely to be paired properly
+    if (x->ph_data)
+    {
+
+        b = binbuf_new();
+
+        if (binbuf_read_via_canvas(b, filename->s_name, x->ph_canvas, 1))
+        {
+            pd_error(x, "%s: read failed", filename->s_name);
+        }
+        else
+        {
+            hd1 = NULL;
+            hd2 = NULL;
+            np1 = NULL;
+            np2 = NULL;
+            ignore_entry = 0;
+
+            // load the data from the buffer and add to the preset db
+            natom = binbuf_getnatom(b);
+            if (pos < natom && natom > 1)
+            {
+                argv = binbuf_getvec(b);
+                if (argv->a_type != A_SYMBOL ||
+                    strcmp(atom_getsymbol(argv)->s_name, "#hub"))
+                {
+                    pd_error(x, "%s: malformed file", filename->s_name);
+                    goto preset_hub_read_fail;
+                }
+                else
+                {
+                    // detected proper preset file format, let's continue
+                    argv++;
+                    for (pos = 1; pos < natom; pos++, argv++)
+                    {
+                        if(PH_DEBUG) fprintf(stderr,"    atom\n");
+                        // SYMBOL ANALYSIS
+                        if (argv->a_type == A_SYMBOL)
+                        {
+                            if(PH_DEBUG)
+                                fprintf(stderr,"    data = %s\n",
+                                    atom_getsymbol(argv)->s_name);
+                            if (!strcmp(atom_getsymbol(argv)->s_name, "%node%"))
+                            {
+                                // beginning of a new node
+                                ignore_entry = 0;
+                                if(PH_DEBUG) fprintf(stderr,"    new node\n");
+                                loc_length = 0;
+                                h_cur = H_NODE;
+                            }
+                            else if (!strcmp(
+                                      atom_getsymbol(argv)->s_name, "%preset%")
+                                     && !ignore_entry)
+                            {
+                                // beginning of a new preset
+                                if(PH_DEBUG) fprintf(stderr,"    new preset\n");
+                                h_cur = H_PRESET;
+                            }
+                        }
+                        // FLOAT ANALYSIS
+                        else if (argv->a_type == A_FLOAT && !ignore_entry)
+                        {
+                            if(PH_DEBUG)
+                                fprintf(stderr,"    data = %g\n",
+                                    atom_getfloat(argv));
+                            if (h_cur == H_NODE)
+                            {
+                                // node location length
+                                loc_length = (int)atom_getfloat(argv);
+                                // reconstruct the dynamic location array
+                                if (!loc_data)
+                                    loc_data = (int*)calloc(loc_length,
+                                        sizeof(loc_data));
+                                loc_data[loc_length-1] =
+                                    (int)atom_getfloat(&argv[i]);
+                                if(PH_DEBUG)
+                                    fprintf(stderr,"    loc length = %d\n",
+                                        loc_length);
+                                loc_pos = 0;
+                                h_cur = H_LOCATION;
+                            }
+                            else if (h_cur == H_LOCATION)
+                            {
+                                // node location data
+                                loc_data[loc_pos] = (int)atom_getfloat(argv);
+                                if(PH_DEBUG)
+                                    fprintf(stderr,"    loc = %d\n",
+                                        loc_data[loc_pos]);
+                                loc_pos++;
+                                if (loc_pos == loc_length)
+                                {
+                                    /* the location data has been collected, now
+                                       check if such a node already exists */
+                                    found_node = 0;
+
+                                    hd1 = NULL;
+                                    hd2 = NULL;
+
+                                    /* we use hd1 to navigate and hd2 to
+                                       populate first check for existing
+                                       nodes and reenable them if they match
+                                       location */
+                                    hd1 = x->ph_data;
+                                    while (hd1)
+                                    {
+                                        if (!preset_hub_compare_loc(
+                                                hd1->phd_pn_gl_loc,
+                                                hd1->phd_pn_gl_loc_length,
+                                                loc_data, loc_length))
+                                        {
+                                            /* if this hub node data's location
+                                               matches that of the node */
+                                            if (PH_DEBUG)
+                                                fprintf(stderr,
+                                                   "    found matching node\n");
+                                            found_node = 1;
+                                            break;
+                                        }
+                                        hd1 = hd1->phd_next;
+                                    }
+
+                                    if (!found_node)
+                                    {
+                                        /* we failed locating matching
+                                           ph_data so we ignore the said data
+                                           as there is no way the user will be
+                                           able to predictably recreate node
+                                           locations even if they wanted to */
+                                        if (PH_DEBUG)
+                                            fprintf(stderr,
+                                          "    failed to find matching node\n");
+                                        ignore_entry = 1;
+                                    }
+
+                                    if (found_node)
+                                    {
+                                        hd2 = hd1;
+                                    }
+
+                                    /* free loc_data as we don't need it
+                                       any more */
+                                    free(loc_data);
+                                    loc_data = NULL;
+                                }
+                            }
+                            else if (h_cur == H_PRESET)
+                            {
+                                // preset number
+                                if (PH_DEBUG)
+                                    fprintf(stderr,"    preset %g\n",
+                                        atom_getfloat(argv));
+                                node_preset = (int)atom_getfloat(argv);
+
+                                np1 = NULL;
+                                np2 = NULL;
+
+                                // check if the preset already exists
+                                np1 = hd2->phd_npreset;
+                                while (np1 && np1->np_preset != node_preset)
+                                {
+                                    np1 = np1->np_next;
+                                }
+                                if (!np1)
+                                {
+                                    /* we need to create a new preset
+                                       for the node */
+                                    np2 = (t_node_preset *)t_getbytes(
+                                        sizeof(*np2));
+                                    if (!hd2->phd_npreset)
+                                    {
+                                        hd2->phd_npreset = np2;
+                                    }
+                                    else
+                                    {
+                                        np1 = hd2->phd_npreset;
+                                        while(np1->np_next)
+                                        {
+                                            np1 = np1->np_next;
+                                        }
+                                        np1->np_next = np2;
+                                    }
+                                    np2->np_preset = node_preset;
+                                }
+                                else
+                                {
+                                    /* otherwise we simply make np2 point
+                                       to np1 (which is our matching preset) */
+                                    np2 = np1;
+                                    // clear old preset data
+                                    if (np2->np_val.l_n)
+                                        alist_clear(&np2->np_val);
+                                }
+
+                                data_count = 0;
+                                argv++;
+
+                                /* figure out how long of variable data list
+                                   follows the preset descriptor */
+                                while (data_count < natom &&
+                                       strcmp(
+                                        atom_getsymbol(argv+data_count)->s_name,
+                                        "%preset%") &&
+                                       strcmp(
+                                        atom_getsymbol(argv+data_count)->s_name,
+                                        "%node%"))
+                                {
+                                    data_count++;
+                                }
+                                if (PH_DEBUG)
+                                    fprintf(stderr,"    found preset? %d "
+                                                   "found node? %d\n",
+                                        !strcmp(
+                                        atom_getsymbol(argv+data_count)->s_name,
+                                         "%preset%"),
+                                        !strcmp(
+                                        atom_getsymbol(argv+data_count)->s_name,
+                                         "%node%"));
+                                if (PH_DEBUG)
+                                    fprintf(stderr,"    data_count = %d "
+                                                   "starting @ %d out of %d\n",
+                                        data_count, pos+1, natom);
+                                alist_init(&np2->np_val);
+                                alist_list(&np2->np_val, 0, data_count, argv);
+
+                                if (PH_DEBUG)
+                                {
+                                    if ((argv)->a_type == A_SYMBOL)
+                                        fprintf(stderr,"    1st_element = %s\n",
+                                            atom_getsymbol(argv)->s_name);
+                                    else if ((argv)->a_type == A_FLOAT)
+                                        fprintf(stderr,"    1st_element = %f\n",
+                                            atom_getfloat(argv));
+                                    else
+                                        fprintf(stderr,
+                                          "    1st_element = unknown format\n");
+                                }
+
+                                pos = pos + data_count;
+                                /* we already incremented it above before
+                                   figuring out how long data list is so
+                                   we do one less */
+                                argv = argv + data_count - 1;
+                                h_cur = H_PRESET_DATA;
+                            }
+                        }
+                    }
+                }
+            }
+            else
+            {
+                pd_error(x, "%s: malformed/incomplete file", filename->s_name);
+                goto preset_hub_read_fail;
+            }
+        }
+        result = 1;
+    }
+
+    preset_hub_read_fail:
+    if (b) binbuf_free(b);
+    SETFLOAT(ap+0, (t_float)result);
     outlet_anything(x->ph_outlet, gensym("read"), 1, ap);
 }
 
 void preset_hub_write(t_preset_hub *x, t_symbol *filename)
 {
-	if(PH_DEBUG) fprintf(stderr,"preset_hub_write\n");
-
-	t_atom ap[1];
-	int result = 0;
-	t_atom *outv;
-	int i;
-	t_preset_hub_data *phd;
-	t_node_preset *np;
-	t_binbuf *b = binbuf_new();
-
-	if (filename == &s_) {
-		pd_error(x, "no write filename given\n");
-		goto preset_hub_write_fail;
-	}
-
-	phd = x->ph_data;
-	if (phd) {
-		binbuf_addv(b, "s", gensym("#hub"));
-		while (phd) {
-			if(PH_DEBUG) fprintf(stderr,"	saving phd\n");
-			// designate a node and state whether it is active or disabled
-			// (disabled nodes are ones that have presets saved but have been deleted since--
-			// we keep these in the case of undo actions during the session that may go beyond
-			// saving something into a file)
-			binbuf_addv(b, "si", gensym("%node%"), phd->phd_pn_gl_loc_length);
-
-			// gather info about the length of the node's location and store it
-			for (i = 0; i < phd->phd_pn_gl_loc_length; i++) {
-				binbuf_addv(b,"i", (int)phd->phd_pn_gl_loc[i]);
-			}
-
-			// save preset data
-			np = phd->phd_npreset;
-			while (np) {
-				if (np->np_val.l_n > 0) {
-					binbuf_addv(b, "si", gensym("%preset%"), (int)np->np_preset);
-					for (i = 0; i < np->np_val.l_n; i++) {
-						if (np->np_val.l_vec[i].l_a.a_type == A_FLOAT)
-							binbuf_addv(b, "f", np->np_val.l_vec[i].l_a.a_w.w_float);
-						else if (np->np_val.l_vec[i].l_a.a_type == A_SYMBOL)
-							binbuf_addv(b, "s", np->np_val.l_vec[i].l_a.a_w.w_symbol);	
-					}
-				}
-				np = np->np_next;
-			}
-
-			phd = phd->phd_next;
-		}
-		binbuf_addv(b, ";");
-		result = 1;
-	}
-	if(PH_DEBUG) fprintf(stderr,"	done creating binbuf\n");
+    if(PH_DEBUG) fprintf(stderr,"preset_hub_write\n");
+
+    t_atom ap[1];
+    int result = 0;
+    t_atom *outv;
+    int i;
+    t_preset_hub_data *phd;
+    t_node_preset *np;
+    t_binbuf *b = binbuf_new();
+
+    if (filename == &s_)
+    {
+        pd_error(x, "no write filename given\n");
+        goto preset_hub_write_fail;
+    }
+
+    phd = x->ph_data;
+    if (phd)
+    {
+        binbuf_addv(b, "s", gensym("#hub"));
+        while (phd)
+        {
+            if(PH_DEBUG) fprintf(stderr,"    saving phd\n");
+            /* designate a node and state whether it is active or disabled
+               (disabled nodes are ones that have presets saved but have been
+               deleted since-- we keep these in the case of undo actions during
+               the session that may go beyond saving something into a file) */
+            binbuf_addv(b, "si", gensym("%node%"), phd->phd_pn_gl_loc_length);
+
+            // gather info about the length of the node's location and store it
+            for (i = 0; i < phd->phd_pn_gl_loc_length; i++)
+            {
+                binbuf_addv(b,"i", (int)phd->phd_pn_gl_loc[i]);
+            }
+
+            // save preset data
+            np = phd->phd_npreset;
+            while (np)
+            {
+                if (np->np_val.l_n > 0)
+                {
+                    binbuf_addv(b, "si", gensym("%preset%"),
+                        (int)np->np_preset);
+                    for (i = 0; i < np->np_val.l_n; i++)
+                    {
+                        if (np->np_val.l_vec[i].l_a.a_type == A_FLOAT)
+                            binbuf_addv(b, "f",
+                                np->np_val.l_vec[i].l_a.a_w.w_float);
+                        else if (np->np_val.l_vec[i].l_a.a_type == A_SYMBOL)
+                            binbuf_addv(b, "s",
+                                np->np_val.l_vec[i].l_a.a_w.w_symbol);    
+                    }
+                }
+                np = np->np_next;
+            }
+
+            phd = phd->phd_next;
+        }
+        binbuf_addv(b, ";");
+        result = 1;
+    }
+    if(PH_DEBUG) fprintf(stderr,"    done creating binbuf\n");
 
     char buf[MAXPDSTRING];
     canvas_makefilename(x->ph_canvas, filename->s_name,
-		buf, MAXPDSTRING);
-    if (binbuf_write(b, buf, "", 1)) {
-    	pd_error(x, "%s: write failed", filename->s_name);
-		result = 0;
-	}
+        buf, MAXPDSTRING);
+    if (binbuf_write(b, buf, "", 1))
+    {
+        pd_error(x, "%s: write failed", filename->s_name);
+        result = 0;
+    }
 
-	preset_hub_write_fail:
-	if (b) binbuf_free(b);
-	if(PH_DEBUG) fprintf(stderr,"	done saving file\n");
+    preset_hub_write_fail:
+    if (b) binbuf_free(b);
+    if(PH_DEBUG) fprintf(stderr,"    done saving file\n");
 
-	SETFLOAT(ap+0, (t_float)result);
+    SETFLOAT(ap+0, (t_float)result);
     outlet_anything(x->ph_outlet, gensym("write"), 1, ap);
 }
 
 void preset_hub_readpreset(t_preset_hub *x, t_symbol *filename)
 {
-	if(PH_DEBUG) fprintf(stderr,"preset_hub_readpreset\n");
-
-	t_atom ap[1];
-	int result = 0;
-	int pos = 0;
-	t_atom *argv = NULL;
-	t_binbuf *b = NULL;
-	int natom = 0;
-	int i = 0;
-
-	t_preset_hub_data *hd1, *hd2;
-	t_node_preset *np1, *np2;
-	t_hub_parser h_cur = H_NONE;
-	int loc_length = 0;
-	int *loc_data = NULL;
-	int loc_pos = 0;
-	int node_preset = -1;
-	int found_node = 0;
-	int found_preset = 0;
-	int ignore_entry = 0;
-	int data_count = 0;
-
-	int recall_preset = -1;
-
-	if (filename == &s_) {
-		pd_error(x, "no readpreset filename given\n");
-		goto preset_hub_readpreset_fail;
-	}
-
-	// we only try to do this if we have valid paired nodes
-	// otherwise, we'll be filling the hub with bunch of
-	// disabled nodes that are unlikely to be paired properly
-	if (x->ph_data) {
-
-		b = binbuf_new();
-
-		if (binbuf_read_via_canvas(b, filename->s_name, x->ph_canvas, 1)) {
-			pd_error(x, "%s: read failed", filename->s_name);
-		} else {
-			hd1 = NULL;
-			hd2 = NULL;
-			np1 = NULL;
-			np2 = NULL;
-			ignore_entry = 0;
-
-			// load the data from the buffer and add to the preset db
-			natom = binbuf_getnatom(b);
-			if (pos < natom && natom > 1) {
-				argv = binbuf_getvec(b);
-				if (argv->a_type != A_SYMBOL || strcmp(atom_getsymbol(argv)->s_name, "#hubpreset")) {
-					pd_error(x, "%s: malformed file", filename->s_name);
-					goto preset_hub_readpreset_fail;
-				} else {
-					// detected proper preset file format, let's continue
-					argv++;
-					// read preset we need to recall as soon as we're done reading
-					if (argv->a_type != A_FLOAT) {
-						pd_error(x, "%s: malformed file", filename->s_name);
-						goto preset_hub_readpreset_fail;
-					} else {
-						recall_preset = (int)atom_getfloat(argv);
-					}
-					argv++;
-					for (pos = 1; pos < natom; pos++, argv++) {
-						if(PH_DEBUG) fprintf(stderr,"	atom\n");
-						// SYMBOL ANALYSIS
-						if (argv->a_type == A_SYMBOL) {
-							if(PH_DEBUG) fprintf(stderr,"	data = %s\n", atom_getsymbol(argv)->s_name);
-							if (!strcmp(atom_getsymbol(argv)->s_name, "%node%")) {
-								// beginning of a new node
-								ignore_entry = 0;
-								if(PH_DEBUG) fprintf(stderr,"	new node\n");
-								loc_length = 0;
-								h_cur = H_NODE;
-							}
-							else if (!strcmp(atom_getsymbol(argv)->s_name, "%preset%") && !ignore_entry) {
-								// beginning of a new preset
-								if(PH_DEBUG) fprintf(stderr,"	new preset\n");
-								h_cur = H_PRESET;
-							}
-						}
-						// FLOAT ANALYSIS
-						else if (argv->a_type == A_FLOAT && !ignore_entry) {
-							if(PH_DEBUG) fprintf(stderr,"	data = %g\n", atom_getfloat(argv));
-							if (h_cur == H_NODE) {
-								// node location length
-								loc_length = (int)atom_getfloat(argv);
-								// reconstruct the dynamic location array
-								if (!loc_data)
-									loc_data = (int*)calloc(loc_length, sizeof(loc_data));
-								loc_data[loc_length-1] = (int)atom_getfloat(&argv[i]);
-								if(PH_DEBUG) fprintf(stderr,"	loc length = %d\n", loc_length);
-								loc_pos = 0;
-								h_cur = H_LOCATION;
-							}
-							else if (h_cur == H_LOCATION) {
-								// node location data
-								loc_data[loc_pos] = (int)atom_getfloat(argv);
-								if(PH_DEBUG) fprintf(stderr,"	loc = %d\n", loc_data[loc_pos]);
-								loc_pos++;
-								if (loc_pos == loc_length) {
-									//the location data has been collected, now check if such a node already exists
-									found_node = 0;
-
-									hd1 = NULL;
-									hd2 = NULL;
-
-									// we use hd1 to navigate and hd2 to populate
-									// first check for existing nodes and reenable them if they match location
-									hd1 = x->ph_data;
-									while (hd1) {
-										if (!preset_hub_compare_loc(hd1->phd_pn_gl_loc, hd1->phd_pn_gl_loc_length,
-											loc_data, loc_length))
-										{
-											// if this hub node data's location matches that of the node
-											if(PH_DEBUG) fprintf(stderr,"	found matching node\n");
-											found_node = 1;
-											break;
-										}
-										hd1 = hd1->phd_next;
-									}
-
-									if (!found_node) {
-										// we failed locating matching ph_data so we ignore the said data
-										// as there is no way the user will be able to predictably recreate
-										// node locations even if they wanted to
-										if(PH_DEBUG) fprintf(stderr,"	failed to find matching node\n");
-										ignore_entry = 1;
-									}
-
-									if (found_node) {
-										hd2 = hd1;
-									}
-
-									// free loc_data as we don't need it any more
-									free(loc_data);
-									loc_data = NULL;
-								}
-							}
-							else if (h_cur == H_PRESET) {
-								// preset number
-								if(PH_DEBUG) fprintf(stderr,"	preset %g\n", atom_getfloat(argv));
-								node_preset = (int)atom_getfloat(argv);
-
-								np1 = NULL;
-								np2 = NULL;
-
-								// check if the preset already exists
-								np1 = hd2->phd_npreset;
-								while (np1 && np1->np_preset != node_preset) {
-									np1 = np1->np_next;
-								}
-								if (!np1) {
-									// we need to create a new preset for the node
-									np2 = (t_node_preset *)t_getbytes(sizeof(*np2));
-									if (!hd2->phd_npreset) {
-										hd2->phd_npreset = np2;
-									} else {
-										np1 = hd2->phd_npreset;
-										while(np1->np_next) {
-											np1 = np1->np_next;
-										}
-										np1->np_next = np2;
-									}
-									np2->np_preset = node_preset;
-								} else {
-									// otherwise we simply make np2 point to np1 (which is our matching preset)
-									np2 = np1;
-									// clear old preset data
-									if (np2->np_val.l_n)
-										alist_clear(&np2->np_val);
-								}
-
-								data_count = 0;
-								argv++;
-
-								// figure out how long of variable data list follows the preset descriptor
-								while (data_count < natom && strcmp(atom_getsymbol(argv+data_count)->s_name, "%preset%") && strcmp(atom_getsymbol(argv+data_count)->s_name, "%node%")) {
-									data_count++;
-								}
-								if(PH_DEBUG) fprintf(stderr,"	found preset? %d found node? %d\n", !strcmp(atom_getsymbol(argv+data_count)->s_name, "%preset%"), !strcmp(atom_getsymbol(argv+data_count)->s_name, "%node%"));
-								if(PH_DEBUG) fprintf(stderr,"	data_count = %d starting @ %d out of %d\n", data_count, pos+1, natom);
-								alist_init(&np2->np_val);
-								alist_list(&np2->np_val, 0, data_count, argv);
-
-								if(PH_DEBUG) {
-									if ((argv)->a_type == A_SYMBOL)
-										fprintf(stderr,"	1st_element = %s\n", atom_getsymbol(argv)->s_name);
-									else if ((argv)->a_type == A_FLOAT)
-										fprintf(stderr,"	1st_element = %f\n", atom_getfloat(argv));
-									else fprintf(stderr,"	1st_element = unknown format\n");
-								}
-
-								pos = pos + data_count;
-								// we already incremented it above before figuring out
-								// how long data list is so we do one less
-								argv = argv + data_count - 1;
-								h_cur = H_PRESET_DATA;
-							}
-						}
-					}
-				}
-			} else {
-				pd_error(x, "%s: malformed/incomplete file", filename->s_name);
-				goto preset_hub_readpreset_fail;
-			}
-		}
-		result = 1;
-	}
-
-	preset_hub_readpreset_fail:
-	if (b) binbuf_free(b);
-	SETFLOAT(ap+0, (t_float)result);
+    if(PH_DEBUG) fprintf(stderr,"preset_hub_readpreset\n");
+
+    t_atom ap[1];
+    int result = 0;
+    int pos = 0;
+    t_atom *argv = NULL;
+    t_binbuf *b = NULL;
+    int natom = 0;
+    int i = 0;
+
+    t_preset_hub_data *hd1, *hd2;
+    t_node_preset *np1, *np2;
+    t_hub_parser h_cur = H_NONE;
+    int loc_length = 0;
+    int *loc_data = NULL;
+    int loc_pos = 0;
+    int node_preset = -1;
+    int found_node = 0;
+    int found_preset = 0;
+    int ignore_entry = 0;
+    int data_count = 0;
+
+    int recall_preset = -1;
+
+    if (filename == &s_)
+    {
+        pd_error(x, "no readpreset filename given\n");
+        goto preset_hub_readpreset_fail;
+    }
+
+    // we only try to do this if we have valid paired nodes
+    // otherwise, we'll be filling the hub with bunch of
+    // disabled nodes that are unlikely to be paired properly
+    if (x->ph_data)
+    {
+
+        b = binbuf_new();
+
+        if (binbuf_read_via_canvas(b, filename->s_name, x->ph_canvas, 1))
+        {
+            pd_error(x, "%s: read failed", filename->s_name);
+        }
+        else
+        {
+            hd1 = NULL;
+            hd2 = NULL;
+            np1 = NULL;
+            np2 = NULL;
+            ignore_entry = 0;
+
+            // load the data from the buffer and add to the preset db
+            natom = binbuf_getnatom(b);
+            if (pos < natom && natom > 1)
+            {
+                argv = binbuf_getvec(b);
+                if (argv->a_type != A_SYMBOL ||
+                    strcmp(atom_getsymbol(argv)->s_name, "#hubpreset"))
+                {
+                    pd_error(x, "%s: malformed file", filename->s_name);
+                    goto preset_hub_readpreset_fail;
+                }
+                else
+                {
+                    // detected proper preset file format, let's continue
+                    argv++;
+                    /* read preset we need to recall as soon as we're done
+                       reading */
+                    if (argv->a_type != A_FLOAT)
+                    {
+                        pd_error(x, "%s: malformed file", filename->s_name);
+                        goto preset_hub_readpreset_fail;
+                    }
+                    else
+                    {
+                        recall_preset = (int)atom_getfloat(argv);
+                    }
+                    argv++;
+                    for (pos = 1; pos < natom; pos++, argv++)
+                    {
+                        if(PH_DEBUG) fprintf(stderr,"    atom\n");
+                        // SYMBOL ANALYSIS
+                        if (argv->a_type == A_SYMBOL)
+                        {
+                            if (PH_DEBUG)
+                                fprintf(stderr,"    data = %s\n",
+                                    atom_getsymbol(argv)->s_name);
+                            if (!strcmp(atom_getsymbol(argv)->s_name, "%node%"))
+                            {
+                                // beginning of a new node
+                                ignore_entry = 0;
+                                if (PH_DEBUG) fprintf(stderr,"    new node\n");
+                                loc_length = 0;
+                                h_cur = H_NODE;
+                            }
+                            else if (!strcmp(atom_getsymbol(argv)->s_name,
+                                     "%preset%") && !ignore_entry)
+                            {
+                                // beginning of a new preset
+                                if (PH_DEBUG)
+                                    fprintf(stderr,"    new preset\n");
+                                h_cur = H_PRESET;
+                            }
+                        }
+                        // FLOAT ANALYSIS
+                        else if (argv->a_type == A_FLOAT && !ignore_entry)
+                        {
+                            if (PH_DEBUG)
+                                fprintf(stderr,"    data = %g\n",
+                                    atom_getfloat(argv));
+                            if (h_cur == H_NODE)
+                            {
+                                // node location length
+                                loc_length = (int)atom_getfloat(argv);
+                                // reconstruct the dynamic location array
+                                if (!loc_data)
+                                    loc_data = (int*)calloc(loc_length,
+                                        sizeof(loc_data));
+                                loc_data[loc_length-1] =
+                                    (int)atom_getfloat(&argv[i]);
+                                if (PH_DEBUG)
+                                    fprintf(stderr,"    loc length = %d\n",
+                                        loc_length);
+                                loc_pos = 0;
+                                h_cur = H_LOCATION;
+                            }
+                            else if (h_cur == H_LOCATION)
+                            {
+                                // node location data
+                                loc_data[loc_pos] = (int)atom_getfloat(argv);
+                                if (PH_DEBUG)
+                                    fprintf(stderr,"    loc = %d\n",
+                                        loc_data[loc_pos]);
+                                loc_pos++;
+                                if (loc_pos == loc_length)
+                                {
+                                    /* the location data has been collected, now
+                                       check if such a node already exists */
+                                    found_node = 0;
+
+                                    hd1 = NULL;
+                                    hd2 = NULL;
+
+                                    /* we use hd1 to navigate and hd2 to
+                                       populate first check for existing
+                                       nodes and reenable them if they match
+                                       location */
+                                    hd1 = x->ph_data;
+                                    while (hd1)
+                                    {
+                                        if (!preset_hub_compare_loc(
+                                                hd1->phd_pn_gl_loc,
+                                                hd1->phd_pn_gl_loc_length,
+                                                loc_data, loc_length))
+                                        {
+                                            /* if this hub node data's location
+                                               matches that of the node */
+                                            if (PH_DEBUG)
+                                                fprintf(stderr,
+                                                   "    found matching node\n");
+                                            found_node = 1;
+                                            break;
+                                        }
+                                        hd1 = hd1->phd_next;
+                                    }
+
+                                    if (!found_node)
+                                    {
+                                        /* we failed locating matching
+                                           ph_data so we ignore the said data
+                                           as there is no way the user will be
+                                           able to predictably recreate node
+                                           locations even if they wanted to */
+                                        if (PH_DEBUG)
+                                            fprintf(stderr, "    failed to "
+                                                    "find matching node\n");
+                                        ignore_entry = 1;
+                                    }
+
+                                    if (found_node)
+                                    {
+                                        hd2 = hd1;
+                                    }
+
+                                    /* free loc_data as we don't need it
+                                       any more */
+                                    free(loc_data);
+                                    loc_data = NULL;
+                                }
+                            }
+                            else if (h_cur == H_PRESET)
+                            {
+                                // preset number
+                                if (PH_DEBUG)
+                                    fprintf(stderr,"    preset %g\n",
+                                        atom_getfloat(argv));
+                                node_preset = (int)atom_getfloat(argv);
+
+                                np1 = NULL;
+                                np2 = NULL;
+
+                                // check if the preset already exists
+                                np1 = hd2->phd_npreset;
+                                while (np1 && np1->np_preset != node_preset)
+                                {
+                                    np1 = np1->np_next;
+                                }
+                                if (!np1)
+                                {
+                                    /* we need to create a new preset
+                                       for the node */
+                                    np2 = (t_node_preset *)t_getbytes(
+                                        sizeof(*np2));
+                                    if (!hd2->phd_npreset)
+                                    {
+                                        hd2->phd_npreset = np2;
+                                    }
+                                    else
+                                    {
+                                        np1 = hd2->phd_npreset;
+                                        while(np1->np_next)
+                                        {
+                                            np1 = np1->np_next;
+                                        }
+                                        np1->np_next = np2;
+                                    }
+                                    np2->np_preset = node_preset;
+                                }
+                                else
+                                {
+                                    /* otherwise we simply make np2 point to
+                                       np1 (which is our matching preset) */
+                                    np2 = np1;
+                                    // clear old preset data
+                                    if (np2->np_val.l_n)
+                                        alist_clear(&np2->np_val);
+                                }
+
+                                data_count = 0;
+                                argv++;
+
+                                /* figure out how long of variable data list
+                                   follows the preset descriptor */
+                                while (data_count < natom &&
+                                       strcmp(
+                                        atom_getsymbol(argv+data_count)->s_name,
+                                            "%preset%") &&
+                                       strcmp(
+                                        atom_getsymbol(argv+data_count)->s_name,
+                                            "%node%"))
+                                {
+                                    data_count++;
+                                }
+                                if (PH_DEBUG)
+                                    fprintf(stderr,"    found preset? %d "
+                                                   "found node? %d\n",
+                                        !strcmp(
+                                        atom_getsymbol(argv+data_count)->s_name,
+                                            "%preset%"),
+                                        !strcmp(
+                                        atom_getsymbol(argv+data_count)->s_name,
+                                            "%node%"));
+                                if (PH_DEBUG)
+                                    fprintf(stderr,"    data_count = %d "
+                                                   "starting @ %d out of %d\n",
+                                        data_count, pos+1, natom);
+                                alist_init(&np2->np_val);
+                                alist_list(&np2->np_val, 0, data_count, argv);
+
+                                if (PH_DEBUG)
+                                {
+                                    if ((argv)->a_type == A_SYMBOL)
+                                        fprintf(stderr,"    1st_element = %s\n",
+                                            atom_getsymbol(argv)->s_name);
+                                    else if ((argv)->a_type == A_FLOAT)
+                                        fprintf(stderr,"    1st_element = %f\n",
+                                            atom_getfloat(argv));
+                                    else
+                                        fprintf(stderr,
+                                          "    1st_element = unknown format\n");
+                                }
+
+                                pos = pos + data_count;
+                                /* we already incremented it above before
+                                   figuring out how long data list is so we
+                                   do one less */
+                                argv = argv + data_count - 1;
+                                h_cur = H_PRESET_DATA;
+                            }
+                        }
+                    }
+                }
+            }
+            else
+            {
+                pd_error(x, "%s: malformed/incomplete file", filename->s_name);
+                goto preset_hub_readpreset_fail;
+            }
+        }
+        result = 1;
+    }
+
+    preset_hub_readpreset_fail:
+    if (b) binbuf_free(b);
+    SETFLOAT(ap+0, (t_float)result);
     outlet_anything(x->ph_outlet, gensym("readpreset"), 1, ap);
-	preset_hub_recall(x, recall_preset);
+    preset_hub_recall(x, recall_preset);
 }
 
 void preset_hub_writepreset(t_preset_hub *x, t_symbol *filename, float preset)
 {
-	if(PH_DEBUG) fprintf(stderr,"preset_hub_writepreset\n");
-
-	t_atom ap[1];
-	int result = 0;
-	t_atom *outv;
-	int i;
-	t_preset_hub_data *phd;
-	t_node_preset *np;
-	t_binbuf *b = binbuf_new();
-
-	if (filename == &s_) {
-		pd_error(x, "no writepreset filename given\n");
-		goto preset_hub_writepreset_fail;
-	}
-
-	phd = x->ph_data;
-	if (phd) {
-		binbuf_addv(b, "si", gensym("#hubpreset"), (int)preset);
-		while (phd) {
-			if(PH_DEBUG) fprintf(stderr,"	saving phd\n");
-			// designate a node and state whether it is active or disabled
-			// (disabled nodes are ones that have presets saved but have been deleted since--
-			// we keep these in the case of undo actions during the session that may go beyond
-			// saving something into a file)
-			binbuf_addv(b, "si", gensym("%node%"), phd->phd_pn_gl_loc_length);
-
-			// gather info about the length of the node's location and store it
-			for (i = 0; i < phd->phd_pn_gl_loc_length; i++) {
-				binbuf_addv(b,"i", (int)phd->phd_pn_gl_loc[i]);
-			}
-
-			// save preset data
-			np = phd->phd_npreset;
-			while (np) {
-				// only store preset if it matches requested preset number
-				if (np->np_val.l_n > 0 && np->np_preset == preset) {
-					binbuf_addv(b, "si", gensym("%preset%"), (int)np->np_preset);
-					for (i = 0; i < np->np_val.l_n; i++) {
-						if (np->np_val.l_vec[i].l_a.a_type == A_FLOAT)
-							binbuf_addv(b, "f", np->np_val.l_vec[i].l_a.a_w.w_float);
-						else if (np->np_val.l_vec[i].l_a.a_type == A_SYMBOL)
-							binbuf_addv(b, "s", np->np_val.l_vec[i].l_a.a_w.w_symbol);	
-					}
-				}
-				np = np->np_next;
-			}
-
-			phd = phd->phd_next;
-		}
-		binbuf_addv(b, ";");
-		result = 1;
-	}
-	if(PH_DEBUG) fprintf(stderr,"	done creating binbuf\n");
+    if(PH_DEBUG) fprintf(stderr,"preset_hub_writepreset\n");
+
+    t_atom ap[1];
+    int result = 0;
+    t_atom *outv;
+    int i;
+    t_preset_hub_data *phd;
+    t_node_preset *np;
+    t_binbuf *b = binbuf_new();
+
+    if (filename == &s_)
+    {
+        pd_error(x, "no writepreset filename given\n");
+        goto preset_hub_writepreset_fail;
+    }
+
+    phd = x->ph_data;
+    if (phd)
+    {
+        binbuf_addv(b, "si", gensym("#hubpreset"), (int)preset);
+        while (phd)
+        {
+            if(PH_DEBUG) fprintf(stderr,"    saving phd\n");
+            /* designate a node and state whether it is active or disabled
+               (disabled nodes are ones that have presets saved but have been
+               deleted since-- we keep these in the case of undo actions during
+               the session that may go beyond saving something into a file) */
+            binbuf_addv(b, "si", gensym("%node%"), phd->phd_pn_gl_loc_length);
+
+            // gather info about the length of the node's location and store it
+            for (i = 0; i < phd->phd_pn_gl_loc_length; i++)
+            {
+                binbuf_addv(b,"i", (int)phd->phd_pn_gl_loc[i]);
+            }
+
+            // save preset data
+            np = phd->phd_npreset;
+            while (np)
+            {
+                // only store preset if it matches requested preset number
+                if (np->np_val.l_n > 0 && np->np_preset == preset)
+                {
+                    binbuf_addv(b, "si", gensym("%preset%"), (int)np->np_preset);
+                    for (i = 0; i < np->np_val.l_n; i++)
+                    {
+                        if (np->np_val.l_vec[i].l_a.a_type == A_FLOAT)
+                            binbuf_addv(b, "f",
+                                np->np_val.l_vec[i].l_a.a_w.w_float);
+                        else if (np->np_val.l_vec[i].l_a.a_type == A_SYMBOL)
+                            binbuf_addv(b, "s",
+                                np->np_val.l_vec[i].l_a.a_w.w_symbol);    
+                    }
+                }
+                np = np->np_next;
+            }
+
+            phd = phd->phd_next;
+        }
+        binbuf_addv(b, ";");
+        result = 1;
+    }
+    if (PH_DEBUG) fprintf(stderr,"    done creating binbuf\n");
 
     char buf[MAXPDSTRING];
     canvas_makefilename(x->ph_canvas, filename->s_name,
-		buf, MAXPDSTRING);
-    if (binbuf_write(b, buf, "", 1)) {
-    	pd_error(x, "%s: write failed", filename->s_name);
-		result = 0;
-	}
-	if(PH_DEBUG) fprintf(stderr,"	done saving file\n");
-
-	preset_hub_writepreset_fail:
-	if (b) binbuf_free(b);
-	SETFLOAT(ap+0, (t_float)result);
+        buf, MAXPDSTRING);
+    if (binbuf_write(b, buf, "", 1))
+    {
+        pd_error(x, "%s: write failed", filename->s_name);
+        result = 0;
+    }
+    if (PH_DEBUG) fprintf(stderr,"    done saving file\n");
+
+    preset_hub_writepreset_fail:
+    if (b) binbuf_free(b);
+    SETFLOAT(ap+0, (t_float)result);
     outlet_anything(x->ph_outlet, gensym("writepreset"), 1, ap);
 }
 
 static void *preset_hub_new(t_symbol *s, int argc, t_atom *argv)
 {
-	if(PH_DEBUG) fprintf(stderr,"===preset_hub_new===\n");
-	t_glob_preset_node_list *nl;
-	t_glob_preset_hub_list *hl;
-	t_preset_hub_data *hd1, *hd2;
-	t_node_preset *np1, *np2;
-	t_hub_parser h_cur = H_NONE;
-
-	t_preset_hub *x, *check;
-	t_atom *name;
-	int i, pos, loc_pos;
-	int j, data_count; //for lists
-	t_glist *glist=(t_glist *)canvas_getcurrent();
-	t_canvas *canvas = (t_canvas *)glist_getcanvas(glist);
-
-	loc_pos = 0;
-	pos = 0; // position within argc
-
-	name = (t_atom *)getbytes(sizeof(t_atom));
-
-	// read creation arguments and substitute default for objects without optional arguments
+    if(PH_DEBUG) fprintf(stderr,"===preset_hub_new===\n");
+    t_glob_preset_node_list *nl;
+    t_glob_preset_hub_list *hl;
+    t_preset_hub_data *hd1, *hd2;
+    t_node_preset *np1, *np2;
+    t_hub_parser h_cur = H_NONE;
+
+    t_preset_hub *x, *check;
+    t_atom *name;
+    int i, pos, loc_pos;
+    int j, data_count; //for lists
+    t_glist *glist=(t_glist *)canvas_getcurrent();
+    t_canvas *canvas = (t_canvas *)glist_getcanvas(glist);
+
+    loc_pos = 0;
+    pos = 0; // position within argc
+
+    name = (t_atom *)getbytes(sizeof(t_atom));
+
+    /* read creation arguments and substitute default for objects without
+       optional arguments */
     if (argc == 0 ||
-		(argc > 0 && argv[0].a_type == A_SYMBOL && !strcmp(atom_getsymbol(&argv[0])->s_name, "%hidden%"))) {
-			pos--; // we subtract one position as we are essentially missing one argument (to counter pos++; call below that is called without checks)	
-			name->a_type = A_SYMBOL;
-			name->a_w.w_symbol = &s_;
-			if (PH_DEBUG) fprintf(stderr,"	name is null symbol\n");
-	} else {
-		if (argv[0].a_type == A_SYMBOL)
-			SETSYMBOL(name, atom_getsymbolarg(0, argc, argv));
-		else
-			SETFLOAT(name, atom_getfloatarg(0, argc, argv));
-		if(PH_DEBUG) {
-			if (name->a_type == A_SYMBOL) fprintf(stderr,"	name is a symbol %s\n", atom_getsymbol(name)->s_name);
-			else fprintf(stderr,"	name is a float %f\n", atom_getfloat(name));
-		}
-	}
-
-	// now check if there is already another hub on the same canvas with the same name and fail if so
-	check = canvas->gl_phub;
-	if (check) {
-		while (check) {
-			if (name->a_type == A_SYMBOL && check->ph_name->a_type == A_SYMBOL) {
-				if (!strcmp(atom_getsymbol(name)->s_name, atom_getsymbol(check->ph_name)->s_name)) {
-					pd_error(canvas, "preset_hub with the name %s already exists on this canvas", atom_getsymbol(check->ph_name)->s_name);
-					freebytes(name, sizeof(t_atom));
-					return(NULL);
-				}
-			}
-			else if (name->a_type == A_FLOAT && check->ph_name->a_type == A_FLOAT) {
-				if (atom_getfloat(name) == atom_getfloat(check->ph_name)) {
-					pd_error(canvas, "preset_hub with the name %f already exists on this canvas", atom_getfloat(check->ph_name));
-					freebytes(name, sizeof(t_atom));
-					return(NULL);
-				}
-			}
-			check = check->ph_next;
-		}
-	}
-
-	x = (t_preset_hub *)pd_new(preset_hub_class);
-	x->ph_invis = 0;
-	x->ph_extern_file = 0;
-
-	// read basic creation arguments
-	x->ph_name = name;
-	pos++;
-	// saving into external file
-	if (argc > pos && argv[pos].a_type == A_SYMBOL && !strcmp(atom_getsymbol(&argv[pos])->s_name, "file")) {
-		x->ph_extern_file = 1;
-		pos++;
-	}
-	// are we invisible (used by k12 mode)
-	if (argc > pos && argv[pos].a_type == A_FLOAT) {
-		x->ph_invis = (int)atom_getfloat(&argv[1]);
-		if (x->ph_invis < 0) x->ph_invis = 0;
-		/*level = x->ph_level;
-		while (level > 0 && canvas->gl_owner) {
-			if (canvas->gl_owner) canvas = canvas->gl_owner;
-			level--;
-		}*/
-		pos++;
-	}
-	if(PH_DEBUG) fprintf(stderr,"	hub file %d invis %d\n", x->ph_extern_file, x->ph_invis);
-
-	while (argc > pos && argv[pos].a_type != A_SYMBOL && !strcmp(atom_getsymbol(&argv[pos])->s_name, "%hidden%")) {
-		if(PH_DEBUG) fprintf(stderr,"	pos++\n");
-		pos++; // one more time to move ahead of the %hidden% tag
-	}
-
-	// assign default x and y position
-	x->ph_obj.te_xpix = 0;
-	x->ph_obj.te_ypix = 0;
-
-	x->ph_preset = -1;
-
-	x->ph_canvas = canvas;
-
-	// add us to the global hub list
-	glob_preset_hub_list_add(x);
-
-	// add hub to the canvas pointer
-	if (!canvas->gl_phub)
-		canvas->gl_phub = x;
-	else {
-		t_preset_hub *gl_phub = canvas->gl_phub;
-		while (gl_phub->ph_next)
-			gl_phub = gl_phub->ph_next;
-		gl_phub->ph_next = x;
-	}
-	x->ph_next = NULL;
-	x->ph_data = NULL;
-
-	hd1 = NULL;
-	hd2 = NULL;
-	np1 = NULL;
-	np2 = NULL;
-
-	// load the data from the buffer and build the preset db
-	if (pos < argc) {
-		for (i=pos; i < argc; i++) {
-			if(PH_DEBUG) fprintf(stderr,"	position: %d\n", i);
-			// SYMBOL ANALYSIS
-			if (argv[i].a_type == A_SYMBOL) {
-				if(PH_DEBUG) fprintf(stderr,"	data = %s\n", atom_getsymbol(&argv[i])->s_name);
-				if (!strcmp(atom_getsymbol(&argv[i])->s_name, "%node%")) {
-					// beginning of a new node
-					if(PH_DEBUG) fprintf(stderr,"	new node\n");
-					hd2 = (t_preset_hub_data *)t_getbytes(sizeof(*hd2));
-					hd2->phd_pn_gl_loc_length = 0;
-					if (hd1) {
-						hd1->phd_next = hd2;
-						if(PH_DEBUG) fprintf(stderr,"	not first node\n");
-					}
-					else {
-						x->ph_data = hd2;
-						if(PH_DEBUG) fprintf(stderr,"	first node\n");
-					}
-					hd1 = hd2;
-					np1 = NULL; // have to reset it so that new presets are not erroneously appended to previous node
-					h_cur = H_NODE;
-				}
-				else if (!strcmp(atom_getsymbol(&argv[i])->s_name, "%preset%")) {
-					// beginning of a new preset
-					if(PH_DEBUG) fprintf(stderr,"	new preset\n");
-					np2 = (t_node_preset *)t_getbytes(sizeof(*np2));
-					if (np1) {
-						np1->np_next = np2;
-						if(PH_DEBUG) fprintf(stderr,"	not first preset\n");
-					}
-					else {
-						hd2->phd_npreset = np2;
-						if(PH_DEBUG) fprintf(stderr,"	first preset\n");
-					}
-					np1 = np2;
-					h_cur = H_PRESET;
-				}
-			}
-			// FLOAT ANALYSIS
-			else if (argv[i].a_type == A_FLOAT) {
-				if(PH_DEBUG) fprintf(stderr,"	data = %g\n", atom_getfloat(&argv[i]));
-				if (h_cur == H_NODE) {
-					// node location length
-					hd2->phd_pn_gl_loc_length = (int)atom_getfloat(&argv[i]);
-					// reconstruct the dynamic location array
-					if (!hd2->phd_pn_gl_loc)
-						hd2->phd_pn_gl_loc = (int*)calloc(hd2->phd_pn_gl_loc_length, sizeof(hd2->phd_pn_gl_loc));
-					hd2->phd_pn_gl_loc[hd2->phd_pn_gl_loc_length-1] = (int)atom_getfloat(&argv[i]); //WHY IS THIS HERE?
-					if(PH_DEBUG) fprintf(stderr,"	loc length = %d\n", hd2->phd_pn_gl_loc_length);
-					loc_pos = 0;
-					h_cur = H_LOCATION;
-				}
-				else if (h_cur == H_LOCATION) {
-					// node location data
-					hd2->phd_pn_gl_loc[loc_pos] = (int)atom_getfloat(&argv[i]);
-					if(PH_DEBUG) fprintf(stderr,"	loc = %d\n", hd2->phd_pn_gl_loc[loc_pos]);
-					loc_pos++;
-				}
-				else if (h_cur == H_PRESET) {
-					// preset number
-					if(PH_DEBUG) fprintf(stderr,"	preset %g\n", atom_getfloat(&argv[i]));
-					np2->np_preset = (int)atom_getfloat(&argv[i]);
-					data_count = i+1;
-					// figure out how long of variable data list follows the preset descriptor
-					while (data_count < argc && strcmp(atom_getsymbol(&argv[data_count])->s_name, "%preset%") && strcmp(atom_getsymbol(&argv[data_count])->s_name, "%node%")) {
-						data_count++;
-					}
-					if(PH_DEBUG) fprintf(stderr,"	found preset? %d found node? %d\n", !strcmp(atom_getsymbol(&argv[data_count])->s_name, "%preset%"), !strcmp(atom_getsymbol(&argv[data_count])->s_name, "%node%"));
-					data_count = data_count - (i+1);
-					if(PH_DEBUG) fprintf(stderr,"	data_count = %d starting @ %d out of %d\n", data_count, i+1, argc);
-					alist_init(&np2->np_val);
-					alist_list(&np2->np_val, 0, data_count, argv+(i+1));
-					i = i + data_count;
-					h_cur = H_PRESET_DATA;
-				}
-			}
-		}
-	}
-	x->ph_outlet = outlet_new(&x->ph_obj, 0);
-
-	// let us pair with our nodes (if any)
-	// this is done node-side (node has to traverse canvases upwards to make sure
-	// multiple abstractions with same hubs/nodes do not trip over each other)
-	// do this only if we are not undoing, otherwise, we'll have the undo do it for us
-	// once it has repositioned objects to their original locations
-	// (the undo check is done inside the glob_preset_node_list_seek_hub)
-	glob_preset_node_list_seek_hub();
+        (argc > 0 && argv[0].a_type == A_SYMBOL &&
+         !strcmp(atom_getsymbol(&argv[0])->s_name, "%hidden%")))
+        {
+            /* we subtract one position as we are essentially missing one
+               argument (to counter pos++; call below that is called without
+               checks) */
+            pos--;
+            name->a_type = A_SYMBOL;
+            name->a_w.w_symbol = &s_;
+            if (PH_DEBUG) fprintf(stderr,"    name is null symbol\n");
+    }
+    else
+    {
+        if (argv[0].a_type == A_SYMBOL)
+            SETSYMBOL(name, atom_getsymbolarg(0, argc, argv));
+        else
+            SETFLOAT(name, atom_getfloatarg(0, argc, argv));
+        if (PH_DEBUG)
+        {
+            if (name->a_type == A_SYMBOL)
+                fprintf(stderr,"    name is a symbol %s\n",
+                    atom_getsymbol(name)->s_name);
+            else
+                fprintf(stderr,"    name is a float %f\n",
+                    atom_getfloat(name));
+        }
+    }
+
+    /* now check if there is already another hub on the same canvas with the
+       same name and fail if so */
+    check = canvas->gl_phub;
+    if (check)
+    {
+        while (check)
+        {
+            if (name->a_type == A_SYMBOL && check->ph_name->a_type == A_SYMBOL)
+            {
+                if (!strcmp(atom_getsymbol(name)->s_name,
+                        atom_getsymbol(check->ph_name)->s_name))
+                {
+                    pd_error(canvas, "preset_hub with the name %s "
+                                     "already exists on this canvas",
+                        atom_getsymbol(check->ph_name)->s_name);
+                    freebytes(name, sizeof(t_atom));
+                    return(NULL);
+                }
+            }
+            else if (name->a_type == A_FLOAT &&
+                     check->ph_name->a_type == A_FLOAT)
+            {
+                if (atom_getfloat(name) == atom_getfloat(check->ph_name))
+                {
+                    pd_error(canvas, "preset_hub with the name %f "
+                                     "already exists on this canvas",
+                        atom_getfloat(check->ph_name));
+                    freebytes(name, sizeof(t_atom));
+                    return(NULL);
+                }
+            }
+            check = check->ph_next;
+        }
+    }
+
+    x = (t_preset_hub *)pd_new(preset_hub_class);
+    x->ph_invis = 0;
+    x->ph_extern_file = 0;
+
+    // read basic creation arguments
+    x->ph_name = name;
+    pos++;
+    // saving into external file
+    if (argc > pos && argv[pos].a_type == A_SYMBOL &&
+        !strcmp(atom_getsymbol(&argv[pos])->s_name, "file"))
+    {
+        x->ph_extern_file = 1;
+        pos++;
+    }
+    // are we invisible (used by k12 mode)
+    if (argc > pos && argv[pos].a_type == A_FLOAT)
+    {
+        x->ph_invis = (int)atom_getfloat(&argv[1]);
+        if (x->ph_invis < 0) x->ph_invis = 0;
+        /*level = x->ph_level;
+        while (level > 0 && canvas->gl_owner) {
+            if (canvas->gl_owner) canvas = canvas->gl_owner;
+            level--;
+        }*/
+        pos++;
+    }
+    if (PH_DEBUG)
+        fprintf(stderr,"    hub file %d invis %d\n",
+            x->ph_extern_file, x->ph_invis);
+
+    while (argc > pos && argv[pos].a_type != A_SYMBOL &&
+           !strcmp(atom_getsymbol(&argv[pos])->s_name, "%hidden%"))
+    {
+        if (PH_DEBUG) fprintf(stderr,"    pos++\n");
+        pos++; // one more time to move ahead of the %hidden% tag
+    }
+
+    // assign default x and y position
+    x->ph_obj.te_xpix = 0;
+    x->ph_obj.te_ypix = 0;
+
+    x->ph_preset = -1;
+
+    x->ph_canvas = canvas;
+
+    // add us to the global hub list
+    glob_preset_hub_list_add(x);
+
+    // add hub to the canvas pointer
+    if (!canvas->gl_phub)
+        canvas->gl_phub = x;
+    else
+    {
+        t_preset_hub *gl_phub = canvas->gl_phub;
+        while (gl_phub->ph_next)
+            gl_phub = gl_phub->ph_next;
+        gl_phub->ph_next = x;
+    }
+    x->ph_next = NULL;
+    x->ph_data = NULL;
+
+    hd1 = NULL;
+    hd2 = NULL;
+    np1 = NULL;
+    np2 = NULL;
+
+    // load the data from the buffer and build the preset db
+    if (pos < argc)
+    {
+        for (i=pos; i < argc; i++)
+        {
+            if(PH_DEBUG) fprintf(stderr,"    position: %d\n", i);
+            // SYMBOL ANALYSIS
+            if (argv[i].a_type == A_SYMBOL)
+            {
+                if (PH_DEBUG)
+                    fprintf(stderr,"    data = %s\n",
+                        atom_getsymbol(&argv[i])->s_name);
+                if (!strcmp(atom_getsymbol(&argv[i])->s_name, "%node%"))
+                {
+                    // beginning of a new node
+                    if (PH_DEBUG) fprintf(stderr,"    new node\n");
+                    hd2 = (t_preset_hub_data *)t_getbytes(sizeof(*hd2));
+                    hd2->phd_pn_gl_loc_length = 0;
+                    if (hd1)
+                    {
+                        hd1->phd_next = hd2;
+                        if (PH_DEBUG) fprintf(stderr,"    not first node\n");
+                    }
+                    else
+                    {
+                        x->ph_data = hd2;
+                        if (PH_DEBUG) fprintf(stderr,"    first node\n");
+                    }
+                    hd1 = hd2;
+                    /* have to reset it so that new presets are not erroneously
+                       appended to previous node... */
+                    np1 = NULL;
+                    h_cur = H_NODE;
+                }
+                else if (!strcmp(atom_getsymbol(&argv[i])->s_name, "%preset%"))
+                {
+                    // beginning of a new preset
+                    if (PH_DEBUG) fprintf(stderr,"    new preset\n");
+                    np2 = (t_node_preset *)t_getbytes(sizeof(*np2));
+                    if (np1)
+                    {
+                        np1->np_next = np2;
+                        if (PH_DEBUG) fprintf(stderr,"    not first preset\n");
+                    }
+                    else
+                    {
+                        hd2->phd_npreset = np2;
+                        if (PH_DEBUG) fprintf(stderr,"    first preset\n");
+                    }
+                    np1 = np2;
+                    h_cur = H_PRESET;
+                }
+            }
+            // FLOAT ANALYSIS
+            else if (argv[i].a_type == A_FLOAT)
+            {
+                if (PH_DEBUG)
+                    fprintf(stderr,"    data = %g\n", atom_getfloat(&argv[i]));
+                if (h_cur == H_NODE)
+                {
+                    // node location length
+                    hd2->phd_pn_gl_loc_length = (int)atom_getfloat(&argv[i]);
+                    // reconstruct the dynamic location array
+                    if (!hd2->phd_pn_gl_loc)
+                        hd2->phd_pn_gl_loc =
+                            (int*)calloc(hd2->phd_pn_gl_loc_length,
+                                sizeof(hd2->phd_pn_gl_loc));
+                    hd2->phd_pn_gl_loc[hd2->phd_pn_gl_loc_length-1] =
+                        (int)atom_getfloat(&argv[i]); //WHY IS THIS HERE?
+                    if (PH_DEBUG)
+                        fprintf(stderr,"    loc length = %d\n",
+                            hd2->phd_pn_gl_loc_length);
+                    loc_pos = 0;
+                    h_cur = H_LOCATION;
+                }
+                else if (h_cur == H_LOCATION)
+                {
+                    // node location data
+                    hd2->phd_pn_gl_loc[loc_pos] = (int)atom_getfloat(&argv[i]);
+                    if (PH_DEBUG)
+                        fprintf(stderr,"    loc = %d\n",
+                            hd2->phd_pn_gl_loc[loc_pos]);
+                    loc_pos++;
+                }
+                else if (h_cur == H_PRESET)
+                {
+                    // preset number
+                    if (PH_DEBUG)
+                        fprintf(stderr,"    preset %g\n",
+                            atom_getfloat(&argv[i]));
+                    np2->np_preset = (int)atom_getfloat(&argv[i]);
+                    data_count = i+1;
+                    /* figure out how long of variable data list follows the
+                       preset descriptor */
+                    while (data_count < argc &&
+                           strcmp(atom_getsymbol(&argv[data_count])->s_name,
+                               "%preset%") &&
+                           strcmp(atom_getsymbol(&argv[data_count])->s_name,
+                               "%node%"))
+                    {
+                        data_count++;
+                    }
+                    if (PH_DEBUG)
+                        fprintf(stderr,"    found preset? %d found node? %d\n",
+                            !strcmp(atom_getsymbol(&argv[data_count])->s_name,
+                                "%preset%"),
+                            !strcmp(atom_getsymbol(&argv[data_count])->s_name,
+                                "%node%"));
+                    data_count = data_count - (i+1);
+                    if (PH_DEBUG)
+                        fprintf(stderr,"    data_count = %d "
+                                       "starting @ %d out of %d\n",
+                            data_count, i+1, argc);
+                    alist_init(&np2->np_val);
+                    alist_list(&np2->np_val, 0, data_count, argv+(i+1));
+                    i = i + data_count;
+                    h_cur = H_PRESET_DATA;
+                }
+            }
+        }
+    }
+    x->ph_outlet = outlet_new(&x->ph_obj, 0);
+
+    /* let us pair with our nodes (if any)
+       this is done node-side (node has to traverse canvases upwards to make
+       sure multiple abstractions with same hubs/nodes do not trip over each
+       other). Do this only if we are not undoing, otherwise, we'll have the
+       undo do it for us once it has repositioned objects to their original
+       locations (the undo check is done inside the
+       glob_preset_node_list_seek_hub) */
+    glob_preset_node_list_seek_hub();
 
     return(x);
 }
 
 static void preset_hub_free(t_preset_hub* x)
 {
-	if(PH_DEBUG) fprintf(stderr,"preset_hub_free\n");
-	t_glob_preset_node_list *nl;
-	t_preset_hub_data *hd1, *hd2;
-	t_node_preset *np1, *np2;
-	t_preset_hub *h1, *h2;
-
-	// inform all nodes that the hub is going bye-bye
-	if (gpnl) {
-		if(PH_DEBUG) fprintf(stderr,"	we got gpnl\n");
-		nl = gpnl;
-		while(nl) {
-			if(PH_DEBUG) fprintf(stderr,"	analyzing gpnl entry %d\n", nl->gpnl_paired);
-			if (nl->gpnl_paired && nl->gpnl_node->pn_hub == x) {
-				// we only make the hub pointer null and leave location for undo/redo/save purposes
-				nl->gpnl_paired = 0;
-				nl->gpnl_node->pn_hub = NULL;
-				if(PH_DEBUG) fprintf(stderr,"	removed gpnl reference\n");
-			}
-			nl = nl->gpnl_next;
-		}
-	}
-	glob_preset_hub_list_delete(x);
-
-	// remove the hub from the canvas pointer list
-	h2 = x->ph_canvas->gl_phub;
-	h1 = h2;
-	if (!h2->ph_next) {
-		// if there is only one hub on this canvas
-		x->ph_canvas->gl_phub = NULL;
-	} else {
-		while (h2 && h2 != x) {
-			h1 = h2;
-			h2 = h2->ph_next;
-		}
-		if (h2 != x) {
-			// this should never happen
-			pd_error(x, "preset_hub %s destructor was unable to find its canvas pointer", atom_getsymbol(x->ph_name)->s_name);
-		} else {
-			if (h1 == h2) {
-				// this means we're the first on the multi-element list
-				x->ph_canvas->gl_phub = h1->ph_next;
-			} else {
-				h1->ph_next = h2->ph_next;
-			}
-		}
-	}
-
-	// deallocate all the dynamically-allocated memory
-	if (x->ph_data) {
-		hd1 = x->ph_data;
-		while (hd1) {
-			if (hd1->phd_npreset) {
-				np1 = hd1->phd_npreset;
-				while (np1) {
-					np2 = np1->np_next;
-					if (np1->np_val.l_n)
-						alist_clear(&np1->np_val);
-					freebytes(np1, sizeof(*np1));
-					np1 = np2;
-				}
-			}
-			hd2 = hd1->phd_next;
-			free(hd1->phd_pn_gl_loc);
-			freebytes(hd1, sizeof(*hd1));
-			hd1 = hd2;
-		}
-	}
-	
-	//if (x->ph_name->a_type == A_SYMBOL && x->ph_name->a_w.w_symbol == &s_)
-	if (x->ph_name)
-		freebytes(x->ph_name, sizeof(t_atom));
+    if(PH_DEBUG) fprintf(stderr,"preset_hub_free\n");
+    t_glob_preset_node_list *nl;
+    t_preset_hub_data *hd1, *hd2;
+    t_node_preset *np1, *np2;
+    t_preset_hub *h1, *h2;
+
+    // inform all nodes that the hub is going bye-bye
+    if (gpnl)
+    {
+        if(PH_DEBUG) fprintf(stderr,"    we got gpnl\n");
+        nl = gpnl;
+        while(nl)
+        {
+            if(PH_DEBUG)
+                fprintf(stderr,"    analyzing gpnl entry %d\n",
+                    nl->gpnl_paired);
+            if (nl->gpnl_paired && nl->gpnl_node->pn_hub == x)
+            {
+                /* we only make the hub pointer null and leave location
+                   for undo/redo/save purposes */
+                nl->gpnl_paired = 0;
+                nl->gpnl_node->pn_hub = NULL;
+                if(PH_DEBUG) fprintf(stderr,"    removed gpnl reference\n");
+            }
+            nl = nl->gpnl_next;
+        }
+    }
+    glob_preset_hub_list_delete(x);
+
+    // remove the hub from the canvas pointer list
+    h2 = x->ph_canvas->gl_phub;
+    h1 = h2;
+    if (!h2->ph_next)
+    {
+        // if there is only one hub on this canvas
+        x->ph_canvas->gl_phub = NULL;
+    }
+    else
+    {
+        while (h2 && h2 != x)
+        {
+            h1 = h2;
+            h2 = h2->ph_next;
+        }
+        if (h2 != x)
+        {
+            // this should never happen
+            pd_error(x, "preset_hub %s destructor was unable to "
+                        "find its canvas pointer",
+                atom_getsymbol(x->ph_name)->s_name);
+        }
+        else
+        {
+            if (h1 == h2)
+            {
+                // this means we're the first on the multi-element list
+                x->ph_canvas->gl_phub = h1->ph_next;
+            }
+            else
+            {
+                h1->ph_next = h2->ph_next;
+            }
+        }
+    }
+
+    // deallocate all the dynamically-allocated memory
+    if (x->ph_data)
+    {
+        hd1 = x->ph_data;
+        while (hd1)
+        {
+            if (hd1->phd_npreset)
+            {
+                np1 = hd1->phd_npreset;
+                while (np1)
+                {
+                    np2 = np1->np_next;
+                    if (np1->np_val.l_n)
+                        alist_clear(&np1->np_val);
+                    freebytes(np1, sizeof(*np1));
+                    np1 = np2;
+                }
+            }
+            hd2 = hd1->phd_next;
+            free(hd1->phd_pn_gl_loc);
+            freebytes(hd1, sizeof(*hd1));
+            hd1 = hd2;
+        }
+    }
+    
+    //if (x->ph_name->a_type == A_SYMBOL && x->ph_name->a_w.w_symbol == &s_)
+    if (x->ph_name)
+        freebytes(x->ph_name, sizeof(t_atom));
 }
 
 void preset_hub_setup(void)
 {
-	preset_hub_class = class_new(gensym("preset_hub"), 
-	    (t_newmethod)preset_hub_new, (t_method)preset_hub_free, 
-	    sizeof(t_preset_hub), 0, A_GIMME, 0);
-
-	// have to call this after everything has loaded, otherwise, the hub may not yet exist
-	// we do this using pre-loadbang call that is issued before other loadbangs, otherwise
-	// out-of-order loadbangs can issue preset recall before the preset has been properly
-	// configured
-	class_addmethod(preset_hub_class, (t_method)glob_preset_node_list_seek_hub,
+    preset_hub_class = class_new(gensym("preset_hub"), 
+        (t_newmethod)preset_hub_new, (t_method)preset_hub_free, 
+        sizeof(t_preset_hub), 0, A_GIMME, 0);
+
+    /* have to call this after everything has loaded, otherwise, the hub
+       may not yet exist we do this using pre-loadbang call that is issued
+       before other loadbangs, otherwise out-of-order loadbangs can issue
+       preset recall before the preset has been properly configured */
+    class_addmethod(preset_hub_class, (t_method)glob_preset_node_list_seek_hub,
         gensym("pre-loadbang"), 0);
 
     class_addmethod(preset_hub_class, (t_method)preset_hub_recall,
@@ -2228,8 +2785,9 @@ void preset_hub_setup(void)
     class_addmethod(preset_hub_class, (t_method)preset_hub_writepreset,
         gensym("writepreset"), A_DEFSYM, A_DEFFLOAT, 0);
 
-    class_addbang(preset_hub_class, preset_hub_bang);		// we'll use this to output current preset
-	class_setsavefn(preset_hub_class, preset_hub_save);
+    // we'll use this to output current preset...
+    class_addbang(preset_hub_class, preset_hub_bang);
+    class_setsavefn(preset_hub_class, preset_hub_save);
 }
 
 //====================== end preset_hub ============================//
@@ -2237,6 +2795,6 @@ void preset_hub_setup(void)
 void x_preset_setup(void)
 {
     preset_node_setup();
-	preset_hub_setup();
+    preset_hub_setup();
 }