[med-svn] [praat] 09/14: Imported Upstream version 6.0.3

Rafael Laboissière rlaboiss-guest at moszumanska.debian.org
Sun Nov 1 19:08:30 UTC 2015


This is an automated email from the git hooks/post-receive script.

rlaboiss-guest pushed a commit to branch master
in repository praat.

commit d7b3a42c062f4abede1d67d872f38d375e92ccec
Author: Rafael Laboissiere <rafael at laboissiere.net>
Date:   Sat Oct 31 14:44:52 2015 -0200

    Imported Upstream version 6.0.3
---
 EEG/EEG.cpp                                  |  16 +-
 LPC/Cepstrogram.cpp                          |   4 +-
 LPC/LPC_to_Spectrogram.cpp                   |   4 +-
 LPC/Sound_and_LPC.cpp                        |   2 +-
 LPC/Sound_and_LPC_robust.cpp                 |   6 +-
 artsynth/Art_Speaker_to_VocalTract.cpp       |   4 +-
 artsynth/Art_Speaker_to_VocalTract.h         |   4 +-
 artsynth/Articulation.cpp                    |   2 +-
 artsynth/Articulation.h                      |   2 +-
 artsynth/Artword_Speaker.cpp                 |  13 +-
 artsynth/Artword_Speaker_Sound.cpp           |   6 +-
 artsynth/Artword_to_Art.cpp                  |   4 +-
 artsynth/Artword_to_Art.h                    |   4 +-
 artsynth/Delta.cpp                           |   4 +-
 artsynth/Delta.h                             |   2 +-
 artsynth/Speaker.cpp                         |   5 +-
 artsynth/Speaker.h                           |   2 +-
 artsynth/Speaker_to_Delta.cpp                |   4 +-
 artsynth/Speaker_to_Delta.h                  |   2 +-
 artsynth/praat_Artsynth.cpp                  |   3 +-
 dwtest/test_Sound_draw_where.praat           |   1 +
 dwtest/test_sigma_ellipse.praat              |   2 +
 dwtools/CCA.cpp                              |   5 +-
 dwtools/CategoriesEditor.cpp                 |  38 +--
 dwtools/DTW_and_TextGrid.cpp                 |  40 +--
 dwtools/DTW_and_TextGrid.h                   |  13 +-
 dwtools/Discriminant.cpp                     |   8 +-
 dwtools/EditDistanceTable.cpp                |  62 ++--
 dwtools/EditDistanceTable.h                  |  18 +-
 dwtools/EditDistanceTable_def.h              |   4 +-
 dwtools/Eigen_and_Matrix.cpp                 |  32 +-
 dwtools/Eigen_and_Matrix.h                   |   6 +-
 dwtools/Eigen_and_Procrustes.cpp             |   7 +-
 dwtools/Eigen_and_Procrustes.h               |   4 +-
 dwtools/Eigen_and_SSCP.cpp                   |  18 +-
 dwtools/Eigen_and_SSCP.h                     |   7 +-
 dwtools/Eigen_and_TableOfReal.cpp            |  16 +-
 dwtools/Eigen_and_TableOfReal.h              |  10 +-
 dwtools/Excitations.cpp                      |  18 +-
 dwtools/Excitations.h                        |  10 +-
 dwtools/FormantGrid_extensions.h             |   2 +-
 dwtools/GaussianMixture.cpp                  |  86 +++---
 dwtools/GaussianMixture.h                    |  55 ++--
 dwtools/HMM.cpp                              | 368 +++++++++++------------
 dwtools/HMM.h                                |  68 ++---
 dwtools/HMM_def.h                            |  22 +-
 dwtools/ICA.cpp                              |  64 ++--
 dwtools/ICA.h                                |  48 +--
 dwtools/Intensity_extensions.cpp             |  23 +-
 dwtools/Intensity_extensions.h               |   8 +-
 dwtools/KlattGrid.cpp                        |   2 +-
 dwtools/KlattTable.cpp                       | 115 ++++----
 dwtools/KlattTable.h                         |  18 +-
 dwtools/LFCC.cpp                             |   7 +-
 dwtools/LFCC.h                               |   4 +-
 dwtools/LongSound_extensions.cpp             |   7 +-
 dwtools/Matrix_Categories.cpp                |   6 +-
 dwtools/Matrix_Categories.h                  |   4 +-
 dwtools/Matrix_extensions.cpp                |  52 ++--
 dwtools/Matrix_extensions.h                  |   7 +-
 dwtools/OptimalCeilingTier.cpp               |  10 +-
 dwtools/OptimalCeilingTier.h                 |   4 +-
 dwtools/PCA.cpp                              |  46 ++-
 dwtools/PCA.h                                |  16 +-
 dwtools/Pitch_extensions.cpp                 |  73 +++--
 dwtools/Pitch_extensions.h                   |   8 +-
 dwtools/Polygon_extensions.cpp               |  83 +++---
 dwtools/Polygon_extensions.h                 |  36 ++-
 dwtools/Procrustes.cpp                       |   8 +-
 dwtools/Procrustes.h                         |   4 +-
 dwtools/Resonator.cpp                        |  14 +-
 dwtools/Resonator.h                          |   8 +-
 dwtools/Sound_and_FilterBank.cpp             | 421 ---------------------------
 dwtools/Sound_and_FilterBank.h               |  58 ----
 dwtools/Sound_and_PCA.cpp                    |  18 +-
 dwtools/Sound_and_PCA.h                      |  12 +-
 dwtools/Sound_and_Spectrogram_extensions.cpp |  36 +--
 dwtools/Sound_and_Spectrogram_extensions.h   |  15 +-
 dwtools/Sound_extensions.cpp                 | 255 ++++++++--------
 dwtools/Sound_extensions.h                   |  69 ++---
 dwtools/SpeechSynthesizer.cpp                |  11 +-
 dwtools/SpeechSynthesizer.h                  |   4 +-
 dwtools/SpeechSynthesizer_and_TextGrid.cpp   |  69 +++--
 dwtools/SpeechSynthesizer_and_TextGrid.h     |  12 +-
 dwtools/manual_BSS.cpp                       |  28 +-
 dwtools/manual_HMM.cpp                       |  40 +--
 dwtools/praat_BSS_init.cpp                   |  57 ++--
 dwtools/praat_David_init.cpp                 | 247 +++++++++-------
 dwtools/praat_HMM_init.cpp                   | 192 ++++++------
 fon/AmplitudeTier.cpp                        |   3 +-
 fon/FormantGrid.cpp                          |   8 +-
 fon/IntensityTier.cpp                        |  12 +-
 fon/Ltas_to_SpectrumTier.cpp                 |   3 +-
 fon/PitchTier.cpp                            |   3 +-
 fon/PointEditor.cpp                          |   2 +-
 fon/Praat_tests.cpp                          |   2 +
 fon/RealTier.cpp                             |  34 +--
 fon/RealTier.h                               |  18 +-
 fon/Sound.cpp                                |  88 +++---
 fon/Sound.h                                  |  68 ++---
 fon/SoundEditor.cpp                          |  10 +-
 fon/SoundRecorder.cpp                        |  30 +-
 fon/Sound_PointProcess.cpp                   |   4 +-
 fon/Sound_PointProcess.h                     |   4 +-
 fon/Sound_and_Spectrogram.cpp                |   8 +-
 fon/Sound_and_Spectrogram.h                  |   6 +-
 fon/Sound_and_Spectrum.cpp                   |  24 +-
 fon/Sound_and_Spectrum.h                     |  14 +-
 fon/Sound_audio.cpp                          |   4 +-
 fon/Sound_enhance.cpp                        |  10 +-
 fon/Sound_files.cpp                          |  20 +-
 fon/Sound_to_Cochleagram.cpp                 |  12 +-
 fon/Sound_to_Cochleagram.h                   |   6 +-
 fon/Sound_to_Formant.cpp                     |  21 +-
 fon/Sound_to_Formant.h                       |  10 +-
 fon/Sound_to_Harmonicity.cpp                 |   8 +-
 fon/Sound_to_Harmonicity.h                   |   8 +-
 fon/Sound_to_Harmonicity_GNE.cpp             |   6 +-
 fon/Sound_to_Intensity.cpp                   |  11 +-
 fon/Sound_to_Intensity.h                     |   2 +-
 fon/Sound_to_Pitch.h                         |   2 +-
 fon/Spectrogram.cpp                          |  12 +-
 fon/Spectrogram.h                            |   6 +-
 fon/Spectrum.cpp                             |  20 +-
 fon/Spectrum.h                               |  12 +-
 fon/SpectrumTier.cpp                         |  10 +-
 fon/SpectrumTier.h                           |   6 +-
 fon/Spectrum_and_Spectrogram.cpp             |  10 +-
 fon/Spectrum_and_Spectrogram.h               |   6 +-
 fon/Spectrum_to_Excitation.cpp               |   4 +-
 fon/Spectrum_to_Excitation.h                 |   4 +-
 fon/Spectrum_to_Formant.cpp                  |   4 +-
 fon/Spectrum_to_Formant.h                    |   4 +-
 fon/SpellingChecker.cpp                      |   8 +-
 fon/SpellingChecker.h                        |   6 +-
 fon/TextGrid.cpp                             | 145 ++++-----
 fon/TextGrid.h                               |  68 ++---
 fon/TextGridEditor.cpp                       |  19 +-
 fon/TextGrid_Sound.cpp                       |  16 +-
 fon/TextGrid_Sound.h                         |   6 +-
 fon/TimeSoundAnalysisEditor.cpp              |  57 ++--
 fon/TimeSoundAnalysisEditor.h                |   4 +-
 fon/TimeSoundEditor.cpp                      |   2 +-
 fon/Transition.cpp                           |  16 +-
 fon/Transition.h                             |   8 +-
 fon/VocalTract.cpp                           |  16 +-
 fon/VocalTract.h                             |   8 +-
 fon/VocalTract_to_Spectrum.cpp               |   4 +-
 fon/VocalTract_to_Spectrum.h                 |   4 +-
 fon/WordList.cpp                             |  16 +-
 fon/WordList.h                               |   4 +-
 fon/manual_Script.cpp                        |  33 ++-
 fon/manual_tutorials.cpp                     |   9 +-
 fon/praat_Fon.cpp                            |  10 +-
 fon/praat_Sound_init.cpp                     |  37 +--
 sys/praat.cpp                                |  17 +-
 sys/praat_version.h                          |   6 +-
 157 files changed, 1953 insertions(+), 2357 deletions(-)

diff --git a/EEG/EEG.cpp b/EEG/EEG.cpp
index 22ea457..772645c 100644
--- a/EEG/EEG.cpp
+++ b/EEG/EEG.cpp
@@ -233,7 +233,7 @@ EEG EEG_readFromBdfFile (MelderFile file) {
 		}
 		autoTextGrid thee;
 		if (hasLetters) {
-			thee.reset (TextGrid_create (0, duration, U"Mark Trigger", U"Mark Trigger"));
+			thee = TextGrid_create (0, duration, U"Mark Trigger", U"Mark Trigger");
 			autoMelderString letters;
 			double time = NUMundefined;
 			for (long i = 1; i <= my nx; i ++) {
@@ -284,8 +284,8 @@ EEG EEG_readFromBdfFile (MelderFile file) {
 				time = NUMundefined;   // defensive
 			}
 		} else {
-			thee.reset (TextGrid_create (0, duration,
-				numberOfStatusBits == 8 ? U"S1 S2 S3 S4 S5 S6 S7 S8" : U"S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 S12 S13 S14 S15 S16", U""));
+			thee = TextGrid_create (0, duration,
+				numberOfStatusBits == 8 ? U"S1 S2 S3 S4 S5 S6 S7 S8" : U"S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 S12 S13 S14 S15 S16", U"");
 			for (int bit = 1; bit <= numberOfStatusBits; bit ++) {
 				unsigned long bitValue = 1 << (bit - 1);
 				IntervalTier tier = (IntervalTier) thy tiers -> item [bit];
@@ -553,7 +553,7 @@ EEG EEG_extractChannel (EEG me, long channelNumber) {
 		thy numberOfChannels = 1;
 		thy channelNames = NUMvector <char32 *> (1, 1);
 		thy channelNames [1] = Melder_dup (my channelNames [1]);
-		thy sound = Sound_extractChannel (my sound, channelNumber);
+		thy sound = Sound_extractChannel (my sound, channelNumber).transfer();
 		thy textgrid = Data_copy (my textgrid);
 		return thee.transfer();
 	} catch (MelderError) {
@@ -603,8 +603,8 @@ EEG EEGs_concatenate (Collection me) {
 		for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
 			thy channelNames [ichan] = Melder_dup (channelNames [ichan]);
 		}
-		thy sound = Sounds_concatenate_e (soundCollection.peek(), 0.0);
-		thy textgrid = TextGrids_concatenate (textgridCollection.peek());
+		thy sound = Sounds_concatenate_e (soundCollection.peek(), 0.0).transfer();
+		thy textgrid = TextGrids_concatenate (textgridCollection.peek()).transfer();
 		thy xmin = thy textgrid -> xmin;
 		thy xmax = thy textgrid -> xmax;
 		return thee.transfer();
@@ -621,8 +621,8 @@ EEG EEG_extractPart (EEG me, double tmin, double tmax, bool preserveTimes) {
 		for (long ichan = 1; ichan <= my numberOfChannels; ichan ++) {
 			thy channelNames [ichan] = Melder_dup (my channelNames [ichan]);
 		}
-		thy sound = Sound_extractPart (my sound, tmin, tmax, kSound_windowShape_RECTANGULAR, 1.0, preserveTimes);
-		thy textgrid = TextGrid_extractPart (my textgrid, tmin, tmax, preserveTimes);
+		thy sound = Sound_extractPart (my sound, tmin, tmax, kSound_windowShape_RECTANGULAR, 1.0, preserveTimes).transfer();
+		thy textgrid = TextGrid_extractPart (my textgrid, tmin, tmax, preserveTimes).transfer();
 		thy xmin = thy textgrid -> xmin;
 		thy xmax = thy textgrid -> xmax;
 		return thee.transfer();
diff --git a/LPC/Cepstrogram.cpp b/LPC/Cepstrogram.cpp
index 840bf3b..bb06e2d 100644
--- a/LPC/Cepstrogram.cpp
+++ b/LPC/Cepstrogram.cpp
@@ -376,9 +376,9 @@ autoPowerCepstrogram Sound_to_PowerCepstrogram_hillenbrand (Sound me, double min
 		autoSound thee;
 		if (samplingFrequency > 30000) {
 			samplingFrequency = samplingFrequency / 2.0;
-			thee.reset (Sound_resample (me, samplingFrequency, 1));
+			thee = Sound_resample (me, samplingFrequency, 1);
 		} else {
-			thee.reset (Data_copy (me));
+			thee = Data_copy (me);
 		}
 		// pre-emphasis with fixed coefficient 0.9
 		for (long i = thy nx; i > 1; i--) {
diff --git a/LPC/LPC_to_Spectrogram.cpp b/LPC/LPC_to_Spectrogram.cpp
index 4b9bad2..3cb46b4 100644
--- a/LPC/LPC_to_Spectrogram.cpp
+++ b/LPC/LPC_to_Spectrogram.cpp
@@ -36,8 +36,8 @@ autoSpectrogram LPC_to_Spectrogram (LPC me, double dfMin, double bandwidthReduct
 		}
 		double freqStep = samplingFrequency / nfft;
 
-		autoSpectrogram thee = (Spectrogram) Spectrogram_create (my xmin, my xmax, my nx, my dx, my x1,
-		                       0, samplingFrequency / 2, nfft / 2 + 1, freqStep, 0);
+		autoSpectrogram thee = Spectrogram_create (my xmin, my xmax, my nx, my dx, my x1,
+		                                           0.0, samplingFrequency / 2.0, nfft / 2 + 1, freqStep, 0.0);
 
 		for (long i = 1; i <= my nx; i++) {
 			double t = Sampled_indexToX (me, i);
diff --git a/LPC/Sound_and_LPC.cpp b/LPC/Sound_and_LPC.cpp
index 9c2f4ea..475e4e9 100644
--- a/LPC/Sound_and_LPC.cpp
+++ b/LPC/Sound_and_LPC.cpp
@@ -507,7 +507,7 @@ autoSound LPC_and_Sound_filter (LPC me, Sound thee, int useGain) {
 		// resample sound if samplings don't match
 		autoSound source = nullptr;
 		if (my samplingPeriod != thy dx) {
-			source.reset (Sound_resample (thee, 1.0 / my samplingPeriod, 50));
+			source = Sound_resample (thee, 1.0 / my samplingPeriod, 50);
 			thee = source.peek();   // reference copy; remove at end
 		}
 
diff --git a/LPC/Sound_and_LPC_robust.cpp b/LPC/Sound_and_LPC_robust.cpp
index eb907a3..974bb6c 100644
--- a/LPC/Sound_and_LPC_robust.cpp
+++ b/LPC/Sound_and_LPC_robust.cpp
@@ -251,11 +251,11 @@ Formant Sound_to_Formant_robust (Sound me, double dt_in, double numberOfFormants
 	double nyquist = 0.5 / my dx;
 	int predictionOrder = (long) floor (2 * numberOfFormants);
 	try {
-		autoSound sound = NULL;
+		autoSound sound;
 		if (maximumFrequency <= 0.0 || fabs (maximumFrequency / nyquist - 1.0) < 1.0e-12) {
-			sound.reset (Data_copy (me));   // will be modified
+			sound = Data_copy (me);   // will be modified
 		} else {
-			sound.reset (Sound_resample (me, maximumFrequency * 2.0, 50));
+			sound = Sound_resample (me, maximumFrequency * 2.0, 50);
 		}
 
 		autoLPC lpc = Sound_to_LPC_auto (sound.peek(), predictionOrder, halfdt_window, dt, preEmphasisFrequency);
diff --git a/artsynth/Art_Speaker_to_VocalTract.cpp b/artsynth/Art_Speaker_to_VocalTract.cpp
index 3ac3b86..84b615e 100644
--- a/artsynth/Art_Speaker_to_VocalTract.cpp
+++ b/artsynth/Art_Speaker_to_VocalTract.cpp
@@ -22,7 +22,7 @@
 #include "Art_Speaker_Delta.h"
 #include "Art_Speaker_to_VocalTract.h"
 
-VocalTract Art_Speaker_to_VocalTract (Art art, Speaker speaker) {
+autoVocalTract Art_Speaker_to_VocalTract (Art art, Speaker speaker) {
 	autoDelta delta = Speaker_to_Delta (speaker);
 	Art_Speaker_intoDelta (art, speaker, delta.get());
 	double area [300];
@@ -38,7 +38,7 @@ VocalTract Art_Speaker_to_VocalTract (Art art, Speaker speaker) {
 	autoVocalTract thee = VocalTract_create (numberOfSections, sectionLength);
 	for (long isection = 1; isection <= numberOfSections; isection ++)
 		thy z [1] [isection] = area [isection];
-	return thee.transfer();
+	return thee;
 }
 
 /* End of file Art_Speaker_to_VocalTract.cpp */
diff --git a/artsynth/Art_Speaker_to_VocalTract.h b/artsynth/Art_Speaker_to_VocalTract.h
index 4391b67..05e50b4 100644
--- a/artsynth/Art_Speaker_to_VocalTract.h
+++ b/artsynth/Art_Speaker_to_VocalTract.h
@@ -1,6 +1,6 @@
 /* Art_Speaker_to_VocalTract.h
  *
- * Copyright (C) 1992-2011 Paul Boersma
+ * Copyright (C) 1992-2011,2015 Paul Boersma
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,6 +21,6 @@
 #include "Speaker.h"
 #include "VocalTract.h"
 
-VocalTract Art_Speaker_to_VocalTract (Art art, Speaker speaker);
+autoVocalTract Art_Speaker_to_VocalTract (Art art, Speaker speaker);
 
 /* End of file Art_Speaker_to_VocalTract.h */
diff --git a/artsynth/Articulation.cpp b/artsynth/Articulation.cpp
index de9a7c1..7067fec 100644
--- a/artsynth/Articulation.cpp
+++ b/artsynth/Articulation.cpp
@@ -45,7 +45,7 @@
 
 Thing_implement (Art, Daata, 0);
 
-Art Art_create () {
+autoArt Art_create () {
 	return Thing_new (Art);
 }
 
diff --git a/artsynth/Articulation.h b/artsynth/Articulation.h
index 50d98a3..5022ffc 100644
--- a/artsynth/Articulation.h
+++ b/artsynth/Articulation.h
@@ -30,7 +30,7 @@
 #include "Articulation_def.h"
 oo_CLASS_CREATE (Art, Daata);
 
-Art Art_create ();
+autoArt Art_create ();
 /*
 	Return value:
 		an array of double, with indices from enum Art.
diff --git a/artsynth/Artword_Speaker.cpp b/artsynth/Artword_Speaker.cpp
index 1a388cd..8a82c0e 100644
--- a/artsynth/Artword_Speaker.cpp
+++ b/artsynth/Artword_Speaker.cpp
@@ -22,24 +22,23 @@
 
 void Artword_Speaker_draw (Artword artword, Speaker speaker, Graphics g, int numberOfSteps) {
 	double oldLineWidth = Graphics_inqLineWidth (g);
-	Art art = Art_create ();
+	autoArt art = Art_create ();
 	for (int i = 0; i <= numberOfSteps; i ++) {
-		Artword_intoArt (artword, art, i * artword -> totalTime / numberOfSteps);
+		Artword_intoArt (artword, art.get(), i * artword -> totalTime / numberOfSteps);
 		Graphics_setLineWidth (g, 2 + i + i);
-		Art_Speaker_draw (art, speaker, g);
+		Art_Speaker_draw (art.get(), speaker, g);
 	}
-	forget (art);
 	Graphics_setLineWidth (g, oldLineWidth);
 }
 
 void Artword_Speaker_movie (Artword artword, Speaker speaker, Graphics g) {
 	double timeStep = 0.00001;
-	Art art = Art_create ();
+	autoArt art = Art_create ();
 	for (double tim = 0.0; tim < artword -> totalTime; tim += timeStep) {
-		Artword_intoArt (artword, art, tim);
+		Artword_intoArt (artword, art.get(), tim);
 		Graphics_setViewport (g, 0, 1, 0, 1);
 		Graphics_clearWs (g);
-		Art_Speaker_draw (art, speaker, g);
+		Art_Speaker_draw (art.get(), speaker, g);
 		Graphics_flushWs (g);
 		// TODO: we should pause here a bit
 	}
diff --git a/artsynth/Artword_Speaker_Sound.cpp b/artsynth/Artword_Speaker_Sound.cpp
index dca99bf..5e25d73 100644
--- a/artsynth/Artword_Speaker_Sound.cpp
+++ b/artsynth/Artword_Speaker_Sound.cpp
@@ -29,11 +29,11 @@ struct playInfo {
 
 static int playCallback (void *playClosure, int /* phase */, double /* tmin */, double /* tmax */, double t) {
 	struct playInfo *me = (struct playInfo *) playClosure;
-	static Art art;
+	static autoArt art;
 	if (! art) art = Art_create ();
-	Artword_intoArt (my artword, art, t);
+	Artword_intoArt (my artword, art.get(), t);
 	Graphics_clearWs (my graphics);
-	Art_Speaker_draw (art, my speaker, my graphics);
+	Art_Speaker_draw (art.get(), my speaker, my graphics);
 	return 1;
 }
 
diff --git a/artsynth/Artword_to_Art.cpp b/artsynth/Artword_to_Art.cpp
index a85923c..e25742e 100644
--- a/artsynth/Artword_to_Art.cpp
+++ b/artsynth/Artword_to_Art.cpp
@@ -19,11 +19,11 @@
 
 #include "Artword_to_Art.h"
 
-Art Artword_to_Art (Artword me, double tim) {
+autoArt Artword_to_Art (Artword me, double tim) {
 	try {
 		autoArt thee = Art_create ();
 		Artword_intoArt (me, thee.peek(), tim);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Articulation.");
 	}
diff --git a/artsynth/Artword_to_Art.h b/artsynth/Artword_to_Art.h
index d5f2b8a..01b7b66 100644
--- a/artsynth/Artword_to_Art.h
+++ b/artsynth/Artword_to_Art.h
@@ -1,6 +1,6 @@
 /* Artword_to_Art.h
  *
- * Copyright (C) 1992-2011 Paul Boersma
+ * Copyright (C) 1992-2011,2015 Paul Boersma
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
 
 #include "Artword.h"
 
-Art Artword_to_Art (Artword me, double time);
+autoArt Artword_to_Art (Artword me, double time);
 /*
 	Function:
 		linear interpolation between targets.	
diff --git a/artsynth/Delta.cpp b/artsynth/Delta.cpp
index 294a997..0378eef 100644
--- a/artsynth/Delta.cpp
+++ b/artsynth/Delta.cpp
@@ -36,10 +36,10 @@ void Delta_init (Delta me, int numberOfTubes) {
 	}
 }
 
-Delta Delta_create (int numberOfTubes) {
+autoDelta Delta_create (int numberOfTubes) {
 	autoDelta me = Thing_new (Delta);
 	Delta_init (me.peek(), numberOfTubes);
-	return me.transfer();
+	return me;
 }
 
 /* End of file Delta.cpp */
diff --git a/artsynth/Delta.h b/artsynth/Delta.h
index 61afd35..e81662a 100644
--- a/artsynth/Delta.h
+++ b/artsynth/Delta.h
@@ -63,7 +63,7 @@ Thing_define (Delta, Thing) {
 
 void Delta_init (Delta me, int numberOfTubes);
 
-Delta Delta_create (int numberOfTubes);
+autoDelta Delta_create (int numberOfTubes);
 /*
 	Function:
 		return a new Delta.
diff --git a/artsynth/Speaker.cpp b/artsynth/Speaker.cpp
index c230e85..33b7007 100644
--- a/artsynth/Speaker.cpp
+++ b/artsynth/Speaker.cpp
@@ -40,8 +40,8 @@
 
 Thing_implement (Speaker, Daata, 0);
 
-Speaker Speaker_create (char32 *kindOfSpeaker, int numberOfVocalCordMasses) {
-	Speaker me = Thing_new (Speaker);
+autoSpeaker Speaker_create (char32 *kindOfSpeaker, int numberOfVocalCordMasses) {
+	autoSpeaker me = Thing_new (Speaker);
 
 	/* Supralaryngeal dimensions are taken from P. Mermelstein (1973):		*/
 	/*    "Articulatory model for the study of speech production",		*/
@@ -49,7 +49,6 @@ Speaker Speaker_create (char32 *kindOfSpeaker, int numberOfVocalCordMasses) {
 	/* That was a male speaker, so we need scaling for other speakers:		*/
 
 	double scaling;
-	if (! me) return NULL;
 	if (str32equ (kindOfSpeaker, U"Male")) my relativeSize = 1.1;
 	else if (str32equ (kindOfSpeaker, U"Child")) my relativeSize = 0.7;
 	else my relativeSize = 1.0;
diff --git a/artsynth/Speaker.h b/artsynth/Speaker.h
index aad255a..61c74bd 100644
--- a/artsynth/Speaker.h
+++ b/artsynth/Speaker.h
@@ -24,7 +24,7 @@
 #include "Speaker_def.h"
 oo_CLASS_CREATE (Speaker, Daata);
 
-Speaker Speaker_create (char32 *kindOfSpeaker, int numberOfVocalCordMasses);
+autoSpeaker Speaker_create (char32 *kindOfSpeaker, int numberOfVocalCordMasses);
 	/* Preconditions:								*/
 	/*    1 <= numberOfVocalCordMasses <= 2;					*/
 	/* Failures:									*/
diff --git a/artsynth/Speaker_to_Delta.cpp b/artsynth/Speaker_to_Delta.cpp
index c49c164..e3af6e5 100644
--- a/artsynth/Speaker_to_Delta.cpp
+++ b/artsynth/Speaker_to_Delta.cpp
@@ -22,7 +22,7 @@
 #define SMOOTH_LUNGS  true
 #define FIRST_TUBE  7
 
-Delta Speaker_to_Delta (Speaker me) {
+autoDelta Speaker_to_Delta (Speaker me) {
 	double f = my relativeSize * 1e-3;   /* We shall use millimetres and grams. */
 	double xe [30], ye [30], xi [30], yi [30], xmm [30], ymm [30], dx, dy;
 	int closed [40];
@@ -358,7 +358,7 @@ Delta Speaker_to_Delta (Speaker me) {
 		Melder_assert (! t->right1 || t->right1->left1 == t || t->right1->left2 == t);
 		Melder_assert (! t->right2 || t->right2->left1 == t);
 	}
-	return thee.transfer();
+	return thee;
 }
 
 /* End of file Speaker_to_Delta.cpp */
diff --git a/artsynth/Speaker_to_Delta.h b/artsynth/Speaker_to_Delta.h
index ad6d42e..12b64d5 100644
--- a/artsynth/Speaker_to_Delta.h
+++ b/artsynth/Speaker_to_Delta.h
@@ -20,6 +20,6 @@
 #include "Speaker.h"
 #include "Delta.h"
 
-Delta Speaker_to_Delta (Speaker me);
+autoDelta Speaker_to_Delta (Speaker me);
 
 /* End of file Speaker_to_Delta.h */
diff --git a/artsynth/praat_Artsynth.cpp b/artsynth/praat_Artsynth.cpp
index 3b3e19b..9eeb90f 100644
--- a/artsynth/praat_Artsynth.cpp
+++ b/artsynth/praat_Artsynth.cpp
@@ -38,7 +38,8 @@ FORM (Art_create, U"Create a default Articulation", U"Articulatory synthesis") {
 	WORD (U"Name", U"articulation")
 	OK2
 DO
-	praat_new (Art_create (), GET_STRING (U"Name"));
+	autoArt me = Art_create ();
+	praat_new (me.transfer(), GET_STRING (U"Name"));
 END2 }
 
 FORM (Art_edit, U"View & Edit Articulation", 0) {
diff --git a/dwtest/test_Sound_draw_where.praat b/dwtest/test_Sound_draw_where.praat
index d60363f..5626051 100644
--- a/dwtest/test_Sound_draw_where.praat
+++ b/dwtest/test_Sound_draw_where.praat
@@ -75,5 +75,6 @@ Marks bottom every... 1 0.0005 n y y
 Marks bottom every... 1 0.001 y y y
 Draw inner box
 Text top... n Random amplitudes: parts > 0.5 blue only in the first half of every 0.001 s
+Remove
 printline Draw where... End tests
 
diff --git a/dwtest/test_sigma_ellipse.praat b/dwtest/test_sigma_ellipse.praat
index 66dbe27..ca077b6 100644
--- a/dwtest/test_sigma_ellipse.praat
+++ b/dwtest/test_sigma_ellipse.praat
@@ -30,3 +30,5 @@ procedure get_p .nsigma
   Draw confidence ellipse... psigma 1 2  -6 6 -12 12 no
   Black
 endproc
+
+removeObject: tor, sscp
\ No newline at end of file
diff --git a/dwtools/CCA.cpp b/dwtools/CCA.cpp
index 65939da..463e17e 100644
--- a/dwtools/CCA.cpp
+++ b/dwtools/CCA.cpp
@@ -230,10 +230,9 @@ TableOfReal CCA_and_TableOfReal_scores (CCA me, TableOfReal thee, long numberOfF
 			Melder_throw (U"The number of factors must be in interval [1, ", my numberOfCoefficients, U"].");
 		}
 		autoTableOfReal him = TableOfReal_create (n, 2 * numberOfFactors);
-		TableOfReal phim = him.peek();
 		NUMstrings_copyElements (thy rowLabels, his rowLabels, 1, thy numberOfRows);
-		Eigen_and_TableOfReal_project_into (my y, thee, 1, ny, &phim, 1, numberOfFactors);
-		Eigen_and_TableOfReal_project_into (my x, thee, ny + 1, thy numberOfColumns, &phim, numberOfFactors + 1, his numberOfColumns);
+		Eigen_and_TableOfReal_project_into (my y, thee, 1, ny, him.peek(), 1, numberOfFactors);
+		Eigen_and_TableOfReal_project_into (my x, thee, ny + 1, thy numberOfColumns, him.peek(), numberOfFactors + 1, his numberOfColumns);
 		TableOfReal_setSequentialColumnLabels (him.peek(), 1, numberOfFactors, U"y_", 1, 1);
 		TableOfReal_setSequentialColumnLabels (him.peek(), numberOfFactors + 1, his numberOfColumns, U"x_", 1, 1);
 		return him.transfer();
diff --git a/dwtools/CategoriesEditor.cpp b/dwtools/CategoriesEditor.cpp
index 2ae5255..2ba8f5e 100644
--- a/dwtools/CategoriesEditor.cpp
+++ b/dwtools/CategoriesEditor.cpp
@@ -114,7 +114,7 @@ static void Collection_replaceItemPos (I, Any item, long pos) {
 	if (pos < 1 || pos > my size) {
 		return;
 	}
-	forget ( ( (SimpleString *) my item) [pos]);
+	forget (((SimpleString *) my item) [pos]);
 	my item[pos] = item;
 }
 
@@ -161,10 +161,8 @@ void structCategoriesEditorCommand :: v_destroy () {
 	CategoriesEditorCommand_Parent :: v_destroy ();
 }
 
-static void CategoriesEditorCommand_init (I, const char32 *name,  Any data,
-        int (*execute) (Any), int (*undo) (Any), int nCategories, int nSelected) {
-	iam (CategoriesEditorCommand);
-	(void) nCategories;
+static void CategoriesEditorCommand_init (CategoriesEditorCommand me, const char32 *name,  Any data,
+        int (*execute) (Any), int (*undo) (Any), int /*nCategories*/, int nSelected) {
 
 	my nSelected = nSelected;
 	Command_init (me, name, data, execute, undo);
@@ -585,8 +583,7 @@ static void update (I, long from, long to, const long *select, long nSelect) {
 	}
 }
 
-static void gui_button_cb_remove (I, GuiButtonEvent event) {
-	(void) event;
+static void gui_button_cb_remove (I, GuiButtonEvent /* event */) {
 	iam (CategoriesEditor);
 	long posCount;
 	autoNUMvector<long> posList (GuiList_getSelectedPositions (my list, & posCount), 1);
@@ -616,22 +613,19 @@ static void insert (I, int position) {
 	}
 }
 
-static void gui_button_cb_insert (I, GuiButtonEvent event) {
-	(void) event;
+static void gui_button_cb_insert (I, GuiButtonEvent /* event */) {
 	iam (CategoriesEditor);
 	insert (me, my position);
 }
 
-static void gui_button_cb_insertAtEnd (I, GuiButtonEvent event) {
-	(void) event;
+static void gui_button_cb_insertAtEnd (I, GuiButtonEvent /* event */) {
 	iam (CategoriesEditor);
 	Categories categories = (Categories) my data;
 	insert (me, categories -> size + 1);
 	my position = categories -> size;
 }
 
-static void gui_button_cb_replace (I, GuiButtonEvent event) {
-	(void) event;
+static void gui_button_cb_replace (I, GuiButtonEvent /* event */) {
 	iam (CategoriesEditor);
 	long posCount;
 	autoNUMvector<long> posList (GuiList_getSelectedPositions (my list, & posCount), 1);
@@ -651,8 +645,7 @@ static void gui_button_cb_replace (I, GuiButtonEvent event) {
 }
 
 /* Precondition: contiguous selection */
-static void gui_button_cb_moveUp (I, GuiButtonEvent event) {
-	(void) event;
+static void gui_button_cb_moveUp (I, GuiButtonEvent /* event */) {
 	iam (CategoriesEditor);
 	long posCount;
 	autoNUMvector<long> posList (GuiList_getSelectedPositions (my list, & posCount), 1);
@@ -668,8 +661,7 @@ static void gui_button_cb_moveUp (I, GuiButtonEvent event) {
 }
 
 /* Precondition: contiguous selection */
-static void gui_button_cb_moveDown (I, GuiButtonEvent event) {
-	(void) event;
+static void gui_button_cb_moveDown (I, GuiButtonEvent /* event */) {
 	iam (CategoriesEditor);
 	long posCount;
 	autoNUMvector<long> posList (GuiList_getSelectedPositions (my list, & posCount), 1);
@@ -690,21 +682,18 @@ static void gui_cb_scroll (GUI_ARGS) {
 	notifyOutOfView (me);
 }
 
-static void gui_list_cb_double_click (void *void_me, GuiListEvent event) {
-	(void) event;
+static void gui_list_cb_double_click (void *void_me, GuiListEvent /* event */) {
 	iam (CategoriesEditor);
 	const char32 *catg = OrderedOfString_itemAtIndex_c ((OrderedOfString) my data, my position);
 	GuiText_setString (my text, catg);
 }
 
-static void gui_list_cb_extended (void *void_me, GuiListEvent event) {
-	(void) event;
+static void gui_list_cb_extended (void *void_me, GuiListEvent /* event */) {
 	iam (CategoriesEditor);
 	updateWidgets (me);
 }
 
-static void gui_button_cb_undo (I, GuiButtonEvent event) {
-	(void) event;
+static void gui_button_cb_undo (I, GuiButtonEvent /* event */) {
 	iam (CategoriesEditor);
 	if (CommandHistory_offleft (my history)) {
 		return;
@@ -714,8 +703,7 @@ static void gui_button_cb_undo (I, GuiButtonEvent event) {
 	updateWidgets (me);
 }
 
-static void gui_button_cb_redo (I, GuiButtonEvent event) {
-	(void) event;
+static void gui_button_cb_redo (I, GuiButtonEvent /* event */) {
 	iam (CategoriesEditor);
 	CommandHistory_forth (my history);
 	if (CommandHistory_offright (my history)) {
diff --git a/dwtools/DTW_and_TextGrid.cpp b/dwtools/DTW_and_TextGrid.cpp
index db0e07e..7cf4046 100644
--- a/dwtools/DTW_and_TextGrid.cpp
+++ b/dwtools/DTW_and_TextGrid.cpp
@@ -1,6 +1,6 @@
 /* DTW_and_TextGrid.cpp
  *
- * Copyright (C) 1993-2012 David Weenink
+ * Copyright (C) 1993-2012, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -26,13 +26,13 @@
 #include "DTW_and_TextGrid.h"
 
 // begin old prototypes for compatibility reasons with the past
-TextGrid DTW_and_TextGrid_to_TextGrid_old (DTW me, TextGrid thee);
-IntervalTier DTW_and_IntervalTier_to_IntervalTier_old (DTW me, IntervalTier thee);
-TextTier DTW_and_TextTier_to_TextTier_old (DTW me, TextTier thee);
+autoTextGrid DTW_and_TextGrid_to_TextGrid_old (DTW me, TextGrid thee);
+autoIntervalTier DTW_and_IntervalTier_to_IntervalTier_old (DTW me, IntervalTier thee);
+autoTextTier DTW_and_TextTier_to_TextTier_old (DTW me, TextTier thee);
 // end old
 
 /* Get times from TextGrid and substitute new time form the y-times of the DTW. */
-TextTier DTW_and_TextTier_to_TextTier (DTW me, TextTier thee, double precision) {
+autoTextTier DTW_and_TextTier_to_TextTier (DTW me, TextTier thee, double precision) {
 	try {
 		if (fabs (my ymin - thy xmin) <= precision && fabs (my ymax - thy xmax) <= precision) { // map from Y to X
 			autoTextTier him = Data_copy (thee);
@@ -43,7 +43,7 @@ TextTier DTW_and_TextTier_to_TextTier (DTW me, TextTier thee, double precision)
 				double time = DTW_getXTimeFromYTime (me, textpoint -> number);
 				textpoint -> number = time;
 			}
-			return him.transfer();
+			return him;
 		} else if (fabs (my xmin - thy xmin) <= precision && fabs (my xmax - thy xmax) <= precision) { // map from X to Y
 			autoTextTier him = Data_copy (thee);
 			his xmin = my ymin;
@@ -53,7 +53,7 @@ TextTier DTW_and_TextTier_to_TextTier (DTW me, TextTier thee, double precision)
 				double time = DTW_getYTimeFromXTime (me, textpoint -> number);
 				textpoint -> number = time;
 			}
-			return him.transfer();
+			return him;
 		} else {
 			Melder_throw (U"The domain of the TextTier and one of the domains of the DTW must be equal.");
 		}
@@ -62,7 +62,7 @@ TextTier DTW_and_TextTier_to_TextTier (DTW me, TextTier thee, double precision)
 	}
 }
 
-IntervalTier DTW_and_IntervalTier_to_IntervalTier (DTW me, IntervalTier thee, double precision) {
+autoIntervalTier DTW_and_IntervalTier_to_IntervalTier (DTW me, IntervalTier thee, double precision) {
 	try {
 		if (fabs (my ymin - thy xmin) <= precision && fabs (my ymax - thy xmax) <= precision) { // map from Y to X
 			autoIntervalTier him = Data_copy (thee);
@@ -75,7 +75,7 @@ IntervalTier DTW_and_IntervalTier_to_IntervalTier (DTW me, IntervalTier thee, do
 				double xmax = DTW_getXTimeFromYTime (me, textinterval -> xmax);
 				textinterval -> xmax = xmax;
 			}
-			return him.transfer();
+			return him;
 		} else if (fabs (my xmin - thy xmin) <= precision && fabs (my xmax - thy xmax) <= precision) { // map from X to Y
 			autoIntervalTier him = Data_copy (thee);
 			his xmin = my ymin;
@@ -87,7 +87,7 @@ IntervalTier DTW_and_IntervalTier_to_IntervalTier (DTW me, IntervalTier thee, do
 				double xmax = DTW_getYTimeFromXTime (me, textinterval -> xmax);
 				textinterval -> xmax = xmax;
 			}
-			return him.transfer();
+			return him;
 		} else {
 			Melder_throw (U"The domain of the IntervalTier and one of the domains of the DTW must be equal.");
 		}
@@ -96,7 +96,7 @@ IntervalTier DTW_and_IntervalTier_to_IntervalTier (DTW me, IntervalTier thee, do
 	}
 }
 
-TextGrid DTW_and_TextGrid_to_TextGrid (DTW me, TextGrid thee, double precision) {
+autoTextGrid DTW_and_TextGrid_to_TextGrid (DTW me, TextGrid thee, double precision) {
 	try {
 		double tmin, tmax;
 		if (fabs (my ymin - thy xmin) <= precision && fabs (my ymax - thy xmax) <= precision) {
@@ -124,13 +124,13 @@ TextGrid DTW_and_TextGrid_to_TextGrid (DTW me, TextGrid thee, double precision)
 				Melder_throw (U"Unknown tier.");
 			}
 		}
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (U"TextGrid not created from DTW & TextGrid.");
 	}
 }
 
-Table DTW_and_IntervalTier_to_Table (DTW me, IntervalTier thee, double precision) {
+autoTable DTW_and_IntervalTier_to_Table (DTW me, IntervalTier thee, double precision) {
 	try {
 		long numberOfIntervals = thy intervals -> size;
 		autoTable him = Table_createWithColumnNames (numberOfIntervals, U"tmin tmax label dist");
@@ -173,7 +173,7 @@ Table DTW_and_IntervalTier_to_Table (DTW me, IntervalTier thee, double precision
 		} else {
 			Melder_throw (U"The domain of the IntervalTier and one of the domains of the DTW must be equal.");
 		}
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (me, U": no Table with distances created.");
 	}
@@ -182,7 +182,7 @@ Table DTW_and_IntervalTier_to_Table (DTW me, IntervalTier thee, double precision
 }
 
 /* Get times from TextGrid and substitute new time form the y-times of the DTW. */
-TextTier DTW_and_TextTier_to_TextTier_old (DTW me, TextTier thee) {
+autoTextTier DTW_and_TextTier_to_TextTier_old (DTW me, TextTier thee) {
 	try {
 		if (my xmin != thy xmin || my xmax != thy xmax) {
 			Melder_throw (U"The domain of the TextTier and the DTW must be equal.");
@@ -196,13 +196,13 @@ TextTier DTW_and_TextTier_to_TextTier_old (DTW me, TextTier thee) {
 			double time = DTW_getPathY (me, textpoint -> number);
 			textpoint -> number = time;
 		}
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (U"TextTier not created.");
 	}
 }
 
-IntervalTier DTW_and_IntervalTier_to_IntervalTier_old (DTW me, IntervalTier thee) {
+autoIntervalTier DTW_and_IntervalTier_to_IntervalTier_old (DTW me, IntervalTier thee) {
 	try {
 		if ( (my xmin != thy xmin) || my xmax != thy xmax) Melder_throw
 			(U"The domain of the IntervalTier and the DTW must be equal.");
@@ -219,13 +219,13 @@ IntervalTier DTW_and_IntervalTier_to_IntervalTier_old (DTW me, IntervalTier thee
 			double xmax = DTW_getPathY (me, textinterval -> xmax);
 			textinterval -> xmax = xmax;
 		}
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (U"IntervalTier not created.");
 	}
 }
 
-TextGrid DTW_and_TextGrid_to_TextGrid_old (DTW me, TextGrid thee) {
+autoTextGrid DTW_and_TextGrid_to_TextGrid_old (DTW me, TextGrid thee) {
 	try {
 		autoTextGrid him = Thing_new (TextGrid);
 		if (my xmin != thy xmin || my xmax != thy xmax) {
@@ -250,7 +250,7 @@ TextGrid DTW_and_TextGrid_to_TextGrid_old (DTW me, TextGrid thee) {
 				Melder_throw (U"Unknown tier.");
 			}
 		}
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (U"TextGrid not created.");
 	}
diff --git a/dwtools/DTW_and_TextGrid.h b/dwtools/DTW_and_TextGrid.h
index e63dcac..280636f 100644
--- a/dwtools/DTW_and_TextGrid.h
+++ b/dwtools/DTW_and_TextGrid.h
@@ -3,7 +3,7 @@
 
 /* DTW_and_TextGrid.h
  *
- * Copyright (C) 1993-2012 David Weenink
+ * Copyright (C) 1993-2012, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,20 +22,21 @@
 
 /*
  djmw 20060906
- djmw 20120328 Latest modification
 */
 
 #include "DTW.h"
 #include "TextGrid.h"
 #include "Table.h"
 
-TextTier DTW_and_TextTier_to_TextTier (DTW me, TextTier thee, double precision);
-IntervalTier DTW_and_IntervalTier_to_IntervalTier (DTW me, IntervalTier thee, double precision);
-TextGrid DTW_and_TextGrid_to_TextGrid (DTW me, TextGrid thee, double precision);
+autoTextTier DTW_and_TextTier_to_TextTier (DTW me, TextTier thee, double precision);
+
+autoIntervalTier DTW_and_IntervalTier_to_IntervalTier (DTW me, IntervalTier thee, double precision);
+
+autoTextGrid DTW_and_TextGrid_to_TextGrid (DTW me, TextGrid thee, double precision);
 /*
 	Purpose: Create the new TextGrid with all times determined by the DTW.
 */
 
-Table DTW_and_IntervalTier_to_Table (DTW me, IntervalTier thee, double precision);
+autoTable DTW_and_IntervalTier_to_Table (DTW me, IntervalTier thee, double precision);
 
 #endif /* _DTW_and_TextGrid_h_ */
diff --git a/dwtools/Discriminant.cpp b/dwtools/Discriminant.cpp
index f052cf7..adfeaea 100644
--- a/dwtools/Discriminant.cpp
+++ b/dwtools/Discriminant.cpp
@@ -483,9 +483,8 @@ autoConfiguration Discriminant_and_TableOfReal_to_Configuration (Discriminant me
 			numberOfDimensions = Discriminant_getNumberOfFunctions (me);
 		}
 		autoConfiguration him = Configuration_create (thy numberOfRows, numberOfDimensions);
-		Configuration thim = him.peek();
-		Eigen_and_TableOfReal_project_into (me, thee, 1, thy numberOfColumns, & thim, 1, numberOfDimensions);
-		TableOfReal_copyLabels (thee, thim, 1, 0);
+		Eigen_and_TableOfReal_project_into (me, thee, 1, thy numberOfColumns, him.peek(), 1, numberOfDimensions);
+		TableOfReal_copyLabels (thee, him.peek(), 1, 0);
 		TableOfReal_setSequentialColumnLabels (him.peek(), 0, 0, U"Eigenvector ", 1, 1);
 		return him;
 	} catch (MelderError) {
@@ -498,8 +497,7 @@ autoConfiguration Discriminant_and_TableOfReal_to_Configuration (Discriminant me
 	Input matrix (li) is the inverse L^-1 of the Cholesky decomposition
 	S = L.L'.
 */
-static double mahalanobisDistanceSq (double **li, long n, double *v, double *m,
-                                     double *buf) {
+static double mahalanobisDistanceSq (double **li, long n, double *v, double *m, double *buf) {
 	for (long i = 1; i <= n; i++) {
 		buf[i] = v[i] - m[i];
 	}
diff --git a/dwtools/EditDistanceTable.cpp b/dwtools/EditDistanceTable.cpp
index e0210ac..6b15e6a 100644
--- a/dwtools/EditDistanceTable.cpp
+++ b/dwtools/EditDistanceTable.cpp
@@ -1,6 +1,6 @@
 /* EditDistanceTable.c
  *
- * Copyright (C) 2012, 2014 David Weenink
+ * Copyright (C) 2012, 2014, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -43,7 +43,7 @@
 #include "EditDistanceTable_def.h"
 
 // prototypes
-EditCostsTable EditCostsTable_createDefault ();
+autoEditCostsTable EditCostsTable_createDefault ();
 
 /* The insertion, deletion and substitution costs are specified in a TableOfReal
  * 1..n-2 target symbols/alphabet
@@ -57,12 +57,12 @@ EditCostsTable EditCostsTable_createDefault ();
 
 Thing_implement (WarpingPath, Daata, 0);
 
-WarpingPath WarpingPath_create (long length) {
+autoWarpingPath WarpingPath_create (long length) {
 	try {
 		autoWarpingPath me = Thing_new (WarpingPath);
 		my path = NUMvector<structPairOfInteger> (1, length);
 		my _capacity = my pathLength = length;
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"WarpPath not created.");
 	}
@@ -162,24 +162,24 @@ bool structEditCostsTable :: v_matchTargetWithSourceSymbol (const char32 *target
 	return Melder_equ (targetSymbol, sourceSymbol);
 }
 
-EditCostsTable EditCostsTable_create (long targetAlphabetSize, long sourceAlphabetSize) {
+autoEditCostsTable EditCostsTable_create (long targetAlphabetSize, long sourceAlphabetSize) {
 	try{
 		autoEditCostsTable me = Thing_new (EditCostsTable);
 		TableOfReal_init (me.peek(), targetAlphabetSize + 2, sourceAlphabetSize + 2);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"EditCostsTable not created.");
 	}
 }
 
-EditCostsTable EditCostsTable_createDefault () {
+autoEditCostsTable EditCostsTable_createDefault () {
 	try {
 		autoEditCostsTable me = EditCostsTable_create (0, 0);
 		my data[1][1] = 0; // default substitution cost (nomatch == nomatch)
 		my data[2][2] = 2; // default substitution cost (nomatch != nomatch)
 		my data[2][1] = 1; // default insertion cost
 		my data[1][2] = 1; // default deletion cost
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Default EditCostsTable not created.");
 	}
@@ -304,7 +304,7 @@ double EditCostsTable_getSubstitutionCost (EditCostsTable me, const char32 *symb
 	return my data[irow][icol];
 }
 
-TableOfReal EditCostsTable_to_TableOfReal (EditCostsTable me) {
+autoTableOfReal EditCostsTable_to_TableOfReal (EditCostsTable me) {
 	try {
 		autoTableOfReal thee = TableOfReal_create (my numberOfRows, my numberOfColumns);
 		for (long j = 1; j <= my numberOfColumns; j++) {
@@ -314,7 +314,7 @@ TableOfReal EditCostsTable_to_TableOfReal (EditCostsTable me) {
 			thy rowLabels[i] = Melder_dup (my rowLabels[i]);
 		}
 		NUMmatrix_copyElements<double> (my data, thy data, 1, my numberOfRows, 1, my numberOfColumns);
-		return thee.transfer();
+		return thee;
 
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to TableOfReal.");
@@ -329,7 +329,7 @@ void structEditDistanceTable :: v_info () {
 	MelderInfo_writeLine (U"Source:", numberOfColumns, U" symbols.");
 }
 
-EditDistanceTable EditDistanceTable_create (Strings target, Strings source) {
+autoEditDistanceTable EditDistanceTable_create (Strings target, Strings source) {
 	try {
 		autoEditDistanceTable me = Thing_new (EditDistanceTable);
 		long numberOfSourceSymbols = source -> numberOfStrings, numberOfTargetSymbols = target -> numberOfStrings;
@@ -345,7 +345,7 @@ EditDistanceTable EditDistanceTable_create (Strings target, Strings source) {
 		my warpingPath = WarpingPath_create (numberOfTargetSymbols + numberOfSourceSymbols + 1);
 		my editCostsTable = EditCostsTable_createDefault ();
 		EditDistanceTable_findPath (me.peek(), 0);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"EditDistanceTable not created.");
 	}
@@ -353,20 +353,18 @@ EditDistanceTable EditDistanceTable_create (Strings target, Strings source) {
 
 void EditDistanceTable_setEditCosts (EditDistanceTable me, EditCostsTable thee) {
 	try {
-		forget (my editCostsTable);
-		autoEditCostsTable ect = (EditCostsTable) Data_copy (thee);
-		my editCostsTable = ect.transfer();
+		my editCostsTable = Data_copy (thee);
 	} catch (MelderError) {
 		Melder_throw (me, U": edit costs not set.");
 	}
 }
 
-EditDistanceTable EditDistanceTable_createFromCharacterStrings (const char32 *chars1, const char32 *chars2) {
+autoEditDistanceTable EditDistanceTable_createFromCharacterStrings (const char32 *chars1, const char32 *chars2) {
 	try {
 		autoStrings s1 = Strings_createAsCharacters (chars1);
 		autoStrings s2 = Strings_createAsCharacters (chars2);
 		autoEditDistanceTable me = EditDistanceTable_create (s1.peek(), s2.peek());
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"EditDistanceTable not created from character strings.");
 	}
@@ -510,17 +508,17 @@ void EditDistanceTable_drawEditOperations (EditDistanceTable me, Graphics graphi
 }
 
 void EditDistanceTable_setDefaultCosts (EditDistanceTable me, double insertionCosts, double deletionCosts, double substitutionCosts) {
-	EditCostsTable_setDefaultCosts (my editCostsTable, insertionCosts, deletionCosts, substitutionCosts);
+	EditCostsTable_setDefaultCosts (my editCostsTable.peek(), insertionCosts, deletionCosts, substitutionCosts);
 	EditDistanceTable_findPath (me, 0);
 }
 
-TableOfReal EditDistanceTable_to_TableOfReal_directions (EditDistanceTable me) {
-		TableOfReal tor;
+autoTableOfReal EditDistanceTable_to_TableOfReal_directions (EditDistanceTable me) {
+		autoTableOfReal tor;
 		EditDistanceTable_findPath (me, &tor);
 		return tor;
 }
 
-void EditDistanceTable_findPath (EditDistanceTable me, TableOfReal *directions) {
+void EditDistanceTable_findPath (EditDistanceTable me, autoTableOfReal *directions) {
 	try {
 		/* What do we have to do to source to get target?
 		 * Origin [0][0] is at bottom-left corner
@@ -532,19 +530,19 @@ void EditDistanceTable_findPath (EditDistanceTable me, TableOfReal *directions)
 		autoNUMmatrix<double> delta (0, numberOfTargets, 0, numberOfSources);
 
 		for (long j = 1; j <= numberOfSources; j++) {
-			delta[0][j] = delta[0][j - 1] + EditCostsTable_getDeletionCost (my editCostsTable, my columnLabels[j+1]);
+			delta[0][j] = delta[0][j - 1] + EditCostsTable_getDeletionCost (my editCostsTable.peek(), my columnLabels[j+1]);
 			psi[0][j] = WARPING_fromLeft;
 		}
 		for (long i = 1; i <= numberOfTargets; i++) {
-			delta[i][0] = delta[i - 1][0] + EditCostsTable_getInsertionCost (my editCostsTable, my rowLabels[i+1]);
+			delta[i][0] = delta[i - 1][0] + EditCostsTable_getInsertionCost (my editCostsTable.peek(), my rowLabels[i+1]);
 			psi[i][0] = WARPING_fromBelow;
 		}
 		for (long j = 1; j <= numberOfSources; j++) {
 			for (long i = 1; i <= numberOfTargets; i++) {
 				// the substitution, deletion and insertion costs.
-				double left = delta[i][j - 1] + EditCostsTable_getInsertionCost (my editCostsTable, my rowLabels[i+1]);
-				double bottom = delta[i - 1][j] + EditCostsTable_getDeletionCost (my editCostsTable, my columnLabels[j+1]);
-				double mindist = delta[i - 1][j - 1] + EditCostsTable_getSubstitutionCost (my editCostsTable, my rowLabels[i+1], my columnLabels[j+1]); // diag
+				double left = delta[i][j - 1] + EditCostsTable_getInsertionCost (my editCostsTable.peek(), my rowLabels[i+1]);
+				double bottom = delta[i - 1][j] + EditCostsTable_getDeletionCost (my editCostsTable.peek(), my columnLabels[j+1]);
+				double mindist = delta[i - 1][j - 1] + EditCostsTable_getSubstitutionCost (my editCostsTable.peek(), my rowLabels[i+1], my columnLabels[j+1]); // diag
 				psi[i][j] = WARPING_fromDiag;
 				if (bottom < mindist) {
 					mindist = bottom;
@@ -560,11 +558,11 @@ void EditDistanceTable_findPath (EditDistanceTable me, TableOfReal *directions)
 		// find minimum distance in last column
 		long iy = numberOfTargets, ix = numberOfSources;
 
-		WarpingPath_reset (my warpingPath);
+		WarpingPath_reset (my warpingPath.peek());
 
-		WarpingPath_getPath (my warpingPath, psi.peek(), iy, ix);
+		WarpingPath_getPath (my warpingPath.peek(), psi.peek(), iy, ix);
 
-		WarpingPath_shiftPathByOne (my warpingPath);
+		WarpingPath_shiftPathByOne (my warpingPath.peek());
 
 		for (long i = 0; i <= numberOfTargets; i++) {
 			for (long j = 0; j <= numberOfSources; j++) {
@@ -578,14 +576,14 @@ void EditDistanceTable_findPath (EditDistanceTable me, TableOfReal *directions)
 					his data[i+1][j+1] = psi[i][j];
 				}
 			}
-			*directions = him.transfer();
+			*directions = him.move();
 		}
 	} catch (MelderError) {
 		Melder_throw (me, U": minimum path not found.");
 	}
 }
 
-TableOfReal EditDistanceTable_to_TableOfReal (EditDistanceTable me) {
+autoTableOfReal EditDistanceTable_to_TableOfReal (EditDistanceTable me) {
 	try {
 		autoTableOfReal thee = TableOfReal_create (my numberOfRows, my numberOfColumns);
 		for (long j = 1; j <= my numberOfColumns; j++) {
@@ -595,7 +593,7 @@ TableOfReal EditDistanceTable_to_TableOfReal (EditDistanceTable me) {
 			thy rowLabels[i] = Melder_dup (my rowLabels[i]);
 		}
 		NUMmatrix_copyElements<double> (my data, thy data, 1, my numberOfRows, 1, my numberOfColumns);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no TableOfReal created.");
 	}
diff --git a/dwtools/EditDistanceTable.h b/dwtools/EditDistanceTable.h
index ebe7363..1f49343 100644
--- a/dwtools/EditDistanceTable.h
+++ b/dwtools/EditDistanceTable.h
@@ -2,7 +2,7 @@
 #define _EditDistanceTable_h_
 /* EditDistanceTable.h
  *
- * Copyright (C) 2012,2015 David Weenink
+ * Copyright (C) 2012, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ oo_CLASS_CREATE (WarpingPath, Daata);
 oo_CLASS_CREATE (EditCostsTable, TableOfReal);
 oo_CLASS_CREATE (EditDistanceTable, TableOfReal);
 
-WarpingPath WarpingPath_create (long length);
+autoWarpingPath WarpingPath_create (long length);
 
 // Search the path for the corresponding axis value. If path is horizontal/vertical
 //  ivar1 and ivar2 will not be equal. The return value is the length of the path segment (ivar2-ivar1 +1)
@@ -39,7 +39,7 @@ long WarpingPath_getColumnsFromRowIndex (WarpingPath me, long irow, long *icol1,
 long WarpingPath_getRowsFromColumnIndex (WarpingPath me, long icol, long *irow1, long *irow2);
 
 
-EditCostsTable EditCostsTable_create (long targetAlphabetSize, long sourceAlphabetSize);
+autoEditCostsTable EditCostsTable_create (long targetAlphabetSize, long sourceAlphabetSize);
 /* The insertion, deletion and substitution costs are specified in this table
  * 1..n-2 target symbols (target alphabet)
  * 1..m-2 source symbols (source alphabet)
@@ -61,20 +61,20 @@ double EditCostsTable_getDeletionCost (EditCostsTable me, const char32 *symbol);
 void EditCostsTable_setDeletionCosts (EditCostsTable me, char32 *sources, double cost);
 double EditCostsTable_getSubstitutionCost (EditCostsTable me, const char32 *symbol, const char32 *replacement);
 void EditCostsTable_setSubstitutionCosts (EditCostsTable me, char32 *targets, char32 *sources, double cost);
-TableOfReal EditCostsTable_to_TableOfReal (EditCostsTable me);
+autoTableOfReal EditCostsTable_to_TableOfReal (EditCostsTable me);
 
 
-EditDistanceTable EditDistanceTable_create (Strings target, Strings source);
-EditDistanceTable EditDistanceTable_createFromCharacterStrings (const char32 *chars1, const char32 *chars2);
+autoEditDistanceTable EditDistanceTable_create (Strings target, Strings source);
+autoEditDistanceTable EditDistanceTable_createFromCharacterStrings (const char32 *chars1, const char32 *chars2);
 void EditDistanceTable_draw (EditDistanceTable me, Graphics graphics, int iformat, int precision, double angle);
 void EditDistanceTable_drawEditOperations (EditDistanceTable me, Graphics graphics);
 void EditDistanceTable_setDefaultCosts (EditDistanceTable me, double insertionCosts, double deletionCosts, double substitutionCosts);
-void EditDistanceTable_findPath (EditDistanceTable me, TableOfReal *directions);
+void EditDistanceTable_findPath (EditDistanceTable me, autoTableOfReal *directions);
 
 void EditDistanceTable_setEditCosts (EditDistanceTable me, EditCostsTable thee);
 
-TableOfReal EditDistanceTable_to_TableOfReal_directions (EditDistanceTable me);
+autoTableOfReal EditDistanceTable_to_TableOfReal_directions (EditDistanceTable me);
 
-TableOfReal EditDistanceTable_to_TableOfReal (EditDistanceTable me);
+autoTableOfReal EditDistanceTable_to_TableOfReal (EditDistanceTable me);
 
 #endif /* _EditDistanceTable_h_ */
diff --git a/dwtools/EditDistanceTable_def.h b/dwtools/EditDistanceTable_def.h
index 4bf1664..5ce1b28 100644
--- a/dwtools/EditDistanceTable_def.h
+++ b/dwtools/EditDistanceTable_def.h
@@ -51,9 +51,9 @@ oo_END_CLASS (EditCostsTable)
 
 #define ooSTRUCT EditDistanceTable
 oo_DEFINE_CLASS (EditDistanceTable, TableOfReal)
-	oo_OBJECT (WarpingPath, 0, warpingPath)
+	oo_AUTO_OBJECT (WarpingPath, 0, warpingPath)
 	#if oo_DECLARING
-		oo_OBJECT (EditCostsTable, 0, editCostsTable)
+		oo_AUTO_OBJECT (EditCostsTable, 0, editCostsTable)
 
 		void v_info ()
 			override;
diff --git a/dwtools/Eigen_and_Matrix.cpp b/dwtools/Eigen_and_Matrix.cpp
index 75199d7..92d0852 100644
--- a/dwtools/Eigen_and_Matrix.cpp
+++ b/dwtools/Eigen_and_Matrix.cpp
@@ -1,6 +1,6 @@
 /* Eigen_and_Matrix.cpp
  *
- * Copyright (C) 1993-2011 David Weenink
+ * Copyright (C) 1993-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -24,42 +24,40 @@
 
 #include "Eigen_and_Matrix.h"
 
-Matrix Eigen_and_Matrix_project (Eigen me, Matrix thee, long numberOfComponents) {
+autoMatrix Eigen_and_Matrix_project (Eigen me, Matrix thee, long numberOfComponents) {
 	try {
 		if (numberOfComponents == 0) {
 			numberOfComponents = my numberOfEigenvalues;
 		}
-
-		autoMatrix him = Matrix_create (thy xmin, thy xmax, thy nx, thy dx, thy x1, 0.5, 0.5 +
-		                                numberOfComponents, numberOfComponents, 1, 1);
-		Matrix thim = him.peek();
-		Eigen_and_Matrix_project_into (me, thee, &thim);
-		return him.transfer();
+		autoMatrix him = Matrix_create (thy xmin, thy xmax, thy nx, thy dx, thy x1, 0.5, 0.5 + numberOfComponents, numberOfComponents, 1, 1);
+		Eigen_and_Matrix_project_into (me, thee, & him);
+		return him;
 	} catch (MelderError) {
 		Melder_throw (U"Projection Matrix not created.");
 	}
 }
 
-void Eigen_and_Matrix_project_into (Eigen me, Matrix thee, Matrix *pointer_to_him) {
-	Matrix him = *pointer_to_him;
+void Eigen_and_Matrix_project_into (Eigen me, Matrix thee, autoMatrix *him) {
 
-	if (my dimension != thy ny) Melder_throw
-		(U"The number of rows in the 'from' Matrix must equal the dimension of the eigenvector.");
-	if (his nx != thy nx) {
+	if (my dimension != thy ny) {
+		Melder_throw (U"The number of rows in the 'from' Matrix must equal the dimension of the eigenvector.");
+	}
+	if ((*him)-> nx != thy nx) {
 		Melder_throw (U"The number of columns in the Matrixes must be equal.");
 	}
-	if (his ny > my numberOfEigenvalues) Melder_throw
-		(U"The number of rows in the 'to' Matrix cannot exceed the number of eigenvectors.");
+	if ((*him) ->  ny > my numberOfEigenvalues) {
+		Melder_throw (U"The number of rows in the 'to' Matrix cannot exceed the number of eigenvectors.");
+	}
 
 	for (long i = 1; i <= thy nx; i++) {
-		for (long j = 1; j <= his ny; j++) {
+		for (long j = 1; j <= (*him) -> ny; j++) {
 			double r = 0;
 			for (long k = 1; k <= my dimension; k++) {
 				// eigenvector in row, data in column
 
 				r += my eigenvectors[j][k] * thy z[k][i];
 			}
-			his z[j][i] = r;
+			(*him) -> z[j][i] = r;
 		}
 	}
 }
diff --git a/dwtools/Eigen_and_Matrix.h b/dwtools/Eigen_and_Matrix.h
index 9945640..ebd2064 100644
--- a/dwtools/Eigen_and_Matrix.h
+++ b/dwtools/Eigen_and_Matrix.h
@@ -3,7 +3,7 @@
 
 /* Eigen_and_Matrix.h
  *
- * Copyright (C) 1993-2011 David Weenink
+ * Copyright (C) 1993-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -29,13 +29,13 @@
 #include "Eigen.h"
 #include "Matrix.h"
 
-Matrix Eigen_and_Matrix_project (Eigen me, Matrix thee, long numberOfComponents);
+autoMatrix Eigen_and_Matrix_project (Eigen me, Matrix thee, long numberOfComponents);
 /*
 	Purpose: project the columns of the matrix (thou) on the 
 	eigenspace (me). 
 */
 
-void Eigen_and_Matrix_project_into (Eigen me, Matrix thee, Matrix *pointer_to_him);
+void Eigen_and_Matrix_project_into (Eigen me, Matrix thee, autoMatrix *p_him);
 /*
 	Purpose: project the columns of the Matrix (thou) on the 
 	eigenspace (me). Result in existing Matrix (him). 
diff --git a/dwtools/Eigen_and_Procrustes.cpp b/dwtools/Eigen_and_Procrustes.cpp
index 7a3389b..3043543 100644
--- a/dwtools/Eigen_and_Procrustes.cpp
+++ b/dwtools/Eigen_and_Procrustes.cpp
@@ -1,5 +1,5 @@
 /* Eigen_and_Procrustes.cpp
- * Copyright (C) 2005-2011 David Weenink
+ * Copyright (C) 2005-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,9 +22,8 @@
 #include "Configuration_and_Procrustes.h"
 #include "NUM2.h"
 
-Procrustes Eigens_to_Procrustes (I, thou, long evec_from, long evec_to) {
+autoProcrustes Eigens_to_Procrustes (Eigen me,Eigen thee, long evec_from, long evec_to) {
 	try {
-		iam (Eigen); thouart (Eigen);
 		long nvectors = evec_to - evec_from + 1;
 		long nmin = my numberOfEigenvalues < thy numberOfEigenvalues ? my numberOfEigenvalues : thy numberOfEigenvalues;
 
@@ -49,7 +48,7 @@ Procrustes Eigens_to_Procrustes (I, thou, long evec_from, long evec_to) {
 		autoProcrustes him = Procrustes_create (nvectors);
 
 		NUMProcrustes (x.peek(), y.peek(), my dimension, nvectors, his r, nullptr, nullptr);
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (U"Procrustes not created from Eigens.");
 	}
diff --git a/dwtools/Eigen_and_Procrustes.h b/dwtools/Eigen_and_Procrustes.h
index 94248b2..fc0c83f 100644
--- a/dwtools/Eigen_and_Procrustes.h
+++ b/dwtools/Eigen_and_Procrustes.h
@@ -2,7 +2,7 @@
 #define _Eigen_and_Procrustes_h_
 
 /* Eigen_and_Procrustes.h
- * Copyright (C) 2004-2011 David Weenink
+ * Copyright (C) 2004-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -27,6 +27,6 @@
 #include "Eigen.h"
 #include "Procrustes.h"
 
-Procrustes Eigens_to_Procrustes (I, thou, long evec_from, long evec_to);
+autoProcrustes Eigens_to_Procrustes (Eigen me, Eigen thee, long evec_from, long evec_to);
 
 #endif /* _Eigen_and_Procrustes_h_ */
diff --git a/dwtools/Eigen_and_SSCP.cpp b/dwtools/Eigen_and_SSCP.cpp
index 09d35d7..74a5af7 100644
--- a/dwtools/Eigen_and_SSCP.cpp
+++ b/dwtools/Eigen_and_SSCP.cpp
@@ -1,6 +1,6 @@
 /* Eigen_and_SSCP.c
  *
- * Copyright (C) 1993-2011 David Weenink
+ * Copyright (C) 1993-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,11 +25,7 @@
 
 #include "Eigen_and_SSCP.h"
 
-static void Eigen_and_SSCP_project_ (I, thou, Any sscp) {
-	iam (Eigen);
-	thouart (SSCP);
-	SSCP him = (SSCP) sscp;
-
+static void Eigen_and_SSCP_project_ (Eigen me, SSCP thee, SSCP him) {
 	for (long i = 1; i <= my numberOfEigenvalues; i++) {
 		for (long j = i; j <= my numberOfEigenvalues; j++) {
 			double tmp = 0;
@@ -51,29 +47,27 @@ static void Eigen_and_SSCP_project_ (I, thou, Any sscp) {
 }
 
 
-SSCP Eigen_and_SSCP_project (I, SSCP thee) {
+autoSSCP Eigen_and_SSCP_project (Eigen me, SSCP thee) {
 	try {
-		iam (Eigen);
 		if (thy numberOfRows != my dimension) {
 			Melder_throw (U"SSCP_and_Eigen_project: dimensions don't agree.");
 		}
 		autoSSCP him = SSCP_create (my numberOfEigenvalues);
 		Eigen_and_SSCP_project_ (me, thee, him.peek());
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (U"SSCP not projected.");
 	}
 }
 
-Covariance Eigen_and_Covariance_project (I, Covariance thee) {
+autoCovariance Eigen_and_Covariance_project (Eigen me, Covariance thee) {
 	try {
-		iam (Eigen);
 		if (thy numberOfRows != my dimension) {
 			Melder_throw (U"Covariance_and_Eigen_project: dimensions don't agree.");
 		}
 		autoCovariance him = Covariance_create (my numberOfEigenvalues);
 		Eigen_and_SSCP_project_ (me, thee, him.peek());
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (U"Covariance not projected.");
 	}
diff --git a/dwtools/Eigen_and_SSCP.h b/dwtools/Eigen_and_SSCP.h
index 38c7f59..37a7798 100644
--- a/dwtools/Eigen_and_SSCP.h
+++ b/dwtools/Eigen_and_SSCP.h
@@ -2,7 +2,7 @@
 #define _Eigen_and_SSCP_h_
 /* Eigen_and_SSCP.h
  *
- * Copyright (C) 1993-2004 David Weenink
+ * Copyright (C) 1993-2004, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -27,8 +27,9 @@
 #include "Eigen.h"
 #include "SSCP.h"
 
-SSCP Eigen_and_SSCP_project (I, SSCP thee);
-Covariance Eigen_and_Covariance_project (I, Covariance thee);
+autoSSCP Eigen_and_SSCP_project (Eigen me, SSCP thee);
+
+autoCovariance Eigen_and_Covariance_project (Eigen me, Covariance thee);
 /*
 	Purpose: project the SSCP (thee) on the eigenspace (me): S' = E' S E
 	Returns SSCP-object with square matrix dimension 'my numberOfEigenvalues'
diff --git a/dwtools/Eigen_and_TableOfReal.cpp b/dwtools/Eigen_and_TableOfReal.cpp
index 78ffe38..b3cc9c2 100644
--- a/dwtools/Eigen_and_TableOfReal.cpp
+++ b/dwtools/Eigen_and_TableOfReal.cpp
@@ -1,6 +1,6 @@
 /* Eigen_and_TableOfReal.cpp
  *
- * Copyright (C) 1993-2012 David Weenink
+ * Copyright (C) 1993-2012, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -28,16 +28,14 @@
 #include "Eigen_and_TableOfReal.h"
 #include "NUM2.h"
 
-TableOfReal Eigen_and_TableOfReal_project (Eigen me, TableOfReal thee, long from,
-        long numberOfComponents) {
+autoTableOfReal Eigen_and_TableOfReal_project (Eigen me, TableOfReal thee, long from, long numberOfComponents) {
 	try {
 		if (numberOfComponents == 0) {
 			numberOfComponents = my numberOfEigenvalues;
 		}
 
 		autoTableOfReal him = TableOfReal_create (thy numberOfRows, numberOfComponents);
-		TableOfReal thim = him.peek();
-		Eigen_and_TableOfReal_project_into (me, thee, from, thy numberOfColumns, &thim, 1, numberOfComponents);
+		Eigen_and_TableOfReal_project_into (me, thee, from, thy numberOfColumns, him.peek(), 1, numberOfComponents);
 		NUMstrings_copyElements (thy rowLabels, his rowLabels, 1, thy numberOfRows);
 		return him.transfer();
 	} catch (MelderError) {
@@ -45,9 +43,7 @@ TableOfReal Eigen_and_TableOfReal_project (Eigen me, TableOfReal thee, long from
 	}
 }
 
-void Eigen_and_TableOfReal_project_into (Eigen me, TableOfReal thee, long thee_from, long thee_to,
-        Any void_pointer_to_him, long his_from, long his_to) {
-	TableOfReal him = * ( (TableOfReal *) void_pointer_to_him);
+void Eigen_and_TableOfReal_project_into (Eigen me, TableOfReal thee, long thee_from, long thee_to, TableOfReal him, long his_from, long his_to) {
 	long thee_ncols = thee_to - thee_from + 1;
 	long his_ncols = his_to - his_from + 1;
 
@@ -75,14 +71,14 @@ void Eigen_and_TableOfReal_project_into (Eigen me, TableOfReal thee, long thee_f
 	}
 }
 
-Eigen TablesOfReal_to_Eigen_gsvd (TableOfReal me, TableOfReal thee) {
+autoEigen TablesOfReal_to_Eigen_gsvd (TableOfReal me, TableOfReal thee) {
 	try {
 		if (my numberOfColumns != thy numberOfColumns) {
 			Melder_throw (U"TablesOfReal_to_Eigen: Number of columns must be equal.");
 		}
 		autoEigen him = Thing_new (Eigen);
 		Eigen_initFromSquareRootPair (him.peek(), my data, my numberOfRows, my numberOfColumns, thy data, thy numberOfRows);
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (me, U": Eigen not created.");
 	}
diff --git a/dwtools/Eigen_and_TableOfReal.h b/dwtools/Eigen_and_TableOfReal.h
index cae7ad6..faa4cbc 100644
--- a/dwtools/Eigen_and_TableOfReal.h
+++ b/dwtools/Eigen_and_TableOfReal.h
@@ -3,7 +3,7 @@
 
 /* Eigen_and_TableOfReal.h
  *
- * Copyright (C) 1993-2011 David Weenink
+ * Copyright (C) 1993-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -29,21 +29,19 @@
 #include "Eigen.h"
 #include "TableOfReal.h"
 
-TableOfReal Eigen_and_TableOfReal_project (Eigen me, TableOfReal thee, long from,
-	long numberOfComponents);
+autoTableOfReal Eigen_and_TableOfReal_project (Eigen me, TableOfReal thee, long from, long numberOfComponents);
 /*
 	Purpose: project the rows of the TableOfReal (thee) starting at index 'from'
 	on the eigenspace (me).
 */
 
-void Eigen_and_TableOfReal_project_into (Eigen me, TableOfReal thee, long thee_from, long thee_to,
-	Any void_pointer_to_him, long his_from, long his_to);
+void Eigen_and_TableOfReal_project_into (Eigen me, TableOfReal thee, long thee_from, long thee_to, TableOfReal him, long his_from, long his_to);
 /*
 	Purpose: project the rows of the TableOfReal (thee) on the
 	eigenspace (me). Result in existing TableOfReal (him).
 */
 
-Eigen TablesOfReal_to_Eigen_gsvd (TableOfReal me, TableOfReal thee);
+autoEigen TablesOfReal_to_Eigen_gsvd (TableOfReal me, TableOfReal thee);
 /*
 	Solve A'A x -lambda B'B x = 0
 */
diff --git a/dwtools/Excitations.cpp b/dwtools/Excitations.cpp
index 59cadb0..de960bb 100644
--- a/dwtools/Excitations.cpp
+++ b/dwtools/Excitations.cpp
@@ -1,6 +1,6 @@
 /* Excitations.cpp
  *
- * Copyright (C) 1993-2011 David Weenink
+ * Copyright (C) 1993-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -45,17 +45,17 @@ static int readBinary (I, FILE *f)
 
 Thing_implement (Excitations, Ordered, 0);
 
-Excitations Excitations_create (long initialCapacity) {
+autoExcitations Excitations_create (long initialCapacity) {
 	try {
 		autoExcitations me = Thing_new (Excitations);
 		Ordered_init (me.peek(), classExcitation, initialCapacity);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Excitations not created.");
 	}
 }
 
-Pattern Excitations_to_Pattern (Excitations me, long join) {
+autoPattern Excitations_to_Pattern (Excitations me, long join) {
 	try {
 		Melder_assert (my size > 0);
 		Matrix m = (Matrix) my item[1];
@@ -77,13 +77,13 @@ Pattern Excitations_to_Pattern (Excitations me, long join) {
 				thy z[r][c++] = z[j];
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no Pattern created.");
 	}
 }
 
-TableOfReal Excitations_to_TableOfReal (Excitations me) {
+autoTableOfReal Excitations_to_TableOfReal (Excitations me) {
 	try {
 		Melder_assert (my size > 0);
 		Matrix m = (Matrix) my item[1];
@@ -94,20 +94,20 @@ TableOfReal Excitations_to_TableOfReal (Excitations me) {
 				thy data[i][j] = z[j];
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no TableOfReal created.");
 	}
 }
 
-Excitation Excitations_getItem (Excitations me, long item) {
+autoExcitation Excitations_getItem (Excitations me, long item) {
 	try {
 		if (item < 1 || item > my size) {
 			Melder_throw (U"Not a valid element number.");
 		}
 		autoExcitation thee = Data_copy ( (Excitation) my item[item]);
 		Thing_setName (thee.peek(), Thing_getName ( (Thing) my item[item]));
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no Excitation created.");
 	}
diff --git a/dwtools/Excitations.h b/dwtools/Excitations.h
index 515a220..5096851 100644
--- a/dwtools/Excitations.h
+++ b/dwtools/Excitations.h
@@ -2,7 +2,7 @@
 #define _Excitations_h_
 /* Excitations.h
  *
- * Copyright (C) 1993-2011 David Weenink
+ * Copyright (C) 1993-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -34,14 +34,14 @@ Thing_define (Excitations, Ordered) {
 
 /* Excitations is a collection of objects of the same class Excitation */
 
-Excitations Excitations_create (long initialCapacity);
+autoExcitations Excitations_create (long initialCapacity);
 
-Pattern Excitations_to_Pattern (Excitations me, long join);
+autoPattern Excitations_to_Pattern (Excitations me, long join);
 /* Precondition: my size >= 1, all items have same dimension */
 
-TableOfReal Excitations_to_TableOfReal (Excitations me);
+autoTableOfReal Excitations_to_TableOfReal (Excitations me);
 /* Precondition: my size >= 1, all items have same dimension */
 
-Excitation Excitations_getItem (Excitations m, long item);
+autoExcitation Excitations_getItem (Excitations m, long item);
 
 #endif /* _Excitations_h_ */
diff --git a/dwtools/FormantGrid_extensions.h b/dwtools/FormantGrid_extensions.h
index 5f1c42d..847e8a6 100644
--- a/dwtools/FormantGrid_extensions.h
+++ b/dwtools/FormantGrid_extensions.h
@@ -2,7 +2,7 @@
 #define _FormantGrid_extensions_h_
 /* FormantGrid_extensions.h
  *
- * Copyright (C) 2009-2011 David Weenink
+ * Copyright (C) 2009-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/dwtools/GaussianMixture.cpp b/dwtools/GaussianMixture.cpp
index 119d746..9a7e1f6 100644
--- a/dwtools/GaussianMixture.cpp
+++ b/dwtools/GaussianMixture.cpp
@@ -1,6 +1,6 @@
 /* GaussianMixture.cpp
  *
- * Copyright (C) 2011-2014 David Weenink
+ * Copyright (C) 2011-2014, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -203,7 +203,7 @@ static void GaussianMixture_setDefaultMixtureNames (GaussianMixture me) {
 	}
 }
 
-GaussianMixture GaussianMixture_create (long numberOfComponents, long dimension, long storage) {
+autoGaussianMixture GaussianMixture_create (long numberOfComponents, long dimension, long storage) {
 	try {
 		autoGaussianMixture me = Thing_new (GaussianMixture);
 		my numberOfComponents = numberOfComponents;
@@ -218,7 +218,7 @@ GaussianMixture GaussianMixture_create (long numberOfComponents, long dimension,
 			my mixingProbabilities[im] = 1.0 / numberOfComponents;
 		}
 		GaussianMixture_setDefaultMixtureNames (me.peek());
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"GaussianMixture not created.");
 	}
@@ -247,7 +247,7 @@ int GaussianMixture_generateOneVector (GaussianMixture me, double *c, char32 **c
 	}
 }
 
-GaussianMixture TableOfReal_to_GaussianMixture_fromRowLabels (TableOfReal me, long storage) {
+autoGaussianMixture TableOfReal_to_GaussianMixture_fromRowLabels (TableOfReal me, long storage) {
 	try {
 		autoStrings rowLabels = TableOfReal_extractRowLabels (me);
 		autoDistributions dist = Strings_to_Distributions (rowLabels.peek());
@@ -266,13 +266,13 @@ GaussianMixture TableOfReal_to_GaussianMixture_fromRowLabels (TableOfReal me, lo
 		for (long im = 1; im <= numberOfComponents; im++) {
 			thy mixingProbabilities[im] = dist -> data[im][1] / my numberOfRows;
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no GaussianMixture created.");
 	}
 }
 
-Covariance GaussianMixture_to_Covariance_between (GaussianMixture me) {
+autoCovariance GaussianMixture_to_Covariance_between (GaussianMixture me) {
 	try {
 		autoCovariance thee = Covariance_create (my dimension);
 
@@ -322,13 +322,13 @@ Covariance GaussianMixture_to_Covariance_between (GaussianMixture me) {
 		}
 
 		thy numberOfObservations = nobs_total;
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no Covariance (between) created.");
 	}
 }
 
-Covariance GaussianMixture_to_Covariance_within (GaussianMixture me) {
+autoCovariance GaussianMixture_to_Covariance_within (GaussianMixture me) {
 	try {
 		autoCovariance thee = Covariance_create (my dimension);
 
@@ -352,13 +352,13 @@ Covariance GaussianMixture_to_Covariance_within (GaussianMixture me) {
 		// Leave centroid at 0 so we can add the within and between covariance nicely
 		// Copy row labels from columns, because covar might be diagonal
 		TableOfReal_copyLabels ((Covariance) my covariances -> item[1], thee.peek(), -1, 1);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no Covariance (within) created.");
 	}
 }
 
-Covariance GaussianMixture_to_Covariance_total (GaussianMixture me) {
+autoCovariance GaussianMixture_to_Covariance_total (GaussianMixture me) {
 	try {
 		autoCovariance thee = GaussianMixture_to_Covariance_between (me);
 		autoCovariance within = GaussianMixture_to_Covariance_within (me);
@@ -368,24 +368,25 @@ Covariance GaussianMixture_to_Covariance_total (GaussianMixture me) {
 				thy data[ir][ic] = thy data[ic][ir] += within -> data[ir][ic];
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no Covariance (total) created.");
 	}
 }
 
-Covariance GaussianMixture_extractComponent (GaussianMixture me, long component) {
+autoCovariance GaussianMixture_extractComponent (GaussianMixture me, long component) {
 	try {
 		if (component < 1 || component > my numberOfComponents) {
 			Melder_throw (U"Illegal component.");
 		}
-		return Data_copy ( (Covariance) my covariances -> item[component]);
+		autoCovariance thee = Data_copy ((Covariance) my covariances -> item[component]);
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no component extracted.");
 	}
 }
 
-TableOfReal GaussianMixture_extractMixingProbabilities (GaussianMixture me) {
+autoTableOfReal GaussianMixture_extractMixingProbabilities (GaussianMixture me) {
 	try {
 		autoTableOfReal thee = TableOfReal_create (my numberOfComponents, 2);
 		TableOfReal_setColumnLabel (thee.peek(), 1, U"p");
@@ -396,13 +397,13 @@ TableOfReal GaussianMixture_extractMixingProbabilities (GaussianMixture me) {
 			thy data[im][2] = cov -> numberOfObservations;
 			TableOfReal_setRowLabel (thee.peek(), im, Thing_getName (cov));
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no mixing probabilities extracted.");
 	}
 }
 
-TableOfReal GaussianMixture_extractCentroids (GaussianMixture me) {
+autoTableOfReal GaussianMixture_extractCentroids (GaussianMixture me) {
 	try {
 		autoTableOfReal thee = TableOfReal_create (my numberOfComponents, my dimension);
 
@@ -418,17 +419,17 @@ TableOfReal GaussianMixture_extractCentroids (GaussianMixture me) {
 				thy data[im][j] = cov -> centroid[j];
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no centroid extracted.");
 	}
 }
 
-PCA GaussianMixture_to_PCA (GaussianMixture me) {
+autoPCA GaussianMixture_to_PCA (GaussianMixture me) {
 	try {
 		autoCovariance him = GaussianMixture_to_Covariance_total (me);
 		autoPCA thee = SSCP_to_PCA (him.peek());
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no PCA calculated.");
 	}
@@ -554,9 +555,7 @@ void GaussianMixture_drawMarginalPdf (GaussianMixture me, Graphics g, long d, do
 	}
 }
 
-void GaussianMixture_and_PCA_drawConcentrationEllipses (GaussianMixture me, PCA him, Graphics g, double scale,
-        int confidence, char32 *label, long d1, long d2,
-        double xmin, double xmax, double ymin, double ymax, int fontSize, int garnish) {
+void GaussianMixture_and_PCA_drawConcentrationEllipses (GaussianMixture me, PCA him, Graphics g, double scale, int confidence, char32 *label, long d1, long d2, double xmin, double xmax, double ymin, double ymax, int fontSize, int garnish) {
 	if (my dimension != his dimension) {
 		Melder_warning (U"Dimensions don't agree.");
 		return;
@@ -598,9 +597,7 @@ void GaussianMixture_and_PCA_drawConcentrationEllipses (GaussianMixture me, PCA
 	}
 }
 
-void GaussianMixture_drawConcentrationEllipses (GaussianMixture me, Graphics g,
-        double scale, int confidence, char32 *label, int pcaDirections, long d1, long d2,
-        double xmin, double xmax, double ymin, double ymax, int fontSize, int garnish) {
+void GaussianMixture_drawConcentrationEllipses (GaussianMixture me, Graphics g, double scale, int confidence, char32 *label, int pcaDirections, long d1, long d2, double xmin, double xmax, double ymin, double ymax, int fontSize, int garnish) {
 	if (d1 == 0 && d2 == 0) {
 		d1 = 1;
 		d2 = 2;
@@ -682,7 +679,7 @@ void GaussianMixture_initialGuess (GaussianMixture me, TableOfReal thee, double
 						covi -> centroid[ic] -= (1.0 - scale) * (covi -> centroid[ic] - cov_b -> centroid[ic]);
 					}
 				}
-				cov_b.reset (GaussianMixture_to_Covariance_between (me));
+				cov_b = GaussianMixture_to_Covariance_between (me);
 			}
 
 			// Within variances are now (total - between) / numberOfComponents;
@@ -717,7 +714,7 @@ void GaussianMixture_initialGuess (GaussianMixture me, TableOfReal thee, double
 }
 
 
-ClassificationTable GaussianMixture_and_TableOfReal_to_ClassificationTable (GaussianMixture me, TableOfReal thee) {
+autoClassificationTable GaussianMixture_and_TableOfReal_to_ClassificationTable (GaussianMixture me, TableOfReal thee) {
 	try {
 		autoClassificationTable him = ClassificationTable_create (thy numberOfRows, my numberOfComponents);
 		for (long im = 1; im <= my numberOfComponents; im++) {
@@ -750,7 +747,7 @@ ClassificationTable GaussianMixture_and_TableOfReal_to_ClassificationTable (Gaus
 
 			TableOfReal_setRowLabel (him.peek(), i, thy rowLabels[i]);
 		}
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (U"No ClassificationTable created from GaussianMixture & TableOfReal.");
 	}
@@ -905,8 +902,7 @@ void GaussianMixture_unExpandPCA (GaussianMixture me) {
 	}
 }
 
-void GaussianMixture_and_TableOfReal_improveLikelihood (GaussianMixture me, thou, double delta_lnp, long maxNumberOfIterations, double lambda, int criterion) {
-	thouart (TableOfReal);
+void GaussianMixture_and_TableOfReal_improveLikelihood (GaussianMixture me, TableOfReal thee, double delta_lnp, long maxNumberOfIterations, double lambda, int criterion) {
 	try {
 		const char32 *criterionText = GaussianMixture_criterionText (criterion);
 
@@ -1085,7 +1081,7 @@ double GaussianMixture_getLikelihoodValue (GaussianMixture me, double **p, long
 	return lnp;
 }
 
-GaussianMixture GaussianMixture_and_TableOfReal_to_GaussianMixture_CEMM (GaussianMixture gm, TableOfReal thee, long minNumberOfComponents, double delta_l, long maxNumberOfIterations, double lambda, int criterion) {
+autoGaussianMixture GaussianMixture_and_TableOfReal_to_GaussianMixture_CEMM (GaussianMixture gm, TableOfReal thee, long minNumberOfComponents, double delta_l, long maxNumberOfIterations, double lambda, int criterion) {
 	try {
 		const char32 *criterionText = GaussianMixture_criterionText (criterion);
 		bool deleteWeakComponents = ( minNumberOfComponents > 0 );
@@ -1106,7 +1102,7 @@ GaussianMixture GaussianMixture_and_TableOfReal_to_GaussianMixture_CEMM (Gaussia
 		double lnew = GaussianMixture_getLikelihoodValue (me.peek(), p.peek(), thy numberOfRows, criterion);
 
 		autoMelderProgress progress (U"Gaussian mixture...");
-		autoGaussianMixture best = 0;
+		autoGaussianMixture best;
 		try {
 			double lstart = lnew / thy numberOfRows;
 			long iter = 0, component;
@@ -1161,7 +1157,7 @@ GaussianMixture GaussianMixture_and_TableOfReal_to_GaussianMixture_CEMM (Gaussia
 						U"\nL0: ", lstart);
 				} while (lnew > lprev && fabs ( (lprev - lnew) / lnew) > delta_l && iter < maxNumberOfIterations);
 				if (lnew > lmax) {
-					best.reset (Data_copy (me.peek()));
+					best = Data_copy (me.peek());
 					lmax = lnew;
 					if (! deleteWeakComponents) {
 						break;    // TODO was got end; is dat hetzelfde?
@@ -1185,7 +1181,7 @@ GaussianMixture GaussianMixture_and_TableOfReal_to_GaussianMixture_CEMM (Gaussia
 		} catch (MelderError) {
 			Melder_clearError ();
 		}
-		return best.transfer();
+		return best;
 	} catch (MelderError) {
 		Melder_throw (U"GaussianMixture not improved.");
 	}
@@ -1207,7 +1203,7 @@ void GaussianMixture_removeComponent (GaussianMixture me, long component) {
 	NUMdvector_scaleAsProbabilities (my mixingProbabilities, my numberOfComponents);
 }
 
-GaussianMixture TableOfReal_to_GaussianMixture (TableOfReal me, long numberOfComponents, double delta_lnp, long maxNumberOfIterations, double lambda, int storage, int criterion) {
+autoGaussianMixture TableOfReal_to_GaussianMixture (TableOfReal me, long numberOfComponents, double delta_lnp, long maxNumberOfIterations, double lambda, int storage, int criterion) {
 	try {
 		if (my numberOfRows < 2 * numberOfComponents) {
 			Melder_throw (U"The number of data points must at least be twice the number of components.");
@@ -1217,17 +1213,17 @@ GaussianMixture TableOfReal_to_GaussianMixture (TableOfReal me, long numberOfCom
 		GaussianMixture_setLabelsFromTableOfReal (thee.peek(), me);
 		GaussianMixture_initialGuess (thee.peek(), me, 1.0, 0.05);
 		if (maxNumberOfIterations <= 0) {
-			return thee.transfer();
+			return thee;
 		}
 
 		GaussianMixture_and_TableOfReal_improveLikelihood (thee.peek(), me, delta_lnp, maxNumberOfIterations, lambda, criterion);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no GaussianMixture created.");
 	}
 }
 
-Correlation GaussianMixture_and_TableOfReal_to_Correlation (GaussianMixture me, thou) {
+autoCorrelation GaussianMixture_and_TableOfReal_to_Correlation (GaussianMixture me, thou) {
 	try {
 		thouart (TableOfReal);
 		if (my dimension != thy numberOfColumns) {
@@ -1235,7 +1231,7 @@ Correlation GaussianMixture_and_TableOfReal_to_Correlation (GaussianMixture me,
 		}
 		autoClassificationTable ct = GaussianMixture_and_TableOfReal_to_ClassificationTable (me, thee);
 		autoCorrelation him = ClassificationTable_to_Correlation_columns (ct.peek());
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (U"Correlation not created from GaussianMixture & TableOfReal.");
 	}
@@ -1273,7 +1269,7 @@ double GaussianMixture_getProbabilityAtPosition (GaussianMixture me, double *xpo
 	return p;
 }
 
-Matrix GaussianMixture_and_PCA_to_Matrix_density (GaussianMixture me, PCA thee, long d1, long d2, double xmin, double xmax, long nx, double ymin, double ymax, long ny) {
+autoMatrix GaussianMixture_and_PCA_to_Matrix_density (GaussianMixture me, PCA thee, long d1, long d2, double xmin, double xmax, long nx, double ymin, double ymax, long ny) {
 	try {
 		if (my dimension != thy dimension) {
 			Melder_throw (U"Dimensions must be equal.");
@@ -1313,13 +1309,13 @@ Matrix GaussianMixture_and_PCA_to_Matrix_density (GaussianMixture me, PCA thee,
 				his z[i][j] = GaussianMixture_getProbabilityAtPosition (me, v.peek());
 			}
 		}
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (me, U" & ", thee, U": no Matrix density created.");
 	}
 }
 
-TableOfReal GaussianMixture_to_TableOfReal_randomSampling (GaussianMixture me, long numberOfPoints) {
+autoTableOfReal GaussianMixture_to_TableOfReal_randomSampling (GaussianMixture me, long numberOfPoints) {
 	try {
 		Covariance cov = (Covariance) my covariances -> item[1];
 		autoTableOfReal thee = TableOfReal_create (numberOfPoints, my dimension);
@@ -1331,13 +1327,13 @@ TableOfReal GaussianMixture_to_TableOfReal_randomSampling (GaussianMixture me, l
 			TableOfReal_setRowLabel (thee.peek(), i, covname);
 		}
 		GaussianMixture_unExpandPCA (me);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		GaussianMixture_unExpandPCA (me); Melder_throw (U"TableOfReal with random ssampling not created.");
 	}
 }
 
-TableOfReal GaussianMixture_and_TableOfReal_to_TableOfReal_BHEPNormalityTests (GaussianMixture me, TableOfReal thee, double h) {
+autoTableOfReal GaussianMixture_and_TableOfReal_to_TableOfReal_BHEPNormalityTests (GaussianMixture me, TableOfReal thee, double h) {
 	try {
 		long n = thy numberOfRows, d = thy numberOfColumns, nocp1 = my numberOfComponents + 1;
 
@@ -1419,7 +1415,7 @@ TableOfReal GaussianMixture_and_TableOfReal_to_TableOfReal_BHEPNormalityTests (G
 			his data[im][id] = d;
 			his data[im][itnb] = tnb;
 		}
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (U"TableOfReal for BHEP not created.");
 	}
diff --git a/dwtools/GaussianMixture.h b/dwtools/GaussianMixture.h
index f89dcb5..d8cec0b 100644
--- a/dwtools/GaussianMixture.h
+++ b/dwtools/GaussianMixture.h
@@ -2,7 +2,7 @@
 #define _GaussianMixture_h_
 /* GaussianMixture.h
  *
- * Copyright (C) 2010-2011 David Weenink
+ * Copyright (C) 2010-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -36,21 +36,26 @@ oo_CLASS_CREATE (GaussianMixture, Daata);
 	Constraints for a Gaussian mixture:
 	 all covariances have the same 'dimension' parameter
 */
-GaussianMixture GaussianMixture_create (long numberOfComponents, long dimension, long storage);
+autoGaussianMixture GaussianMixture_create (long numberOfComponents, long dimension, long storage);
 /* Start each function with expand and end with unExpand */
+
 void GaussianMixture_expandPCA (GaussianMixture me);
+
 void GaussianMixture_unExpandPCA (GaussianMixture me);
 
 void GaussianMixture_drawConcentrationEllipses (GaussianMixture me, Graphics g,
 	double scale, int confidence, char32 *label, int pcaDirections, long d1, long d2,
 	double xmin, double xmax, double ymin, double ymax, int fontSize, int garnish);
+
 void GaussianMixture_and_PCA_drawConcentrationEllipses (GaussianMixture me, PCA him, Graphics g,
 	double scale, int confidence, char32 *label, long d1, long d2,
 	double xmin, double xmax, double ymin, double ymax, int fontSize, int garnish);
+
 void GaussianMixture_drawMarginalPdf (GaussianMixture me, Graphics g, long d, double xmin, double xmax, double ymin, double ymax, long npoints, long nbins, int garnish);
+
 void GaussianMixture_and_PCA_drawMarginalPdf (GaussianMixture me, PCA him, Graphics g, long d, double xmin, double xmax, double ymin, double ymax, long npoints, long nbins, int garnish);
 
-GaussianMixture TableOfReal_to_GaussianMixture_fromRowLabels (TableOfReal me, long storage);
+autoGaussianMixture TableOfReal_to_GaussianMixture_fromRowLabels (TableOfReal me, long storage);
 
 void GaussianMixture_initialGuess (GaussianMixture me, TableOfReal thee, double nSigmas, double ru_range);
 /*
@@ -72,45 +77,57 @@ void GaussianMixture_initialGuess (GaussianMixture me, TableOfReal thee, double
 
 const char32 *GaussianMixture_criterionText (int criterion);
 
-GaussianMixture TableOfReal_to_GaussianMixture (TableOfReal me, long numberOfComponents, double delta_lnp, long maxNumberOfIterations, double lambda, int storage, int criterion);
+autoGaussianMixture TableOfReal_to_GaussianMixture (TableOfReal me, long numberOfComponents, double delta_lnp, long maxNumberOfIterations, double lambda, int storage, int criterion);
 
-void GaussianMixture_and_TableOfReal_improveLikelihood (GaussianMixture me, thou, double delta_lnp,
-	long maxNumberOfIterations, double lambda, int criterion);
+void GaussianMixture_and_TableOfReal_improveLikelihood (GaussianMixture me, TableOfReal thee, double delta_lnp, long maxNumberOfIterations, double lambda, int criterion);
+
+autoGaussianMixture GaussianMixture_and_TableOfReal_to_GaussianMixture_CEMM (GaussianMixture me, TableOfReal thee, long minNumberOfComponents, double delta_l, long maxNumberOfIterations, double lambda, int criterion);
 
-GaussianMixture GaussianMixture_and_TableOfReal_to_GaussianMixture_CEMM (GaussianMixture me, TableOfReal thee, long minNumberOfComponents, double delta_l, long maxNumberOfIterations, double lambda, int criterion);
 void GaussianMixture_splitComponent (GaussianMixture me, long component);
 
-ClassificationTable GaussianMixture_and_TableOfReal_to_ClassificationTable (GaussianMixture me, TableOfReal thee);
-TableOfReal GaussianMixture_and_TableOfReal_to_TableOfReal_BHEPNormalityTests (GaussianMixture me, TableOfReal thee, double h);
+autoClassificationTable GaussianMixture_and_TableOfReal_to_ClassificationTable (GaussianMixture me, TableOfReal thee);
+
+autoTableOfReal GaussianMixture_and_TableOfReal_to_TableOfReal_BHEPNormalityTests (GaussianMixture me, TableOfReal thee, double h);
 
 double GaussianMixture_and_TableOfReal_getLikelihoodValue (GaussianMixture me, TableOfReal thee, int criterion);
 
 double GaussianMixture_getProbabilityAtPosition (GaussianMixture me, double *vector);
+
 double GaussianMixture_getProbabilityAtPosition_string (GaussianMixture me, const char32 *vector);
+
 double GaussianMixture_getMarginalProbabilityAtPosition (GaussianMixture me, double *vector, double x);
 
-Correlation GaussianMixture_and_TableOfReal_to_Correlation (GaussianMixture me, thou);
+autoCorrelation GaussianMixture_and_TableOfReal_to_Correlation (GaussianMixture me, thou);
 /* Correlation between components based on the data in the table */
 
-Covariance GaussianMixture_to_Covariance_total (GaussianMixture me);
-Covariance GaussianMixture_to_Covariance_between (GaussianMixture me);
-Covariance GaussianMixture_to_Covariance_within (GaussianMixture me);
+autoCovariance GaussianMixture_to_Covariance_total (GaussianMixture me);
 
+autoCovariance GaussianMixture_to_Covariance_between (GaussianMixture me);
 
-Covariance GaussianMixture_extractComponent(GaussianMixture me, long component);
-TableOfReal GaussianMixture_extractCentroids (GaussianMixture me);
-TableOfReal GaussianMixture_extractMixingProbabilities (GaussianMixture me);
+autoCovariance GaussianMixture_to_Covariance_within (GaussianMixture me);
 
-PCA GaussianMixture_to_PCA (GaussianMixture me);
 
-Matrix GaussianMixture_and_PCA_to_Matrix_density (GaussianMixture me, PCA pca, long d1, long d2, double xmin, double xmax, long nx, double ymin, double ymax, long ny);
+autoCovariance GaussianMixture_extractComponent(GaussianMixture me, long component);
+
+autoTableOfReal GaussianMixture_extractCentroids (GaussianMixture me);
+
+autoTableOfReal GaussianMixture_extractMixingProbabilities (GaussianMixture me);
+
+autoPCA GaussianMixture_to_PCA (GaussianMixture me);
+
+autoMatrix GaussianMixture_and_PCA_to_Matrix_density (GaussianMixture me, PCA pca, long d1, long d2, double xmin, double xmax, long nx, double ymin, double ymax, long ny);
+
 void GaussianMixture_and_PCA_getIntervalsAlongDirections (GaussianMixture me, PCA thee, long d1, long d2, double nsigmas, double *xmin, double *xmax, double *ymin, double *ymax);
+
 void GaussianMixture_and_PCA_getIntervalAlongDirection (GaussianMixture me, PCA thee, long d, double nsigmas, double *xmin, double *xmax);
+
 void GaussianMixture_getIntervalAlongDirection (GaussianMixture me, long d, double nsigmas, double *xmin, double *xmax);
+
 void GaussianMixture_getIntervalsAlongDirections (GaussianMixture me, long d1, long d2, double nsigmas, double *xmin, double *xmax, double *ymin, double *ymax);
 
 /* with on demand expand of pca ! */
 int GaussianMixture_generateOneVector (GaussianMixture me, double *c, char32 **covname, double *buf);
-TableOfReal GaussianMixture_to_TableOfReal_randomSampling (GaussianMixture me, long numberOfPoints);
+
+autoTableOfReal GaussianMixture_to_TableOfReal_randomSampling (GaussianMixture me, long numberOfPoints);
 
 #endif /* _GaussianMixture_h_ */
diff --git a/dwtools/HMM.cpp b/dwtools/HMM.cpp
index 23a8942..a0fb157 100644
--- a/dwtools/HMM.cpp
+++ b/dwtools/HMM.cpp
@@ -54,32 +54,32 @@
 
 // helpers
 int NUMget_line_intersection_with_circle (double xc, double yc, double r, double a, double b, double *x1, double *y1, double *x2, double *y2);
-void HMM_Observation_init (I, const char32 *label, long numberOfComponents, long dimension, long storage);
-autoHMM_Observation HMM_Observation_create (const char32 *label, long numberOfComponents, long dimension, long storage);
+void HMMObservation_init (I, const char32 *label, long numberOfComponents, long dimension, long storage);
+autoHMMObservation HMMObservation_create (const char32 *label, long numberOfComponents, long dimension, long storage);
 
-long HMM_and_HMM_ObservationSequence_getLongestSequence (HMM me, HMM_ObservationSequence thee, long symbolNumber);
+long HMM_and_HMMObservationSequence_getLongestSequence (HMM me, HMMObservationSequence thee, long symbolNumber);
 long StringsIndex_getLongestSequence (StringsIndex me, long index, long *pos);
 long Strings_getLongestSequence (Strings me, char32 *string, long *pos);
-void HMM_State_init (I, const char32 *label);
-autoHMM_State HMM_State_create (const char32 *label);
-
-autoHMM_BaumWelch HMM_BaumWelch_create (long nstates, long nsymbols, long capacity);
-void HMM_BaumWelch_getGamma (HMM_BaumWelch me);
-autoHMM_BaumWelch HMM_forward (HMM me, long *obs, long nt);
-void HMM_BaumWelch_reInit (HMM_BaumWelch me);
-void HMM_and_HMM_BaumWelch_getXi (HMM me, HMM_BaumWelch thee, long *obs);
-void HMM_and_HMM_BaumWelch_reestimate (HMM me, HMM_BaumWelch thee);
-void HMM_and_HMM_BaumWelch_addEstimate (HMM me, HMM_BaumWelch thee, long *obs);
-void HMM_and_HMM_BaumWelch_forward (HMM me, HMM_BaumWelch thee, long *obs);
-void HMM_and_HMM_BaumWelch_backward (HMM me, HMM_BaumWelch thee, long *obs);
-void HMM_and_HMM_Viterbi_decode (HMM me, HMM_Viterbi thee, long *obs);
+void HMMState_init (I, const char32 *label);
+autoHMMState HMMState_create (const char32 *label);
+
+autoHMMBaumWelch HMMBaumWelch_create (long nstates, long nsymbols, long capacity);
+void HMMBaumWelch_getGamma (HMMBaumWelch me);
+autoHMMBaumWelch HMM_forward (HMM me, long *obs, long nt);
+void HMMBaumWelch_reInit (HMMBaumWelch me);
+void HMM_and_HMMBaumWelch_getXi (HMM me, HMMBaumWelch thee, long *obs);
+void HMM_and_HMMBaumWelch_reestimate (HMM me, HMMBaumWelch thee);
+void HMM_and_HMMBaumWelch_addEstimate (HMM me, HMMBaumWelch thee, long *obs);
+void HMM_and_HMMBaumWelch_forward (HMM me, HMMBaumWelch thee, long *obs);
+void HMM_and_HMMBaumWelch_backward (HMM me, HMMBaumWelch thee, long *obs);
+void HMM_and_HMMViterbi_decode (HMM me, HMMViterbi thee, long *obs);
 double HMM_getProbabilityOfObservations (HMM me, long *obs, long numberOfTimes);
 autoTableOfReal StringsIndex_to_TableOfReal_transitions (StringsIndex me, int probabilities);
-autoStringsIndex HMM_and_HMM_StateSequence_to_StringsIndex (HMM me, HMM_StateSequence thee);
+autoStringsIndex HMM_and_HMMStateSequence_to_StringsIndex (HMM me, HMMStateSequence thee);
 
 
-autoHMM_Viterbi HMM_Viterbi_create (long nstates, long ntimes);
-autoHMM_Viterbi HMM_to_HMM_Viterbi (HMM me, long *obs, long ntimes);
+autoHMMViterbi HMMViterbi_create (long nstates, long ntimes);
+autoHMMViterbi HMM_to_HMMViterbi (HMM me, long *obs, long ntimes);
 
 // evaluate the numbers given to probabilities
 static double *NUMwstring_to_probs (char32 *s, long nwanted) {
@@ -126,34 +126,34 @@ int NUMget_line_intersection_with_circle (double xc, double yc, double r, double
 
 // D(l_1,l_2)=1/n( log p(O_2|l_1) - log p(O_2|l_2)
 static double HMM_and_HMM_getCrossEntropy_asym (HMM me, HMM thee, long observationLength) {
-	autoHMM_ObservationSequence os = HMM_to_HMM_ObservationSequence (thee, 0, observationLength);
-	double ce = HMM_and_HMM_ObservationSequence_getCrossEntropy (me, os.peek());
+	autoHMMObservationSequence os = HMM_to_HMMObservationSequence (thee, 0, observationLength);
+	double ce = HMM_and_HMMObservationSequence_getCrossEntropy (me, os.peek());
 	if (ce == NUMundefined || ce == INFINITY) {
 		return ce;
 	}
-	double ce2 = HMM_and_HMM_ObservationSequence_getCrossEntropy (thee, os.peek());
+	double ce2 = HMM_and_HMMObservationSequence_getCrossEntropy (thee, os.peek());
 	if (ce2 == NUMundefined || ce2 == INFINITY) {
 		return ce2;
 	}
 	return ce - ce2;
 }
 
-/**************** HMM_Observation ******************************/
+/**************** HMMObservation ******************************/
 
-Thing_implement (HMM_Observation, Daata, 0);
+Thing_implement (HMMObservation, Daata, 0);
 
-void HMM_Observation_init (HMM_Observation me, const char32 *label, long numberOfComponents, long dimension, long storage) {
+void HMMObservation_init (HMMObservation me, const char32 *label, long numberOfComponents, long dimension, long storage) {
 	my label = Melder_dup (label);
 	my gm = GaussianMixture_create (numberOfComponents, dimension, storage);
 }
 
-autoHMM_Observation HMM_Observation_create (const char32 *label, long numberOfComponents, long dimension, long storage) {
+autoHMMObservation HMMObservation_create (const char32 *label, long numberOfComponents, long dimension, long storage) {
 	try {
-		autoHMM_Observation me = Thing_new (HMM_Observation);
-		HMM_Observation_init (me.peek(), label, numberOfComponents, dimension, storage);
+		autoHMMObservation me = Thing_new (HMMObservation);
+		HMMObservation_init (me.peek(), label, numberOfComponents, dimension, storage);
 		return me;
 	} catch (MelderError) {
-		Melder_throw (U"HMM_Observation not created.");
+		Melder_throw (U"HMMObservation not created.");
 	}
 }
 
@@ -197,35 +197,35 @@ long StringsIndex_getLongestSequence (StringsIndex me, long index, long *pos) {
 	return length;
 }
 
-/**************** HMM_State ******************************/
+/**************** HMMState ******************************/
 
-Thing_implement (HMM_State, Daata, 0);
+Thing_implement (HMMState, Daata, 0);
 
-void HMM_State_init (HMM_State me, const char32 *label) {
+void HMMState_init (HMMState me, const char32 *label) {
 	my label = Melder_dup (label);
 }
 
-autoHMM_State HMM_State_create (const char32 *label) {
+autoHMMState HMMState_create (const char32 *label) {
 	try {
-		autoHMM_State me = Thing_new (HMM_State);
-		HMM_State_init (me.peek(), label);
+		autoHMMState me = Thing_new (HMMState);
+		HMMState_init (me.peek(), label);
 		return me;
 	} catch (MelderError) {
-		Melder_throw (U"HMM_State not created.");
+		Melder_throw (U"HMMState not created.");
 	}
 }
 
-void HMM_State_setLabel (HMM_State me, char32 *label) {
+void HMMState_setLabel (HMMState me, char32 *label) {
 	Melder_free (my label);
 	my label = Melder_dup (label);
 }
 
-/**************** HMM_BaumWelch ******************************/
+/**************** HMMBaumWelch ******************************/
 
-Thing_implement (HMM_BaumWelch, Daata, 0);
+Thing_implement (HMMBaumWelch, Daata, 0);
 
-void structHMM_BaumWelch :: v_destroy () {
-	for (long it = 1; it <= numberOfTimes; it++) {
+void structHMMBaumWelch :: v_destroy () {
+	for (long it = 1; it <= capacity; it++) {
 		NUMmatrix_free (xi[it], 1, 1);
 	}
 	NUMvector_free (xi, 1);
@@ -233,11 +233,15 @@ void structHMM_BaumWelch :: v_destroy () {
 	NUMmatrix_free (beta, 1, 1);
 	NUMmatrix_free (alpha, 1, 1);
 	NUMmatrix_free (gamma, 1, 1);
+	NUMmatrix_free (aij_num, 0, 1);
+	NUMmatrix_free (aij_denom, 0, 1);
+	NUMmatrix_free (bik_num, 1, 1);
+	NUMmatrix_free (bik_denom, 1, 1);
 }
 
-autoHMM_BaumWelch HMM_BaumWelch_create (long nstates, long nsymbols, long capacity) {
+autoHMMBaumWelch HMMBaumWelch_create (long nstates, long nsymbols, long capacity) {
 	try {
-		autoHMM_BaumWelch me = Thing_new (HMM_BaumWelch);
+		autoHMMBaumWelch me = Thing_new (HMMBaumWelch);
 		my numberOfTimes = my capacity = capacity;
 		my numberOfStates = nstates;
 		my numberOfSymbols = nsymbols;
@@ -255,11 +259,11 @@ autoHMM_BaumWelch HMM_BaumWelch_create (long nstates, long nsymbols, long capaci
 		}
 		return me;
 	} catch (MelderError) {
-		Melder_throw (U"HMM_BaumWelch not created.");
+		Melder_throw (U"HMMBaumWelch not created.");
 	}
 }
 
-void HMM_BaumWelch_getGamma (HMM_BaumWelch me) {
+void HMMBaumWelch_getGamma (HMMBaumWelch me) {
 	for (long it = 1; it <= my numberOfTimes; it++) {
 		double sum = 0.0;
 		for (long is = 1; is <= my numberOfStates; is++) {
@@ -273,13 +277,13 @@ void HMM_BaumWelch_getGamma (HMM_BaumWelch me) {
 	}
 }
 
-/**************** HMM_Viterbi ******************************/
+/**************** HMMViterbi ******************************/
 
-Thing_implement (HMM_Viterbi, Daata, 0);
+Thing_implement (HMMViterbi, Daata, 0);
 
-autoHMM_Viterbi HMM_Viterbi_create (long nstates, long ntimes) {
+autoHMMViterbi HMMViterbi_create (long nstates, long ntimes) {
 	try {
-		autoHMM_Viterbi me = Thing_new (HMM_Viterbi);
+		autoHMMViterbi me = Thing_new (HMMViterbi);
 		my numberOfTimes = ntimes;
 		my numberOfStates = nstates;
 		my viterbi = NUMmatrix<double> (1, nstates, 1 , ntimes);
@@ -287,33 +291,33 @@ autoHMM_Viterbi HMM_Viterbi_create (long nstates, long ntimes) {
 		my path = NUMvector<long> (1, ntimes);
 		return me;
 	} catch (MelderError) {
-		Melder_throw (U"HMM_Viterbi not created.");
+		Melder_throw (U"HMMViterbi not created.");
 	}
 }
 
-/******************* HMM_ObservationSequence & HMM_StateSequence ***/
+/******************* HMMObservationSequence & HMMStateSequence ***/
 
-Thing_implement (HMM_ObservationSequence, Table, 0);
+Thing_implement (HMMObservationSequence, Table, 0);
 
-autoHMM_ObservationSequence HMM_ObservationSequence_create (long numberOfItems, long dataLength) {
+autoHMMObservationSequence HMMObservationSequence_create (long numberOfItems, long dataLength) {
 	try {
-		autoHMM_ObservationSequence me = Thing_new (HMM_ObservationSequence);
+		autoHMMObservationSequence me = Thing_new (HMMObservationSequence);
 		Table_initWithoutColumnNames (me.peek(), numberOfItems, dataLength + 1);
 		return me;
 	} catch (MelderError) {
-		Melder_throw (U"HMM_ObservationSequence not created.");
+		Melder_throw (U"HMMObservationSequence not created.");
 	}
 }
 
-long HMM_ObservationSequence_getNumberOfObservations (HMM_ObservationSequence me) {
+long HMMObservationSequence_getNumberOfObservations (HMMObservationSequence me) {
 	return my rows -> size;
 }
 
-void HMM_ObservationSequence_removeObservation (HMM_ObservationSequence me, long index) {
+void HMMObservationSequence_removeObservation (HMMObservationSequence me, long index) {
 	Table_removeRow ( (Table) me, index);
 }
 
-autoStrings HMM_ObservationSequence_to_Strings (HMM_ObservationSequence me) {
+autoStrings HMMObservationSequence_to_Strings (HMMObservationSequence me) {
 	try {
 		long numberOfStrings = my rows -> size;
 		autoStrings thee = Thing_new (Strings);
@@ -328,21 +332,21 @@ autoStrings HMM_ObservationSequence_to_Strings (HMM_ObservationSequence me) {
 	}
 }
 
-autoHMM_ObservationSequence Strings_to_HMM_ObservationSequence (Strings me) {
+autoHMMObservationSequence Strings_to_HMMObservationSequence (Strings me) {
 	try {
-		autoHMM_ObservationSequence thee = HMM_ObservationSequence_create (my numberOfStrings, 0);
+		autoHMMObservationSequence thee = HMMObservationSequence_create (my numberOfStrings, 0);
 		for (long i = 1; i <= my numberOfStrings; i++) {
 			Table_setStringValue ( (Table) thee.peek(), i, 1, my strings[i]);
 		}
 		return thee;
 	} catch (MelderError) {
-		Melder_throw (me, U": no HMM_ObservationSequence created.");
+		Melder_throw (me, U": no HMMObservationSequence created.");
 	}
 }
 
-autoStringsIndex HMM_ObservationSequence_to_StringsIndex (HMM_ObservationSequence me) {
+autoStringsIndex HMMObservationSequence_to_StringsIndex (HMMObservationSequence me) {
 	try {
-		autoStrings s = HMM_ObservationSequence_to_Strings (me);
+		autoStrings s = HMMObservationSequence_to_Strings (me);
 		autoStringsIndex thee = Strings_to_StringsIndex (s.peek());
 		return thee;
 	} catch (MelderError) {
@@ -350,29 +354,29 @@ autoStringsIndex HMM_ObservationSequence_to_StringsIndex (HMM_ObservationSequenc
 	}
 }
 
-long HMM_and_HMM_ObservationSequence_getLongestSequence (HMM me, HMM_ObservationSequence thee, long symbolNumber) {
-	autoStringsIndex si = HMM_and_HMM_ObservationSequence_to_StringsIndex (me, thee);
+long HMM_and_HMMObservationSequence_getLongestSequence (HMM me, HMMObservationSequence thee, long symbolNumber) {
+	autoStringsIndex si = HMM_and_HMMObservationSequence_to_StringsIndex (me, thee);
 	// TODO
 	(void) symbolNumber;
 	return 1;
 }
 
-Thing_implement (HMM_ObservationSequences, Collection, 0);
+Thing_implement (HMMObservationSequences, Collection, 0);
 
-autoHMM_ObservationSequences HMM_ObservationSequences_create () {
+autoHMMObservationSequences HMMObservationSequences_create () {
 	try {
-		autoHMM_ObservationSequences me = Thing_new (HMM_ObservationSequences);
-		Collection_init (me.peek(), classHMM_ObservationSequence, 1000);
+		autoHMMObservationSequences me = Thing_new (HMMObservationSequences);
+		Collection_init (me.peek(), classHMMObservationSequence, 1000);
 		return me;
 	} catch (MelderError) {
-		Melder_throw (U"HMM_ObservationSequences not created.");
+		Melder_throw (U"HMMObservationSequences not created.");
 	}
 }
 
-long HMM_ObservationSequences_getLongestSequence (HMM_ObservationSequences me) {
+long HMMObservationSequences_getLongestSequence (HMMObservationSequences me) {
 	long longest = 0;
 	for (long i = 1; i <= my size; i++) {
-		HMM_ObservationSequence thee = (HMM_ObservationSequence) my item[i];
+		HMMObservationSequence thee = (HMMObservationSequence) my item[i];
 		if (thy rows -> size > longest) {
 			longest = thy rows -> size;
 		}
@@ -380,19 +384,19 @@ long HMM_ObservationSequences_getLongestSequence (HMM_ObservationSequences me) {
 	return longest;
 }
 
-Thing_implement (HMM_StateSequence, Strings, 0);
+Thing_implement (HMMStateSequence, Strings, 0);
 
-autoHMM_StateSequence HMM_StateSequence_create (long numberOfItems) {
+autoHMMStateSequence HMMStateSequence_create (long numberOfItems) {
 	try {
-		autoHMM_StateSequence me = Thing_new (HMM_StateSequence);
+		autoHMMStateSequence me = Thing_new (HMMStateSequence);
 		my strings = NUMvector<char32 *> (1, numberOfItems);
 		return me;
 	} catch (MelderError) {
-		Melder_throw (U"HMM_StateSequence not created.");
+		Melder_throw (U"HMMStateSequence not created.");
 	}
 }
 
-autoStrings HMM_StateSequence_to_Strings (HMM_StateSequence me) {
+autoStrings HMMStateSequence_to_Strings (HMMStateSequence me) {
 	try {
 		autoStrings thee = Thing_new (Strings);
 		my structStrings :: v_copy (thee.peek());
@@ -411,12 +415,12 @@ void structHMM :: v_info () {
 	structDaata :: v_info ();
 	MelderInfo_writeLine (U"Number of states: ", numberOfStates);
 	for (long i = 1; i <= numberOfStates; i++) {
-		HMM_State hmms = (HMM_State) states -> item[i];
+		HMMState hmms = (HMMState) states -> item[i];
 		MelderInfo_writeLine (U"  ", hmms -> label);
 	}
 	MelderInfo_writeLine (U"Number of symbols: ", numberOfObservationSymbols);
 	for (long i = 1; i <= numberOfObservationSymbols; i++) {
-		HMM_Observation hmms = (HMM_Observation) observationSymbols -> item[i];
+		HMMObservation hmms = (HMMObservation) observationSymbols -> item[i];
 		MelderInfo_writeLine (U"  ", hmms -> label);
 	}
 }
@@ -449,7 +453,7 @@ autoHMM HMM_create (int leftToRight, long numberOfStates, long numberOfObservati
 
 void HMM_setDefaultStates (HMM me) {
 	for (long i = 1; i <= my numberOfStates; i++) {
-		autoHMM_State hmms = HMM_State_create (Melder_cat (U"S", i));
+		autoHMMState hmms = HMMState_create (Melder_cat (U"S", i));
 		HMM_addState (me, hmms.transfer());
 	}
 }
@@ -472,11 +476,11 @@ autoHMM HMM_createContinuousModel (int leftToRight, long numberOfStates, long nu
 		my componentDimension = componentDimension;
 		my componentStorage = componentStorage;
 		for (long i = 1; i <= numberOfStates; i++) {
-			autoHMM_State state = HMM_State_create (Melder_cat (U"S", i));
+			autoHMMState state = HMMState_create (Melder_cat (U"S", i));
 			HMM_addState (me.peek(), state.transfer());
 		}
 		for (long j = 1; j <= numberOfObservationSymbols; j++) {
-			autoHMM_Observation obs = HMM_Observation_create (Melder_cat (U"s", j), numberOfMixtureComponentsPerSymbol, componentDimension, componentStorage);
+			autoHMMObservation obs = HMMObservation_create (Melder_cat (U"s", j), numberOfMixtureComponentsPerSymbol, componentDimension, componentStorage);
 			HMM_addObservation (me.peek(), obs.transfer());
 		}
 		HMM_setDefaultTransitionProbs (me.peek());
@@ -499,7 +503,7 @@ autoHMM HMM_createSimple (int leftToRight, const char32 *states_string, const ch
 		long numberOfObservationSymbols = Melder_countTokens (symbols_string);
 
 		if (numberOfStates == 0 and numberOfObservationSymbols == 0) {
-			Melder_throw (U"No states and symbols.");
+			Melder_throw (U"No states and no symbols given.");
 		}
 		if (numberOfStates > 0) {
 			if (numberOfObservationSymbols <= 0) {
@@ -516,11 +520,11 @@ autoHMM HMM_createSimple (int leftToRight, const char32 *states_string, const ch
 		HMM_init (me.peek(), numberOfStates, numberOfObservationSymbols, leftToRight);
 
 		for (char32 *token = Melder_firstToken (states); token != 0; token = Melder_nextToken ()) {
-			autoHMM_State state = HMM_State_create (token);
+			autoHMMState state = HMMState_create (token);
 			HMM_addState (me.peek(), state.transfer());
 		}
 		for (char32 *token = Melder_firstToken (symbols); token != nullptr; token = Melder_nextToken ()) {
-			autoHMM_Observation symbol = HMM_Observation_create (token, 0, 0, 0);
+			autoHMMObservation symbol = HMMObservation_create (token, 0, 0, 0);
 			HMM_addObservation (me.peek(), symbol.transfer());
 		}
 		HMM_setDefaultTransitionProbs (me.peek());
@@ -535,7 +539,7 @@ autoHMM HMM_createSimple (int leftToRight, const char32 *states_string, const ch
 void HMM_setDefaultObservations (HMM me) {
 	const char32 *def = my notHidden ? U"S" : U"s";
 	for (long i = 1; i <= my numberOfObservationSymbols; i++) {
-		autoHMM_Observation hmms = HMM_Observation_create (Melder_cat (def, i), 0, 0, 0);
+		autoHMMObservation hmms = HMMObservation_create (Melder_cat (def, i), 0, 0, 0);
 		HMM_addObservation (me, hmms.transfer());
 	}
 }
@@ -570,7 +574,7 @@ void HMM_setDefaultEmissionProbs (HMM me) {
 void HMM_setDefaultMixingProbabilities (HMM me) {
 	double mp = 1.0 / my numberOfMixtureComponents;
 	for (long is = 1; is <= my numberOfObservationSymbols; is++) {
-		HMM_Observation hmmo = (HMM_Observation) my observationSymbols -> item[is];
+		HMMObservation hmmo = (HMMObservation) my observationSymbols -> item[is];
 		for (long im = 1; im <= my numberOfMixtureComponents; im++) {
 			hmmo -> gm -> mixingProbabilities[im] = mp;
 		}
@@ -593,7 +597,7 @@ void HMM_setTransitionProbabilities (HMM me, long state_number, char32 *state_pr
 		if (state_number > my states -> size) {
 			Melder_throw (U"State number too large.");
 		}
-		autoNUMvector<double> p (NUMwstring_to_probs (state_probs, my numberOfStates + 1), 1);
+		autoNUMvector<double> p (NUMwstring_to_probs (state_probs, my numberOfStates), 1);
 		for (long i = 1; i <= my numberOfStates + 1; i++) {
 			my transitionProbs[state_number][i] = p[i];
 		}
@@ -621,7 +625,7 @@ void HMM_setEmissionProbabilities (HMM me, long state_number, char32 *emission_p
 }
 
 void HMM_addObservation (HMM me, thou) {
-	thouart (HMM_Observation);
+	thouart (HMMObservation);
 	long ns = my observationSymbols -> size + 1;
 	if (ns > my numberOfObservationSymbols) {
 		Melder_throw (U"Observation list is full.");
@@ -630,7 +634,7 @@ void HMM_addObservation (HMM me, thou) {
 }
 
 void HMM_addState (HMM me, thou) {
-	thouart (HMM_State);
+	thouart (HMMState);
 	long ns = my states -> size + 1;
 	if (ns > my numberOfStates) {
 		Melder_throw (U"States list is full.");
@@ -642,7 +646,7 @@ autoTableOfReal HMM_extractTransitionProbabilities (HMM me) {
 	try {
 		autoTableOfReal thee = TableOfReal_create (my numberOfStates + 1, my numberOfStates + 1);
 		for (long is = 1; is <= my numberOfStates; is++) {
-			HMM_State hmms = (HMM_State) my states -> item[is];
+			HMMState hmms = (HMMState) my states -> item[is];
 			TableOfReal_setRowLabel (thee.peek(), is + 1, hmms -> label);
 			TableOfReal_setColumnLabel (thee.peek(), is, hmms -> label);
 			for (long js = 1; js <= my numberOfStates; js++) {
@@ -665,11 +669,11 @@ autoTableOfReal HMM_extractEmissionProbabilities (HMM me) {
 	try {
 		autoTableOfReal thee = TableOfReal_create (my numberOfStates, my numberOfObservationSymbols);
 		for (long js = 1; js <= my numberOfObservationSymbols; js++) {
-			HMM_Observation hmms = (HMM_Observation) my observationSymbols -> item[js];
+			HMMObservation hmms = (HMMObservation) my observationSymbols -> item[js];
 			TableOfReal_setColumnLabel (thee.peek(), js, hmms -> label);
 		}
 		for (long is = 1; is <= my numberOfStates; is++) {
-			HMM_State hmms = (HMM_State) my states -> item[is];
+			HMMState hmms = (HMMState) my states -> item[is];
 			TableOfReal_setRowLabel (thee.peek(), is, hmms -> label);
 			for (long js = 1; js <= my numberOfObservationSymbols; js++) {
 				thy data[is][js] = my emissionProbs[is][js];
@@ -707,12 +711,12 @@ double HMM_and_HMM_getCrossEntropy (HMM me, HMM thee, long observationLength, in
 	return (ce1 + ce2) / 2.0;
 }
 
-double HMM_and_HMM_and_HMM_ObservationSequence_getCrossEntropy (HMM me, HMM thee, HMM_ObservationSequence him) {
-	double ce1 = HMM_and_HMM_ObservationSequence_getCrossEntropy (me, him);
+double HMM_and_HMM_and_HMMObservationSequence_getCrossEntropy (HMM me, HMM thee, HMMObservationSequence him) {
+	double ce1 = HMM_and_HMMObservationSequence_getCrossEntropy (me, him);
 	if (ce1 == NUMundefined || ce1 == INFINITY) {
 		return ce1;
 	}
-	double ce2 = HMM_and_HMM_ObservationSequence_getCrossEntropy (thee, him);
+	double ce2 = HMM_and_HMMObservationSequence_getCrossEntropy (thee, him);
 	if (ce2 == NUMundefined || ce2 == INFINITY) {
 		return ce2;
 	}
@@ -744,7 +748,7 @@ void HMM_draw (HMM me, Graphics g, int garnish) {
 	const char32 *widest_label = U"";
 	double max_width = 0.0;
 	for (long is = 1; is <= my numberOfStates; is++) {
-		HMM_State hmms = (HMM_State) my states -> item[is];
+		HMMState hmms = (HMMState) my states -> item[is];
 		double w = ( hmms -> label == nullptr ? 0.0 : Graphics_textWidth (g, hmms -> label) );
 		if (w > max_width) {
 			widest_label = hmms -> label;
@@ -760,7 +764,7 @@ void HMM_draw (HMM me, Graphics g, int garnish) {
 	Graphics_setFontSize (g, new_fontSize);
 	Graphics_setTextAlignment (g, Graphics_CENTRE, Graphics_HALF);
 	for (long is = 1; is <= my numberOfStates; is++) {
-		HMM_State hmms = (HMM_State) my states -> item[is];
+		HMMState hmms = (HMMState) my states -> item[is];
 		Graphics_circle (g, xs[is], ys[is], rstate);
 		Graphics_text (g, xs[is], ys[is], hmms -> label);
 	}
@@ -795,14 +799,14 @@ void HMM_unExpandPCA (HMM me) {
 		return;    // nothing to do
 	}
 	for (long is = 1; is <= my numberOfObservationSymbols; is++) {
-		HMM_Observation s = (HMM_Observation) my observationSymbols -> item[is];
-		GaussianMixture_unExpandPCA (s -> gm);
+		HMMObservation s = (HMMObservation) my observationSymbols -> item[is];
+		GaussianMixture_unExpandPCA (s -> gm.peek());
 	}
 }
 
-autoHMM_ObservationSequence HMM_to_HMM_ObservationSequence (HMM me, long startState, long numberOfItems) {
+autoHMMObservationSequence HMM_to_HMMObservationSequence (HMM me, long startState, long numberOfItems) {
 	try {
-		autoHMM_ObservationSequence thee = HMM_ObservationSequence_create (numberOfItems, my componentDimension);
+		autoHMMObservationSequence thee = HMMObservationSequence_create (numberOfItems, my componentDimension);
 		autoNUMvector<double> obs;
 		autoNUMvector<double> buf;
 		if (my componentDimension > 0) {
@@ -814,11 +818,11 @@ autoHMM_ObservationSequence HMM_to_HMM_ObservationSequence (HMM me, long startSt
 			// Emit a symbol from istate
 
 			long isymbol = NUMgetIndexFromProbability (my emissionProbs[istate], my numberOfObservationSymbols, NUMrandomUniform (0.0, 1.0));
-			HMM_Observation s = (HMM_Observation) my observationSymbols -> item[isymbol];
+			HMMObservation s = (HMMObservation) my observationSymbols -> item[isymbol];
 
 			if (my componentDimension > 0) {
 				char32 *name;
-				GaussianMixture_generateOneVector (s -> gm, obs.peek(), &name, buf.peek());
+				GaussianMixture_generateOneVector (s -> gm.peek(), obs.peek(), &name, buf.peek());
 				for (long j = 1; j <= my componentDimension; j++) {
 					Table_setNumericValue ( (Table) thee.peek(), i, 1 + j, obs[j]);
 				}
@@ -831,7 +835,7 @@ autoHMM_ObservationSequence HMM_to_HMM_ObservationSequence (HMM me, long startSt
 			istate = NUMgetIndexFromProbability (my transitionProbs[istate], my numberOfStates + 1, NUMrandomUniform (0.0, 1.0));
 			if (istate == my numberOfStates + 1) { // final state
 				for (long j = numberOfItems; j > i; j--) {
-					HMM_ObservationSequence_removeObservation (thee.peek(), j);
+					HMMObservationSequence_removeObservation (thee.peek(), j);
 				}
 				break;
 			}
@@ -840,31 +844,31 @@ autoHMM_ObservationSequence HMM_to_HMM_ObservationSequence (HMM me, long startSt
 		return thee;
 	} catch (MelderError) {
 		HMM_unExpandPCA (me);
-		Melder_throw (me, U":no HMM_ObservationSequence created.");
+		Melder_throw (me, U":no HMMObservationSequence created.");
 	}
 }
 
-autoHMM_BaumWelch HMM_forward (HMM me, long *obs, long nt) {
+autoHMMBaumWelch HMM_forward (HMM me, long *obs, long nt) {
 	try {
-		autoHMM_BaumWelch thee = HMM_BaumWelch_create (my numberOfStates, my numberOfObservationSymbols, nt);
-		HMM_and_HMM_BaumWelch_forward (me, thee.peek(), obs);
+		autoHMMBaumWelch thee = HMMBaumWelch_create (my numberOfStates, my numberOfObservationSymbols, nt);
+		HMM_and_HMMBaumWelch_forward (me, thee.peek(), obs);
 		return thee;
 	} catch (MelderError) {
-		Melder_throw (me, U": no HMM_BaumWelch created.");
+		Melder_throw (me, U": no HMMBaumWelch created.");
 	}
 }
 
-autoHMM_Viterbi HMM_to_HMM_Viterbi (HMM me, long *obs, long ntimes) {
+autoHMMViterbi HMM_to_HMMViterbi (HMM me, long *obs, long ntimes) {
 	try {
-		autoHMM_Viterbi thee = HMM_Viterbi_create (my numberOfStates, ntimes);
-		HMM_and_HMM_Viterbi_decode (me, thee.peek(), obs);
+		autoHMMViterbi thee = HMMViterbi_create (my numberOfStates, ntimes);
+		HMM_and_HMMViterbi_decode (me, thee.peek(), obs);
 		return thee;
 	} catch (MelderError) {
-		Melder_throw (me, U": no HMM_Viterbi created.");
+		Melder_throw (me, U": no HMMViterbi created.");
 	}
 }
 
-void HMM_BaumWelch_reInit (HMM_BaumWelch me) {
+void HMMBaumWelch_reInit (HMMBaumWelch me) {
 	my totalNumberOfSequences = 0;
 	my lnProb = 0;
 
@@ -888,21 +892,22 @@ void HMM_BaumWelch_reInit (HMM_BaumWelch me) {
 	}
 }
 
-void HMM_and_HMM_ObservationSequences_learn (HMM me, HMM_ObservationSequences thee, double delta_lnp, double minProb) {
+void HMM_and_HMMObservationSequences_learn (HMM me, HMMObservationSequences thee, double delta_lnp, double minProb, int info) {
 	try {
 		// act as if all observation sequences are in memory
-		long capacity = HMM_ObservationSequences_getLongestSequence (thee);
-		autoHMM_BaumWelch bw = HMM_BaumWelch_create (my numberOfStates, my numberOfObservationSymbols, capacity);
+		long capacity = HMMObservationSequences_getLongestSequence (thee);
+		autoHMMBaumWelch bw = HMMBaumWelch_create (my numberOfStates, my numberOfObservationSymbols, capacity);
 		bw -> minProb = minProb;
-		MelderInfo_open ();
+		if (info) {
+			MelderInfo_open (); 
+		}
 		long iter = 0; double lnp;
 		do {
 			lnp = bw -> lnProb;
-			HMM_BaumWelch_reInit (bw.peek());
+			HMMBaumWelch_reInit (bw.peek());
 			for (long ios = 1; ios <= thy size; ios++) {
-				MelderInfo_writeLine (U"Observation sequence: ", ios);
-				HMM_ObservationSequence hmm_os = (HMM_ObservationSequence) thy item[ios];
-				autoStringsIndex si = HMM_and_HMM_ObservationSequence_to_StringsIndex (me, hmm_os);
+				HMMObservationSequence hmm_os = (HMMObservationSequence) thy item[ios];
+				autoStringsIndex si = HMM_and_HMMObservationSequence_to_StringsIndex (me, hmm_os); // TODO outside the loop or more efficiently
 				long *obs = si -> classIndex, nobs = si -> numberOfElements; // convenience
 
 				// Interpretation of unknowns: end of sequence
@@ -922,25 +927,28 @@ void HMM_and_HMM_ObservationSequences_learn (HMM me, HMM_ObservationSequences th
 					iend --;
 					bw -> numberOfTimes = iend - istart + 1;
 					(bw -> totalNumberOfSequences) ++;
-					MelderInfo_writeLine (U"  sub observation: ", bw -> totalNumberOfSequences);
-					HMM_and_HMM_BaumWelch_forward (me, bw.peek(), obs + istart - 1); // get new alphas
-					HMM_and_HMM_BaumWelch_backward (me, bw.peek(), obs + istart - 1); // get new betas
-					HMM_BaumWelch_getGamma (bw.peek());
-					HMM_and_HMM_BaumWelch_getXi (me, bw.peek(), obs + istart - 1);
-					HMM_and_HMM_BaumWelch_addEstimate (me, bw.peek(), obs + istart - 1);
+					HMM_and_HMMBaumWelch_forward (me, bw.peek(), obs + istart - 1); // get new alphas
+					HMM_and_HMMBaumWelch_backward (me, bw.peek(), obs + istart - 1); // get new betas
+					HMMBaumWelch_getGamma (bw.peek());
+					HMM_and_HMMBaumWelch_getXi (me, bw.peek(), obs + istart - 1);
+					HMM_and_HMMBaumWelch_addEstimate (me, bw.peek(), obs + istart - 1);
 					istart = iend + 1;
 				}
 			}
-			// we have processed all observation sequences, now it time to estimate new probabilities.
+			// we have processed all observation sequences, now it is time to estimate new probabilities.
 			iter++;
-			HMM_and_HMM_BaumWelch_reestimate (me, bw.peek());
-			MelderInfo_writeLine (U"Iteration: ", iter, U" ln(prob): ", bw -> lnProb);
-		} while (fabs ( (lnp - bw -> lnProb) / bw -> lnProb) > delta_lnp);
-
-		MelderInfo_writeLine (U"******** Learning summary *********");
-		MelderInfo_writeLine (U"  Processed ", thy size, U" sequences,");
-		MelderInfo_writeLine (U"  consisting of ", bw -> totalNumberOfSequences, U" observation sequences.");
-		MelderInfo_writeLine (U"  Longest observation sequence had ", capacity, U" items");
+			HMM_and_HMMBaumWelch_reestimate (me, bw.peek());
+			if (info) { 
+				MelderInfo_writeLine (U"Iteration: ", iter, U" ln(prob): ", bw -> lnProb); 
+			}
+		} while (fabs ((lnp - bw -> lnProb) / bw -> lnProb) > delta_lnp);
+		if (info) {
+			MelderInfo_writeLine (U"******** Learning summary *********");
+			MelderInfo_writeLine (U"  Processed ", thy size, U" sequences,");
+			MelderInfo_writeLine (U"  consisting of ", bw -> totalNumberOfSequences, U" observation sequences.");
+			MelderInfo_writeLine (U"  Longest observation sequence had ", capacity, U" items");
+			MelderInfo_close();
+		}
 	} catch (MelderError) {
 		Melder_throw (me, U" & ", thee, U": not learned.");
 	}
@@ -948,9 +956,9 @@ void HMM_and_HMM_ObservationSequences_learn (HMM me, HMM_ObservationSequences th
 
 
 // xc1 < xc2
-void HMM_and_HMM_StateSequence_drawTrellis (HMM me, HMM_StateSequence thee, Graphics g, int connect, int garnish) {
+void HMM_and_HMMStateSequence_drawTrellis (HMM me, HMMStateSequence thee, Graphics g, int connect, int garnish) {
 	long numberOfTimes = thy numberOfStrings;
-	autoStringsIndex si = HMM_and_HMM_StateSequence_to_StringsIndex (me, thee);
+	autoStringsIndex si = HMM_and_HMMStateSequence_to_StringsIndex (me, thee);
 	double xmin = 0.0, xmax = numberOfTimes + 1.0, ymin = 0.5, ymax = my numberOfStates + 0.5;
 
 	Graphics_setInner (g);
@@ -986,7 +994,7 @@ void HMM_and_HMM_StateSequence_drawTrellis (HMM me, HMM_StateSequence thee, Grap
 	if (garnish) {
 		Graphics_drawInnerBox (g);
 		for (long js = 1; js <= my numberOfStates; js++) {
-			HMM_State hmms = (HMM_State) my states -> item[js];
+			HMMState hmms = (HMMState) my states -> item[js];
 			Graphics_markLeft (g, js, false, false, false, hmms -> label);
 		}
 		Graphics_marksBottomEvery (g, 1.0, 1.0, true, true, false);
@@ -1148,7 +1156,7 @@ void HMM_drawForwardAndBackwardProbabilitiesIllustration (Graphics g, bool garni
 	}
 }
 
-void HMM_and_HMM_BaumWelch_getXi (HMM me, HMM_BaumWelch thee, long *obs) {
+void HMM_and_HMMBaumWelch_getXi (HMM me, HMMBaumWelch thee, long *obs) {
 
 	for (long it = 1; it <= thy numberOfTimes - 1; it++) {
 		double sum = 0.0;
@@ -1167,7 +1175,7 @@ void HMM_and_HMM_BaumWelch_getXi (HMM me, HMM_BaumWelch thee, long *obs) {
 	}
 }
 
-void HMM_and_HMM_BaumWelch_addEstimate (HMM me, HMM_BaumWelch thee, long *obs) {
+void HMM_and_HMMBaumWelch_addEstimate (HMM me, HMMBaumWelch thee, long *obs) {
 	for (long is = 1; is <= my numberOfStates; is++) {
 		// only for valid start states with p > 0
 		if (my transitionProbs[0][is] > 0.0) {
@@ -1222,7 +1230,7 @@ void HMM_and_HMM_BaumWelch_addEstimate (HMM me, HMM_BaumWelch thee, long *obs) {
 	}
 }
 
-void HMM_and_HMM_BaumWelch_reestimate (HMM me, HMM_BaumWelch thee) {
+void HMM_and_HMMBaumWelch_reestimate (HMM me, HMMBaumWelch thee) {
 	double p;
 	/*
 		If we only have a couple of training sequences and they all happen to start with the same symbol,
@@ -1263,7 +1271,7 @@ void HMM_and_HMM_BaumWelch_reestimate (HMM me, HMM_BaumWelch thee) {
 	}
 }
 
-void HMM_and_HMM_BaumWelch_forward (HMM me, HMM_BaumWelch thee, long *obs) {
+void HMM_and_HMMBaumWelch_forward (HMM me, HMMBaumWelch thee, long *obs) {
 	// initialise at t = 1 & scale
 	thy scale[1] = 0.0;
 	for (long js = 1; js <= my numberOfStates; js++) {
@@ -1296,7 +1304,7 @@ void HMM_and_HMM_BaumWelch_forward (HMM me, HMM_BaumWelch thee, long *obs) {
 	}
 }
 
-void HMM_and_HMM_BaumWelch_backward (HMM me, HMM_BaumWelch thee, long *obs) {
+void HMM_and_HMMBaumWelch_backward (HMM me, HMMBaumWelch thee, long *obs) {
 	for (long is = 1; is <= my numberOfStates; is++) {
 		thy beta[is][thy numberOfTimes] = 1.0 / thy scale[thy numberOfTimes];
 	}
@@ -1314,7 +1322,7 @@ void HMM_and_HMM_BaumWelch_backward (HMM me, HMM_BaumWelch thee, long *obs) {
 /*************************** HMM decoding ***********************************/
 
 // precondition: valid symbols, i.e. 1 <= o[i] <= my numberOfSymbols for i=1..nt
-void HMM_and_HMM_Viterbi_decode (HMM me, HMM_Viterbi thee, long *obs) {
+void HMM_and_HMMViterbi_decode (HMM me, HMMViterbi thee, long *obs) {
 	long ntimes = thy numberOfTimes;
 	// initialisation
 	for (long is = 1; is <= my numberOfStates; is++) {
@@ -1350,9 +1358,9 @@ void HMM_and_HMM_Viterbi_decode (HMM me, HMM_Viterbi thee, long *obs) {
 	}
 }
 
-autoHMM_StateSequence HMM_and_HMM_ObservationSequence_to_HMM_StateSequence (HMM me, HMM_ObservationSequence thee) {
+autoHMMStateSequence HMM_and_HMMObservationSequence_to_HMMStateSequence (HMM me, HMMObservationSequence thee) {
 	try {
-		autoStringsIndex si = HMM_and_HMM_ObservationSequence_to_StringsIndex (me, thee);
+		autoStringsIndex si = HMM_and_HMMObservationSequence_to_StringsIndex (me, thee);
 		long *obs = si -> classIndex; // convenience
 		long numberOfUnknowns = StringsIndex_countItems (si.peek(), 0);
 
@@ -1362,22 +1370,22 @@ autoHMM_StateSequence HMM_and_HMM_ObservationSequence_to_HMM_StateSequence (HMM
 
 
 		long numberOfTimes = thy rows -> size;
-		autoHMM_Viterbi v = HMM_to_HMM_Viterbi (me, obs, numberOfTimes);
-		autoHMM_StateSequence him = HMM_StateSequence_create (numberOfTimes);
+		autoHMMViterbi v = HMM_to_HMMViterbi (me, obs, numberOfTimes);
+		autoHMMStateSequence him = HMMStateSequence_create (numberOfTimes);
 		// trace the path and get states
 		for (long it = 1; it <= numberOfTimes; it++) {
-			HMM_State hmms = (HMM_State) my states -> item[ v -> path[it] ];
+			HMMState hmms = (HMMState) my states -> item[ v -> path[it] ];
 			his strings [it] = Melder_dup (hmms -> label);
 			his numberOfStrings ++;
 		}
 		return him;
 	} catch (MelderError) {
-		Melder_throw (me, U": no HMM_StateSequence created.");
+		Melder_throw (me, U": no HMMStateSequence created.");
 	}
 }
 
-double HMM_and_HMM_StateSequence_getProbability (HMM me, HMM_StateSequence thee) {
-	autoStringsIndex si = HMM_and_HMM_StateSequence_to_StringsIndex (me, thee);
+double HMM_and_HMMStateSequence_getProbability (HMM me, HMMStateSequence thee) {
+	autoStringsIndex si = HMM_and_HMMStateSequence_to_StringsIndex (me, thee);
 	long numberOfUnknowns = StringsIndex_countItems (si.peek(), 0);
 	long *index = si -> classIndex;
 
@@ -1500,8 +1508,8 @@ double HMM_getProbabilityOfObservations (HMM me, long *obs, long numberOfTimes)
 	return lnp;
 }
 
-double HMM_and_HMM_ObservationSequence_getProbability (HMM me, HMM_ObservationSequence thee) {
-	autoStringsIndex si = HMM_and_HMM_ObservationSequence_to_StringsIndex (me, thee);
+double HMM_and_HMMObservationSequence_getProbability (HMM me, HMMObservationSequence thee) {
+	autoStringsIndex si = HMM_and_HMMObservationSequence_to_StringsIndex (me, thee);
 	long *index = si -> classIndex;
 	long numberOfUnknowns = StringsIndex_countItems (si.peek(), 0);
 	if (numberOfUnknowns > 0) {
@@ -1510,21 +1518,21 @@ double HMM_and_HMM_ObservationSequence_getProbability (HMM me, HMM_ObservationSe
 	return HMM_getProbabilityOfObservations (me, index, thy rows -> size);
 }
 
-double HMM_and_HMM_ObservationSequence_getCrossEntropy (HMM me, HMM_ObservationSequence thee) {
-	double lnp = HMM_and_HMM_ObservationSequence_getProbability (me, thee);
+double HMM_and_HMMObservationSequence_getCrossEntropy (HMM me, HMMObservationSequence thee) {
+	double lnp = HMM_and_HMMObservationSequence_getProbability (me, thee);
 	return lnp == NUMundefined ? NUMundefined : (lnp == -INFINITY ? INFINITY :
-	        -lnp / (NUMln10 * HMM_ObservationSequence_getNumberOfObservations (thee)));
+	        -lnp / (NUMln10 * HMMObservationSequence_getNumberOfObservations (thee)));
 }
 
-double HMM_and_HMM_ObservationSequence_getPerplexity (HMM me, HMM_ObservationSequence thee) {
-	double ce = HMM_and_HMM_ObservationSequence_getCrossEntropy (me, thee);
+double HMM_and_HMMObservationSequence_getPerplexity (HMM me, HMMObservationSequence thee) {
+	double ce = HMM_and_HMMObservationSequence_getCrossEntropy (me, thee);
 	return ce == NUMundefined ? NUMundefined : (ce == INFINITY ? INFINITY : pow (2, ce));
 }
 
-autoHMM HMM_createFromHMM_ObservationSequence (HMM_ObservationSequence me, long numberOfStates, int leftToRight) {
+autoHMM HMM_createFromHMMObservationSequence (HMMObservationSequence me, long numberOfStates, int leftToRight) {
 	try {
 		autoHMM thee = Thing_new (HMM);
-		autoStrings s = HMM_ObservationSequence_to_Strings (me);
+		autoStrings s = HMMObservationSequence_to_Strings (me);
 		autoDistributions d = Strings_to_Distributions (s.peek());
 
 		long numberOfObservationSymbols = d -> numberOfRows;
@@ -1535,10 +1543,10 @@ autoHMM HMM_createFromHMM_ObservationSequence (HMM_ObservationSequence me, long
 
 		for (long i = 1; i <= numberOfObservationSymbols; i++) {
 			const char32 *label = d -> rowLabels[i];
-			autoHMM_Observation hmmo = HMM_Observation_create (label, 0, 0, 0);
+			autoHMMObservation hmmo = HMMObservation_create (label, 0, 0, 0);
 			HMM_addObservation (thee.peek(), hmmo.transfer());
 			if (thy notHidden) {
-				autoHMM_State hmms = HMM_State_create (label);
+				autoHMMState hmms = HMMState_create (label);
 				HMM_addState (thee.peek(), hmms.transfer());
 			}
 		}
@@ -1554,9 +1562,9 @@ autoHMM HMM_createFromHMM_ObservationSequence (HMM_ObservationSequence me, long
 	}
 }
 
-autoTableOfReal HMM_ObservationSequence_to_TableOfReal_transitions (HMM_ObservationSequence me, int probabilities) {
+autoTableOfReal HMMObservationSequence_to_TableOfReal_transitions (HMMObservationSequence me, int probabilities) {
 	try {
-		autoStrings thee = HMM_ObservationSequence_to_Strings (me);
+		autoStrings thee = HMMObservationSequence_to_Strings (me);
 		autoTableOfReal him = Strings_to_TableOfReal_transitions (thee.peek(), probabilities);
 		return him;
 	} catch (MelderError) {
@@ -1564,16 +1572,16 @@ autoTableOfReal HMM_ObservationSequence_to_TableOfReal_transitions (HMM_Observat
 	}
 }
 
-autoStringsIndex HMM_and_HMM_ObservationSequence_to_StringsIndex (HMM me, HMM_ObservationSequence thee) {
+autoStringsIndex HMM_and_HMMObservationSequence_to_StringsIndex (HMM me, HMMObservationSequence thee) {
 	try {
 		autoStrings classes = Thing_new (Strings);
 		classes -> strings = NUMvector<char32 *> (1, my numberOfObservationSymbols);
 		for (long is = 1; is <= my numberOfObservationSymbols; is++) {
-			HMM_Observation hmmo = (HMM_Observation) my observationSymbols -> item[is];
+			HMMObservation hmmo = (HMMObservation) my observationSymbols -> item[is];
 			classes -> strings[is] = Melder_dup (hmmo -> label);
 			(classes -> numberOfStrings) ++;
 		}
-		autoStrings obs = HMM_ObservationSequence_to_Strings (thee);
+		autoStrings obs = HMMObservationSequence_to_Strings (thee);
 		autoStringsIndex him = Stringses_to_StringsIndex (obs.peek(), classes.peek());
 		return him;
 	} catch (MelderError) {
@@ -1581,16 +1589,16 @@ autoStringsIndex HMM_and_HMM_ObservationSequence_to_StringsIndex (HMM me, HMM_Ob
 	}
 }
 
-autoStringsIndex HMM_and_HMM_StateSequence_to_StringsIndex (HMM me, HMM_StateSequence thee) {
+autoStringsIndex HMM_and_HMMStateSequence_to_StringsIndex (HMM me, HMMStateSequence thee) {
 	try {
 		autoStrings classes = Thing_new (Strings);
 		classes -> strings = NUMvector<char32 *> (1, my numberOfObservationSymbols);
 		for (long is = 1; is <= my numberOfStates; is++) {
-			HMM_State hmms = (HMM_State) my states -> item[is];
+			HMMState hmms = (HMMState) my states -> item[is];
 			classes -> strings[is] = Melder_dup (hmms -> label);
 			(classes -> numberOfStrings) ++;
 		}
-		autoStrings sts = HMM_StateSequence_to_Strings (thee);
+		autoStrings sts = HMMStateSequence_to_Strings (thee);
 		autoStringsIndex him = Stringses_to_StringsIndex (sts.peek(), classes.peek());
 		return him;
 	} catch (MelderError) {
@@ -1598,23 +1606,23 @@ autoStringsIndex HMM_and_HMM_StateSequence_to_StringsIndex (HMM me, HMM_StateSeq
 	}
 }
 
-autoTableOfReal HMM_and_HMM_ObservationSequence_to_TableOfReal_transitions (HMM me, HMM_ObservationSequence thee, int probabilities) {
+autoTableOfReal HMM_and_HMMObservationSequence_to_TableOfReal_transitions (HMM me, HMMObservationSequence thee, int probabilities) {
 	try {
-		autoStringsIndex si = HMM_and_HMM_ObservationSequence_to_StringsIndex (me, thee);
+		autoStringsIndex si = HMM_and_HMMObservationSequence_to_StringsIndex (me, thee);
 		autoTableOfReal him = StringsIndex_to_TableOfReal_transitions (si.peek(), probabilities);
 		return him;
 	} catch (MelderError) {
-		Melder_throw (me, U": no transition table created for HMM_ObservationSequence.");
+		Melder_throw (me, U": no transition table created for HMMObservationSequence.");
 	}
 }
 
-autoTableOfReal HMM_and_HMM_StateSequence_to_TableOfReal_transitions (HMM me, HMM_StateSequence thee, int probabilities) {
+autoTableOfReal HMM_and_HMMStateSequence_to_TableOfReal_transitions (HMM me, HMMStateSequence thee, int probabilities) {
 	try {
-		autoStringsIndex si = HMM_and_HMM_StateSequence_to_StringsIndex (me, thee);
+		autoStringsIndex si = HMM_and_HMMStateSequence_to_StringsIndex (me, thee);
 		autoTableOfReal him = StringsIndex_to_TableOfReal_transitions (si.peek(), probabilities);
 		return him;
 	} catch (MelderError) {
-		Melder_throw (me, U": no transition table created for HMM_StateSequence.");
+		Melder_throw (me, U": no transition table created for HMMStateSequence.");
 	}
 }
 
diff --git a/dwtools/HMM.h b/dwtools/HMM.h
index e049f30..76b7585 100644
--- a/dwtools/HMM.h
+++ b/dwtools/HMM.h
@@ -27,12 +27,12 @@
 #include "Index.h"
 
 #include "HMM_def.h"
-oo_CLASS_CREATE (HMM_State, Daata);
-oo_CLASS_CREATE (HMM_Observation, Daata);
-oo_CLASS_CREATE (HMM_Viterbi, Daata);
+oo_CLASS_CREATE (HMMState, Daata);
+oo_CLASS_CREATE (HMMObservation, Daata);
+oo_CLASS_CREATE (HMMViterbi, Daata);
 oo_CLASS_CREATE (HMM, Daata);
 
-Thing_define (HMM_BaumWelch, Daata) {
+Thing_define (HMMBaumWelch, Daata) {
 	// new data:
 	public:
 		long capacity;
@@ -53,47 +53,47 @@ Thing_define (HMM_BaumWelch, Daata) {
 		virtual void v_destroy ();
 };
 
-Thing_define (HMM_StateSequence, Strings) {
+Thing_define (HMMStateSequence, Strings) {
 };
 
-Thing_define (HMM_ObservationSequence, Table) {
+Thing_define (HMMObservationSequence, Table) {
 };
 // First column is always a symbol, if only 1 column then symbols only
 
-Thing_define (HMM_ObservationSequences, Collection) {
+Thing_define (HMMObservationSequences, Collection) {
 };
 
-autoHMM_ObservationSequence HMM_ObservationSequence_create (long numberOfItems, long dataLength);
+autoHMMObservationSequence HMMObservationSequence_create (long numberOfItems, long dataLength);
 
-void HMM_ObservationSequence_removeObservation (HMM_ObservationSequence me, long index);
+void HMMObservationSequence_removeObservation (HMMObservationSequence me, long index);
 
-autoStrings HMM_ObservationSequence_to_Strings (HMM_ObservationSequence me);
+autoStrings HMMObservationSequence_to_Strings (HMMObservationSequence me);
 
-autoHMM_ObservationSequence Strings_to_HMM_ObservationSequence (Strings me);
+autoHMMObservationSequence Strings_to_HMMObservationSequence (Strings me);
 
-autoStringsIndex HMM_ObservationSequence_to_StringsIndex (HMM_ObservationSequence me);
+autoStringsIndex HMMObservationSequence_to_StringsIndex (HMMObservationSequence me);
 
-autoStringsIndex HMM_and_HMM_ObservationSequence_to_StringsIndex (HMM me, HMM_ObservationSequence thee);
+autoStringsIndex HMM_and_HMMObservationSequence_to_StringsIndex (HMM me, HMMObservationSequence thee);
 
-autoTableOfReal HMM_ObservationSequence_to_TableOfReal_transitions (HMM_ObservationSequence me, int probabilities);
+autoTableOfReal HMMObservationSequence_to_TableOfReal_transitions (HMMObservationSequence me, int probabilities);
 
-autoTableOfReal HMM_and_HMM_ObservationSequence_to_TableOfReal_transitions (HMM me, HMM_ObservationSequence thee, int probabilities);
+autoTableOfReal HMM_and_HMMObservationSequence_to_TableOfReal_transitions (HMM me, HMMObservationSequence thee, int probabilities);
 
-autoHMM_ObservationSequences HMM_ObservationSequences_create ();
+autoHMMObservationSequences HMMObservationSequences_create ();
 
-long HMM_ObservationSequence_getNumberOfObservations (HMM_ObservationSequence me);
+long HMMObservationSequence_getNumberOfObservations (HMMObservationSequence me);
 
-long HMM_ObservationSequences_getLongestSequence (HMM_ObservationSequences me);
+long HMMObservationSequences_getLongestSequence (HMMObservationSequences me);
 
-autoTableOfReal HMM_StateSequence_to_TableOfReal_transitions (HMM_StateSequence me);
+autoTableOfReal HMMStateSequence_to_TableOfReal_transitions (HMMStateSequence me);
 
-autoTableOfReal HMM_and_HMM_StateSequence_to_TableOfReal_transitions (HMM me, HMM_StateSequence thee, int probabilities);
+autoTableOfReal HMM_and_HMMStateSequence_to_TableOfReal_transitions (HMM me, HMMStateSequence thee, int probabilities);
 
-autoHMM_StateSequence HMM_StateSequence_create (long numberOfItems);
+autoHMMStateSequence HMMStateSequence_create (long numberOfItems);
 
-autoStrings HMM_StateSequence_to_Strings (HMM_StateSequence me);
+autoStrings HMMStateSequence_to_Strings (HMMStateSequence me);
 
-void HMM_State_setLabel (HMM_State me, char32 *label);
+void HMMState_setLabel (HMMState me, char32 *label);
 
 
 autoHMM HMM_create (int leftToRight, long numberOfStates, long numberOfObservationSymbols);
@@ -106,7 +106,7 @@ autoHMM HMM_createContinuousModel (int leftToRight, long numberOfStates, long nu
 autoHMM HMM_createFullContinuousModel (int leftToRight, long numberOfStates, long numberOfObservationSymbols,
 	long numberOfFeatureStreams, long *dimensionOfStream, long *numberOfGaussiansforStream);
 
-autoHMM HMM_createFromHMM_ObservationSequence (HMM_ObservationSequence me, long numberOfStates, int leftToRight);
+autoHMM HMM_createFromHMMObservationSequence (HMMObservationSequence me, long numberOfStates, int leftToRight);
 
 void HMM_draw (HMM me, Graphics g, int garnish);
 
@@ -157,29 +157,29 @@ double HMM_getProbabilityOfStayingInState (HMM me, long istate, long numberOfTim
 
 double HMM_and_HMM_getCrossEntropy (HMM me, HMM thee, long observationLength, int symmetric);
 
-double HMM_and_HMM_and_HMM_ObservationSequence_getCrossEntropy (HMM me, HMM thee, HMM_ObservationSequence him);
+double HMM_and_HMM_and_HMMObservationSequence_getCrossEntropy (HMM me, HMM thee, HMMObservationSequence him);
 
 autoTableOfReal HMM_extractTransitionProbabilities (HMM me);
 
 autoTableOfReal HMM_extractEmissionProbabilities (HMM me);
 
-/* HMM & HMM_ObservationSequence ****/
+/* HMM & HMMObservationSequence ****/
 
-autoHMM_ObservationSequence HMM_to_HMM_ObservationSequence (HMM me, long initialState, long numberOfItems);
+autoHMMObservationSequence HMM_to_HMMObservationSequence (HMM me, long initialState, long numberOfItems);
 
-autoHMM_StateSequence HMM_and_HMM_ObservationSequence_to_HMM_StateSequence (HMM me, HMM_ObservationSequence thee);
+autoHMMStateSequence HMM_and_HMMObservationSequence_to_HMMStateSequence (HMM me, HMMObservationSequence thee);
 
-double HMM_and_HMM_StateSequence_getProbability (HMM me, HMM_StateSequence thee);
+double HMM_and_HMMStateSequence_getProbability (HMM me, HMMStateSequence thee);
 
-void HMM_and_HMM_ObservationSequences_learn (HMM me, HMM_ObservationSequences thee, double delta_lnp, double minProb);
+void HMM_and_HMMObservationSequences_learn (HMM me, HMMObservationSequences thee, double delta_lnp, double minProb, int info);
 
-void HMM_and_HMM_StateSequence_drawTrellis (HMM me, HMM_StateSequence thee, Graphics g, int connect, int garnish);
+void HMM_and_HMMStateSequence_drawTrellis (HMM me, HMMStateSequence thee, Graphics g, int connect, int garnish);
 
-double HMM_and_HMM_ObservationSequence_getProbability (HMM me, HMM_ObservationSequence thee);
+double HMM_and_HMMObservationSequence_getProbability (HMM me, HMMObservationSequence thee);
 
-double HMM_and_HMM_ObservationSequence_getCrossEntropy (HMM me, HMM_ObservationSequence thee);
+double HMM_and_HMMObservationSequence_getCrossEntropy (HMM me, HMMObservationSequence thee);
 
-double HMM_and_HMM_ObservationSequence_getPerplexity (HMM me, HMM_ObservationSequence thee);
+double HMM_and_HMMObservationSequence_getPerplexity (HMM me, HMMObservationSequence thee);
 
 // somewhere else
 void MelderInfo_lnp (double logp);
diff --git a/dwtools/HMM_def.h b/dwtools/HMM_def.h
index 6d3be79..05b2000 100644
--- a/dwtools/HMM_def.h
+++ b/dwtools/HMM_def.h
@@ -1,6 +1,6 @@
 /* HMM_def.h
  *
- * Copyright (C) 2010-2011 David Weenink
+ * Copyright (C) 2010-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -23,22 +23,22 @@
  */
 
 
-#define ooSTRUCT HMM_State
-oo_DEFINE_CLASS (HMM_State, Daata)
+#define ooSTRUCT HMMState
+oo_DEFINE_CLASS (HMMState, Daata)
 
 	oo_STRING(label)
 
-oo_END_CLASS(HMM_State)
+oo_END_CLASS(HMMState)
 #undef ooSTRUCT
 
 
-#define ooSTRUCT HMM_Observation
-oo_DEFINE_CLASS (HMM_Observation, Daata)
+#define ooSTRUCT HMMObservation
+oo_DEFINE_CLASS (HMMObservation, Daata)
 
 	oo_STRING(label)
-	oo_OBJECT (GaussianMixture, 1, gm)
+	oo_AUTO_OBJECT (GaussianMixture, 1, gm)
 
-oo_END_CLASS(HMM_Observation)
+oo_END_CLASS(HMMObservation)
 #undef ooSTRUCT
 
 
@@ -66,15 +66,15 @@ oo_END_CLASS(HMM)
 #undef ooSTRUCT
 
 
-#define ooSTRUCT HMM_Viterbi
-oo_DEFINE_CLASS (HMM_Viterbi, Daata)
+#define ooSTRUCT HMMViterbi
+oo_DEFINE_CLASS (HMMViterbi, Daata)
 	oo_LONG (numberOfTimes)
 	oo_LONG (numberOfStates)
 	oo_DOUBLE (prob)
 	oo_DOUBLE_MATRIX (viterbi, numberOfStates, numberOfTimes)
 	oo_LONG_MATRIX (bp, numberOfStates, numberOfTimes)
 	oo_LONG_VECTOR (path, numberOfTimes)
-oo_END_CLASS(HMM_Viterbi)
+oo_END_CLASS(HMMViterbi)
 #undef ooSTRUCT
 
 
diff --git a/dwtools/ICA.cpp b/dwtools/ICA.cpp
index 2583507..44e34f5 100644
--- a/dwtools/ICA.cpp
+++ b/dwtools/ICA.cpp
@@ -464,7 +464,7 @@ static void NUMcrossCorrelate_rows (double **x, long nrows, long icol1, long ico
 	The cross-correlation between channel i and channel j is defined as
 		sum(k=1..nsamples, (z[i][k] - mean[i])(z[j][k + tau] - mean[j]))*samplingTime
 */
-CrossCorrelationTable Sound_to_CrossCorrelationTable (Sound me, double startTime, double endTime, double lagStep) {
+autoCrossCorrelationTable Sound_to_CrossCorrelationTable (Sound me, double startTime, double endTime, double lagStep) {
 	try {
 		if (endTime <= startTime) {
 			startTime = my xmin;
@@ -490,7 +490,7 @@ CrossCorrelationTable Sound_to_CrossCorrelationTable (Sound me, double startTime
 
 		thy numberOfObservations = nsamples;
 
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": CrossCorrelationTable not created.");
 	}
@@ -500,7 +500,7 @@ CrossCorrelationTable Sound_to_CrossCorrelationTable (Sound me, double startTime
  * Both sounds are treated as if their domain runs from 0 to duration.
  * Outside the chosen interval the sounds are assumed to be zero
  */
-CrossCorrelationTable Sounds_to_CrossCorrelationTable_combined (Sound me, Sound thee, double relativeStartTime, double relativeEndTime, double lagStep) {
+autoCrossCorrelationTable Sounds_to_CrossCorrelationTable_combined (Sound me, Sound thee, double relativeStartTime, double relativeEndTime, double lagStep) {
 	try {
 		if (my dx != thy dx) {
 			Melder_throw (U"Sampling frequencies must be equal.");
@@ -536,25 +536,25 @@ CrossCorrelationTable Sounds_to_CrossCorrelationTable_combined (Sound me, Sound
 
 		his numberOfObservations = nsamples;
 
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (me, U": CrossCorrelationTable not created.");
 	}
 }
 
-Covariance Sound_to_Covariance_channels (Sound me, double startTime, double endTime) {
+autoCovariance Sound_to_Covariance_channels (Sound me, double startTime, double endTime) {
     try {
         double lagStep = 0.0;
         autoCrossCorrelationTable thee = Sound_to_CrossCorrelationTable (me, startTime, endTime, lagStep);
         autoCovariance him = Thing_new (Covariance);
         thy structCrossCorrelationTable :: v_copy (him.peek());
-        return him.transfer();
+        return him;
     } catch (MelderError) {
         Melder_throw (me, U": no Covariance created.");
     }
 }
 
-CrossCorrelationTables Sound_to_CrossCorrelationTables (Sound me, double startTime, double endTime, double lagStep, long ncovars) {
+autoCrossCorrelationTables Sound_to_CrossCorrelationTables (Sound me, double startTime, double endTime, double lagStep, long ncovars) {
 	try {
 		if (lagStep < my dx) {
 			lagStep = my dx;
@@ -572,7 +572,7 @@ CrossCorrelationTables Sound_to_CrossCorrelationTables (Sound me, double startTi
 			autoCrossCorrelationTable ct = Sound_to_CrossCorrelationTable (me, startTime, endTime, lag);
 			Collection_addItem (thee.peek(), ct.transfer());
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no CrossCorrelationTables created.");
 	}
@@ -610,18 +610,18 @@ Diagonalizer Diagonalizer_create (long dimension) {
 
 Thing_implement (MixingMatrix, TableOfReal, 0);
 
-MixingMatrix MixingMatrix_create (long numberOfChannels, long numberOfComponents) {
+autoMixingMatrix MixingMatrix_create (long numberOfChannels, long numberOfComponents) {
 	try {
 		autoMixingMatrix me = Thing_new (MixingMatrix);
 		TableOfReal_init (me.peek(), numberOfChannels, numberOfComponents);
 		MixingMatrix_initializeRandom (me.peek());
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"MixingMatrix not created.");
 	}
 }
 
-MixingMatrix MixingMatrix_createSimple (long numberOfChannels, long numberOfComponents, char32 *elements) {
+autoMixingMatrix MixingMatrix_createSimple (long numberOfChannels, long numberOfComponents, char32 *elements) {
 	try {
 		long inum = 1, ntokens = Melder_countTokens (elements);
 		if (ntokens == 0) {
@@ -647,7 +647,7 @@ MixingMatrix MixingMatrix_createSimple (long numberOfChannels, long numberOfComp
 				my data[irow][icol] = number; // repeat the last number given!
 			}
 		}
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"MixingMatrix not created.");
 	}
@@ -664,24 +664,24 @@ void MixingMatrix_initializeRandom (MixingMatrix me) {
 /***************** Diagonalizer & MixingMatrix *************************/
 
 
-Diagonalizer MixingMatrix_to_Diagonalizer (MixingMatrix me) {
+autoDiagonalizer MixingMatrix_to_Diagonalizer (MixingMatrix me) {
 	try {
 		if (my numberOfRows != my numberOfColumns) {
 			Melder_throw (U"The number of channels and the number of components must be equal.");
 		}
 		autoDiagonalizer thee = Diagonalizer_create (my numberOfRows);
 		NUMpseudoInverse (my data, my numberOfRows, my numberOfColumns, thy data, 0);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no Diagonalizer created.");
 	}
 }
 
-MixingMatrix Diagonalizer_to_MixingMatrix (Diagonalizer me) {
+autoMixingMatrix Diagonalizer_to_MixingMatrix (Diagonalizer me) {
 	try {
 		autoMixingMatrix thee = MixingMatrix_create (my numberOfRows, my numberOfColumns);
 		NUMpseudoInverse (my data, my numberOfRows, my numberOfColumns, thy data, 0);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no MixingMatrix created.");
 	}
@@ -734,25 +734,25 @@ Sound Sound_and_MixingMatrix_unmix (Sound me, MixingMatrix thee) {
 	}
 }
 
-MixingMatrix Sound_to_MixingMatrix (Sound me, double startTime, double endTime, long ncovars, double lagStep, long maxNumberOfIterations, double tol, int method) {
+autoMixingMatrix Sound_to_MixingMatrix (Sound me, double startTime, double endTime, long ncovars, double lagStep, long maxNumberOfIterations, double tol, int method) {
 	try {
 		autoCrossCorrelationTables ccs = Sound_to_CrossCorrelationTables (me, startTime, endTime, lagStep, ncovars);
 		autoMixingMatrix thee = MixingMatrix_create (my ny, my ny);
 		MixingMatrix_and_CrossCorrelationTables_improveUnmixing (thee.peek(), ccs.peek(), maxNumberOfIterations, tol, method);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no MixingMatrix created.");
 	}
 }
 
-MixingMatrix TableOfReal_to_MixingMatrix (TableOfReal me) {
+autoMixingMatrix TableOfReal_to_MixingMatrix (TableOfReal me) {
 	try {
 		if (my numberOfColumns != my numberOfRows) {
 			Melder_throw (U"Number of rows and columns must be equal.");
 		}
 		autoMixingMatrix thee = Thing_new (MixingMatrix);
 		my structTableOfReal :: v_copy (thee.peek());
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to MixingMatrix.");
 	}
@@ -768,17 +768,17 @@ void structCrossCorrelationTable :: v_info () {
 	MelderInfo_writeLine (U"Diagonality measure: ", dm);
 }
 
-CrossCorrelationTable CrossCorrelationTable_create (long dimension) {
+autoCrossCorrelationTable CrossCorrelationTable_create (long dimension) {
 	try {
 		autoCrossCorrelationTable me = Thing_new (CrossCorrelationTable);
 		SSCP_init (me.peek(), dimension, dimension);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"CrossCorrelationTable not created.");
 	}
 }
 
-CrossCorrelationTable CrossCorrelationTable_createSimple (char32 *covars, char32 *centroid, long numberOfSamples) {
+autoCrossCorrelationTable CrossCorrelationTable_createSimple (char32 *covars, char32 *centroid, long numberOfSamples) {
 	try {
 		long dimension = Melder_countTokens (centroid);
 		long ncovars = Melder_countTokens (covars);
@@ -811,7 +811,7 @@ CrossCorrelationTable CrossCorrelationTable_createSimple (char32 *covars, char32
 			my centroid[inum] = number;
 		}
 		my numberOfObservations = numberOfSamples;
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"CrossCorrelationTable not created.");
 	}
@@ -835,11 +835,11 @@ void structCrossCorrelationTables :: v_info () {
 
 Thing_implement (CrossCorrelationTables, Ordered, 0);
 
-CrossCorrelationTables CrossCorrelationTables_create () {
+autoCrossCorrelationTables CrossCorrelationTables_create () {
 	try {
 		autoCrossCorrelationTables me = Thing_new (CrossCorrelationTables);
 		Ordered_init (me.peek(), classCrossCorrelationTable, 30);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"CrossCorrelationTables not created.");
 	}
@@ -875,20 +875,20 @@ double CrossCorrelationTables_and_Diagonalizer_getDiagonalityMeasure (CrossCorre
 	return dm;
 }
 
-CrossCorrelationTable CrossCorrelationTable_and_Diagonalizer_diagonalize (CrossCorrelationTable me, Diagonalizer thee) {
+autoCrossCorrelationTable CrossCorrelationTable_and_Diagonalizer_diagonalize (CrossCorrelationTable me, Diagonalizer thee) {
 	try {
 		if (my numberOfRows != thy numberOfRows) {
 			Melder_throw (U"The CrossCorrelationTable and the Diagonalizer matrix dimensions must be equal.");
 		}
 		autoCrossCorrelationTable him = CrossCorrelationTable_create (my numberOfColumns);
 		NUMdmatrices_multiply_VCVp (his data, thy data, my numberOfColumns, my numberOfColumns, my data, 1);
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (U"CrossCorrelationTable not diagonalized.");
 	}
 }
 
-CrossCorrelationTables CrossCorrelationTables_and_Diagonalizer_diagonalize (CrossCorrelationTables me, Diagonalizer thee) {
+autoCrossCorrelationTables CrossCorrelationTables_and_Diagonalizer_diagonalize (CrossCorrelationTables me, Diagonalizer thee) {
 	try {
 		autoCrossCorrelationTables him = CrossCorrelationTables_create ();
 		for (long i = 1; i <= my size; i++) {
@@ -902,7 +902,7 @@ CrossCorrelationTables CrossCorrelationTables_and_Diagonalizer_diagonalize (Cros
 	}
 }
 
-Diagonalizer CrossCorrelationTables_to_Diagonalizer (CrossCorrelationTables me, long maxNumberOfIterations, double tol, int method) {
+autoDiagonalizer CrossCorrelationTables_to_Diagonalizer (CrossCorrelationTables me, long maxNumberOfIterations, double tol, int method) {
 	try {
 		CrossCorrelationTable him = (CrossCorrelationTable) my item[1];
 		autoDiagonalizer thee = Diagonalizer_create (his numberOfColumns);
@@ -950,7 +950,7 @@ Sound Sound_and_Covariance_whitenChannels (Sound me, Covariance thee, double var
 /*
  * Generate n different cct's that have a common diagonalizer.
  */
-CrossCorrelationTables CrossCorrelationTables_createTestSet (long dimension, long n, int firstPositiveDefinite, double sigma) {
+autoCrossCorrelationTables CrossCorrelationTables_createTestSet (long dimension, long n, int firstPositiveDefinite, double sigma) {
 	try {
 		// Start with a square matrix with random gaussian elements and make its singular value decomposition UDV'
 		// The V matrix will be the common diagonalizer matrix that we use.
@@ -988,7 +988,7 @@ CrossCorrelationTables CrossCorrelationTables_createTestSet (long dimension, lon
 			NUMdmatrices_multiply_VCVp (ct -> data, v.peek(), dimension, dimension, d.peek(), 1);
             Collection_addItem (me.peek(), ct.transfer());
 		}
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"CrossCorrelationTables test set not created.");
 	}
diff --git a/dwtools/ICA.h b/dwtools/ICA.h
index f0d2f91..2831062 100644
--- a/dwtools/ICA.h
+++ b/dwtools/ICA.h
@@ -2,7 +2,7 @@
 #define _ICA_h_
 /* ICA.h
  *
- * Copyright (C) 2010-2014 David Weenink
+ * Copyright (C) 2010-2014, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@ Thing_define (CrossCorrelationTables, Ordered) {
 };
 
 /*
-	Cell [i,j] of a CrossCorrelationTable contains the cross-correlation between signal i and signal j.
+	Cell [i,j] of a CrossCorrelationTable contains the cross-correlation between signal i and signal j (for one particular lag time).
 	For example, the CrossCorrelation of an n-channel sound is a nxn table where cell [i,j] contains the
 	cross-correlation of channel i with channel j for a particlular lag time tau.
 	In the statistical literature sometimes the cross-correlation between signals is also called "covariance".
@@ -55,20 +55,27 @@ Thing_define (CrossCorrelationTables, Ordered) {
 	2. The elements c[i][j] in a Covariance always satisfy |c[i][j]/sqrt(c[i][i]*c[j][j])| <= 1, this is
 	  in general not the case for cross-correlations.
 */
-CrossCorrelationTable CrossCorrelationTable_create (long dimension);
-CrossCorrelationTable CrossCorrelationTable_createSimple (char32 *covars, char32 *centroid, long numberOfSamples);
+
+autoCrossCorrelationTable CrossCorrelationTable_create (long dimension);
+
+autoCrossCorrelationTable CrossCorrelationTable_createSimple (char32 *covars, char32 *centroid, long numberOfSamples);
 
 /* (sum(i,j=1..dimension, i!=j; C[i][j]^2))/(dimension*(dimension-1)) */
 double CrossCorrelationTable_getDiagonalityMeasure (CrossCorrelationTable me);
-CrossCorrelationTable CrossCorrelationTable_and_Diagonalizer_diagonalize (CrossCorrelationTable me, Diagonalizer thee);
 
-CrossCorrelationTables CrossCorrelationTables_create ();
+autoCrossCorrelationTable CrossCorrelationTable_and_Diagonalizer_diagonalize (CrossCorrelationTable me, Diagonalizer thee);
+
+autoCrossCorrelationTables CrossCorrelationTables_create ();
+
 double CrossCorrelationTables_getDiagonalityMeasure (CrossCorrelationTables me, double *w, long start, long end);
+
 double CrossCorrelationTables_and_Diagonalizer_getDiagonalityMeasure (CrossCorrelationTables me, Diagonalizer thee, double *w, long start, long end);
-CrossCorrelationTables CrossCorrelationTables_createTestSet (long dimension, long n, int firstPositiveDefinite, double sigma);
 
-MixingMatrix MixingMatrix_create (long numberOfChannels, long numberOfComponents);
-MixingMatrix MixingMatrix_createSimple (long numberOfChannels, long numberOfComponents, char32 *elements);
+autoCrossCorrelationTables CrossCorrelationTables_createTestSet (long dimension, long n, int firstPositiveDefinite, double sigma);
+
+autoMixingMatrix MixingMatrix_create (long numberOfChannels, long numberOfComponents);
+
+autoMixingMatrix MixingMatrix_createSimple (long numberOfChannels, long numberOfComponents, char32 *elements);
 void MixingMatrix_initializeRandom (MixingMatrix me);
 
 Diagonalizer Diagonalizer_create (long dimension);
@@ -76,7 +83,7 @@ Diagonalizer Diagonalizer_create (long dimension);
 Sound Sound_and_MixingMatrix_mix (Sound me, MixingMatrix thee);
 Sound Sound_and_MixingMatrix_unmix (Sound me, MixingMatrix thee);
 
-MixingMatrix Sound_to_MixingMatrix (Sound me, double startTime, double endTime, long ncovars, double lagStep, long maxNumberOfIterations, double delta_w, int method);
+autoMixingMatrix Sound_to_MixingMatrix (Sound me, double startTime, double endTime, long ncovars, double lagStep, long maxNumberOfIterations, double delta_w, int method);
 
 Sound Sound_to_Sound_BSS (Sound me, double startTime, double endTime, long ncovars, double lagStep, long maxNumberOfIterations, double delta_w, int method);
 
@@ -88,33 +95,36 @@ void MixingMatrix_and_CrossCorrelationTables_improveUnmixing (MixingMatrix me, C
 /*
 	Determine the matrix that diagonalizes a series of CrossCorrelationTables as well as possible.
 */
-Diagonalizer CrossCorrelationTables_to_Diagonalizer (CrossCorrelationTables me, long maxNumberOfIterations, double tol, int method);
+autoDiagonalizer CrossCorrelationTables_to_Diagonalizer (CrossCorrelationTables me, long maxNumberOfIterations, double tol, int method);
+
 void Diagonalizer_and_CrossCorrelationTables_improveDiagonality (Diagonalizer me, CrossCorrelationTables thee, long maxNumberOfIterations, double tol, int method);
 
 /*
 	Determine V*C[k]*V' for k=1..n, where V is the diagonalizer matrix and C[k} the k-th CrossCorrelationTable.
 */
-CrossCorrelationTables CrossCorrelationTables_and_Diagonalizer_diagonalize (CrossCorrelationTables me, Diagonalizer thee);
+autoCrossCorrelationTables CrossCorrelationTables_and_Diagonalizer_diagonalize (CrossCorrelationTables me, Diagonalizer thee);
 
 
-Diagonalizer MixingMatrix_to_Diagonalizer (MixingMatrix me);
-MixingMatrix Diagonalizer_to_MixingMatrix (Diagonalizer me);
+autoDiagonalizer MixingMatrix_to_Diagonalizer (MixingMatrix me);
+
+autoMixingMatrix Diagonalizer_to_MixingMatrix (Diagonalizer me);
 
 /*
 	For multi-channel "sounds" like EEG signals.
 	The cross-correlation between channel i and channel j is defined as
 		sum(k=1..nsamples; (z[i][k] - mean[i])(z[j][k + lag] - mean[j])) / (nsamples - 1).
 */
-CrossCorrelationTable Sound_to_CrossCorrelationTable (Sound me, double startTime, double endTime, double lagStep);
-CrossCorrelationTable Sounds_to_CrossCorrelationTable_combined (Sound me, Sound thee, double relativeStartTime, double relativeEndTime, double lagStep);
+autoCrossCorrelationTable Sound_to_CrossCorrelationTable (Sound me, double startTime, double endTime, double lagStep);
+
+autoCrossCorrelationTable Sounds_to_CrossCorrelationTable_combined (Sound me, Sound thee, double relativeStartTime, double relativeEndTime, double lagStep);
 
 // The covariance is the cross-correlation with lag 0.
-Covariance Sound_to_Covariance_channels (Sound me, double startTime, double endTime);
+autoCovariance Sound_to_Covariance_channels (Sound me, double startTime, double endTime);
 /*
 	Determine a CrossCorrelationTable for lags (k-1)*lagStep, where k = 1...n.
 */
-CrossCorrelationTables Sound_to_CrossCorrelationTables (Sound me, double startTime, double endTime, double lagStep, long n);
+autoCrossCorrelationTables Sound_to_CrossCorrelationTables (Sound me, double startTime, double endTime, double lagStep, long n);
 
-MixingMatrix TableOfReal_to_MixingMatrix (TableOfReal me);
+autoMixingMatrix TableOfReal_to_MixingMatrix (TableOfReal me);
 
 #endif /*_ICA_h_ */
diff --git a/dwtools/Intensity_extensions.cpp b/dwtools/Intensity_extensions.cpp
index e6c4fce..7d3ab46 100644
--- a/dwtools/Intensity_extensions.cpp
+++ b/dwtools/Intensity_extensions.cpp
@@ -46,8 +46,7 @@ static void IntervalTier_addBoundaryUnsorted (IntervalTier me, long iinterval, d
 	Sorted_addItem_unsorted (my intervals, ti_new.transfer());
 }
 
-TextGrid Intensity_to_TextGrid_detectSilences (Intensity me, double silenceThreshold_dB,
-		double minSilenceDuration, double minSoundingDuration, const char32 *silenceLabel, const char32 *soundingLabel) {
+autoTextGrid Intensity_to_TextGrid_detectSilences (Intensity me, double silenceThreshold_dB, double minSilenceDuration, double minSoundingDuration, const char32 *silenceLabel, const char32 *soundingLabel) {
 	try {
 		double duration = my xmax - my xmin, time;
 
@@ -59,7 +58,7 @@ TextGrid Intensity_to_TextGrid_detectSilences (Intensity me, double silenceThres
 		IntervalTier it = (IntervalTier) thy tiers -> item[1];
 		TextInterval_setText ( (TextInterval) it -> intervals -> item[1], soundingLabel);
 		if (minSilenceDuration > duration) {
-			return thee.transfer();
+			return thee;
 		}
 
 		double intensity_max_db, intensity_min_db, xOfMaximum, xOfMinimum;
@@ -67,13 +66,13 @@ TextGrid Intensity_to_TextGrid_detectSilences (Intensity me, double silenceThres
 		Vector_getMinimumAndX (me, 0, 0, 1, NUM_PEAK_INTERPOLATE_PARABOLIC, &intensity_min_db, &xOfMinimum);
 		double intensity_dbRange = intensity_max_db - intensity_min_db;
 
-		if (intensity_dbRange < 10) Melder_warning (U"The loudest and softest part in your sound only differ by ",
-			        intensity_dbRange, U" dB.");
-
+		if (intensity_dbRange < 10) {
+			Melder_warning (U"The loudest and softest part in your sound only differ by ", intensity_dbRange, U" dB.");
+		}
 		double intensityThreshold = intensity_max_db - fabs (silenceThreshold_dB);
 
 		if (minSilenceDuration > duration || intensityThreshold < intensity_min_db) {
-			return thee.transfer();
+			return thee;
 		}
 
 		int inSilenceInterval = my z[1][1] < intensityThreshold;
@@ -118,13 +117,13 @@ TextGrid Intensity_to_TextGrid_detectSilences (Intensity me, double silenceThres
 		IntervalTier_cutIntervals_minimumDuration (it, silenceLabel, minSilenceDuration);
 		IntervalTier_cutIntervalsOnLabelMatch (it, soundingLabel);
 
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": TextGrid not created.");
 	}
 }
 
-Intensity IntensityTier_to_Intensity (IntensityTier me, double dt) {
+autoIntensity IntensityTier_to_Intensity (IntensityTier me, double dt) {
 	try {
 		long nt = (long) floor ((my xmax - my xmin) / dt);
 		double t1 = 0.5 * dt;
@@ -133,18 +132,18 @@ Intensity IntensityTier_to_Intensity (IntensityTier me, double dt) {
 			double time = t1 + (i - 1) * dt;
 			thy z[1][i] = RealTier_getValueAtTime (me, time);
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U" no Intensity created.");
 	}
 }
 
-TextGrid IntensityTier_to_TextGrid_detectSilences (IntensityTier me, double dt, double silenceThreshold_dB, double minSilenceDuration,
+autoTextGrid IntensityTier_to_TextGrid_detectSilences (IntensityTier me, double dt, double silenceThreshold_dB, double minSilenceDuration,
 	double minSoundingDuration, const char32 *silenceLabel, const char32 *soundingLabel) {
 	try {
 		autoIntensity intensity = IntensityTier_to_Intensity (me, dt);
 		autoTextGrid thee = Intensity_to_TextGrid_detectSilences (intensity.peek(), silenceThreshold_dB, minSilenceDuration, minSoundingDuration, silenceLabel, soundingLabel);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U" no TextGrid created.");
 	}
diff --git a/dwtools/Intensity_extensions.h b/dwtools/Intensity_extensions.h
index 3a2d99a..873a4e7 100644
--- a/dwtools/Intensity_extensions.h
+++ b/dwtools/Intensity_extensions.h
@@ -2,7 +2,7 @@
 #define _Intensity_extensions_h_
 /* Intensity_extensions.h
  *
- * Copyright (C) 2006-2011 David Weenink
+ * Copyright (C) 2006-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@
 #include "IntensityTier.h"
 #include "TextGrid.h"
 
-TextGrid Intensity_to_TextGrid_detectSilences (Intensity me, double silenceThreshold_dB, double minSilenceDuration,
+autoTextGrid Intensity_to_TextGrid_detectSilences (Intensity me, double silenceThreshold_dB, double minSilenceDuration,
 	double minSoundingDuration, const char32 *silenceLabel, const char32 *soundingLabel);
 /*
 	Marks "silence" intervals in a sound as intervals in a TextGrid.
@@ -42,9 +42,9 @@ TextGrid Intensity_to_TextGrid_detectSilences (Intensity me, double silenceThres
 	as silences in the IntervalTier.
 */
 
-Intensity IntensityTier_to_Intensity (IntensityTier me, double dt);
+autoIntensity IntensityTier_to_Intensity (IntensityTier me, double dt);
 
-TextGrid IntensityTier_to_TextGrid_detectSilences (IntensityTier me, double dt, double silenceThreshold_dB, double minSilenceDuration,
+autoTextGrid IntensityTier_to_TextGrid_detectSilences (IntensityTier me, double dt, double silenceThreshold_dB, double minSilenceDuration,
 	double minSoundingDuration, const char32 *silenceLabel, const char32 *soundingLabel);
 
 #endif /* _Intensity_extensions_h_ */
diff --git a/dwtools/KlattGrid.cpp b/dwtools/KlattGrid.cpp
index 8f8f718..34e0325 100644
--- a/dwtools/KlattGrid.cpp
+++ b/dwtools/KlattGrid.cpp
@@ -1777,7 +1777,7 @@ void _Sound_FormantGrid_filterWithOneFormant_inline (Sound me, thou, long iforma
 	}
 
 	double nyquist = 0.5 / my dx;
-	autoFilter r =  antiformant != 0 ? (Filter) AntiResonator_create (my dx) : (Filter) Resonator_create (my dx, Resonator_NORMALISATION_H0);
+	autoFilter r =  antiformant != 0 ? (autoFilter) AntiResonator_create (my dx) : (autoFilter) Resonator_create (my dx, Resonator_NORMALISATION_H0);
 
 	for (long is = 1; is <= my nx; is++) {
 		double t = my x1 + (is - 1) * my dx;
diff --git a/dwtools/KlattTable.cpp b/dwtools/KlattTable.cpp
index ed77485..8791c90 100644
--- a/dwtools/KlattTable.cpp
+++ b/dwtools/KlattTable.cpp
@@ -1,6 +1,6 @@
 /* KlattTable.cpp
  *
- * Copyright (C) 2008-2011 David Weenink
+ * Copyright (C) 2008-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -452,11 +452,11 @@ typedef struct structKlattGlobal {
 	short *natural_samples; /* pointer to an array of glottal samples */
 	long F0hz10; /* Voicing fund freq in units of 0.1 Hz */
 	long original_f0; /* original value of f0 not modified by flutter (kanweg) */
-	Resonator rp[7], rc[9], rnpp, rnpc, rgl, rlp, rout;
-	AntiResonator rnz;
+	autoResonator rp[7], rc[9], rnpp, rnpc, rgl, rlp, rout;
+	autoAntiResonator rnz;
 } *KlattGlobal;
 
-KlattTable KlattTable_readFromRawTextFile (MelderFile fs) {
+autoKlattTable KlattTable_readFromRawTextFile (MelderFile fs) {
 	try {
 		autoMatrix thee = Matrix_readFromRawTextFile (fs);
 
@@ -475,25 +475,13 @@ KlattTable KlattTable_readFromRawTextFile (MelderFile fs) {
 				Table_setNumericValue ( (Table) me.peek(), irow, jcol, val);
 			}
 		}
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"KlattTable not read from file.");
 	}
 }
 
 static void KlattGlobal_free (KlattGlobal me) {
-	for (long i = 1; i <= 8; i++) {
-		Melder_free (my rc[i]);
-		if (i <= 6) {
-			Melder_free (my rp[i]);
-		}
-	}
-	Melder_free (my rnpp);
-	Melder_free (my rnpc);
-	Melder_free (my rnz);
-	Melder_free (my rgl);
-	Melder_free (my rlp);
-	Melder_free (my rout);
 	Melder_free (me);
 }
 
@@ -548,7 +536,7 @@ static void KlattGlobal_init (KlattGlobal me, int synthesisModel, int numberOfFo
 
 	my FLPhz = (long) floor (0.0950 * my samrate); // depends on samplingFrequency ????
 	my BLPhz = (long) floor (0.0630 * my samrate);
-	Filter_setFB (my rlp, my FLPhz, my BLPhz);
+	Filter_setFB (my rlp.peek(), my FLPhz, my BLPhz);
 }
 
 static KlattFrame KlattFrame_create () {
@@ -559,12 +547,12 @@ static void KlattFrame_free (KlattFrame me) {
 	Melder_free (me);
 }
 
-KlattTable KlattTable_create (double frameDuration, double totalDuration) {
+autoKlattTable KlattTable_create (double frameDuration, double totalDuration) {
 	try {
 		autoKlattTable me = (KlattTable) Thing_new (KlattTable);
 		long nrows = (long) floor (totalDuration / frameDuration) + 1;
 		Table_initWithColumnNames (me.peek(), nrows, columnNames);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"KlattTable not created.");
 	}
@@ -601,28 +589,28 @@ static void KlattGlobal_getFrame (KlattGlobal me, KlattFrame thee) {
 
 	for (long i = 8; i > 0; i--) {
 		if (my nfcascade >= i) {
-			Filter_setFB (my rc[i], thy Fhz[i], thy Bhz[i]);
+			Filter_setFB (my rc[i].peek(), thy Fhz[i], thy Bhz[i]);
 		}
 	}
 
 	/* Set coefficients of nasal resonator and zero antiresonator */
 
-	Filter_setFB (my rnpc, thy FNPhz, thy BNPhz);
-	Filter_setFB (my rnz, thy FNZhz, thy BNZhz);
+	Filter_setFB (my rnpc.peek(), thy FNPhz, thy BNPhz);
+	Filter_setFB (my rnz.peek(), thy FNZhz, thy BNZhz);
 
 	/* Set coefficients of parallel resonators, and amplitude of outputs */
 
 	for (long i = 1; i <= 6; i++) {
-		Filter_setFB (my rp[i], thy Fhz[i], thy Bphz[i]);
+		Filter_setFB (my rp[i].peek(), thy Fhz[i], thy Bphz[i]);
 		my rp[i] -> a *= amp_parF[i] * DBtoLIN (thy A[i]);
 	}
 
-	Filter_setFB (my rnpp, thy FNPhz, thy BNPhz);
+	Filter_setFB (my rnpp.peek(), thy FNPhz, thy BNPhz);
 	my rnpp -> a *= amp_parFNP;
 
 	/* output low-pass filter */
 
-	Filter_setFB (my rout, 0, (long) (my samrate / 2));
+	Filter_setFB (my rout.peek(), 0, (long) (my samrate / 2));
 }
 
 /*
@@ -675,7 +663,7 @@ static double KlattGlobal_impulsive_source (KlattGlobal me) {   // ppgb: dit was
 
 	vwave = my nper < 3 ? doublet[my nper] : 0;
 
-	return Filter_getOutput (my rgl, vwave);
+	return Filter_getOutput (my rgl.peek(), vwave);
 }
 
 /*
@@ -839,7 +827,7 @@ static void KlattGlobal_pitch_synch_par_reset (KlattGlobal me) {
 
 		long temp = my samrate / my nopen;
 
-		Filter_setFB (my rgl, 0, temp); // Only used for impulsive source.
+		Filter_setFB (my rgl.peek(), 0, temp); // Only used for impulsive source.
 
 		/* Make gain at F1 about constant */
 
@@ -942,7 +930,7 @@ static void KlattGlobal_synthesizeFrame (KlattGlobal me, short *output) {
 				to samrate samples/sec.  Resonator f=.09*samrate, bw=.06*samrate
 			*/
 
-			voice = Filter_getOutput (my rlp, voice);
+			voice = Filter_getOutput (my rlp.peek(), voice);
 
 			/* Increment counter that keeps track of 4*samrate samples per sec */
 
@@ -986,12 +974,12 @@ static void KlattGlobal_synthesizeFrame (KlattGlobal me, short *output) {
 		*/
 
 		if (my synthesis_model != ALL_PARALLEL) {
-			out = Filter_getOutput (my rnz, glotout); /* anti resonator */
-			out = Filter_getOutput (my rnpc, out);
+			out = Filter_getOutput (my rnz.peek(), glotout); /* anti resonator */
+			out = Filter_getOutput (my rnpc.peek(), out);
 
 			for (long i = 8; i > 0; i--) {
 				if (my nfcascade >= i) {
-					out = Filter_getOutput (my rc[i], out);
+					out = Filter_getOutput (my rc[i].peek(), out);
 				}
 			}
 		} else {
@@ -1020,16 +1008,16 @@ static void KlattGlobal_synthesizeFrame (KlattGlobal me, short *output) {
 		Problem: The source signal is already v'[n], and we are differentiating here again ???
 		*/
 
-		out += Filter_getOutput (my rp[1], sourc);
+		out += Filter_getOutput (my rp[1].peek(), sourc);
 
 		sourc = frics + par_glotout - glotlast; // diff
 		glotlast = par_glotout;
 
-		out += Filter_getOutput (my rnpp, sourc);
+		out += Filter_getOutput (my rnpp.peek(), sourc);
 
 		for (long i = 6; i >= 2; i--) {
 			if (my nfcascade >= i) {
-				out = Filter_getOutput (my rp[i], sourc) - out;
+				out = Filter_getOutput (my rp[i].peek(), sourc) - out;
 			}
 		}
 
@@ -1063,7 +1051,7 @@ static void KlattGlobal_synthesizeFrame (KlattGlobal me, short *output) {
 			}
 		}
 
-		out = Filter_getOutput (my rout, out);
+		out = Filter_getOutput (my rout.peek(), out);
 
 		double temp = out * my amp_gain0;  /* Convert back to integer */
 
@@ -1080,21 +1068,21 @@ static void KlattGlobal_synthesizeFrame (KlattGlobal me, short *output) {
 static int KlattTable_checkLimits (KlattTable me) {
 	long nviolations_upper[KlattTable_NPAR + 1] = { 0 }, nviolations_lower[KlattTable_NPAR + 1] = { 0 };
 	long lower[KlattTable_NPAR + 1] = { 0, // dummy
-	                                    10, 0,  // f0, av
-	                                    200, 40, 550, 40, 1200, 40, 1200, 40, 1200, 40, 1200, 40, // f1,b1 -- f6,b6
-	                                    248, 40, 248, 40, // fnz, bnz, fnp, bnp
-	                                    0, 0, 0, 0, 0, 0, // ah, kopen, aturb, tilt, af, skew
-	                                    0, 40, 0, 40, 0, 40, 0, 40, 0, 40, 0, 40, // a1,b1p -- a6,b6p
-	                                    0, 0, 0, 0 // anp, ab, avp, gain
-	                                  };
+		10, 0,  // f0, av
+		200, 40, 550, 40, 1200, 40, 1200, 40, 1200, 40, 1200, 40, // f1,b1 -- f6,b6
+		248, 40, 248, 40, // fnz, bnz, fnp, bnp
+		0, 0, 0, 0, 0, 0, // ah, kopen, aturb, tilt, af, skew
+		0, 40, 0, 40, 0, 40, 0, 40, 0, 40, 0, 40, // a1,b1p -- a6,b6p
+		0, 0, 0, 0 // anp, ab, avp, gain
+	};
 	long upper[KlattTable_NPAR + 1] = { 0, // dummy
-	                                    10000, 70,   // f0, av
-	                                    1300, 1000, 3000, 1000, 4999, 1000, 4999, 1000, 6999, 1000, 7000, 1000,  // f1,b1 -- f6,b6
-	                                    528, 1000, 528, 1000, // fnz, bnz, fnp, bnp
-	                                    70, 60, 80, 24, 80, 40,  // ah, kopen, aturb, tilt, af, skew
-	                                    80, 1000, 80, 1000, 80, 1000, 80, 1000, 80, 1000, 80, 1000, // a1,b1p -- a6,b6p
-	                                    80, 80, 70, 80  // anp, ab, avp, gain
-	                                  };
+		10000, 70,   // f0, av
+		1300, 1000, 3000, 1000, 4999, 1000, 4999, 1000, 6999, 1000, 7000, 1000,  // f1,b1 -- f6,b6
+		528, 1000, 528, 1000, // fnz, bnz, fnp, bnp
+		70, 60, 80, 24, 80, 40,  // ah, kopen, aturb, tilt, af, skew
+		80, 1000, 80, 1000, 80, 1000, 80, 1000, 80, 1000, 80, 1000, // a1,b1p -- a6,b6p
+		80, 80, 70, 80  // anp, ab, avp, gain
+	};
 
 	long nv = 0;
 	for (long irow = 1; irow <= my rows -> size; irow++) {
@@ -1114,16 +1102,13 @@ static int KlattTable_checkLimits (KlattTable me) {
 		for (long j = 1; j <= KlattTable_NPAR; j++) {
 			if (nviolations_lower[j] > 0) {
 				if (nviolations_upper[j] > 0) {
-					MelderInfo_writeLine (columnNamesA[j], U": ",
-					                       nviolations_lower[j], U" frame(s) < min = ", nviolations_lower[j], U"; ",
-					                       nviolations_upper[j], U" frame(s) > max = ", upper[j]);
+					MelderInfo_writeLine (columnNamesA[j], U": ", nviolations_lower[j], U" frame(s) < min = ", nviolations_lower[j], U"; ",
+						nviolations_upper[j], U" frame(s) > max = ", upper[j]);
 				} else {
-					MelderInfo_writeLine (columnNamesA[j], U": ",
-					                       nviolations_lower[j], U" frame(s) < min = ", lower[j]);
+					MelderInfo_writeLine (columnNamesA[j], U": ", nviolations_lower[j], U" frame(s) < min = ", lower[j]);
 				}
 			} else if (nviolations_upper[j] > 0) {
-				MelderInfo_writeLine (columnNamesA[j], U": ",
-				                       nviolations_upper[j], U" frame(s) > max = ", upper[j]);
+				MelderInfo_writeLine (columnNamesA[j], U": ", nviolations_upper[j], U" frame(s) > max = ", upper[j]);
 			}
 		}
 		MelderInfo_close ();
@@ -1132,7 +1117,7 @@ static int KlattTable_checkLimits (KlattTable me) {
 	return 1;
 }
 
-Sound KlattTable_to_Sound (KlattTable me, double samplingFrequency, int synthesisModel, int numberOfFormants, double frameDuration, int glottalSource, double flutter, int outputType) {
+autoSound KlattTable_to_Sound (KlattTable me, double samplingFrequency, int synthesisModel, int numberOfFormants, double frameDuration, int glottalSource, double flutter, int outputType) {
 	KlattGlobal thee = 0;
 	KlattFrame frame = 0;
 	try {
@@ -1187,7 +1172,7 @@ Sound KlattTable_to_Sound (KlattTable me, double samplingFrequency, int synthesi
 			}
 		}
 		KlattGlobal_free (thee); KlattFrame_free (frame);
-		return him.transfer ();
+		return him;
 	} catch (MelderError) {
 		KlattGlobal_free (thee);
 		KlattFrame_free (frame);
@@ -1196,7 +1181,7 @@ Sound KlattTable_to_Sound (KlattTable me, double samplingFrequency, int synthesi
 }
 
 
-KlattTable KlattTable_createExample () {
+autoKlattTable KlattTable_createExample () {
 	long nrows = 1376;
 	struct klatt_params {
 		short p[40];
@@ -2590,30 +2575,30 @@ KlattTable KlattTable_createExample () {
 				Table_setNumericValue ( (Table) me.peek(), irow, jcol, val);
 			}
 		}
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U" KlattTable example not created.");
 	}
 }
 
-KlattTable Table_to_KlattTable (Table me) {
+autoKlattTable Table_to_KlattTable (Table me) {
 	try {
 		if (my numberOfColumns != KlattTable_NPAR) {
 			Melder_throw (U"A KlattTable needs ", KlattTable_NPAR, U" columns.");
 		}
 		autoKlattTable thee = Thing_new (KlattTable);
 		my structTable :: v_copy (thee.peek());
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (U"KlattTable not created from Table.");
 	}
 }
 
-Table KlattTable_to_Table (KlattTable me) {
+autoTable KlattTable_to_Table (KlattTable me) {
 	try {
 		autoTable thee = Thing_new (Table);
 		my structTable :: v_copy (thee.peek());
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (U"Table not created from KlattTable.");
 	}
diff --git a/dwtools/KlattTable.h b/dwtools/KlattTable.h
index 912a2b6..60e49ca 100644
--- a/dwtools/KlattTable.h
+++ b/dwtools/KlattTable.h
@@ -2,7 +2,7 @@
 #define _KlattTable_h_
 /* KlattTable.h
  *
- * Copyright (C) 2008-2011 David Weenink
+ * Copyright (C) 2008-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@
 Thing_define (KlattTable, Table) {
 };
 
-KlattTable KlattTable_create (double frameDuration, double totalDuration);
+autoKlattTable KlattTable_create (double frameDuration, double totalDuration);
 /*
 f0  (08)	This is the fundamental frequency (pitch) of the utterance.
 		In this case it is specified in steps of 0.1 Hz, hence 100Hz
@@ -94,16 +94,16 @@ gain  	Overall gain in dB range 0-80.
 
 */
 
-Sound KlattTable_to_Sound (KlattTable me, double samplingFrequency, int synthesisModel, int numberOfFormants, double frameDuration, int voicing,
-double flutter, int outputType);
+autoSound KlattTable_to_Sound (KlattTable me, double samplingFrequency, int synthesisModel, int numberOfFormants, double frameDuration, int voicing, double flutter, int outputType);
 
-Sound KlattTable_and_Sound_to_Sound (KlattTable me, Sound thee);
+autoSound KlattTable_and_Sound_to_Sound (KlattTable me, Sound thee);
 
-KlattTable KlattTable_createExample ();
+autoKlattTable KlattTable_createExample ();
 
-KlattTable Table_to_KlattTable (Table me);
-Table KlattTable_to_Table (KlattTable me);
+autoKlattTable Table_to_KlattTable (Table me);
 
-KlattTable KlattTable_readFromRawTextFile (MelderFile fs);
+autoTable KlattTable_to_Table (KlattTable me);
+
+autoKlattTable KlattTable_readFromRawTextFile (MelderFile fs);
 
 #endif /* _KlattTable_h_ */
diff --git a/dwtools/LFCC.cpp b/dwtools/LFCC.cpp
index c1e0f3e..e819545 100644
--- a/dwtools/LFCC.cpp
+++ b/dwtools/LFCC.cpp
@@ -2,7 +2,7 @@
  *
  *	Linear Frequency Cepstral Coefficients class.
  *
- * Copyright (C) 1993-2011 David Weenink
+ * Copyright (C) 1993-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -29,12 +29,11 @@
 
 Thing_implement (LFCC, CC, 1);
 
-LFCC LFCC_create (double tmin, double tmax, long nt, double dt, double t1,
-                  long maximumNumberOfCoefficients, double fmin, double fmax) {
+autoLFCC LFCC_create (double tmin, double tmax, long nt, double dt, double t1, long maximumNumberOfCoefficients, double fmin, double fmax) {
 	try {
 		autoLFCC me = Thing_new (LFCC);
 		CC_init (me.peek(), tmin, tmax, nt, dt, t1, maximumNumberOfCoefficients, fmin, fmax);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"LFCC not created.");
 	}
diff --git a/dwtools/LFCC.h b/dwtools/LFCC.h
index 40263ef..fb2e737 100644
--- a/dwtools/LFCC.h
+++ b/dwtools/LFCC.h
@@ -4,7 +4,7 @@
  *
  * Linear Frequency Cepstral Coefficients class.
  *
- * Copyright (C) 1993-2011 David Weenink
+ * Copyright (C) 1993-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@
 Thing_define (LFCC, CC) {
 };
 
-LFCC LFCC_create (double tmin, double tmax, long nt, double dt, double t1,
+autoLFCC LFCC_create (double tmin, double tmax, long nt, double dt, double t1,
 	long maximumNumberOfCoefficients, double fmin, double fmax);
 
 #endif /* _LFCC_h_ */
diff --git a/dwtools/LongSound_extensions.cpp b/dwtools/LongSound_extensions.cpp
index 04b0ba3..76f3dff 100644
--- a/dwtools/LongSound_extensions.cpp
+++ b/dwtools/LongSound_extensions.cpp
@@ -1,6 +1,6 @@
 /* LongSound_extensions.c
  *
- * Copyright (C) 1993-2013 David Weenink
+ * Copyright (C) 1993-2013, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -153,8 +153,9 @@ static void MelderFile_truncate (MelderFile me, long size) {
 #elif defined(linux) || defined(macintosh)
 
 	MelderFile_close (me);
-	if (truncate (Melder_peek32to8 (my path), size) == -1) Melder_throw (U"Truncating failed for file ",
-		        MelderFile_messageName (me), U" (", Melder_peek8to32 (strerror (errno)), U").");
+	if (truncate (Melder_peek32to8 (my path), size) == -1) {
+		Melder_throw (U"Truncating failed for file ", MelderFile_messageName (me), U" (", Melder_peek8to32 (strerror (errno)), U").");
+	}
 #else
 	Melder_throw (U"Don't know what to do.");
 #endif
diff --git a/dwtools/Matrix_Categories.cpp b/dwtools/Matrix_Categories.cpp
index 6c6754d..1ac87d4 100644
--- a/dwtools/Matrix_Categories.cpp
+++ b/dwtools/Matrix_Categories.cpp
@@ -1,6 +1,6 @@
 /* Matrix_Categories.cpp
  *
- * Copyright (C) 1993-2011 David Weenink
+ * Copyright (C) 1993-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@
 #include "Matrix_Categories.h"
 #include "TableOfReal_extensions.h"
 
-TableOfReal Matrix_and_Categories_to_TableOfReal (Matrix me, Categories thee) {
+autoTableOfReal Matrix_and_Categories_to_TableOfReal (Matrix me, Categories thee) {
 	try {
 		if (thy size != my ny) {
 			Melder_throw (U"Number of rows and number of categories must be equal.");
@@ -41,7 +41,7 @@ TableOfReal Matrix_and_Categories_to_TableOfReal (Matrix me, Categories thee) {
 				his data[i][j] = my z[i][j];
 			}
 		}
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (U"TableOfReal not created from Matrix & Categories.");
 	}
diff --git a/dwtools/Matrix_Categories.h b/dwtools/Matrix_Categories.h
index 8c03708..9943475 100644
--- a/dwtools/Matrix_Categories.h
+++ b/dwtools/Matrix_Categories.h
@@ -2,7 +2,7 @@
 #define _Matrix_Categories_h_
 /* Matrix_Categories.h
  *
- * Copyright (C) 1993-2011 David Weenink
+ * Copyright (C) 1993-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -28,6 +28,6 @@
 #include "Categories.h"
 #include "TableOfReal.h"
 
-TableOfReal Matrix_and_Categories_to_TableOfReal (Matrix me, Categories thee);
+autoTableOfReal Matrix_and_Categories_to_TableOfReal (Matrix me, Categories thee);
 
 #endif /* _Matrix_Categories_h_ */
diff --git a/dwtools/Matrix_extensions.cpp b/dwtools/Matrix_extensions.cpp
index 1829492..c56e528 100644
--- a/dwtools/Matrix_extensions.cpp
+++ b/dwtools/Matrix_extensions.cpp
@@ -30,9 +30,7 @@
 #include "Eigen.h"
 #include "NUM2.h"
 
-void Matrix_scatterPlot (Matrix me, Graphics g, long icx, long icy, double xmin, double xmax, double ymin, double ymax,
-	double size_mm, const char32 *mark, int garnish)
-{
+void Matrix_scatterPlot (Matrix me, Graphics g, long icx, long icy, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, int garnish) {
 	long ix = labs (icx), iy = labs (icy);
 
 	if (ix < 1 || ix > my nx || iy < 1 || iy > my nx) {
@@ -63,8 +61,7 @@ void Matrix_scatterPlot (Matrix me, Graphics g, long icx, long icy, double xmin,
 	}
 	Graphics_setWindow (g, xmin, xmax, ymin, ymax);
 	for (long i = 1; i <= my ny; i++) {
-		if (my z[i][ix] >= xmin && my z[i][ix] <= xmax &&
-		        my z[i][iy] >= ymin && my z[i][iy] <= ymax) {
+		if (my z[i][ix] >= xmin && my z[i][ix] <= xmax && my z[i][iy] >= ymin && my z[i][iy] <= ymax) {
 			Graphics_mark (g, my z[i][ix], my z[i][iy], size_mm, mark);
 		}
 	}
@@ -179,24 +176,21 @@ void Matrix_scale (Matrix me, int choice) {
 	}
 }
 
-Matrix Matrix_transpose (Matrix me) {
+autoMatrix Matrix_transpose (Matrix me) {
 	try {
-		autoMatrix thee = Matrix_create (my ymin, my ymax, my ny, my dy, my y1,
-		                                 my xmin, my xmax, my nx, my dx, my x1);
+		autoMatrix thee = Matrix_create (my ymin, my ymax, my ny, my dy, my y1, my xmin, my xmax, my nx, my dx, my x1);
 		for (long i = 1; i <= my ny; i++) {
 			for (long j = 1; j <= my nx; j++) {
 				thy z[j][i] = my z[i][j];
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not transposed.");
 	}
 }
 
-void Matrix_drawDistribution (Matrix me, Graphics g, double xmin, double xmax,
-                              double ymin, double ymax, double minimum, double maximum, long nBins,
-                              double freqMin, double freqMax, int cumulative, int garnish) {
+void Matrix_drawDistribution (Matrix me, Graphics g, double xmin, double xmax, double ymin, double ymax, double minimum, double maximum, long nBins, double freqMin, double freqMax, int cumulative, int garnish) {
 	if (nBins <= 0) {
 		return;
 	}
@@ -207,19 +201,18 @@ void Matrix_drawDistribution (Matrix me, Graphics g, double xmin, double xmax,
 		ymin = my ymin; ymax = my ymax;
 	}
 	long ixmin, ixmax, iymin, iymax;
-	if (Matrix_getWindowSamplesX (me, xmin, xmax, & ixmin, & ixmax) == 0 ||
-	        Matrix_getWindowSamplesY (me, ymin, ymax, & iymin, & iymax) == 0) {
+	if ((Matrix_getWindowSamplesX (me, xmin, xmax, & ixmin, & ixmax) == 0) || 
+		(Matrix_getWindowSamplesY (me, ymin, ymax, & iymin, & iymax) == 0)) {
 		return;
 	}
-	if (maximum <= minimum) Matrix_getWindowExtrema (me, ixmin, ixmax, iymin,
-		        iymax, & minimum, & maximum);
+	if (maximum <= minimum) {
+		Matrix_getWindowExtrema (me, ixmin, ixmax, iymin, iymax, & minimum, & maximum);
+	}
 	if (maximum <= minimum) {
 		minimum -= 1.0; maximum += 1.0;
 	}
 
-	/*
-		Count the numbers per bin and the total
-	*/
+	// Count the numbers per bin and the total
 
 	if (nBins < 1) {
 		nBins = 10;
@@ -258,8 +251,9 @@ void Matrix_drawDistribution (Matrix me, Graphics g, double xmin, double xmax,
 		if (ftmp > freqMax) {
 			ftmp = freqMax;
 		}
-		if (ftmp > freqMin) Graphics_rectangle (g, minimum + (i - 1) *
-			                                        binWidth, minimum + i * binWidth, freqMin, ftmp);
+		if (ftmp > freqMin) {
+			Graphics_rectangle (g, minimum + (i - 1) * binWidth, minimum + i * binWidth, freqMin, ftmp);
+		}
 	}
 	Graphics_unsetInner (g);
 	if (garnish) {
@@ -272,8 +266,7 @@ void Matrix_drawDistribution (Matrix me, Graphics g, double xmin, double xmax,
 	}
 }
 
-void Matrix_drawSliceY (Matrix me, Graphics g, double x, double ymin, double ymax,
-                        double min, double max) {
+void Matrix_drawSliceY (Matrix me, Graphics g, double x, double ymin, double ymax, double min, double max) {
 
 	if (x < my xmin || x > my xmax) {
 		return;
@@ -305,12 +298,11 @@ void Matrix_drawSliceY (Matrix me, Graphics g, double x, double ymin, double yma
 	for (long i = iymin; i <= iymax; i++) {
 		y[i] = my z[i][ix];
 	}
-	Graphics_function (g, y.peek(), iymin, iymax, Matrix_rowToY (me, iymin),
-	                   Matrix_rowToY (me, iymax));
+	Graphics_function (g, y.peek(), iymin, iymax, Matrix_rowToY (me, iymin), Matrix_rowToY (me, iymax));
 	Graphics_unsetInner (g);
 }
 
-Matrix Matrix_solveEquation (Matrix me, double tolerance) {
+autoMatrix Matrix_solveEquation (Matrix me, double tolerance) {
 	try {
 		long nr = my ny, nc = my nx - 1;
 
@@ -351,8 +343,8 @@ double Matrix_getMean (Matrix me, double xmin, double xmax, double ymin, double
 		ymin = my ymin; ymax = my ymax;
 	}
 	long ixmin, ixmax, iymin, iymax;
-	if (Matrix_getWindowSamplesX (me, xmin, xmax, & ixmin, & ixmax) == 0 ||
-	        Matrix_getWindowSamplesY (me, ymin, ymax, & iymin, & iymax) == 0) {
+	if ((Matrix_getWindowSamplesX (me, xmin, xmax, & ixmin, & ixmax) == 0) ||
+		(Matrix_getWindowSamplesY (me, ymin, ymax, & iymin, & iymax) == 0)) {
 		return NUMundefined;
 	}
 	double sum = 0.0;
@@ -372,8 +364,8 @@ double Matrix_getStandardDeviation (Matrix me, double xmin, double xmax, double
 		ymin = my ymin; ymax = my ymax;
 	}
 	long ixmin, ixmax, iymin, iymax;
-	if (Matrix_getWindowSamplesX (me, xmin, xmax, & ixmin, & ixmax) == 0 ||
-	        Matrix_getWindowSamplesY (me, ymin, ymax, & iymin, & iymax) == 0) {
+	if ((Matrix_getWindowSamplesX (me, xmin, xmax, & ixmin, & ixmax) == 0) ||
+		(Matrix_getWindowSamplesY (me, ymin, ymax, & iymin, & iymax) == 0)) {
 		return NUMundefined;
 	}
 	long nx = ixmax - ixmin + 1, ny = iymax - iymin + 1;
diff --git a/dwtools/Matrix_extensions.h b/dwtools/Matrix_extensions.h
index 86f6c12..f416e68 100644
--- a/dwtools/Matrix_extensions.h
+++ b/dwtools/Matrix_extensions.h
@@ -2,7 +2,7 @@
 #define _Matrix_extensions_h_
 /* Matrix_extensions.h
  *
- * Copyright (C) 1993-2011 David Weenink
+ * Copyright (C) 1993-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -45,7 +45,7 @@ void Matrix_scale (Matrix me, int choice);
 /* choice = 2 :rows, divide each row elmnt by the maximum (abs) of that row	*/
 /* choice = 3 :columns, divide each col elmnt by the maximum of that col	*/
 
-Matrix Matrix_transpose (Matrix me);
+autoMatrix Matrix_transpose (Matrix me);
 
 void Matrix_drawDistribution (Matrix me, Graphics g, double xmin, double xmax,
 	double ymin, double ymax, double minimum, double maximum, long nBins,
@@ -56,9 +56,10 @@ void Matrix_drawSliceY (Matrix me, Graphics g, double x, double ymin, double yma
 
 int Matrix_fitPolynomial (Matrix me, long maxDegree);
 
-Matrix Matrix_solveEquation (Matrix me, double tolerance);
+autoMatrix Matrix_solveEquation (Matrix me, double tolerance);
 
 double Matrix_getMean (Matrix me, double xmin, double xmax, double ymin, double ymax);
+
 double Matrix_getStandardDeviation (Matrix me, double xmin, double xmax, double ymin, double ymax);
 
 
diff --git a/dwtools/OptimalCeilingTier.cpp b/dwtools/OptimalCeilingTier.cpp
index 0b96e42..93c202d 100644
--- a/dwtools/OptimalCeilingTier.cpp
+++ b/dwtools/OptimalCeilingTier.cpp
@@ -21,11 +21,11 @@
 
 Thing_implement (OptimalCeilingTier, RealTier, 0);
 
-OptimalCeilingTier OptimalCeilingTier_create (double tmin, double tmax) {
+autoOptimalCeilingTier OptimalCeilingTier_create (double tmin, double tmax) {
 	try {
 		autoOptimalCeilingTier me = Thing_new (OptimalCeilingTier);
 		RealTier_init (me.peek(), tmin, tmax);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"OptimalCeilingTier not created.");
 	}
@@ -37,8 +37,10 @@ void OptimalCeilingTier_draw (OptimalCeilingTier me, Graphics g, double tmin, do
 	RealTier_draw (me, g, tmin, tmax, ymin, ymax, garnish, method, U"Sound pressure (Pa)");
 }
 
-TableOfReal OptimalCeilingTier_downto_TableOfReal (OptimalCeilingTier me) {
-	return RealTier_downto_TableOfReal (me, U"Time (s)", U"Frequency (Hz)");
+autoTableOfReal OptimalCeilingTier_downto_TableOfReal (OptimalCeilingTier me) {
+	autoTableOfReal thee = RealTier_downto_TableOfReal (me, U"Time (s)", U"Frequency (Hz)");
+	return thee;
+
 }
 
 /* End of file OptimalCeilingTier.cpp */
diff --git a/dwtools/OptimalCeilingTier.h b/dwtools/OptimalCeilingTier.h
index 7cb61b0..d17edf1 100644
--- a/dwtools/OptimalCeilingTier.h
+++ b/dwtools/OptimalCeilingTier.h
@@ -30,12 +30,12 @@ Thing_define (OptimalCeilingTier, RealTier) {
 		override { return MelderQuantity_TIME_SECONDS; }
 };
 
-OptimalCeilingTier OptimalCeilingTier_create (double tmin, double tmax);
+autoOptimalCeilingTier OptimalCeilingTier_create (double tmin, double tmax);
 
 void OptimalCeilingTier_draw (OptimalCeilingTier me, Graphics g, double tmin, double tmax,
 	double ymin, double ymax, const char32 *method, int garnish);
 
-TableOfReal OptimalCeilingTier_downto_TableOfReal (OptimalCeilingTier me);
+autoTableOfReal OptimalCeilingTier_downto_TableOfReal (OptimalCeilingTier me);
 
 /* End of file OptimalCeilingTier.h */
 #endif
diff --git a/dwtools/PCA.cpp b/dwtools/PCA.cpp
index 06cc7c3..02b40f9 100644
--- a/dwtools/PCA.cpp
+++ b/dwtools/PCA.cpp
@@ -2,7 +2,7 @@
  *
  * Principal Component Analysis
  *
- * Copyright (C) 1993-2012 David Weenink
+ * Copyright (C) 1993-2012, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -69,13 +69,13 @@ void structPCA :: v_info () {
 	MelderInfo_writeLine (U"Number of observations: ", numberOfObservations);
 }
 
-PCA PCA_create (long numberOfComponents, long dimension) {
+autoPCA PCA_create (long numberOfComponents, long dimension) {
 	try {
 		autoPCA me = Thing_new (PCA);
 		Eigen_init (me.peek(), numberOfComponents, dimension);
 		my labels = NUMvector<char32 *> (1, dimension);
 		my centroid = NUMvector<double> (1, dimension);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"PCA not created");
 	}
@@ -96,7 +96,7 @@ void PCA_getEqualityOfEigenvalues (PCA me, long from, long to, int conservative,
 	*ndf = 0;
 	*chisq = 0;
 
-	if ( (from > 0 && to == from) || to > my numberOfEigenvalues) {
+	if ((from > 0 && to == from) || to > my numberOfEigenvalues) {
 		return;
 	}
 
@@ -126,7 +126,7 @@ void PCA_getEqualityOfEigenvalues (PCA me, long from, long to, int conservative,
 	*probability = NUMchiSquareQ (*chisq, *ndf);
 }
 
-PCA TableOfReal_to_PCA (I) {
+autoPCA TableOfReal_to_PCA (I) {
 	iam (TableOfReal);
 	try {
 		long m = my numberOfRows, n = my numberOfColumns;
@@ -134,13 +134,12 @@ PCA TableOfReal_to_PCA (I) {
 		if (! TableOfReal_areAllCellsDefined (me, 0, 0, 0, 0)) {
 			Melder_throw (U"Undefined cells.");
 		}
-
-		if (m < 2) Melder_throw (U"There is not enough data to perform a PCA.\n"
-			                         "Your table has less than 2 rows.");
-
-		if (m < n) Melder_warning (U"The number of rows in your table is less than the\n"
-			                           "number of columns. ");
-
+		if (m < 2) {
+			Melder_throw (U"There is not enough data to perform a PCA.\nYour table has less than 2 rows.");
+		}
+		if (m < n) {
+			Melder_warning (U"The number of rows in your table is less than the \nnumber of columns. ");
+		}
 		if (NUMfrobeniusnorm (m, n, my data) == 0) {
 			Melder_throw (U"All values in your table are zero.");
 		}
@@ -175,13 +174,13 @@ PCA TableOfReal_to_PCA (I) {
 		for (long i = 1; i <= thy numberOfEigenvalues; i++) {
 			thy eigenvalues[i] /= (m - 1);
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": PCA not created.");
 	}
 }
 
-TableOfReal PCA_and_TableOfReal_to_TableOfReal_zscores (PCA me, TableOfReal thee, long numberOfDimensions) {
+autoTableOfReal PCA_and_TableOfReal_to_TableOfReal_zscores (PCA me, TableOfReal thee, long numberOfDimensions) {
 	try {
 		if (numberOfDimensions == 0 || numberOfDimensions > my numberOfEigenvalues) {
 			numberOfDimensions = my numberOfEigenvalues;
@@ -199,14 +198,13 @@ TableOfReal PCA_and_TableOfReal_to_TableOfReal_zscores (PCA me, TableOfReal thee
 		}
 		NUMstrings_copyElements (thy rowLabels, his rowLabels, 1, thy numberOfRows);
 		TableOfReal_setSequentialColumnLabels (him.peek(), 0, 0, U"pc", 1, 1);
-		return him.transfer();
-
+		return him;
 	} catch (MelderError) {
 		Melder_throw (U"TableOfReal (zscores) not created from PCA & TableOfReal.");
 	}
 }
 
-Configuration PCA_and_TableOfReal_to_Configuration (PCA me, thou, long numberOfDimensions) {
+autoConfiguration PCA_and_TableOfReal_to_Configuration (PCA me, thou, long numberOfDimensions) {
 	try {
 		thouart (TableOfReal);
 		if (numberOfDimensions == 0 || numberOfDimensions > my numberOfEigenvalues) {
@@ -214,17 +212,16 @@ Configuration PCA_and_TableOfReal_to_Configuration (PCA me, thou, long numberOfD
 		}
 
 		autoConfiguration him = Configuration_create (thy numberOfRows, numberOfDimensions);
-		Configuration thim = him.peek();
-		Eigen_and_TableOfReal_project_into (me, thee, 1, thy numberOfColumns, & thim, 1, numberOfDimensions);
+		Eigen_and_TableOfReal_project_into (me, thee, 1, thy numberOfColumns, him.peek(), 1, numberOfDimensions);
 		NUMstrings_copyElements (thy rowLabels, his rowLabels, 1, thy numberOfRows);
 		TableOfReal_setSequentialColumnLabels (him.peek(), 0, 0, U"pc", 1, 1);
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (U"Configuration not created from PCA & TableOfReal.");
 	}
 }
 
-TableOfReal PCA_and_Configuration_to_TableOfReal_reconstruct (PCA me, thou) {
+autoTableOfReal PCA_and_Configuration_to_TableOfReal_reconstruct (PCA me, thou) {
 	try {
 		thouart (Configuration);
 		long npc = thy numberOfColumns;
@@ -250,7 +247,7 @@ TableOfReal PCA_and_Configuration_to_TableOfReal_reconstruct (PCA me, thou) {
 				}
 			}
 		}
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (U"TableOfReal not reconstructed.");
 	}
@@ -274,7 +271,7 @@ double PCA_and_TableOfReal_getFractionVariance (PCA me, thou, long from, long to
 	}
 }
 
-TableOfReal PCA_to_TableOfReal_reconstruct1 (PCA me, char32 *numstring) {
+autoTableOfReal PCA_to_TableOfReal_reconstruct1 (PCA me, char32 *numstring) {
 	try {
 		long npc;
 		autoNUMvector<double> pc (NUMstring_to_numbers (numstring, & npc), 1);
@@ -284,11 +281,10 @@ TableOfReal PCA_to_TableOfReal_reconstruct1 (PCA me, char32 *numstring) {
 			c -> data [1][j] = pc[j];
 		}
 		autoTableOfReal him = PCA_and_Configuration_to_TableOfReal_reconstruct (me, c.peek());
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (me, U" not reconstructed.");
 	}
 }
 
-
 /* End of file PCA.cpp */
diff --git a/dwtools/PCA.h b/dwtools/PCA.h
index e197162..4f1238f 100644
--- a/dwtools/PCA.h
+++ b/dwtools/PCA.h
@@ -4,7 +4,7 @@
  *
  * Principal Component Analysis
  * 
- * Copyright (C) 1993-2012 David Weenink
+ * Copyright (C) 1993-2012, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -34,20 +34,22 @@
 #include "PCA_def.h"
 oo_CLASS_CREATE (PCA, Eigen);
 
-PCA PCA_create (long numberOfComponents, long dimension);
+autoPCA PCA_create (long numberOfComponents, long dimension);
 
 void PCA_setNumberOfObservations (PCA me, long numberOfObservations);
+
 long PCA_getNumberOfObservations (PCA me);
 
-PCA TableOfReal_to_PCA (I);
+autoPCA TableOfReal_to_PCA (I);
 /* Calculate PCA of M'M */
 
 void PCA_getEqualityOfEigenvalues (PCA me, long from, long to, int conservative,
 	double *probability, double *chisq, long *ndf);
 /* Morrison, Multivariate statistical methods, page 336 */
 
-Configuration PCA_and_TableOfReal_to_Configuration (PCA me, thou, long numberOfDimensions);
-TableOfReal PCA_and_TableOfReal_to_TableOfReal_zscores (PCA me, TableOfReal thee, long numberOfDimensions);
+autoConfiguration PCA_and_TableOfReal_to_Configuration (PCA me, thou, long numberOfDimensions);
+
+autoTableOfReal PCA_and_TableOfReal_to_TableOfReal_zscores (PCA me, TableOfReal thee, long numberOfDimensions);
 
 double PCA_and_TableOfReal_getFractionVariance (PCA me, thou, long from, long to);
 /*	Get fraction variance of the table projected in the pca-space.
@@ -55,10 +57,10 @@ double PCA_and_TableOfReal_getFractionVariance (PCA me, thou, long from, long to
 	and quering the projected Covariance for 'fraction variance'.
 */
 
-TableOfReal PCA_and_Configuration_to_TableOfReal_reconstruct (PCA me, thou);
+autoTableOfReal PCA_and_Configuration_to_TableOfReal_reconstruct (PCA me, thou);
 /* Reconstruct the original TableOfReal from the PCA and the Configuration */
 
-TableOfReal PCA_to_TableOfReal_reconstruct1 (PCA me, char32 *numstring);
+autoTableOfReal PCA_to_TableOfReal_reconstruct1 (PCA me, char32 *numstring);
 
 #endif /* _PCA_h_ */
 
diff --git a/dwtools/Pitch_extensions.cpp b/dwtools/Pitch_extensions.cpp
index b00a278..54d031a 100644
--- a/dwtools/Pitch_extensions.cpp
+++ b/dwtools/Pitch_extensions.cpp
@@ -1,6 +1,6 @@
 /* Pitch_extensions.cpp
  *
- * Copyright (C) 1993-2011 David Weenink
+ * Copyright (C) 1993-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -32,17 +32,18 @@ void Pitch_Frame_addPitch (Pitch_Frame me, double f, double strength, int maxnCa
 	if (my nCandidates < maxnCandidates) {
 		pos = ++ my nCandidates;
 	} else {
-		/* Find weakest candidate so far (skip the unvoiced one) */
-		for (long i = 1; i <= maxnCandidates; i++) if (my candidate[i].strength < weakest &&
-			        my candidate[i].frequency > 0) {
+		// Find weakest candidate so far (skip the unvoiced one)
+		for (long i = 1; i <= maxnCandidates; i++) {
+			if (my candidate[i].strength < weakest && my candidate[i].frequency > 0) {
 				weakest = my candidate[i].strength;
 				pos = i;
 			}
+		}
 		if (strength < weakest) {
 			pos = 0;
 		}
 	}
-	if (pos) {
+	if (pos > 0) {
 		my candidate[pos].frequency = f;
 		my candidate[pos].strength = strength;
 	}
@@ -51,16 +52,16 @@ void Pitch_Frame_addPitch (Pitch_Frame me, double f, double strength, int maxnCa
 void Pitch_Frame_getPitch (Pitch_Frame me, double *f, double *strength) {
 	long pos = 1;
 	*strength = -1;
-	for (long i = 1; i <= my nCandidates; i++) if (my candidate[i].strength > *strength &&
-		        my candidate[i].frequency > 0) {
+	for (long i = 1; i <= my nCandidates; i++) {
+		if (my candidate[i].strength > *strength && my candidate[i].frequency > 0) {
 			*strength = my candidate[i].strength;
 			pos = i;
 		}
+	}
 	*f = my candidate[pos].frequency;
 }
 
-void Pitch_Frame_resizeStrengths (Pitch_Frame me, double maxStrength,
-                                  double unvoicedCriterium) {
+void Pitch_Frame_resizeStrengths (Pitch_Frame me, double maxStrength, double unvoicedCriterium) {
 	int pos = 1;
 	double strongest = my candidate[1].strength;
 	for (long i = 2; i <= my nCandidates; i++) {
@@ -75,11 +76,12 @@ void Pitch_Frame_resizeStrengths (Pitch_Frame me, double maxStrength,
 		}
 	}
 	if (maxStrength < unvoicedCriterium) {
-		for (long i = 1; i <= my nCandidates; i++)
+		for (long i = 1; i <= my nCandidates; i++) {
 			if (my candidate[i].frequency == 0) {
 				pos = i;
 				break;
 			}
+		}
 	}
 	if (pos != 1) {
 		double tmp = my candidate[1].frequency;
@@ -91,7 +93,7 @@ void Pitch_Frame_resizeStrengths (Pitch_Frame me, double maxStrength,
 	}
 }
 
-Pitch Pitch_scaleTime (Pitch me, double scaleFactor) {
+autoPitch Pitch_scaleTime (Pitch me, double scaleFactor) {
 	try {
 		double dx = my dx, x1 = my x1, xmax = my xmax;
 		if (scaleFactor != 1) {
@@ -108,7 +110,7 @@ Pitch Pitch_scaleTime (Pitch me, double scaleFactor) {
 				thy frame[i].candidate[1].frequency = f;
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not scaled.");
 	}
@@ -116,33 +118,30 @@ Pitch Pitch_scaleTime (Pitch me, double scaleFactor) {
 
 static double HertzToSpecial (double value, int pitchUnit) {
 	return	pitchUnit == kPitch_unit_HERTZ ? value :
-	        pitchUnit == kPitch_unit_HERTZ_LOGARITHMIC ? value <= 0.0 ? NUMundefined : log10 (value) :
-		        pitchUnit == kPitch_unit_MEL ? NUMhertzToMel (value) :
-		        pitchUnit == kPitch_unit_LOG_HERTZ ? value <= 0.0 ? NUMundefined : log10 (value) :
-		        pitchUnit == kPitch_unit_SEMITONES_1 ? value <= 0.0 ? NUMundefined : 12.0 * log (value / 1.0) / NUMln2 :
-		        pitchUnit == kPitch_unit_SEMITONES_100 ? value <= 0.0 ? NUMundefined : 12.0 * log (value / 100.0) / NUMln2 :
-		        pitchUnit == kPitch_unit_SEMITONES_200 ? value <= 0.0 ? NUMundefined : 12.0 * log (value / 200.0) / NUMln2 :
-		        pitchUnit == kPitch_unit_SEMITONES_440 ? value <= 0.0 ? NUMundefined : 12.0 * log (value / 440.0) / NUMln2 :
-		        pitchUnit == kPitch_unit_ERB ? NUMhertzToErb (value) :
-		        NUMundefined;
+		pitchUnit == kPitch_unit_HERTZ_LOGARITHMIC ? value <= 0.0 ? NUMundefined : log10 (value) :
+		pitchUnit == kPitch_unit_MEL ? NUMhertzToMel (value) :
+		pitchUnit == kPitch_unit_LOG_HERTZ ? value <= 0.0 ? NUMundefined : log10 (value) :
+		pitchUnit == kPitch_unit_SEMITONES_1 ? value <= 0.0 ? NUMundefined : 12.0 * log (value / 1.0) / NUMln2 :
+		pitchUnit == kPitch_unit_SEMITONES_100 ? value <= 0.0 ? NUMundefined : 12.0 * log (value / 100.0) / NUMln2 :
+		pitchUnit == kPitch_unit_SEMITONES_200 ? value <= 0.0 ? NUMundefined : 12.0 * log (value / 200.0) / NUMln2 :
+		pitchUnit == kPitch_unit_SEMITONES_440 ? value <= 0.0 ? NUMundefined : 12.0 * log (value / 440.0) / NUMln2 :
+		pitchUnit == kPitch_unit_ERB ? NUMhertzToErb (value) : NUMundefined;
 }
 
 static double SpecialToHertz (double value, int pitchUnit) {
 	return	pitchUnit == kPitch_unit_HERTZ ? value :
-	        pitchUnit == kPitch_unit_HERTZ_LOGARITHMIC ? pow (10.0, value) :
-	        pitchUnit == kPitch_unit_MEL ? NUMmelToHertz (value) :
-	        pitchUnit == kPitch_unit_LOG_HERTZ ? pow (10.0, value) :
-	        pitchUnit == kPitch_unit_SEMITONES_1 ? 1.0 * exp (value * (NUMln2 / 12.0)) :
-	        pitchUnit == kPitch_unit_SEMITONES_100 ? 100.0 * exp (value * (NUMln2 / 12.0)) :
-	        pitchUnit == kPitch_unit_SEMITONES_200 ? 200.0 * exp (value * (NUMln2 / 12.0)) :
-	        pitchUnit == kPitch_unit_SEMITONES_440 ? 440.0 * exp (value * (NUMln2 / 12.0)) :
-	        pitchUnit == kPitch_unit_ERB ? NUMerbToHertz (value) : NUMundefined;
+		pitchUnit == kPitch_unit_HERTZ_LOGARITHMIC ? pow (10.0, value) :
+		pitchUnit == kPitch_unit_MEL ? NUMmelToHertz (value) :
+		pitchUnit == kPitch_unit_LOG_HERTZ ? pow (10.0, value) :
+		pitchUnit == kPitch_unit_SEMITONES_1 ? 1.0 * exp (value * (NUMln2 / 12.0)) :
+		pitchUnit == kPitch_unit_SEMITONES_100 ? 100.0 * exp (value * (NUMln2 / 12.0)) :
+		pitchUnit == kPitch_unit_SEMITONES_200 ? 200.0 * exp (value * (NUMln2 / 12.0)) :
+		pitchUnit == kPitch_unit_SEMITONES_440 ? 440.0 * exp (value * (NUMln2 / 12.0)) :
+		pitchUnit == kPitch_unit_ERB ? NUMerbToHertz (value) : NUMundefined;
 }
 
-PitchTier PitchTier_normalizePitchRange (PitchTier me, double pitchMin_ref_Hz, double pitchMax_ref_Hz,
-        double pitchMin_Hz, double pitchMax_Hz, int pitchUnit);
-PitchTier PitchTier_normalizePitchRange (PitchTier me, double pitchMin_ref_Hz, double pitchMax_ref_Hz,
-        double pitchMin_Hz, double pitchMax_Hz, int pitchUnit) {
+autoPitchTier PitchTier_normalizePitchRange (PitchTier me, double pitchMin_ref_Hz, double pitchMax_ref_Hz, double pitchMin_Hz, double pitchMax_Hz, int pitchUnit);
+autoPitchTier PitchTier_normalizePitchRange (PitchTier me, double pitchMin_ref_Hz, double pitchMax_ref_Hz, double pitchMin_Hz, double pitchMax_Hz, int pitchUnit) {
 	try {
 		double fminr = HertzToSpecial (pitchMin_ref_Hz, pitchUnit);
 		double fmaxr = HertzToSpecial (pitchMax_ref_Hz, pitchUnit);
@@ -166,13 +165,13 @@ PitchTier PitchTier_normalizePitchRange (PitchTier me, double pitchMin_ref_Hz, d
 			f = SpecialToHertz (f, pitchUnit);
 			point -> value = f;
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no PitchTier created.");
 	}
 }
 
-Pitch PitchTier_to_Pitch (PitchTier me, double dt, double pitchFloor, double pitchCeiling) {
+autoPitch PitchTier_to_Pitch (PitchTier me, double dt, double pitchFloor, double pitchCeiling) {
 	try {
 		if (my points -> size < 1) {
 			Melder_throw (U"The PitchTier is empty.");
@@ -181,7 +180,7 @@ Pitch PitchTier_to_Pitch (PitchTier me, double dt, double pitchFloor, double pit
 			Melder_throw (U"The time step should be a positive number.");
 		}
 		if (pitchFloor >= pitchCeiling) {
-			Melder_throw (U"The pitch ceiling must be a higher number than the pitch floor.");
+			Melder_throw (U"The pitch ceiling must be larger than the pitch floor.");
 		}
 		double tmin = my xmin, tmax = my xmax, t1 = my xmin + dt / 2;
 		long nt = (long) floor ((tmax - tmin - t1) / dt);
@@ -202,7 +201,7 @@ Pitch PitchTier_to_Pitch (PitchTier me, double dt, double pitchFloor, double pit
 			}
 			candidate -> frequency = f;
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no Pitch created.");
 	}
diff --git a/dwtools/Pitch_extensions.h b/dwtools/Pitch_extensions.h
index e466cd2..18b7709 100644
--- a/dwtools/Pitch_extensions.h
+++ b/dwtools/Pitch_extensions.h
@@ -2,7 +2,7 @@
 #define _Pitch_extensions_h_
 /* Pitch_extensions.h
  *
- * Copyright (C) 1993-2011 David Weenink
+ * Copyright (C) 1993-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -29,16 +29,18 @@
 #include "PitchTier.h"
 
 void Pitch_Frame_addPitch (Pitch_Frame me, double f, double strength, int maxnCandidates);
+
 void Pitch_Frame_getPitch (Pitch_Frame me, double *f, double *strength);
+
 void Pitch_Frame_resizeStrengths (Pitch_Frame me, double maxStrength, double unvoicedCriterium);
 	
-Pitch Pitch_scaleTime (Pitch me, double scaleFactor);
+autoPitch Pitch_scaleTime (Pitch me, double scaleFactor);
 /*  Scale time domain and pitches:
 	xmin' = xmin; dx' = dx * scaleFactor; x1' = xmin + 0.5 * dx'; 
 	xmax' = xmin + nx * dx';
 	pitch[i]' = pitch[i]/scaleFactor;
 */
 
-Pitch PitchTier_to_Pitch (PitchTier me, double dt, double pitchFloor, double pitchCeiling);
+autoPitch PitchTier_to_Pitch (PitchTier me, double dt, double pitchFloor, double pitchCeiling);
 
 #endif /* _Pitch_extensions_h_ */
diff --git a/dwtools/Polygon_extensions.cpp b/dwtools/Polygon_extensions.cpp
index d7e7218..8eb9565 100644
--- a/dwtools/Polygon_extensions.cpp
+++ b/dwtools/Polygon_extensions.cpp
@@ -1,6 +1,6 @@
 /* Polygon_extensions.c
  *
- * Copyright (C) 1993-2012, 2014 David Weenink
+ * Copyright (C) 1993-2012, 2014, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -58,7 +58,8 @@ void Polygon_getExtrema (Polygon me, double *xmin, double *xmax, double *ymin, d
         }
     }
 }
-Polygon Polygon_createSimple (char32 *xystring) {
+
+autoPolygon Polygon_createSimple (char32 *xystring) {
 	try {
 		long numberOfPoints;
 		autoNUMvector<double> xys (NUMstring_to_numbers (xystring, &numberOfPoints), 1);
@@ -77,20 +78,20 @@ Polygon Polygon_createSimple (char32 *xystring) {
 				Melder_warning (U"Two successives vertices are equal.");
 			}
 		}
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Polygon not created.");
 	}
 }
 
-Polygon Polygon_createFromRandomVertices (long numberOfVertices, double xmin, double xmax, double ymin, double ymax) {
+autoPolygon Polygon_createFromRandomVertices (long numberOfVertices, double xmin, double xmax, double ymin, double ymax) {
 	try {
 		autoPolygon me = Polygon_create (numberOfVertices);
 		for (long i = 1; i <= numberOfVertices; i++) {
 			my x[i] = NUMrandomUniform (xmin, xmax);
 			my y[i] = NUMrandomUniform (ymin, ymax);
 		}
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Polygon not created.");
 	}
@@ -127,19 +128,15 @@ void Polygon_reverseX (Polygon me) {
 	for (long i = 1; i <= my numberOfPoints; i++) {
 		my x[i] = -my x[i];
 	}
-
 }
 
 void Polygon_reverseY (Polygon me) {
 	for (long i = 1; i <= my numberOfPoints; i++) {
 		my y[i] = -my y[i];
 	}
-
 }
 
-void Polygon_Categories_draw (Polygon me, thou, Graphics graphics, double xmin, double xmax,
-                              double ymin, double ymax, int garnish) {
-	thouart (Categories);
+void Polygon_Categories_draw (Polygon me, Categories thee, Graphics graphics, double xmin, double xmax, double ymin, double ymax, int garnish) {
 	double min, max, tmp;
 
 	if (my numberOfPoints != thy size) {
@@ -179,8 +176,7 @@ void Polygon_Categories_draw (Polygon me, thou, Graphics graphics, double xmin,
 	}
 }
 
-static void setWindow (Polygon me, Graphics graphics,
-                       double xmin, double xmax, double ymin, double ymax) {
+static void setWindow (Polygon me, Graphics graphics, double xmin, double xmax, double ymin, double ymax) {
 	Melder_assert (me);
 
 	if (xmax <= xmin) { /* Autoscaling along x axis. */
@@ -216,8 +212,7 @@ static void setWindow (Polygon me, Graphics graphics,
 	Graphics_setWindow (graphics, xmin, xmax, ymin, ymax);
 }
 
-void Polygon_drawMarks (Polygon me, Graphics g, double xmin, double xmax,
-                        double ymin, double ymax, double size_mm, const char32 *mark) {
+void Polygon_drawMarks (Polygon me, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark) {
 	Graphics_setInner (g);
 	setWindow (me, g, xmin, xmax, ymin, ymax);
 	for (long i = 1; i <= my numberOfPoints; i++) {
@@ -228,7 +223,7 @@ void Polygon_drawMarks (Polygon me, Graphics g, double xmin, double xmax,
 
 #define CLIP_Y(y,ymin,ymax) (clip ? ((y) > (ymax) ? (ymax) : (y) < (ymin) ? (ymin) : (y)) : y)
 
-Polygon Sound_to_Polygon (Sound me, int channel, double tmin, double tmax, double ymin, double ymax, double level) {
+autoPolygon Sound_to_Polygon (Sound me, int channel, double tmin, double tmax, double ymin, double ymax, double level) {
 	try {
 		bool clip = ymin < ymax;
 		if (channel < 1 || channel > my ny) {
@@ -282,7 +277,7 @@ Polygon Sound_to_Polygon (Sound me, int channel, double tmin, double tmax, doubl
 		his y[k++] = CLIP_Y (y, ymin, ymax);
 		his x[k] = tmax;
 		his y[k++] = CLIP_Y (level, ymin, ymax);
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (me, U":no Polygon created.");
 	}
@@ -290,7 +285,7 @@ Polygon Sound_to_Polygon (Sound me, int channel, double tmin, double tmax, doubl
 
 /* Area inbetween */
 
-Polygon Sounds_to_Polygon_enclosed (Sound me, Sound thee, int channel, double tmin, double tmax, double ymin, double ymax) {
+autoPolygon Sounds_to_Polygon_enclosed (Sound me, Sound thee, int channel, double tmin, double tmax, double ymin, double ymax) {
 	try {
 		bool clip = ymin < ymax;
 		if (my ny > 1 && thy ny > 1 && my ny != thy ny) {
@@ -377,7 +372,7 @@ Polygon Sounds_to_Polygon_enclosed (Sound me, Sound thee, int channel, double tm
 		his y[k] = y;
 
 		Melder_assert (k == numberOfPoints);
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (me, U": no enclosed Polygon created.");
 	}
@@ -643,8 +638,8 @@ static bool pointsInsideInterval (double *x, long n, long istart, long iend, lon
 	return *jstart == istart and * jend == iend;
 }
 
-Polygon Polygon_circularPermutation (Polygon me, long nshift);
-Polygon Polygon_circularPermutation (Polygon me, long nshift) {
+autoPolygon Polygon_circularPermutation (Polygon me, long nshift);
+autoPolygon Polygon_circularPermutation (Polygon me, long nshift) {
 	try {
 		autoPolygon thee = Data_copy (me);
 		if (nshift != 0) {
@@ -654,7 +649,7 @@ Polygon Polygon_circularPermutation (Polygon me, long nshift) {
 				thy y[inew] = my y[i];
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not circularly permuted.");
 	}
@@ -682,8 +677,8 @@ void _Polygons_copyNonCollinearities (Polygon me, Polygon thee, long collstart,
 }
 
 #define AREA(x1,y1,x2,y2,x3,y3) (x1*(y2 - y3)+x2*(y3-y1)+x3*(y1-y2))
-Polygon Polygon_simplify (Polygon me);
-Polygon Polygon_simplify (Polygon me) {
+autoPolygon Polygon_simplify (Polygon me);
+autoPolygon Polygon_simplify (Polygon me) {
 	try {
 		autoPolygon p1 = Data_copy (me);
 
@@ -764,7 +759,7 @@ Polygon Polygon_simplify (Polygon me) {
 		}
 
 		autoPolygon thee = Data_copy (p.peek()); //
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not simplified.");
 	}
@@ -1064,8 +1059,8 @@ static Vertices Verticeses_connectClippingPaths (Vertices me, bool /* use_myinte
 }
 
 //
-Polygon Vertices_to_Polygon (Vertices me, DLLNode *ni);
-Polygon Vertices_to_Polygon (Vertices /* me */, DLLNode *ni) {
+autoPolygon Vertices_to_Polygon (Vertices me, DLLNode *ni);
+autoPolygon Vertices_to_Polygon (Vertices /* me */, DLLNode *ni) {
 	DLLNode n = *ni;
 	try {
 		long i = 1, nPoints = VERTEX (n) -> poly_npoints;
@@ -1078,14 +1073,14 @@ Polygon Vertices_to_Polygon (Vertices /* me */, DLLNode *ni) {
 			i++; thy x[i] = VERTEX (n) -> x; thy y[i] = VERTEX (n) -> y;
 		}
 		*ni =  n;
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (U"Polygon not created.");
 	}
 }
 
-Collection Vertices_to_Polygons (Vertices me);
-Collection Vertices_to_Polygons (Vertices me) {
+autoCollection Vertices_to_Polygons (Vertices me);
+autoCollection Vertices_to_Polygons (Vertices me) {
 	try {
 		autoCollection thee = Collection_create (classPolygon, 10);
 		DLLNode ni = my front;
@@ -1093,14 +1088,14 @@ Collection Vertices_to_Polygons (Vertices me) {
 			autoPolygon p = Vertices_to_Polygon (me, & ni);
 			Collection_addItem (thee.peek(), p.transfer());
 		} while (ni != 0);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no polygon collection created.");
 	}
 }
 
-Collection Polygons_findClippings (Polygon me, bool use_myinterior, Polygon thee, bool use_thyinterior);
-Collection Polygons_findClippings (Polygon me, bool use_myinterior, Polygon thee, bool use_thyinterior) {
+autoCollection Polygons_findClippings (Polygon me, bool use_myinterior, Polygon thee, bool use_thyinterior);
+autoCollection Polygons_findClippings (Polygon me, bool use_myinterior, Polygon thee, bool use_thyinterior) {
 	try {
 		autoVertices s = Polygon_to_Vertices (me, true); // subject
 		long ns = s -> numberOfNodes;
@@ -1122,7 +1117,7 @@ Collection Polygons_findClippings (Polygon me, bool use_myinterior, Polygon thee
 				autoPolygon ap = Data_copy (me);
 				Collection_addItem (apc.peek(), ap.transfer());
 			}
-			return apc.transfer();
+			return apc;
 		}
 
 		// phase 2: Determine intersections as entry / exit points
@@ -1142,37 +1137,37 @@ Collection Polygons_findClippings (Polygon me, bool use_myinterior, Polygon thee
 		//  false        false      union
 		//  true         true       clip
 		//  false        true       diff thee - me
-		autoVertices pgs = 0;
+		autoVertices pgs;
 		if (not use_myinterior and not use_thyinterior) {
-			pgs.reset (Verticeses_connectClippingPathsUnion (s.peek(), c.peek()));
+			pgs = Verticeses_connectClippingPathsUnion (s.peek(), c.peek());
 		} else {
-			pgs.reset (Verticeses_connectClippingPaths (s.peek(), use_myinterior, c.peek(), use_thyinterior));
+			pgs = Verticeses_connectClippingPaths (s.peek(), use_myinterior, c.peek(), use_thyinterior);
 		}
 		// phase 4: to Polygons
 
 		autoCollection pols = Vertices_to_Polygons (pgs.peek());
-		return pols.transfer();
+		return pols;
 	} catch (MelderError) {
 		Melder_throw (me, U": no union Polygon created.");
 	}
 }
 
-Collection Polygons_clip (Polygon subject, Polygon clipper) {
+autoCollection Polygons_clip (Polygon subject, Polygon clipper) {
 	try {
 		autoCollection him = Polygons_findClippings (subject, true, clipper, true);
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (subject, U": no union created.");
 	}
 }
 
-Polygon Polygons_union (Polygon me, Polygon thee);
-Polygon Polygons_union (Polygon me, Polygon thee) {
+autoPolygon Polygons_union (Polygon me, Polygon thee);
+autoPolygon Polygons_union (Polygon me, Polygon thee) {
 	try {
 		autoCollection him = Polygons_findClippings (me, false, thee, false);
 		//Melder_assert (his size == 1);
 		autoPolygon p = (Polygon) Collection_subtractItem (him.peek(), 1);
-		return p.transfer();
+		return p;
 	} catch (MelderError) {
 		Melder_throw (me, U": no union created.");
 	}
@@ -1223,7 +1218,7 @@ static inline double cross (double x1, double y1, double x2, double y2, double x
 }
 
 // Code adapted from http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain#C
-Polygon Polygon_convexHull (Polygon me) {
+autoPolygon Polygon_convexHull (Polygon me) {
 	try {
 		if (my numberOfPoints <= 3) {
 			return (Polygon) Data_copy (me);
@@ -1256,7 +1251,7 @@ Polygon Polygon_convexHull (Polygon me) {
 			thy x[i] = x[hull[i]];
 			thy y[i] = y[hull[i]];
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no convex hull polygon created.");
 	}
diff --git a/dwtools/Polygon_extensions.h b/dwtools/Polygon_extensions.h
index cbb9c52..e2a3d14 100644
--- a/dwtools/Polygon_extensions.h
+++ b/dwtools/Polygon_extensions.h
@@ -2,7 +2,7 @@
 #define _Polygon_extensions_h_
 /* Polygon_extensions.h
  *
- * Copyright (C) 1993-2012, 2014 David Weenink
+ * Copyright (C) 1993-2012, 2014, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -37,27 +37,34 @@
 #define Polygon_VERTEX 5
 
 void Polygon_getExtrema (Polygon me, double *xmin, double *xmax, double *ymin, double *ymax);
-Polygon Polygon_createSimple (char32 *xystring);
-Polygon Polygon_createFromRandomVertices (long numberOfVertices, double xmin, double xmax, double ymin, double ymax);
-Polygon Polygon_simplify (Polygon me);
+
+autoPolygon Polygon_createSimple (char32 *xystring);
+
+autoPolygon Polygon_createFromRandomVertices (long numberOfVertices, double xmin, double xmax, double ymin, double ymax);
+
+autoPolygon Polygon_simplify (Polygon me);
+
 void Polygon_translate (Polygon me, double xt, double yt);
+
 void Polygon_rotate (Polygon me, double alpha, double xc, double yc);
+
 void Polygon_scale (Polygon me, double xs, double ys);
+
 void Polygon_reverseX (Polygon me);
+
 void Polygon_reverseY (Polygon me);
-Polygon Polygon_circularPermutation (Polygon me, long nshift);
+
+autoPolygon Polygon_circularPermutation (Polygon me, long nshift);
 
 // Is point (x,y) Inside, Outside, Boundary (Edge or Vertex) ?
 int Polygon_getLocationOfPoint (Polygon me, double x0, double y0, double eps);
 
-void Polygon_Categories_draw (Polygon me, Any categories, Graphics graphics, double xmin, double xmax,
-	double ymin, double ymax, int garnish);
+void Polygon_Categories_draw (Polygon me, Categories thee, Graphics graphics, double xmin, double xmax, double ymin, double ymax, int garnish);
 /* reverse axis when min > max */
 
-void Polygon_drawMarks (Polygon me, Graphics g, double xmin, double xmax,
-	double ymin, double ymax, double size_mm, const char32 *mark);
+void Polygon_drawMarks (Polygon me, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark);
 
-Polygon Sound_to_Polygon (Sound me, int channel, double tmin, double tmax, double ymin, double ymax, double level);
+autoPolygon Sound_to_Polygon (Sound me, int channel, double tmin, double tmax, double ymin, double ymax, double level);
 /*
 	Post-conditions:
 
@@ -83,14 +90,15 @@ Polygon Sound_to_Polygon (Sound me, int channel, double tmin, double tmax, doubl
 	where clip(y) = y < ymin ? ymin : y > ymax ? ymax ; y;
 */
 
-Polygon Sounds_to_Polygon_enclosed (Sound me, Sound thee, int channel, double tmin, double tmax, double ymin, double ymax);
+autoPolygon Sounds_to_Polygon_enclosed (Sound me, Sound thee, int channel, double tmin, double tmax, double ymin, double ymax);
 /* Area enclosed by the sounds */
 
-Polygon Polygons_union (Polygon me, Polygon thee);
+autoPolygon Polygons_union (Polygon me, Polygon thee);
+
+autoCollection Polygons_clip (Polygon me, Polygon thee);
 
-Collection Polygons_clip (Polygon me, Polygon thee);
+autoPolygon Polygon_convexHull (Polygon me);
 
-Polygon Polygon_convexHull (Polygon me);
 double Polygon_getAreaOfConvexHull (Polygon me);
 
 #endif /* _Polygon_extensions_h_ */
diff --git a/dwtools/Procrustes.cpp b/dwtools/Procrustes.cpp
index 53ef214..a39a927 100644
--- a/dwtools/Procrustes.cpp
+++ b/dwtools/Procrustes.cpp
@@ -1,6 +1,6 @@
 /* Procrustes.cpp
  *
- * Copyright (C) 1993-2011 David Weenink
+ * Copyright (C) 1993-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -102,12 +102,12 @@ static void Procrustes_setDefaults (Procrustes me) {
 	}
 }
 
-Procrustes Procrustes_create (long n) {
+autoProcrustes Procrustes_create (long n) {
 	try {
-		autoProcrustes me = (Procrustes) Thing_new (Procrustes);
+		autoProcrustes me = Thing_new (Procrustes);
 		AffineTransform_init (me.peek(), n);
 		Procrustes_setDefaults (me.peek());
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Procrustes not created.");
 	}
diff --git a/dwtools/Procrustes.h b/dwtools/Procrustes.h
index 5995f35..5254d31 100644
--- a/dwtools/Procrustes.h
+++ b/dwtools/Procrustes.h
@@ -2,7 +2,7 @@
 #define _Procrustes_h_
 /* Procrustes.h
  *
- * Copyright (C) 1993-2011 David Weenink
+ * Copyright (C) 1993-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -30,6 +30,6 @@
 #include "Procrustes_def.h"
 oo_CLASS_CREATE (Procrustes, AffineTransform);
 
-Procrustes Procrustes_create (long n);
+autoProcrustes Procrustes_create (long n);
 
 #endif /* _Procrustes_h_ */
diff --git a/dwtools/Resonator.cpp b/dwtools/Resonator.cpp
index 390303f..b2b5b68 100644
--- a/dwtools/Resonator.cpp
+++ b/dwtools/Resonator.cpp
@@ -1,6 +1,6 @@
 /* Resonator.cpp
  *
- * Copyright (C) 2008-2011 David Weenink
+ * Copyright (C) 2008-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -55,13 +55,13 @@ void structResonator :: v_setFB (double f, double bw) {
 	a = normalisation == Resonator_NORMALISATION_H0 ? (1.0 - b - c) : (1 + c) * sin (2.0 * NUMpi * f * dT);
 }
 
-Resonator Resonator_create (double dT, int normalisation) {
+autoResonator Resonator_create (double dT, int normalisation) {
 	try {
 		autoResonator me = Thing_new (Resonator);
 		my a = 1; // all-pass
 		my dT = dT;
 		my normalisation = normalisation;
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Resonator not created.");
 	}
@@ -110,23 +110,23 @@ double structConstantGainResonator :: v_getOutput (double input) {
 	return output;
 }
 
-ConstantGainResonator ConstantGainResonator_create (double dT) {
+autoConstantGainResonator ConstantGainResonator_create (double dT) {
 	try {
 		autoConstantGainResonator me = Thing_new (ConstantGainResonator);
 		my a = 1; // all-pass
 		my dT = dT;
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"ConstantGainResonator not created.");
 	}
 }
 
-AntiResonator AntiResonator_create (double dT) {
+autoAntiResonator AntiResonator_create (double dT) {
 	try {
 		autoAntiResonator me = Thing_new (AntiResonator);
 		my a = 1; // all-pass
 		my dT = dT;
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"AntiResonator not created.");
 	}
diff --git a/dwtools/Resonator.h b/dwtools/Resonator.h
index 6184191..f48cc1f 100644
--- a/dwtools/Resonator.h
+++ b/dwtools/Resonator.h
@@ -2,7 +2,7 @@
 #define _Resonator_h_
 /* Resonator.h
  *
- * Copyright (C) 2008-2011 David Weenink
+ * Copyright (C) 2008-2011, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -66,11 +66,11 @@ Thing_define (ConstantGainResonator, Filter) {
 #define Resonator_NORMALISATION_HMAX 1
 
 
-Resonator Resonator_create (double dT, int normalisation);
+autoResonator Resonator_create (double dT, int normalisation);
 
-ConstantGainResonator ConstantGainResonator_create (double dT);
+autoConstantGainResonator ConstantGainResonator_create (double dT);
 
-AntiResonator AntiResonator_create (double dT);
+autoAntiResonator AntiResonator_create (double dT);
 
 /*
 	Set a,b,c
diff --git a/dwtools/Sound_and_FilterBank.cpp b/dwtools/Sound_and_FilterBank.cpp
deleted file mode 100644
index 0bd004a..0000000
--- a/dwtools/Sound_and_FilterBank.cpp
+++ /dev/null
@@ -1,421 +0,0 @@
-/* Sound_and_FilterBank.cpp
- *
- * Copyright (C) 1993-2013 David Weenink
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/*
- djmw 20010718
- djmw 20020813 GPL header.
- djmw 20041124 Changed call to Sound_to_Spectrum.
- djmw 20070103 Sound interface changes
- djmw 20071107 Errors/warnings text changes
- djmw 20071202 Melder_warning<n>
-*/
-
-#include "Sound_and_FilterBank.h"
-#include "Sound_extensions.h"
-#include "Sound_and_Spectrum.h"
-#include "Sound_to_Pitch.h"
-#include "Vector.h"
-#include "NUM2.h"
-
-#define MIN(m,n) ((m) < (n) ? (m) : (n))
-// prototypes
-Sound FilterBank_as_Sound (FilterBank me);
-
-/*
-	The gaussian(x) = (exp(-48*((i-(n+1)/2)/(n+1))^2)-exp(-12))/(1-exp(-12));
-	For power we need the area under the square of this window:
-		Integrate (gaussian(i)^2,i=1..n) =
-
-	(sqrt(Pi)*sqrt(3)*sqrt(2)*erf(2*(n-1)*sqrt(3)*sqrt(2)/(n+1))*(n+1)+
-		24*exp(-24)*(n-1)+
-	-4*sqrt(Pi)*sqrt(3)*exp(-12)*erf(2*(n-1)*sqrt(3)/(n+1))*(n+1))/
-	(24 * (-1+exp(-12))^2)
-	To compare with the rectangular window we need to divide this by the
-	window width (n-1) x 1^2.
-*/
-static double gaussian_window_squared_correction (long n) {
-	double e12 = exp (-12), denum = (e12 - 1) * (e12 - 1) * 24 * (n - 1);
-	double sqrt3 = sqrt (3), sqrt2 = sqrt (2), sqrtpi = sqrt (NUMpi);
-	double arg1 = 2 * sqrt3 * (n - 1) / (n + 1), arg2 = arg1 * sqrt2;
-	double p2 = sqrtpi * sqrt3 * sqrt2 * (1 - NUMerfcc (arg2)) * (n + 1);
-	double p1 = 4 * sqrtpi * sqrt3 * e12 * (1 - NUMerfcc (arg1)) * (n + 1);
-
-	return (p2 - p1 + 24 * (n - 1) * e12 * e12) / denum;
-}
-
-static Matrix Sound_to_spectralpower (Sound me) {
-	try {
-		autoSpectrum s = Sound_to_Spectrum (me, TRUE);
-		autoMatrix thee = Matrix_create (s -> xmin, s -> xmax, s -> nx, s -> dx, s -> x1, 1, 1, 1, 1, 1);
-		double scale = 2.0 * s -> dx / (my xmax - my xmin);
-
-		// factor '2' because of positive and negative frequencies
-		// s -> dx : width of frequency bin
-		// my xmax - my xmin : duration of sound
-
-		double *z = thy z[1], *re = s -> z[1], *im = s -> z[2];
-		for (long i = 1; i <= s -> nx; i++) {
-			z[i] = scale * (re[i] * re[i] + im[i] * im [i]);
-		}
-
-		// Frequency bins at 0 Hz and nyquist don't count for two.
-
-		z[1] *= 0.5;
-		z[s -> nx] *= 0.5;
-		return thee.transfer();
-	} catch (MelderError) {
-		Melder_throw (me, ": no Matrix with spectral power created.");
-	}
-}
-
-static int Sound_into_BarkFilter_frame (Sound me, BarkFilter thee, long frame) {
-	autoMatrix pv = Sound_to_spectralpower (me);
-	long nf = pv -> nx;
-	autoNUMvector<double> z (1, nf);
-
-	for (long j = 1; j <= nf; j++) {
-		z[j] = HZTOBARK (pv -> x1 + (j - 1) * pv -> dx);
-	}
-
-	for (long i = 1; i <= thy ny; i++) {
-		double p = 0;
-		double z0 = thy y1 + (i - 1) * thy dy;
-		double *pow = pv -> z[1]; // TODO ??
-		for (long j = 1; j <= nf; j++) {
-			// Sekey & Hanson filter is defined in the power domain.
-			// We therefore multiply the power with a (and not a^2).
-			// integral (F(z),z=0..25) = 1.58/9
-
-			double a = NUMsekeyhansonfilter_amplitude (z0, z[j]);
-			p += a * pow[j] ;
-		}
-		thy z[i][frame] = p;
-	}
-	return 1;
-}
-
-BarkFilter Sound_to_BarkFilter (Sound me, double analysisWidth, double dt, double f1_bark, double fmax_bark, double df_bark) {
-	try {
-		double t1, nyquist = 0.5 / my dx, samplingFrequency = 2 * nyquist;
-		double windowDuration = 2 * analysisWidth; /* gaussian window */
-		double zmax = NUMhertzToBark2 (nyquist);
-		double fmin_bark = 0;
-		long nt, frameErrorCount = 0;
-
-		// Check defaults.
-
-		if (f1_bark <= 0) {
-			f1_bark = 1;
-		}
-		if (fmax_bark <= 0) {
-			fmax_bark = zmax;
-		}
-		if (df_bark <= 0) {
-			df_bark = 1;
-		}
-
-		fmax_bark = MIN (fmax_bark, zmax);
-		long nf = floor ( (fmax_bark - f1_bark) / df_bark + 0.5);
-		if (nf <= 0) {
-			Melder_throw ("The combination of filter parameters is not valid.");
-		}
-
-		Sampled_shortTermAnalysis (me, windowDuration, dt, & nt, & t1);
-		autoSound sframe = Sound_createSimple (1, windowDuration, samplingFrequency);
-		autoSound window = Sound_createGaussian (windowDuration, samplingFrequency);
-		autoBarkFilter thee = BarkFilter_create (my xmin, my xmax, nt, dt, t1,
-		                      fmin_bark, fmax_bark, nf, df_bark, f1_bark);
-
-		autoMelderProgress progess (L"BarkFilter analysis");
-
-		for (long i = 1; i <= nt; i++) {
-			double t = Sampled_indexToX (thee.peek(), i);
-
-			Sound_into_Sound (me, sframe.peek(), t - windowDuration / 2);
-
-			Sounds_multiply (sframe.peek(), window.peek());
-
-			if (! Sound_into_BarkFilter_frame (sframe.peek(), thee.peek(), i)) {
-				frameErrorCount++;
-			}
-
-			if ( (i % 10) == 1) {
-				Melder_progress ( (double) i / nt,  L"BarkFilter analysis: frame ",
-					Melder_integer (i), L" from ", Melder_integer (nt), L".");
-			}
-		}
-
-		if (frameErrorCount > 0) {
-			Melder_warning (L"Analysis results of ", Melder_integer (frameErrorCount), L" frame(s) out of ",
-				Melder_integer (nt), L" will be suspect.");
-		}
-
-		double ref = FilterBank_DBREF * gaussian_window_squared_correction (window -> nx);
-
-		NUMdmatrix_to_dBs (thy z, 1, thy ny, 1, thy nx, ref, FilterBank_DBFAC, FilterBank_DBFLOOR);
-		return thee.transfer();
-	} catch (MelderError) {
-		Melder_throw (me, ": no BarkFilter created.");
-	}
-}
-
-static int Sound_into_MelFilter_frame (Sound me, MelFilter thee, long frame) {
-	autoMatrix pv = Sound_to_spectralpower (me);
-
-	double z1 = pv -> x1;
-	double dz = pv -> dx;
-	long nf = pv -> nx;
-	double df = thy dy;
-	for (long i = 1; i <= thy ny; i++) {
-		double p = 0;
-		double fc_mel = thy y1 + (i - 1) * df;
-		double fc_hz = MELTOHZ (fc_mel);
-		double fl_hz = MELTOHZ (fc_mel - df);
-		double fh_hz =  MELTOHZ (fc_mel + df);
-		double *pow = pv -> z[1];
-		for (long j = 1; j <= nf; j++) {
-			// Bin with a triangular filter the power (=amplitude-squared)
-
-			double f = z1 + (j - 1) * dz;
-			double a = NUMtriangularfilter_amplitude (fl_hz, fc_hz, fh_hz, f);
-			p += a * pow[j];
-		}
-		thy z[i][frame] = p;
-	}
-	return 1;
-}
-
-MelFilter Sound_to_MelFilter (Sound me, double analysisWidth, double dt, double f1_mel, double fmax_mel, double df_mel) {
-	try {
-		double t1, samplingFrequency = 1 / my dx, nyquist = 0.5 * samplingFrequency;
-		double windowDuration = 2 * analysisWidth; /* gaussian window */
-		double fmin_mel = 0;
-		double fbottom = HZTOMEL (100.0), fceiling = HZTOMEL (nyquist);
-		long nt, frameErrorCount = 0;
-
-		// Check defaults.
-
-		if (fmax_mel <= 0 || fmax_mel > fceiling) {
-			fmax_mel = fceiling;
-		}
-		if (fmax_mel <= f1_mel) {
-			f1_mel = fbottom; fmax_mel = fceiling;
-		}
-		if (f1_mel <= 0) {
-			f1_mel = fbottom;
-		}
-		if (df_mel <= 0) {
-			df_mel = 100.0;
-		}
-
-		// Determine the number of filters.
-
-		long nf = floor ((fmax_mel - f1_mel) / df_mel + 0.5);
-		fmax_mel = f1_mel + nf * df_mel;
-
-		Sampled_shortTermAnalysis (me, windowDuration, dt, &nt, &t1);
-		autoSound sframe = Sound_createSimple (1, windowDuration, samplingFrequency);
-		autoSound window = Sound_createGaussian (windowDuration, samplingFrequency);
-		autoMelFilter thee = MelFilter_create (my xmin, my xmax, nt, dt, t1, fmin_mel, fmax_mel, nf, df_mel, f1_mel);
-
-		autoMelderProgress progress (L"MelFilters analysis");
-
-		for (long i = 1; i <= nt; i++) {
-			double t = Sampled_indexToX (thee.peek(), i);
-			Sound_into_Sound (me, sframe.peek(), t - windowDuration / 2);
-			Sounds_multiply (sframe.peek(), window.peek());
-			if (! Sound_into_MelFilter_frame (sframe.peek(), thee.peek(), i)) {
-				frameErrorCount++;
-			}
-			if ( (i % 10) == 1) {
-				Melder_progress ((double) i / nt, L"Frame ", Melder_integer (i), L" out of ", Melder_integer (nt), L".");
-			}
-		}
-
-		if (frameErrorCount) {
-			Melder_warning (L"Analysis results of ", Melder_integer (frameErrorCount),
-			L" frame(s) out of ", Melder_integer (nt), L" will be suspect.");
-		}
-
-		// Window correction.
-
-		double ref = FilterBank_DBREF * gaussian_window_squared_correction (window -> nx);
-
-		NUMdmatrix_to_dBs (thy z, 1, thy ny, 1, thy nx, ref, FilterBank_DBFAC, FilterBank_DBFLOOR);
-		return thee.transfer();
-	} catch (MelderError) {
-		Melder_throw (me, ": no MelFilter created.");
-	}
-}
-
-/*
-	Analog formant filter response :
-	H(f) = i f B / (f1^2 - f^2 + i f B)
-*/
-static int Sound_into_FormantFilter_frame (Sound me, FormantFilter thee, long frame, double bw) {
-	Melder_assert (bw > 0);
-	autoMatrix pv = Sound_to_spectralpower (me);
-	double z1 = pv -> x1;
-	double dz = pv -> dx;
-	long nf = pv -> nx;
-
-	for (long i = 1; i <= thy ny; i++) {
-		double p = 0;
-		double fc = thy y1 + (i - 1) * thy dy;
-		double *pow = pv -> z[1];
-		for (long j = 1; j <= nf; j++) {
-			// H(f) = ifB / (fc^2 - f^2 + ifB)
-			// H(f)| = fB / sqrt ((fc^2 - f^2)^2 + f^2B^2)
-			//|H(f)|^2 = f^2B^2 / ((fc^2 - f^2)^2 + f^2B^2)
-			//         = 1 / (((fc^2 - f^2) /fB)^2 + 1)
-
-			double f = z1 + (j - 1) * dz;
-			double a = NUMformantfilter_amplitude (fc, bw, f);
-			p += a * pow[j];
-		}
-		thy z[i][frame] = p;
-	}
-	return 1;
-}
-
-FormantFilter Sound_to_FormantFilter (Sound me, double analysisWidth,
-                                      double dt, double f1_hz, double fmax_hz, double df_hz, double relative_bw,
-                                      double minimumPitch, double maximumPitch) {
-	try {
-		double floor = 80, ceiling = 600;
-		if (minimumPitch >= maximumPitch) {
-			minimumPitch = floor; maximumPitch = ceiling;
-		}
-		if (minimumPitch <= 0) {
-			minimumPitch = floor;
-		}
-		if (maximumPitch <= 0) {
-			maximumPitch = ceiling;
-		}
-
-		autoPitch thee = Sound_to_Pitch (me, dt, minimumPitch, maximumPitch);
-		autoFormantFilter ff = Sound_and_Pitch_to_FormantFilter (me, thee.peek(), analysisWidth, dt,
-		                       f1_hz, fmax_hz, df_hz, relative_bw);
-		return ff.transfer();
-	} catch (MelderError) {
-		Melder_throw (me, ": no FormantFilter created.");
-	}
-}
-
-FormantFilter Sound_and_Pitch_to_FormantFilter (Sound me, Pitch thee, double analysisWidth, double dt,
-        double f1_hz, double fmax_hz, double df_hz, double relative_bw) {
-	try {
-		double t1, windowDuration = 2 * analysisWidth; /* gaussian window */
-		double nyquist = 0.5 / my dx, samplingFrequency = 2 * nyquist, fmin_hz = 0;
-		long nt, f0_undefined = 0;
-
-		if (my xmin > thy xmin || my xmax > thy xmax) Melder_throw
-			("The domain of the Sound is not included in the domain of the Pitch.");
-
-		double f0_median = Pitch_getQuantile (thee, thy xmin, thy xmax, 0.5, kPitch_unit_HERTZ);
-
-		if (f0_median == NUMundefined || f0_median == 0) {
-			f0_median = 100;
-			Melder_warning (L"Pitch values undefined. Bandwith fixed to 100 Hz. ");
-		}
-
-		if (f1_hz <= 0) {
-			f1_hz = 100;
-		}
-		if (fmax_hz <= 0) {
-			fmax_hz = nyquist;
-		}
-		if (df_hz <= 0) {
-			df_hz = f0_median / 2;
-		}
-		if (relative_bw <= 0) {
-			relative_bw = 1.1;
-		}
-
-		fmax_hz = MIN (fmax_hz, nyquist);
-		long nf = floor ( (fmax_hz - f1_hz) / df_hz + 0.5);
-
-		Sampled_shortTermAnalysis (me, windowDuration, dt, &nt, &t1);
-		autoFormantFilter him = FormantFilter_create (my xmin, my xmax, nt, dt, t1,
-		                        fmin_hz, fmax_hz, nf, df_hz, f1_hz);
-
-		// Temporary objects
-
-		autoSound sframe = Sound_createSimple (1, windowDuration, samplingFrequency);
-		autoSound window = Sound_createGaussian (windowDuration, samplingFrequency);
-		autoMelderProgress progress (L"Sound & Pitch: To FormantFilter");
-		for (long i = 1; i <= nt; i++) {
-			double t = Sampled_indexToX (him.peek(), i);
-			double b, f0 = Pitch_getValueAtTime (thee, t, kPitch_unit_HERTZ, 0);
-
-			if (f0 == NUMundefined || f0 == 0) {
-				f0_undefined++; f0 = f0_median;
-			}
-			b = relative_bw * f0;
-			Sound_into_Sound (me, sframe.peek(), t - windowDuration / 2);
-			Sounds_multiply (sframe.peek(), window.peek());
-
-			Sound_into_FormantFilter_frame (sframe.peek(), him.peek(), i, b);
-
-			if ( (i % 10) == 1) {
-				Melder_progress ( (double) i / nt, L"Frame ", Melder_integer (i), L" out of ",
-				                   Melder_integer (nt), L".");
-			}
-		}
-
-		double ref = FilterBank_DBREF * gaussian_window_squared_correction (window -> nx);
-		NUMdmatrix_to_dBs (his z, 1, his ny, 1, his nx, ref, FilterBank_DBFAC, FilterBank_DBFLOOR);
-		return him.transfer();
-	} catch (MelderError) {
-		Melder_throw ("FormantFilter not created from Pitch & FormantFilter.");
-	}
-}
-
-Sound FilterBank_as_Sound (FilterBank me) {
-	try {
-		autoSound thee = Sound_create (my ny, my xmin, my xmax, my nx, my dx, my x1);
-		for (long i = 1; i <= my ny; i++) {
-			for (long j = 1; j <= my nx; j++)
-				thy z[i][j] = my z[i][j];
-		}
-		return thee.transfer();
-	} catch (MelderError) {
-		Melder_throw (me, ": no Sound created.");
-	}
-}
-
-Sound FilterBanks_crossCorrelate (FilterBank me, FilterBank thee, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain) {
-	try {
-		autoSound cc = Sounds_crossCorrelate ((Sound) me, (Sound) thee, scaling, signalOutsideTimeDomain);
-		return cc.transfer();
-	} catch (MelderError) {
-		Melder_throw (me, " and ", thee, " not cross-correlated.");
-	}
-}
-
-Sound FilterBanks_convolve (FilterBank me, FilterBank thee, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain) {
-	try {
-		autoSound cc = Sounds_convolve ((Sound) me, (Sound) thee, scaling, signalOutsideTimeDomain);
-		return cc.transfer();
-	} catch (MelderError) {
-		Melder_throw (me, " and ", thee, " not convolved.");
-	}
-}
-
-/* End of file Sound_and_FilterBank.cpp */
diff --git a/dwtools/Sound_and_FilterBank.h b/dwtools/Sound_and_FilterBank.h
deleted file mode 100644
index 9e19bdc..0000000
--- a/dwtools/Sound_and_FilterBank.h
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifndef _Sound_and_FilterBank_h_
-#define _Sound_and_FilterBank_h_
-/* Sound_and_FilterBank.h
- *
- * Copyright (C) 1993-2012 David Weenink
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/*
- djmw 20010404
- djmw 20020813 GPL header
- djmw 20120508 Latest modification
-*/
-
-#include "FilterBank.h"
-#include "Pitch.h"
-#include "Sound.h"
-
-BarkFilter Sound_to_BarkFilter (Sound me, double analysisWidth, double dt,
-	double f1_bark, double fmax_bark, double df_bark);
-/*
-	Filtering with filters on a Bark scale as defined by
-		Andrew Sekey & Brian Hanson (1984), "Improved 1-Bark bandwidth
-		"auditory filter", Jasa 75, 1902-1904.
-	Although not explicitely stated the filter function is defined in the
-	power domain.
-	10 log F(z) = 15.8 + 7.5(z + 0.5) - 17.5 * sqrt(1 + (z + 0.5)^2)
-*/
-
-MelFilter Sound_to_MelFilter (Sound me, double analysisWidth, double dt,
-	double f1_mel, double fmax_mel, double df_mel);
-
-FormantFilter Sound_to_FormantFilter (Sound me, double analysisWidth,
-	double dt, double f1_hz, double fmax_hz, double df_hz, double relative_bw,
-	double minimumPitch, double maximumPitch);
-
-FormantFilter Sound_and_Pitch_to_FormantFilter (Sound me, Pitch thee,
-	double analysisWidth, double dt, double f1_hz, double fmax_hz,
-	double df_hz, double relative_bw);
-
-Sound FilterBanks_crossCorrelate (FilterBank me, FilterBank thee, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain);
-Sound FilterBanks_convolve (FilterBank me, FilterBank thee, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain);
-
-
-#endif /* _Sound_and_FilterBank_h_ */
diff --git a/dwtools/Sound_and_PCA.cpp b/dwtools/Sound_and_PCA.cpp
index 86d155d..f2b0db4 100644
--- a/dwtools/Sound_and_PCA.cpp
+++ b/dwtools/Sound_and_PCA.cpp
@@ -34,18 +34,18 @@ static void checkChannelsWithinRange (long *channels, long n, long min, long max
 	}
 }
 
-PCA Sound_to_PCA_channels (Sound me, double startTime, double endTime) {
+autoPCA Sound_to_PCA_channels (Sound me, double startTime, double endTime) {
 	try {
 		// covariance is cross-correlation with lag time 0
 		autoCrossCorrelationTable thee = Sound_to_CrossCorrelationTable (me, startTime, endTime, 0);
 		autoPCA him = SSCP_to_PCA (thee.peek());
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (me, U": no PCA created.");
 	}
 }
 
-Sound Sound_and_PCA_to_Sound_pc_selectedChannels (Sound me, PCA thee, long numberOfComponents, long *channels, long numberOfChannels) {
+autoSound Sound_and_PCA_to_Sound_pc_selectedChannels (Sound me, PCA thee, long numberOfComponents, long *channels, long numberOfChannels) {
 	try {
 		bool channelSelection = channels != 0 && numberOfChannels > 0;
 		if (numberOfComponents <= 0 || numberOfComponents > thy numberOfEigenvalues) {
@@ -55,7 +55,7 @@ Sound Sound_and_PCA_to_Sound_pc_selectedChannels (Sound me, PCA thee, long numbe
 		if (channelSelection) {
 			checkChannelsWithinRange (channels, numberOfChannels, 1, my ny);
 		}
-		autoSound him = (Sound) Data_copy (me);
+		autoSound him = Data_copy (me);
 		// R['i',j] = E(i,k]*S['k',j]
 		// use kij-variant for faster inner loop
 		for (long k = 1; k <= thy dimension; k++) {
@@ -68,17 +68,17 @@ Sound Sound_and_PCA_to_Sound_pc_selectedChannels (Sound me, PCA thee, long numbe
 				}
 			}
 		}
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (me, U": no principal components calculated with ", thee);
 	}
 }
 
-Sound Sound_and_PCA_principalComponents (Sound me, PCA thee, long numberOfComponents) {
+autoSound Sound_and_PCA_principalComponents (Sound me, PCA thee, long numberOfComponents) {
 	return Sound_and_PCA_to_Sound_pc_selectedChannels (me, thee, numberOfComponents, nullptr, 0);
 }
 
-Sound Sound_and_PCA_whitenSelectedChannels (Sound me, PCA thee, long numberOfComponents, long *channels, long numberOfChannels) {
+autoSound Sound_and_PCA_whitenSelectedChannels (Sound me, PCA thee, long numberOfComponents, long *channels, long numberOfChannels) {
 	try {
 		bool channelSelection = channels != 0 && numberOfChannels > 0;
 		if (numberOfComponents <= 0 || numberOfComponents > thy numberOfEigenvalues) {
@@ -109,13 +109,13 @@ Sound Sound_and_PCA_whitenSelectedChannels (Sound me, PCA thee, long numberOfCom
                 }
             }
         }
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not created.");
 	}
 }
 
-Sound Sound_and_PCA_whitenChannels (Sound me, PCA thee, long numberOfComponents) {
+autoSound Sound_and_PCA_whitenChannels (Sound me, PCA thee, long numberOfComponents) {
 	return Sound_and_PCA_whitenSelectedChannels (me, thee, numberOfComponents, nullptr, 0);
 }
 
diff --git a/dwtools/Sound_and_PCA.h b/dwtools/Sound_and_PCA.h
index cb7c0a7..1d10e9b 100644
--- a/dwtools/Sound_and_PCA.h
+++ b/dwtools/Sound_and_PCA.h
@@ -2,7 +2,7 @@
 #define _Sound_and_PCA_h_
 /* Sound_and_PCA.h
  *
- * Copyright (C) 2012 David Weenink
+ * Copyright (C) 2012, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -26,14 +26,14 @@
 #include "PCA.h"
 #include "Sound.h"
 
-PCA Sound_to_PCA_channels (Sound me, double startTime, double endTime);
+autoPCA Sound_to_PCA_channels (Sound me, double startTime, double endTime);
 
-Sound Sound_and_PCA_to_Sound_pc_selectedChannels (Sound me, PCA thee, long numberOfComponents, long *channels, long numberOfChannels);
+autoSound Sound_and_PCA_to_Sound_pc_selectedChannels (Sound me, PCA thee, long numberOfComponents, long *channels, long numberOfChannels);
 
-Sound Sound_and_PCA_principalComponents (Sound me, PCA thee, long numberOfComponents);
+autoSound Sound_and_PCA_principalComponents (Sound me, PCA thee, long numberOfComponents);
 
-Sound Sound_and_PCA_whitenSelectedChannels (Sound me, PCA thee, long numberOfComponents, long *channels, long numberOfChannels);
+autoSound Sound_and_PCA_whitenSelectedChannels (Sound me, PCA thee, long numberOfComponents, long *channels, long numberOfChannels);
 
-Sound Sound_and_PCA_whitenChannels (Sound me, PCA thee, long numberOfComponents);
+autoSound Sound_and_PCA_whitenChannels (Sound me, PCA thee, long numberOfComponents);
 
 #endif /* _Sound_and_PCA_h_ */
diff --git a/dwtools/Sound_and_Spectrogram_extensions.cpp b/dwtools/Sound_and_Spectrogram_extensions.cpp
index 89b8f38..f2effec 100644
--- a/dwtools/Sound_and_Spectrogram_extensions.cpp
+++ b/dwtools/Sound_and_Spectrogram_extensions.cpp
@@ -1,4 +1,4 @@
-/* Sound_and_FilterBank.cpp
+/* Sound_and_Spectrogram_extensions.cpp
  *
  * Copyright (C) 1993-2014 David Weenink
  *
@@ -35,7 +35,7 @@
 
 #define MIN(m,n) ((m) < (n) ? (m) : (n))
 // prototypes
-Sound BandFilterSpectrogram_as_Sound (BandFilterSpectrogram me, int to_dB);
+autoSound BandFilterSpectrogram_as_Sound (BandFilterSpectrogram me, int to_dB);
 
 /*
 	The gaussian(x) = (exp(-48*((i-(n+1)/2)/(n+1))^2)-exp(-12))/(1-exp(-12));
@@ -64,7 +64,7 @@ static void _Spectrogram_windowCorrection (Spectrogram me, long numberOfSamples_
 	}
 }
 
-static Spectrum Sound_to_Spectrum_power (Sound me) {
+static autoSpectrum Sound_to_Spectrum_power (Sound me) {
 	try {
 		autoSpectrum thee = Sound_to_Spectrum (me, true);
 		double scale = 2.0 * thy dx / (my xmax - my xmin);
@@ -82,7 +82,7 @@ static Spectrum Sound_to_Spectrum_power (Sound me) {
 		// Correction of frequency bins at 0 Hz and nyquist: don't count for two.
 
 		re[1] *= 0.5; re[thy nx] *= 0.5;
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no Spectrum with spectral power created.");
 	}
@@ -114,7 +114,7 @@ static void Sound_into_BarkSpectrogram_frame (Sound me, BarkSpectrogram thee, lo
 	}
 }
 
-BarkSpectrogram Sound_to_BarkSpectrogram (Sound me, double analysisWidth, double dt, double f1_bark, double fmax_bark, double df_bark) {
+autoBarkSpectrogram Sound_to_BarkSpectrogram (Sound me, double analysisWidth, double dt, double f1_bark, double fmax_bark, double df_bark) {
 	try {
 		double nyquist = 0.5 / my dx, samplingFrequency = 2 * nyquist;
 		double windowDuration = 2 * analysisWidth; /* gaussian window */
@@ -162,7 +162,7 @@ BarkSpectrogram Sound_to_BarkSpectrogram (Sound me, double analysisWidth, double
 		
 		_Spectrogram_windowCorrection ((Spectrogram) thee.peek(), window -> nx);
 
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no BarkSpectrogram created.");
 	}
@@ -190,7 +190,7 @@ static void Sound_into_MelSpectrogram_frame (Sound me, MelSpectrogram thee, long
 	}
 }
 
-MelSpectrogram Sound_to_MelSpectrogram (Sound me, double analysisWidth, double dt, double f1_mel, double fmax_mel, double df_mel) {
+autoMelSpectrogram Sound_to_MelSpectrogram (Sound me, double analysisWidth, double dt, double f1_mel, double fmax_mel, double df_mel) {
 	try {
 		double t1, samplingFrequency = 1 / my dx, nyquist = 0.5 * samplingFrequency;
 		double windowDuration = 2 * analysisWidth; /* gaussian window */
@@ -238,7 +238,7 @@ MelSpectrogram Sound_to_MelSpectrogram (Sound me, double analysisWidth, double d
 		
 		_Spectrogram_windowCorrection ((Spectrogram) thee.peek(), window -> nx);
 
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no MelSpectrogram created.");
 	}
@@ -271,7 +271,7 @@ static int Sound_into_Spectrogram_frame (Sound me, Spectrogram thee, long frame,
 	return 1;
 }
 
-Spectrogram Sound_to_Spectrogram_pitchDependent (Sound me, double analysisWidth, double dt, double f1_hz, double fmax_hz, double df_hz, double relative_bw, double minimumPitch, double maximumPitch) {
+autoSpectrogram Sound_to_Spectrogram_pitchDependent (Sound me, double analysisWidth, double dt, double f1_hz, double fmax_hz, double df_hz, double relative_bw, double minimumPitch, double maximumPitch) {
 	try {
 		double floor = 80, ceiling = 600;
 		if (minimumPitch >= maximumPitch) {
@@ -286,13 +286,13 @@ Spectrogram Sound_to_Spectrogram_pitchDependent (Sound me, double analysisWidth,
 
 		autoPitch thee = Sound_to_Pitch (me, dt, minimumPitch, maximumPitch);
 		autoSpectrogram ff = Sound_and_Pitch_to_Spectrogram (me, thee.peek(), analysisWidth, dt, f1_hz, fmax_hz, df_hz, relative_bw);
-		return ff.transfer();
+		return ff;
 	} catch (MelderError) {
 		Melder_throw (me, U": no Spectrogram created.");
 	}
 }
 
-Spectrogram Sound_and_Pitch_to_Spectrogram (Sound me, Pitch thee, double analysisWidth, double dt, double f1_hz, double fmax_hz, double df_hz, double relative_bw) {
+autoSpectrogram Sound_and_Pitch_to_Spectrogram (Sound me, Pitch thee, double analysisWidth, double dt, double f1_hz, double fmax_hz, double df_hz, double relative_bw) {
 	try {
 		double t1, windowDuration = 2 * analysisWidth; /* gaussian window */
 		double nyquist = 0.5 / my dx, samplingFrequency = 2 * nyquist, fmin_hz = 0;
@@ -353,42 +353,42 @@ Spectrogram Sound_and_Pitch_to_Spectrogram (Sound me, Pitch thee, double analysi
 		
 		_Spectrogram_windowCorrection (him.peek(), window -> nx);
 
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (U"FormantFilter not created from Pitch & FormantFilter.");
 	}
 }
 
-Sound BandFilterSpectrogram_as_Sound (BandFilterSpectrogram me, int unit) {
+autoSound BandFilterSpectrogram_as_Sound (BandFilterSpectrogram me, int unit) {
 	try {
 		autoSound thee = Sound_create (my ny, my xmin, my xmax, my nx, my dx, my x1);
 		for (long i = 1; i <= my ny; i++) {
 			for (long j = 1; j <= my nx; j++)
 				thy z[i][j] = my v_getValueAtSample (j, i, unit);
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no Sound created.");
 	}
 }
 
-Sound BandFilterSpectrograms_crossCorrelate (BandFilterSpectrogram me, BandFilterSpectrogram thee, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain) {
+autoSound BandFilterSpectrograms_crossCorrelate (BandFilterSpectrogram me, BandFilterSpectrogram thee, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain) {
 	try {
 		autoSound sme = BandFilterSpectrogram_as_Sound (me, 1) ; // to dB
 		autoSound sthee = BandFilterSpectrogram_as_Sound (thee, 1) ;
 		autoSound cc = Sounds_crossCorrelate (sme.peek(), sthee.peek(), scaling, signalOutsideTimeDomain);
-		return cc.transfer();
+		return cc;
 	} catch (MelderError) {
 		Melder_throw (me, U" and ", thee, U" not cross-correlated.");
 	}
 }
 
-Sound BandFilterSpectrograms_convolve (BandFilterSpectrogram me, BandFilterSpectrogram thee, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain) {
+autoSound BandFilterSpectrograms_convolve (BandFilterSpectrogram me, BandFilterSpectrogram thee, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain) {
 	try {
 		autoSound sme = BandFilterSpectrogram_as_Sound (me, 1) ; // to dB
 		autoSound sthee = BandFilterSpectrogram_as_Sound (thee, 1) ;
 		autoSound cc = Sounds_convolve (sme.peek(), sthee.peek(), scaling, signalOutsideTimeDomain);
-		return cc.transfer();
+		return cc;
 	} catch (MelderError) {
 		Melder_throw (me, U" and ", thee, U" not convolved.");
 	}
diff --git a/dwtools/Sound_and_Spectrogram_extensions.h b/dwtools/Sound_and_Spectrogram_extensions.h
index a1917e2..a400e28 100644
--- a/dwtools/Sound_and_Spectrogram_extensions.h
+++ b/dwtools/Sound_and_Spectrogram_extensions.h
@@ -2,7 +2,7 @@
 #define _Sound_and_Spectrogram_extensions_h_
 /* Sound_and_Spectrogram_extensions.h
  *
- * Copyright (C) 2014 David Weenink
+ * Copyright (C) 2014-2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@
 #include "Pitch.h"
 #include "Sound.h"
 
-BarkSpectrogram Sound_to_BarkSpectrogram (Sound me, double analysisWidth, double dt,
+autoBarkSpectrogram Sound_to_BarkSpectrogram (Sound me, double analysisWidth, double dt,
 	double f1_bark, double fmax_bark, double df_bark);
 /*
 	Filtering with filters on a Bark scale as defined by
@@ -38,19 +38,20 @@ BarkSpectrogram Sound_to_BarkSpectrogram (Sound me, double analysisWidth, double
 	10 log F(z) = 15.8 + 7.5(z + 0.5) - 17.5 * sqrt(1 + (z + 0.5)^2)
 */
 
-MelSpectrogram Sound_to_MelSpectrogram (Sound me, double analysisWidth, double dt,
+autoMelSpectrogram Sound_to_MelSpectrogram (Sound me, double analysisWidth, double dt,
 	double f1_mel, double fmax_mel, double df_mel);
 
-Spectrogram Sound_to_Spectrogram_pitchDependent (Sound me, double analysisWidth,
+autoSpectrogram Sound_to_Spectrogram_pitchDependent (Sound me, double analysisWidth,
 	double dt, double f1_hz, double fmax_hz, double df_hz, double relative_bw,
 	double minimumPitch, double maximumPitch);
 
-Spectrogram Sound_and_Pitch_to_Spectrogram (Sound me, Pitch thee,
+autoSpectrogram Sound_and_Pitch_to_Spectrogram (Sound me, Pitch thee,
 	double analysisWidth, double dt, double f1_hz, double fmax_hz,
 	double df_hz, double relative_bw);
 
-Sound BandFilterSpectrograms_crossCorrelate (BandFilterSpectrogram me, BandFilterSpectrogram thee, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain);
-Sound BandFilterSpectrograms_convolve (BandFilterSpectrogram me, BandFilterSpectrogram thee, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain);
+autoSound BandFilterSpectrograms_crossCorrelate (BandFilterSpectrogram me, BandFilterSpectrogram thee, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain);
+
+autoSound BandFilterSpectrograms_convolve (BandFilterSpectrogram me, BandFilterSpectrogram thee, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain);
 
 
 #endif /* _Sound_and_Spectrogram_extensions_h_ */
diff --git a/dwtools/Sound_extensions.cpp b/dwtools/Sound_extensions.cpp
index 14b018e..36c4818 100644
--- a/dwtools/Sound_extensions.cpp
+++ b/dwtools/Sound_extensions.cpp
@@ -316,8 +316,7 @@ Sound Sound_readFromCmuAudioFile (MelderFile file) {
 	}
 }
 
-Sound Sound_readFromRawFile (MelderFile file, const char *format, int nBitsCoding,
-                             int littleEndian, int unSigned, long skipNBytes, double samplingFrequency) {
+Sound Sound_readFromRawFile (MelderFile file, const char *format, int nBitsCoding, int littleEndian, int unSigned, long skipNBytes, double samplingFrequency) {
 	try {
 		autofile f = Melder_fopen (file, "rb");
 		if (! format) {
@@ -342,15 +341,15 @@ Sound Sound_readFromRawFile (MelderFile file, const char *format, int nBitsCodin
 		}
 		autoSound me = Sound_createSimple (1, nSamples / samplingFrequency, samplingFrequency);
 		fseek (f, skipNBytes, SEEK_SET);
-		if (nBytesPerSample == 1 &&   unSigned) {
+		if (nBytesPerSample == 1 && unSigned) {
 			u1read (me.peek(), f);
 		} else if (nBytesPerSample == 1 && ! unSigned) {
 			i1read (me.peek(), f);
-		} else if (nBytesPerSample == 2 &&   unSigned) {
+		} else if (nBytesPerSample == 2 && unSigned) {
 			u2read (me.peek(), f, littleEndian);
 		} else if (nBytesPerSample == 2 && ! unSigned) {
 			i2read (me.peek(), f, littleEndian);
-		} else if (nBytesPerSample == 4 &&   unSigned) {
+		} else if (nBytesPerSample == 4 && unSigned) {
 			u4read (me.peek(), f, littleEndian);
 		} else if (nBytesPerSample == 4 && ! unSigned) {
 			i4read (me.peek(), f, littleEndian);
@@ -381,23 +380,24 @@ void Sound_writeToRawFile (Sound me, MelderFile file, const char *format, int li
 		if (nBytesPerSample == 3 || nBytesPerSample > 4) {
 			Melder_throw (U"number of bytes per sample should be 1, 2 or 4.");
 		}
-		if (nBytesPerSample == 1 &&   unSigned) {
+		if (nBytesPerSample == 1 && unSigned) {
 			u1write (me, f, & nClip);
 		} else if (nBytesPerSample == 1 && ! unSigned) {
 			i1write (me, f, & nClip);
-		} else if (nBytesPerSample == 2 &&   unSigned) {
+		} else if (nBytesPerSample == 2 && unSigned) {
 			u2write (me, f, littleEndian, & nClip);
 		} else if (nBytesPerSample == 2 && ! unSigned) {
 			i2write (me, f, littleEndian, & nClip);
-		} else if (nBytesPerSample == 4 &&   unSigned) {
+		} else if (nBytesPerSample == 4 && unSigned) {
 			u4write (me, f, littleEndian, & nClip);
 		} else if (nBytesPerSample == 4 && ! unSigned) {
 			i4write (me, f, littleEndian, & nClip);
 		} else if (nBytesPerSample == 4 && strequ (format, "float")) {
 			r4write (me, f);
 		}
-		if (nClip > 0) Melder_warning (nClip, U" from ", my nx,
-			                               U" samples have been clipped.\nAdvice: you could scale the amplitudes or save as a binary file.");
+		if (nClip > 0) {
+			Melder_warning (nClip, U" from ", my nx, U" samples have been clipped.\nAdvice: you could scale the amplitudes or save as a binary file.");
+		}
 		if (feof ((FILE *) f) || ferror ((FILE *) f)) {
 			Melder_throw (U"Sound_writeToRawFile: not completed");
 		}
@@ -486,7 +486,7 @@ static float dialogic_adpcm_decode (struct dialogic_adpcm *adpcm) {
 	return scale * s;
 }
 
-Sound Sound_readFromDialogicADPCMFile (MelderFile file, double sampleRate) {
+autoSound Sound_readFromDialogicADPCMFile (MelderFile file, double sampleRate) {
 	try {
 		autofile f = Melder_fopen (file, "rb");
 
@@ -518,7 +518,7 @@ Sound Sound_readFromDialogicADPCMFile (MelderFile file, double sampleRate) {
 			my z[1][n++] = dialogic_adpcm_decode (& adpcm);
 		}
 		f.close (file);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not read from Dialogic ADPCM file", MelderFile_messageName (file), U".");
 	}
@@ -549,7 +549,7 @@ void Sound_deEmphasis (Sound me, double deEmphasisFrequency) {
 	}
 }
 
-Sound Sound_createGaussian (double windowDuration, double samplingFrequency) {
+autoSound Sound_createGaussian (double windowDuration, double samplingFrequency) {
 	try {
 		autoSound me = Sound_createSimple (1, windowDuration, samplingFrequency);
 		double *s = my z[1];
@@ -557,13 +557,13 @@ Sound Sound_createGaussian (double windowDuration, double samplingFrequency) {
 		for (long i = 1; i <= my nx; i++) {
 			s[i] = (exp (-48.0 * (i - imid) * (i - imid) / (my nx + 1) / (my nx + 1)) - edge) / (1 - edge);
 		}
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not created from Gaussian function.");
 	}
 }
 
-Sound Sound_createHamming (double windowDuration, double samplingFrequency) {
+autoSound Sound_createHamming (double windowDuration, double samplingFrequency) {
 	try {
 		autoSound me = Sound_createSimple (1, windowDuration, samplingFrequency);
 		double *s = my z[1];
@@ -571,7 +571,7 @@ Sound Sound_createHamming (double windowDuration, double samplingFrequency) {
 		for (long i = 1; i <= my nx; i++) {
 			s[i] = 0.54 - 0.46 * cos ( (i - 1) * p);
 		}
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not created from Hamming function.");
 	};
@@ -579,7 +579,7 @@ Sound Sound_createHamming (double windowDuration, double samplingFrequency) {
 
 static autoSound Sound_create2 (double minimumTime, double maximumTime, double samplingFrequency) {
 	return Sound_create (1, minimumTime, maximumTime, lround ( (maximumTime - minimumTime) * samplingFrequency),
-	                     1.0 / samplingFrequency, minimumTime + 0.5 / samplingFrequency);
+		1.0 / samplingFrequency, minimumTime + 0.5 / samplingFrequency);
 }
 
 /*
@@ -594,9 +594,7 @@ static autoSound Sound_create2 (double minimumTime, double maximumTime, double s
 
 */
 
-static Sound Sound_createToneComplex (double minimumTime, double maximumTime, double samplingFrequency,
-                                      double firstFrequency, long numberOfComponents, double frequencyDistance,
-                                      long mistunedComponent, double mistuningFraction, int scaleAmplitudes) {
+static autoSound Sound_createToneComplex (double minimumTime, double maximumTime, double samplingFrequency, double firstFrequency, long numberOfComponents, double frequencyDistance, long mistunedComponent, double mistuningFraction, int scaleAmplitudes) {
 	try {
 		autoSound me = Sound_create2 (minimumTime, maximumTime, samplingFrequency);
 		for (long j = 1; j <= numberOfComponents; j++) {
@@ -618,15 +616,14 @@ static Sound Sound_createToneComplex (double minimumTime, double maximumTime, do
 		if (scaleAmplitudes) {
 			Vector_scale (me.peek(), 0.99996948);
 		}
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not created from tone complex.");
 	}
 }
 
 
-Sound Sound_createSimpleToneComplex (double minimumTime, double maximumTime, double samplingFrequency,
-                                     double firstFrequency, long numberOfComponents, double frequencyDistance, int scaleAmplitudes) {
+autoSound Sound_createSimpleToneComplex (double minimumTime, double maximumTime, double samplingFrequency, double firstFrequency, long numberOfComponents, double frequencyDistance, int scaleAmplitudes) {
 	if (firstFrequency + (numberOfComponents - 1) * frequencyDistance > samplingFrequency / 2) {
 		Melder_warning (U"Sound_createSimpleToneComplex: frequency of (some) components too high.");
 		numberOfComponents = (long) floor (1.0 + (samplingFrequency / 2 - firstFrequency) / frequencyDistance);
@@ -635,9 +632,7 @@ Sound Sound_createSimpleToneComplex (double minimumTime, double maximumTime, dou
 	                                firstFrequency, numberOfComponents, frequencyDistance, 0, 0, scaleAmplitudes);
 }
 
-Sound Sound_createMistunedHarmonicComplex (double minimumTime, double maximumTime, double samplingFrequency,
-        double firstFrequency, long numberOfComponents, long mistunedComponent,
-        double mistuningFraction, int scaleAmplitudes) {
+autoSound Sound_createMistunedHarmonicComplex (double minimumTime, double maximumTime, double samplingFrequency, double firstFrequency, long numberOfComponents, long mistunedComponent, double mistuningFraction, int scaleAmplitudes) {
 	if (firstFrequency + (numberOfComponents - 1) * firstFrequency > samplingFrequency / 2) {
 		Melder_warning (U"Sound_createMistunedHarmonicComplex: frequency of (some) components too high.");
 		numberOfComponents = (long) floor (1.0 + (samplingFrequency / 2 - firstFrequency) / firstFrequency);
@@ -645,9 +640,7 @@ Sound Sound_createMistunedHarmonicComplex (double minimumTime, double maximumTim
 	if (mistunedComponent > numberOfComponents) {
 		Melder_warning (U"Sound_createMistunedHarmonicComplex: mistuned component too high.");
 	}
-	return Sound_createToneComplex (minimumTime, maximumTime, samplingFrequency,
-	                                firstFrequency, numberOfComponents, firstFrequency, mistunedComponent,
-	                                mistuningFraction, scaleAmplitudes);
+	return Sound_createToneComplex (minimumTime, maximumTime, samplingFrequency, firstFrequency, numberOfComponents, firstFrequency, mistunedComponent, mistuningFraction, scaleAmplitudes);
 }
 
 /*
@@ -658,9 +651,7 @@ Sound Sound_createMistunedHarmonicComplex (double minimumTime, double maximumTim
 	and so: f = f0 + c /(2 pi t)
 	Irino: bandwidth = (frequency * (6.23e-6 * frequency + 93.39e-3) + 28.52)
 */
-Sound Sound_createGammaTone (double minimumTime, double maximumTime, double samplingFrequency,
-                             long gamma, double frequency, double bandwidth, double initialPhase, double addition,
-                             int scaleAmplitudes) {
+autoSound Sound_createGammaTone (double minimumTime, double maximumTime, double samplingFrequency, long gamma, double frequency, double bandwidth, double initialPhase, double addition, int scaleAmplitudes) {
 	try {
 		autoSound me = Sound_create2 (minimumTime, maximumTime, samplingFrequency);
 		for (long i = 1; i <= my nx; i++) {
@@ -672,19 +663,17 @@ Sound Sound_createGammaTone (double minimumTime, double maximumTime, double samp
 		if (scaleAmplitudes) {
 			Vector_scale (me.peek(), 0.99996948);
 		}
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not created from gammatone function.");
 	}
 }
 
-static void NUMgammatoneFilter4 (double *x, double *y, long n, double centre_frequency,
-                                 double bandwidth, double samplingFrequency) {
+static void NUMgammatoneFilter4 (double *x, double *y, long n, double centre_frequency, double bandwidth, double samplingFrequency) {
 	double a[5], b[9], dt = 1.0 / samplingFrequency, wt = NUMpi * centre_frequency * dt;
 	double bt = 2 * NUMpi * bandwidth * dt, dt2 = dt * dt, dt4 = dt2 * dt2;
 
-	Melder_assert (n > 0 && centre_frequency > 0 && bandwidth >= 0 &&
-	               samplingFrequency > 0);
+	Melder_assert (n > 0 && centre_frequency > 0 && bandwidth >= 0 && samplingFrequency > 0);
 
 	/*
 		The filter function is:
@@ -712,9 +701,7 @@ static void NUMgammatoneFilter4 (double *x, double *y, long n, double centre_fre
 	b[7] = -8 * cos (2 * wt)                           * exp (-7 * bt);
 	b[8] =                                               exp (-8 * bt);
 
-	/*
-		Calculate gain (= Abs (H(z); f=fc) and scale a[0-4] with it.
-	*/
+	// Calculate gain (= Abs (H(z); f=fc) and scale a[0-4] with it.
 
 	double zr =  cos (2 * wt), zi = -sin (2 * wt);
 	double dr = a[4], di = 0, tr, ti, nr, ni;
@@ -756,11 +743,18 @@ static void NUMgammatoneFilter4 (double *x, double *y, long n, double centre_fre
 			Melder_casual (U"b[", i, U"] = ", b[i]);
 		}
 	}
-	/*
-		Perform the filtering. For the first 8 samples we must do some
-		extra work.
-	*/
 
+	/* Perform the filtering. For the first 8 samples we must do some extra work.
+	y[1] = a[0] * x[1];
+	if (n > 1) {
+		y[2] = a[0] * x[2];
+		y[2] += a[1] * x[1] - b[1] * y[1];
+	}
+	if (n > 2) {
+		y[2] = a[0] * x[2];
+		y[2] += a[2] * x[i - 2] - b[2] * y[i - 2];
+	}
+	*/
 	long n8 = n < 8 ? n : 8;
 	for (long i = 1; i <= n8; i++) {
 		y[i] = a[0] * x[i];
@@ -811,7 +805,7 @@ static void NUMgammatoneFilter4 (double *x, double *y, long n, double centre_fre
 }
 
 
-Sound Sound_filterByGammaToneFilter4 (Sound me, double centre_frequency, double bandwidth) {
+autoSound Sound_filterByGammaToneFilter4 (Sound me, double centre_frequency, double bandwidth) {
 	try {
 		if (centre_frequency <= 0) {
 			Melder_throw (U"Centre frequency must be positive.");
@@ -836,7 +830,7 @@ Sound Sound_filterByGammaToneFilter4 (Sound me, double centre_frequency, double
 				thy z[channel][i] = y[i];
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not filtered by gammatone filter4.");
 	}
@@ -868,18 +862,19 @@ Sound Sound_createShepardTone (double minimumTime, double maximumTime, double sa
 }
 */
 
-Sound Sound_createShepardToneComplex (double minimumTime, double maximumTime,
-                                      double samplingFrequency, double lowestFrequency, long numberOfComponents,
-                                      double frequencyChange_st, double amplitudeRange, double octaveShiftFraction) {
+autoSound Sound_createShepardToneComplex (double minimumTime, double maximumTime, double samplingFrequency, double lowestFrequency, long numberOfComponents, double frequencyChange_st, double amplitudeRange, double octaveShiftFraction) {
 	try {
 		double highestFrequency = lowestFrequency * pow (2, numberOfComponents);
 		double lmax_db = 0, lmin_db = lmax_db - fabs (amplitudeRange);
 
-		if (highestFrequency > samplingFrequency / 2) Melder_throw (U"The highest frequency you want to generate is "
-			        U"above the Nyquist frequency. Choose a larger value for \"Sampling frequency\", or lower values for "
-			        U"\"Number of components\" or \"Lowest frequency\".");
-		if (octaveShiftFraction < 0 || octaveShiftFraction >= 1) Melder_throw (U"Octave offset fraction "
-			        U"must be greater or equal zero and smaller than one.");
+		if (highestFrequency > samplingFrequency / 2) {
+			Melder_throw (U"The highest frequency you want to generate is "
+				U"above the Nyquist frequency. Choose a larger value for \"Sampling frequency\", or lower values for "
+				U"\"Number of components\" or \"Lowest frequency\".");
+		}
+		if (octaveShiftFraction < 0 || octaveShiftFraction >= 1) {
+			Melder_throw (U"Octave offset fraction must be greater or equal zero and smaller than one.");
+		}
 		double octaveTime, sweeptime;
 		if (frequencyChange_st != 0) {
 			octaveTime = 12 / fabs (frequencyChange_st);
@@ -938,7 +933,7 @@ Sound Sound_createShepardToneComplex (double minimumTime, double maximumTime,
 			}
 		}
 		Vector_scale (me.peek(), 0.99996948);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not created from Shepard tone complex.");
 	}
@@ -946,9 +941,7 @@ Sound Sound_createShepardToneComplex (double minimumTime, double maximumTime,
 
 /* can be implemented more efficiently with sin recurrence? */
 /* amplitude(f) = min + (1-min)*(1-cos(2*pi*(ln(f/f1) / ln(fn/f1)))/2 */
-Sound Sound_createShepardTone (double minimumTime, double maximumTime,
-                               double samplingFrequency, double lowestFrequency, long numberOfComponents,
-                               double frequencyChange_st, double amplitudeRange) {
+autoSound Sound_createShepardTone (double minimumTime, double maximumTime, double samplingFrequency, double lowestFrequency, long numberOfComponents, double frequencyChange_st, double amplitudeRange) {
 	try {
 		double scale = pow (2, numberOfComponents);
 		double maximumFrequency = lowestFrequency * scale;
@@ -957,11 +950,12 @@ Sound Sound_createShepardTone (double minimumTime, double maximumTime,
 		double lnf1 = log (lowestFrequency + 1);
 		double amplarg = twoPi / log ( (maximumFrequency + 1) /
 		                               (lowestFrequency + 1));
-
-		if (lowestFrequency > samplingFrequency / 2) Melder_throw
-			(U"Sound_createShepardTone: lowest frequency too high.");
-		if (maximumFrequency > samplingFrequency / 2) Melder_throw
-			(U"Sound_createShepardTone: frequency of highest component too high.");
+		if (lowestFrequency > samplingFrequency / 2) {
+			Melder_throw (U"Sound_createShepardTone: lowest frequency too high.");
+		}
+		if (maximumFrequency > samplingFrequency / 2) {
+			Melder_throw (U"Sound_createShepardTone: frequency of highest component too high.");
+		}
 		autoSound me = Sound_create2 (minimumTime, maximumTime, samplingFrequency);
 
 		for (long i = 1; i <= my nx; i++) {
@@ -985,17 +979,17 @@ Sound Sound_createShepardTone (double minimumTime, double maximumTime,
 			}
 		}
 		Vector_scale (me.peek(), 0.99996948);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not created from Shepard tone.");
 	}
 }
 
-Sound Sound_createPattersonWightmanTone (double minimumTime, double maximumTime, double samplingFrequency,
-        double baseFrequency, double frequencyShiftRatio, long numberOfComponents) {
+autoSound Sound_createPattersonWightmanTone (double minimumTime, double maximumTime, double samplingFrequency, double baseFrequency, double frequencyShiftRatio, long numberOfComponents) {
 	try {
-		if ( (numberOfComponents - 1 + frequencyShiftRatio) * baseFrequency >  samplingFrequency / 2) Melder_throw
-			(U"Frequency of one or more components too large.");
+		if ( (numberOfComponents - 1 + frequencyShiftRatio) * baseFrequency >  samplingFrequency / 2) {
+			Melder_throw (U"Frequency of one or more components too large.");
+		}
 		autoSound me = Sound_create2 (minimumTime, maximumTime, samplingFrequency);
 		double w0 = NUM2pi * baseFrequency;
 		for (long i = 1; i <= my nx; i++) {
@@ -1006,19 +1000,19 @@ Sound Sound_createPattersonWightmanTone (double minimumTime, double maximumTime,
 			my z[1][i] = a;
 		}
 		Vector_scale (me.peek(), 0.99996948);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not created from Patterson Wightman tone.");
 	}
 }
 
-Sound Sound_createPlompTone (double minimumTime, double maximumTime, double samplingFrequency,
-                             double baseFrequency, double frequencyFraction, long m) {
+autoSound Sound_createPlompTone (double minimumTime, double maximumTime, double samplingFrequency, double baseFrequency, double frequencyFraction, long m) {
 	try {
 		double w1 = NUM2pi * (1 - frequencyFraction) * baseFrequency;
 		double w2 = NUM2pi * (1 + frequencyFraction) * baseFrequency;
-		if (12 * (1 + frequencyFraction) * baseFrequency >  samplingFrequency / 2) Melder_throw
-			(U"Sound_createPlompTone: frequency of one or more components too large.");
+		if (12 * (1 + frequencyFraction) * baseFrequency >  samplingFrequency / 2) {
+			Melder_throw (U"Sound_createPlompTone: frequency of one or more components too large.");
+		}
 		autoSound me = Sound_create2 (minimumTime, maximumTime, samplingFrequency);
 		for (long i = 1; i <= my nx; i++) {
 			double a = 0, t = (i - 0.5) * my dx;
@@ -1031,7 +1025,7 @@ Sound Sound_createPlompTone (double minimumTime, double maximumTime, double samp
 			my z[1][i] = a;
 		}
 		Vector_scale (me.peek(), 0.99996948);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not created from Plomp tone.");
 	}
@@ -1243,7 +1237,7 @@ void Sound_filter_part_formula (Sound me, double t1, double t2, const char32 *fo
    The underlying analog signal still could have jumps undetected by this algorithm.
     We could get a better approximation by first upsampling the signal.
 */
-PointProcess Sound_to_PointProcess_getJumps (Sound me, double minimumJump, double dt) {
+autoPointProcess Sound_to_PointProcess_getJumps (Sound me, double minimumJump, double dt) {
 	try {
 		autoPointProcess thee = PointProcess_create (my xmin, my xmax, 10);
 		long i = 1, dtn = (long) floor (dt / my dx);
@@ -1263,24 +1257,20 @@ PointProcess Sound_to_PointProcess_getJumps (Sound me, double minimumJump, doubl
 			}
 			i += step;
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no PointProcess created.");
 	}
 }
 
 /* Internal pitch representation in semitones */
-Sound Sound_and_Pitch_changeSpeaker (Sound me, Pitch him,
-                                     double formantMultiplier, // > 0
-                                     double pitchMultiplier, // > 0
-                                     double pitchRangeMultiplier, // any number
-                                     double durationMultiplier) { // > 0
+autoSound Sound_and_Pitch_changeSpeaker (Sound me, Pitch him, double formantMultiplier, double pitchMultiplier, double pitchRangeMultiplier, double durationMultiplier) {
 	try {
 		double samplingFrequency_old = 1 / my dx;
 
-		if (my xmin != his xmin || my xmax != his xmax) Melder_throw
-			(U"The Pitch and the Sound object must have the same start and end times.");
-
+		if (my xmin != his xmin || my xmax != his xmax) {
+			Melder_throw (U"The Pitch and the Sound object must have the same start and end times.");
+		}
 		autoSound sound = Data_copy (me);
 		Vector_subtractMean (sound.peek());
 
@@ -1312,43 +1302,38 @@ Sound Sound_and_Pitch_changeSpeaker (Sound me, Pitch him,
 		// Resample to the original sampling frequency
 
 		if (formantMultiplier != 1) {
-			thee.reset (Sound_resample (thee.peek(), samplingFrequency_old, 10));
+			thee = Sound_resample (thee.peek(), samplingFrequency_old, 10);
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not created from Pitch & Sound.");
 	}
 }
 
-Sound Sound_changeSpeaker (Sound me, double pitchMin, double pitchMax,
-                           double formantMultiplier, // > 0
-                           double pitchMultiplier, // > 0
-                           double pitchRangeMultiplier, // any number
-                           double durationMultiplier) { // > 0
+autoSound Sound_changeSpeaker (Sound me, double pitchMin, double pitchMax, double formantMultiplier, double pitchMultiplier,  double pitchRangeMultiplier, double durationMultiplier) { // > 0
 	try {
 		autoPitch pitch = Sound_to_Pitch (me, 0.8 / pitchMin, pitchMin, pitchMax);
 		autoSound thee = Sound_and_Pitch_changeSpeaker (me, pitch.peek(), formantMultiplier, pitchMultiplier, pitchRangeMultiplier, durationMultiplier);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": speaker not changed.");
 	}
 }
 
-TextGrid Sound_to_TextGrid_detectSilences (Sound me, double minPitch, double timeStep,
+autoTextGrid Sound_to_TextGrid_detectSilences (Sound me, double minPitch, double timeStep,
 	double silenceThreshold, double minSilenceDuration, double minSoundingDuration,
 	const char32 *silentLabel, const char32 *soundingLabel) {
 	try {
 		int subtractMeanPressure = 1;
 		autoIntensity thee = Sound_to_Intensity (me, minPitch, timeStep, subtractMeanPressure);
 		autoTextGrid him = Intensity_to_TextGrid_detectSilences (thee.peek(), silenceThreshold, minSilenceDuration, minSoundingDuration, silentLabel, soundingLabel);
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (me, U": no TextGrid with silences created.");
 	}
 }
 
-void Sound_getStartAndEndTimesOfSounding (Sound me, double minPitch, double timeStep,
-	double silenceThreshold, double minSilenceDuration, double minSoundingDuration, double *t1, double *t2) {
+void Sound_getStartAndEndTimesOfSounding (Sound me, double minPitch, double timeStep, double silenceThreshold, double minSilenceDuration, double minSoundingDuration, double *t1, double *t2) {
 	try {
 		const char32 *silentLabel = U"-", *soundingLabel = U"+";
 		autoTextGrid dbs = Sound_to_TextGrid_detectSilences (me, minPitch, timeStep, silenceThreshold,
@@ -1369,7 +1354,7 @@ void Sound_getStartAndEndTimesOfSounding (Sound me, double minPitch, double time
 	}
 }
 
-Sound Sound_and_IntervalTier_cutPartsMatchingLabel (Sound me, IntervalTier thee, const char32 *match) {
+autoSound Sound_and_IntervalTier_cutPartsMatchingLabel (Sound me, IntervalTier thee, const char32 *match) {
     try {
         // count samples of the trimmed sound
         long ixmin, ixmax, numberOfSamples = 0, previous_ixmax = 0;
@@ -1412,13 +1397,14 @@ Sound Sound_and_IntervalTier_cutPartsMatchingLabel (Sound me, IntervalTier thee,
             }
         }
         Melder_assert (numberOfSamples == his nx);
-        return him.transfer();
+        return him;
     } catch (MelderError) {
         Melder_throw (me, U": intervals not trimmed.");
     }
 }
 
-Sound Sound_trimSilences (Sound me, double trimDuration, bool onlyAtStartAndEnd, double minPitch, double timeStep, double silenceThreshold, double minSilenceDuration, double minSoundingDuration, TextGrid *tg, const char32 *trimLabel) {
+
+autoSound Sound_trimSilences (Sound me, double trimDuration, bool onlyAtStartAndEnd, double minPitch, double timeStep, double silenceThreshold, double minSilenceDuration, double minSoundingDuration, autoTextGrid *p_tg, const char32 *trimLabel) {
     try {
         if (my ny > 1) {
             Melder_throw (U"The sound must be a mono sound.");
@@ -1457,22 +1443,21 @@ Sound Sound_trimSilences (Sound me, double trimDuration, bool onlyAtStartAndEnd,
             }
         }
         autoSound thee = Sound_and_IntervalTier_cutPartsMatchingLabel (me, itg.peek(), trimLabel);
-        if (tg) {
+        if (p_tg) {
 			TextGrid_addTier_copy (dbs.peek(), itg.peek());
-            *tg = dbs.transfer();
+            *p_tg = dbs.move();
         }
-        return thee.transfer();
+        return thee;
     } catch (MelderError) {
         Melder_throw (me, U": silences not trimmed.");
     }
 }
 
-Sound Sound_trimSilencesAtStartAndEnd (Sound me, double trimDuration, double minPitch, double timeStep,
+autoSound Sound_trimSilencesAtStartAndEnd (Sound me, double trimDuration, double minPitch, double timeStep,
 	double silenceThreshold, double minSilenceDuration, double minSoundingDuration, double *t1, double *t2) {
 	try {
-		TextGrid tg;
+		autoTextGrid tg;
 		autoSound thee = Sound_trimSilences (me, trimDuration, true, minPitch, timeStep, silenceThreshold, minSilenceDuration, minSoundingDuration, &tg, U"trimmed");
-		autoTextGrid atg = tg;
 		IntervalTier trim = (IntervalTier) tg -> tiers -> item[2];
 		TextInterval ti1 = (TextInterval) trim -> intervals -> item[1];
 		*t1 = my xmin;
@@ -1484,7 +1469,7 @@ Sound Sound_trimSilencesAtStartAndEnd (Sound me, double trimDuration, double min
 		if (Melder_equ (ti2 -> text, U"trimmed")) {
 			*t2 = ti2 -> xmin;
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": silences not trimmed.");
 	}
@@ -1528,15 +1513,16 @@ static Pitch Pitch_scaleTime_old (Pitch me, double scaleFactor) {
 	}
 }
 
-Sound Sound_and_Pitch_changeGender_old (Sound me, Pitch him, double formantRatio, double new_pitch, double pitchRangeFactor, double durationFactor) {
+autoSound Sound_and_Pitch_changeGender_old (Sound me, Pitch him, double formantRatio, double new_pitch, double pitchRangeFactor, double durationFactor) {
 	try {
 		double samplingFrequency_old = 1 / my dx;
 
 		if (my ny > 1) {
 			Melder_throw (U"Change Gender works only on mono sounds.");
 		}
-		if (my xmin != his xmin || my xmax != his xmax) Melder_throw
-			(U"The Pitch and the Sound object must have the same starting times and finishing times.");
+		if (my xmin != his xmin || my xmax != his xmax) {
+			Melder_throw (U"The Pitch and the Sound object must have the same starting times and finishing times.");
+		}
 		if (new_pitch < 0) {
 			Melder_throw (U"The new pitch median must not be negative.");
 		}
@@ -1574,21 +1560,20 @@ Sound Sound_and_Pitch_changeGender_old (Sound me, Pitch him, double formantRatio
 		// Resample to the original sampling frequency
 
 		if (formantRatio != 1) {
-			thee.reset (Sound_resample (thee.peek(), samplingFrequency_old, 10));
+			thee = Sound_resample (thee.peek(), samplingFrequency_old, 10);
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not created from Pitch & Sound.");
 	}
 }
 
-Sound Sound_changeGender_old (Sound me, double fmin, double fmax, double formantRatio,
-                              double new_pitch, double pitchRangeFactor, double durationFactor) {
+autoSound Sound_changeGender_old (Sound me, double fmin, double fmax, double formantRatio, double new_pitch, double pitchRangeFactor, double durationFactor) {
 	try {
 		autoPitch pitch = Sound_to_Pitch (me, 0.8 / fmin, fmin, fmax);
 		autoSound thee = Sound_and_Pitch_changeGender_old (me, pitch.peek(), formantRatio,
 		                 new_pitch, pitchRangeFactor, durationFactor);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not created for gender change.");
 	}
@@ -1681,8 +1666,7 @@ void Sound_fade (Sound me, int channel, double t, double fadeTime, int inout, in
 	} else if (fadeTime > 0) {
 		t1 = t; t2 = t + fadeTime;
 	} else {
-		Melder_warning (U"You have given a \"Fade time\" of zero seconds. The fade-", fade_inout,
-		                U"will not happen.");
+		Melder_warning (U"You have given a \"Fade time\" of zero seconds. The fade-", fade_inout, U"will not happen.");
 		return;
 	}
 	long i0 = 0, iystart, iyend;
@@ -1741,7 +1725,7 @@ void Sound_fade (Sound me, int channel, double t, double fadeTime, int inout, in
 }
 
 /* 1; rect 2:hamming 3: bartlet 4: welch 5: hanning 6:gaussian */
-Sound Sound_createFromWindowFunction (double windowDuration, double samplingFrequency, int windowType) {
+autoSound Sound_createFromWindowFunction (double windowDuration, double samplingFrequency, int windowType) {
 	try {
 		autoSound me = Sound_createSimple (1, windowDuration, samplingFrequency);
 
@@ -1776,14 +1760,14 @@ Sound Sound_createFromWindowFunction (double windowDuration, double samplingFreq
 			}
 			my z[1][i] = value;
 		}
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not created from window function.");
 	}
 }
 
 /* y[n] = sum(i=-n, i=n, x[n+mi])/(2*n+1) */
-Sound Sound_localAverage (Sound me, double averagingInterval, int windowType) {
+autoSound Sound_localAverage (Sound me, double averagingInterval, int windowType) {
 	try {
 		double windowDuration = windowType == 6 ? 2 * averagingInterval : averagingInterval;
 		autoSound thee = Data_copy (me);
@@ -1809,7 +1793,7 @@ Sound Sound_localAverage (Sound me, double averagingInterval, int windowType) {
 				thy z[k][i] = sum / wsum;
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": no Sound (local average) created.");
 	}
@@ -1944,8 +1928,7 @@ void Sound_drawWhere (Sound me, Graphics g, double tmin, double tmax, double min
 	Graphics_setInner (g);
 	struct Formula_Result result;
 	for (long channel = 1; channel <= my ny; channel ++) {
-		Graphics_setWindow (g, tmin, tmax, minimum - (my ny - channel) * (maximum - minimum),
-			maximum + (channel - 1) * (maximum - minimum));
+		Graphics_setWindow (g, tmin, tmax, minimum - (my ny - channel) * (maximum - minimum), maximum + (channel - 1) * (maximum - minimum));
 		if (str32str (method, U"bars") || str32str (method, U"Bars")) {
 			for (long ix = ixmin; ix <= ixmax; ix ++) {
 				Formula_run (channel, ix, & result);
@@ -2044,8 +2027,7 @@ void Sound_drawWhere (Sound me, Graphics g, double tmin, double tmax, double min
 	}
 }
 
-void Sound_paintWhere (Sound me, Graphics g, Graphics_Colour colour, double tmin, double tmax,
-                       double minimum, double maximum, double level, bool garnish, long numberOfBisections, const char32 *formula, Interpreter interpreter) {
+void Sound_paintWhere (Sound me, Graphics g, Graphics_Colour colour, double tmin, double tmax, double minimum, double maximum, double level, bool garnish, long numberOfBisections, const char32 *formula, Interpreter interpreter) {
 	try {
 		long ixmin, ixmax;
 		struct Formula_Result result;
@@ -2057,9 +2039,7 @@ void Sound_paintWhere (Sound me, Graphics g, Graphics_Colour colour, double tmin
 		Graphics_setColour (g, colour);
 		Graphics_setInner (g);
 		for (long channel = 1; channel <= my ny; channel++) {
-			Graphics_setWindow (g, tmin, tmax,
-			                    minimum - (my ny - channel) * (maximum - minimum),
-			                    maximum + (channel - 1) * (maximum - minimum));
+			Graphics_setWindow (g, tmin, tmax, minimum - (my ny - channel) * (maximum - minimum), maximum + (channel - 1) * (maximum - minimum));
 			bool current, previous = true, fill = false; // fill only when leaving area
 			double tmini = tmin, tmaxi = tmax, xe, ye;
 			long ix = ixmin;
@@ -2104,8 +2084,7 @@ void Sound_paintWhere (Sound me, Graphics g, Graphics_Colour colour, double tmin
 	}
 }
 
-void Sounds_paintEnclosed (Sound me, Sound thee, Graphics g, Graphics_Colour colour, double tmin, double tmax,
-                           double minimum, double maximum, bool garnish) {
+void Sounds_paintEnclosed (Sound me, Sound thee, Graphics g, Graphics_Colour colour, double tmin, double tmax, double minimum, double maximum, bool garnish) {
 	try {
 		long ixmin, ixmax, numberOfChannels = my ny > thy ny ? my ny : thy ny;
 		double min1 = minimum, max1 = maximum, tmin1 = tmin, tmax1 = tmax;
@@ -2128,9 +2107,7 @@ void Sounds_paintEnclosed (Sound me, Sound thee, Graphics g, Graphics_Colour col
 		Graphics_setInner (g);
 		for (long channel = 1; channel <= numberOfChannels; channel++) {
 			autoPolygon him = Sounds_to_Polygon_enclosed (me, thee, channel, tmin, tmax, minimum, maximum);
-			Graphics_setWindow (g, tmin, tmax,
-			                    minimum - (numberOfChannels - channel) * (maximum - minimum),
-			                    maximum + (channel - 1) * (maximum - minimum));
+			Graphics_setWindow (g, tmin, tmax, minimum - (numberOfChannels - channel) * (maximum - minimum), maximum + (channel - 1) * (maximum - minimum));
 			Graphics_fillArea (g, his numberOfPoints, &his x[1], &his y[1]);
 		}
 		Graphics_setWindow (g, tmin, tmax, minimum, maximum);
@@ -2146,7 +2123,7 @@ void Sounds_paintEnclosed (Sound me, Sound thee, Graphics g, Graphics_Colour col
 	}
 }
 
-Sound Sound_copyChannelRanges (Sound me, const char32 *ranges) {
+autoSound Sound_copyChannelRanges (Sound me, const char32 *ranges) {
 	try {
 		long numberOfChannels;
 		autoNUMvector <long> channels (NUMstring_getElementsOfRanges (ranges, my ny, & numberOfChannels, nullptr, U"channel", true), 1);
@@ -2155,14 +2132,14 @@ Sound Sound_copyChannelRanges (Sound me, const char32 *ranges) {
 			double *from = my z[channels[i]], *to = thy z[i];
 			NUMvector_copyElements<double> (from, to, 1, my nx);
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": could not extract channels.");
 	}
 }
 
 /* After a script by Ton Wempe */
-static Sound Sound_removeNoiseBySpectralSubtraction_mono (Sound me, Sound noise, double windowLength) {
+static autoSound Sound_removeNoiseBySpectralSubtraction_mono (Sound me, Sound noise, double windowLength) {
 	try {
 		if (my dx != noise -> dx) {
 			Melder_throw (U"The sound and the noise must have the same sampling frequency.");
@@ -2214,7 +2191,7 @@ static Sound Sound_removeNoiseBySpectralSubtraction_mono (Sound me, Sound noise,
 				denoised -> z[1][istart - 1 + j] += 0.5 * suppressed -> z[1][j]; // 0.5 because of 2-fold oversampling
 			}
 		}
-		return denoised.transfer();
+		return denoised;
 	} catch (MelderError) {
 		Melder_throw (me, U": noise not subtracted.");
 	}
@@ -2241,7 +2218,7 @@ static void Sound_findNoise (Sound me, double minimumNoiseDuration, double *nois
 	}
 }
 
-Sound Sound_removeNoise (Sound me, double noiseStart, double noiseEnd, double windowLength, double minBandFilterFrequency, double maxBandFilterFrequency, double smoothing, int method) {
+autoSound Sound_removeNoise (Sound me, double noiseStart, double noiseEnd, double windowLength, double minBandFilterFrequency, double maxBandFilterFrequency, double smoothing, int method) {
 	try {
 		autoSound filtered = Sound_filter_passHannBand (me, minBandFilterFrequency, maxBandFilterFrequency, smoothing);
 		autoSound denoised = Sound_create (my ny, my xmin, my xmax, my nx, my dx, my x1);
@@ -2254,11 +2231,11 @@ Sound Sound_removeNoise (Sound me, double noiseStart, double noiseEnd, double wi
 			}
 			autoSound noise = Sound_extractPart (channeli.peek(), noiseStart, noiseEnd, kSound_windowShape_RECTANGULAR, 1.0, false);
 			if (method == 1) { // spectral subtraction
-				denoisedi.reset (Sound_removeNoiseBySpectralSubtraction_mono (filtered.peek(), noise.peek(), windowLength));
+				denoisedi = Sound_removeNoiseBySpectralSubtraction_mono (filtered.peek(), noise.peek(), windowLength);
 			}
 			NUMvector_copyElements<double> (denoisedi -> z[1], denoised -> z[ichannel], 1, my nx);
 		}
-		return denoised.transfer();
+		return denoised;
 	} catch (MelderError) {
 		Melder_throw (me, U": not denoised.");
 	}
diff --git a/dwtools/Sound_extensions.h b/dwtools/Sound_extensions.h
index 09d8354..f91b599 100644
--- a/dwtools/Sound_extensions.h
+++ b/dwtools/Sound_extensions.h
@@ -2,7 +2,7 @@
 #define _Sound_extensions_h_
 /* Sound_extensions.h
  *
- * Copyright (C) 1993-2012 David Weenink
+ * Copyright (C) 1993-2012, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -50,12 +50,11 @@ Sound Sound_readFromRawFile (MelderFile file, const char *format, int nBitsCodin
  *	skipNBytes	: start reading after this number of bytes (skipNBytes >= 0 )
  */
 
-Sound Sound_readFromDialogicADPCMFile (MelderFile file, double sampleRate);
+autoSound Sound_readFromDialogicADPCMFile (MelderFile file, double sampleRate);
 /*
 */
 
-void Sound_writeToRawFile (Sound me, MelderFile file, const char *format, int littleEndian,
-	int nBitsCoding, int unSigned);
+void Sound_writeToRawFile (Sound me, MelderFile file, const char *format, int littleEndian, int nBitsCoding, int unSigned);
 
 void Sound_into_Sound (Sound me, Sound to, double startTime);
 /* precondition: my dx == to->dx (equal sampling times */
@@ -73,38 +72,39 @@ void Sound_preEmphasis (Sound me, double preEmphasisFrequency);
 void Sound_deEmphasis (Sound me, double preEmphasisFrequency);
 /*	for (i=2; i <= my nx; i++ ) my z[1][i] += deEmphasis * my z[1][i-1]; */
 
-Sound Sound_createGaussian (double windowDuration, double samplingFrequency);
-Sound Sound_createHamming (double windowDuration, double samplingFrequency);
+autoSound Sound_createGaussian (double windowDuration, double samplingFrequency);
 
-Sound Sound_createSimpleToneComplex (double minimumTime, double maximumTime, double samplingFrequency,
+autoSound Sound_createHamming (double windowDuration, double samplingFrequency);
+
+autoSound Sound_createSimpleToneComplex (double minimumTime, double maximumTime, double samplingFrequency,
 	double firstFrequency, long numberOfComponents, double frequencyDistance,
 	int scaleAmplitudes);
 
-Sound Sound_createMistunedHarmonicComplex (double minimumTime, double maximumTime, double samplingFrequency,
+autoSound Sound_createMistunedHarmonicComplex (double minimumTime, double maximumTime, double samplingFrequency,
 	double firstFrequency, long numberOfComponents, long mistunedComponent,
 	double mistuningFraction, int scaleAmplitudes);
 
-Sound Sound_createGammaTone (double minimumTime, double maximumTime, double samplingFrequency,
+autoSound Sound_createGammaTone (double minimumTime, double maximumTime, double samplingFrequency,
 	long gamma, double frequency, double bandwidth, double initialPhase, double addition,
 	int scaleAmplitudes);
 
-Sound Sound_createShepardTone (double minimumTime, double maximumTime, double samplingFrequency,
+autoSound Sound_createShepardTone (double minimumTime, double maximumTime, double samplingFrequency,
 	double lowestFrequency, long numberOfComponents, double frequencyChange, double amplitudeRange);
 
-Sound Sound_createShepardToneComplex (double minimumTime, double maximumTime,
+autoSound Sound_createShepardToneComplex (double minimumTime, double maximumTime,
 	double samplingFrequency, double lowestFrequency, long numberOfComponents,
 	double frequencyChange_st, double amplitudeRange, double octaveShiftFraction);
 
-Sound Sound_createPattersonWightmanTone (double minimumTime, double maximumTime, double samplingFrequency,
+autoSound Sound_createPattersonWightmanTone (double minimumTime, double maximumTime, double samplingFrequency,
 	double baseFrequency, double frequencyShiftRatio, long numberOfComponents);
 
-Sound Sound_createPlompTone (double minimumTime, double maximumTime, double samplingFrequency,
+autoSound Sound_createPlompTone (double minimumTime, double maximumTime, double samplingFrequency,
 	double baseFrequency, double frequencyFraction, long m);
 
-Sound Sound_createFromWindowFunction (double effectiveTime, double samplingFrequency, int windowType);
+autoSound Sound_createFromWindowFunction (double effectiveTime, double samplingFrequency, int windowType);
 /* 1; rect 2:hamming 3: bartlet 4: welch 5: hanning 6:gaussian */
 
-Sound Sound_filterByGammaToneFilter4 (Sound me, double centre_frequency, double bandwidth);
+autoSound Sound_filterByGammaToneFilter4 (Sound me, double centre_frequency, double bandwidth);
 
 void Sounds_multiply (Sound me, Sound thee);
 /* precondition: my nx = thy nx */
@@ -117,7 +117,7 @@ double Sound_correlateParts (Sound me, double t1, double t2, double duration);
 void Sound_localMean (Sound me, double fromTime, double toTime, double *mean);
 void Sound_localPeak (Sound me, double fromTime, double toTime, double ref, double *peak);
 
-Sound Sound_localAverage (Sound me, double averaginginterval, int windowType);
+autoSound Sound_localAverage (Sound me, double averaginginterval, int windowType);
 /* y[n] = sum(i=-n, i=n, x[n+i])/(2*n+1) */
 
 double Sound_power (Sound me);
@@ -148,23 +148,24 @@ void Sound_draw_btlr (Sound me, Graphics g, double tmin, double tmax, double ami
 void Sound_drawWhere (Sound me, Graphics g, double tmin, double tmax, double minimum, double maximum,
 	bool garnish, const char32 *method, long numberOfBisections, const char32 *formula, Interpreter interpreter);
 
-void Sound_paintWhere (Sound me, Graphics g, Graphics_Colour colour, double tmin, double tmax,
-	double minimum, double maximum, double level, bool garnish, long numberOfBisections, const char32 *formula, Interpreter interpreter);
+void Sound_paintWhere (Sound me, Graphics g, Graphics_Colour colour, double tmin, double tmax, double minimum, double maximum, double level, bool garnish, long numberOfBisections, const char32 *formula, Interpreter interpreter);
+
 void Sounds_paintEnclosed (Sound me, Sound thee, Graphics g, Graphics_Colour colour, double tmin, double tmax,
 	double minimum, double maximum, bool garnish);
 
-Sound Sound_changeGender (Sound me, double pitchMin, double pitchMax, double pitchRatio,
+autoSound Sound_changeGender (Sound me, double pitchMin, double pitchMax, double pitchRatio,
 	double formantFrequenciesRatio, double durationRatio);
-Sound Sound_and_Pitch_changeGender (Sound me, Pitch him, double pitchRatio,
+
+autoSound Sound_and_Pitch_changeGender (Sound me, Pitch him, double pitchRatio,
 	double formantFrequenciesRatio, double durationRatio);
 
-Sound Sound_changeGender_old (Sound me, double fmin, double fmax, double formantRatio,
+autoSound Sound_changeGender_old (Sound me, double fmin, double fmax, double formantRatio,
 	double new_pitch, double pitchRangeFactor, double durationFactor);
 
-Sound Sound_and_Pitch_changeGender_old (Sound me, Pitch him, double formantRatio,
+autoSound Sound_and_Pitch_changeGender_old (Sound me, Pitch him, double formantRatio,
 	double new_pitch, double pitchRangeFactor, double durationFactor);
 
-PointProcess Sound_to_PointProcess_getJumps (Sound me, double minimumJump, double dt);
+autoPointProcess Sound_to_PointProcess_getJumps (Sound me, double minimumJump, double dt);
 /*
 	Marks jumps in the signal where the amplitude changes more than 'minimumJump'
 	within time dt
@@ -172,42 +173,44 @@ PointProcess Sound_to_PointProcess_getJumps (Sound me, double minimumJump, doubl
 
 void Sound_filter_part_formula (Sound me, double t1, double t2, const char32 *formula, Interpreter interpreter);
 
-Sound Sound_changeSpeaker (Sound me, double pitchMin, double pitchMax,
+autoSound Sound_changeSpeaker (Sound me, double pitchMin, double pitchMax,
 	double formantMultiplier, // > 0
 	double pitchMultiplier, // > 0
 	double pitchRangeMultiplier, // any number
 	double durationMultiplier); // > 0
 
-Sound Sound_and_Pitch_changeSpeaker (Sound me, Pitch him,
+autoSound Sound_and_Pitch_changeSpeaker (Sound me, Pitch him,
 	double formantMultiplier, // > 0
 	double pitchMultiplier, // > 0
 	double pitchRangeMultiplier, // any number
 	double durationMultiplier); // > 0
 
 /* Outphased */
-Sound Sound_changeGender_old (Sound me, double fmin, double fmax, double formantRatio,
+autoSound Sound_changeGender_old (Sound me, double fmin, double fmax, double formantRatio,
 	double new_pitch, double pitchRangeFactor, double durationFactor);
 
-TextGrid Sound_to_TextGrid_detectSilences (Sound me, double minPitch, double timeStep,
+autoTextGrid Sound_to_TextGrid_detectSilences (Sound me, double minPitch, double timeStep,
 	double silenceThreshold, double minSilenceDuration, double minSoundingDuration,
 	const char32 *silentLabel, const char32 *soundingLabel);
+
 void Sound_getStartAndEndTimesOfSounding (Sound me, double minPitch, double timeStep,
 	double silenceThreshold, double minSilenceDuration, double minSoundingDuration, double *t1, double *t2);
 
-Sound Sound_and_IntervalTier_cutPartsMatchingLabel (Sound me, IntervalTier thee, const char32 *match);
+autoSound Sound_and_IntervalTier_cutPartsMatchingLabel (Sound me, IntervalTier thee, const char32 *match);
 /* Cut intervals that match the label from the sound. The starting time of the new sound is
  * (1) my xmin if the first interval is not matching
  * (2) the end time of the first interval if matching
  */
 
-Sound Sound_trimSilencesAtStartAndEnd (Sound me, double trimDuration, double minPitch, double timeStep,
+autoSound Sound_trimSilencesAtStartAndEnd (Sound me, double trimDuration, double minPitch, double timeStep,
 	double silenceThreshold, double minSilenceDuration, double minSoundingDuration, double *t1, double *t2);
-Sound Sound_trimSilences (Sound me, double trimDuration, bool onlyAtStartAndEnd, double minPitch, double timeStep,
-    double silenceThreshold, double minSilenceDuration, double minSoundingDuration, TextGrid *tg, const char32 *trimLabel);
 
-Sound Sound_copyChannelRanges (Sound me, const char32 *ranges);
+autoSound Sound_trimSilences (Sound me, double trimDuration, bool onlyAtStartAndEnd, double minPitch, double timeStep,
+    double silenceThreshold, double minSilenceDuration, double minSoundingDuration, autoTextGrid *p_tg, const char32 *trimLabel);
+
+autoSound Sound_copyChannelRanges (Sound me, const char32 *ranges);
 
-Sound Sound_removeNoise (Sound me, double noiseStart, double noiseEnd, double windowLength, double minBandFilterFrequency, double maxBandFilterFrequency, double smoothing, int method);
+autoSound Sound_removeNoise (Sound me, double noiseStart, double noiseEnd, double windowLength, double minBandFilterFrequency, double maxBandFilterFrequency, double smoothing, int method);
 
 void Sound_playAsFrequencyShifted (Sound me, double shiftBy, double newSamplingFrequency, long precision);
 
diff --git a/dwtools/SpeechSynthesizer.cpp b/dwtools/SpeechSynthesizer.cpp
index 759d111..fef3c8a 100644
--- a/dwtools/SpeechSynthesizer.cpp
+++ b/dwtools/SpeechSynthesizer.cpp
@@ -482,7 +482,7 @@ static void espeakdata_SetVoiceByName (const char *name, const char *variantName
 	}
 }
 
-Sound SpeechSynthesizer_to_Sound (SpeechSynthesizer me, const char32 *text, TextGrid *tg, Table *events) {
+autoSound SpeechSynthesizer_to_Sound (SpeechSynthesizer me, const char32 *text, autoTextGrid *tg, autoTable *events) {
 	try {
 		int fsamp = espeak_Initialize (AUDIO_OUTPUT_SYNCHRONOUS, 0, nullptr, // 5000ms
 			espeakINITIALIZE_PHONEME_EVENTS|espeakINITIALIZE_PHONEME_IPA);
@@ -522,7 +522,7 @@ Sound SpeechSynthesizer_to_Sound (SpeechSynthesizer me, const char32 *text, Text
 		autoSound thee = buffer_to_Sound (my d_wav, my d_numberOfSamples, my d_internalSamplingFrequency);
 
 		if (my d_samplingFrequency != my d_internalSamplingFrequency) {
-			thee.reset (Sound_resample (thee.peek(), my d_samplingFrequency, 50));
+			thee = Sound_resample (thee.peek(), my d_samplingFrequency, 50);
 		}
 		my d_numberOfSamples = 0; // re-use the wav-buffer
 		if (tg) {
@@ -530,9 +530,8 @@ Sound SpeechSynthesizer_to_Sound (SpeechSynthesizer me, const char32 *text, Text
 			if (xmin > thy xmin) xmin = thy xmin;
 			double xmax = Table_getNumericValue_Assert (my d_events, my d_events -> rows -> size, 1);
 			if (xmax < thy xmax) xmax = thy xmax;
-			autoTextGrid atg1 = Table_to_TextGrid (my d_events, text, xmin, xmax);
-			autoTextGrid atg2 =  TextGrid_extractPart (atg1.peek(), thy xmin, thy xmax, 0);
-			*tg = atg2.transfer();
+			autoTextGrid tg1 = Table_to_TextGrid (my d_events, text, xmin, xmax);
+			*tg = TextGrid_extractPart (tg1.peek(), thy xmin, thy xmax, 0);
 		}
 		if (events) {
 			Table_setEventTypeString (my d_events);
@@ -540,7 +539,7 @@ Sound SpeechSynthesizer_to_Sound (SpeechSynthesizer me, const char32 *text, Text
 			my d_events = nullptr;
 		}
 		forget (my d_events);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		espeak_Terminate ();
 		Melder_throw (U"Text not played.");
diff --git a/dwtools/SpeechSynthesizer.h b/dwtools/SpeechSynthesizer.h
index 9f8ae25..a77f197 100644
--- a/dwtools/SpeechSynthesizer.h
+++ b/dwtools/SpeechSynthesizer.h
@@ -2,7 +2,7 @@
 #define _SpeechSynthesizer_h_
 /* SpeechSynthesizer.h
  *
- * Copyright (C) 2011-2013 David Weenink
+ * Copyright (C) 2011-2013 David Weenink, 2015 Paul Boersma
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -55,7 +55,7 @@ const char32 *SpeechSynthesizer_getVoiceVariantCodeFromName (SpeechSynthesizer m
 void SpeechSynthesizer_setTextInputSettings (SpeechSynthesizer me, int inputTextFormat, int inputPhonemeCoding);
 void SpeechSynthesizer_setSpeechOutputSettings (SpeechSynthesizer me, double samplingFrequency, double wordgap, long pitchAdjustment, long pitchRange, long wordsPerMinute, bool estimateWordsPerMinute, int outputPhonemeCodes);
 
-Sound SpeechSynthesizer_to_Sound (SpeechSynthesizer me, const char32 *text, TextGrid *tg, Table *events);
+autoSound SpeechSynthesizer_to_Sound (SpeechSynthesizer me, const char32 *text, autoTextGrid *tg, autoTable *events);
 
 void SpeechSynthesizer_playText (SpeechSynthesizer me, const char32 *text);
 
diff --git a/dwtools/SpeechSynthesizer_and_TextGrid.cpp b/dwtools/SpeechSynthesizer_and_TextGrid.cpp
index a8fb214..71e88f4 100644
--- a/dwtools/SpeechSynthesizer_and_TextGrid.cpp
+++ b/dwtools/SpeechSynthesizer_and_TextGrid.cpp
@@ -34,23 +34,22 @@
 static void IntervalTier_splitInterval (IntervalTier me, double time, const char32 *leftLabel, long interval, double precision);
 static IntervalTier IntervalTier_and_IntervalTier_cutPartsMatchingLabel (IntervalTier me, IntervalTier thee, const char32 *label, double precision);
 static IntervalTier IntervalTiers_patch_noBoundaries (IntervalTier me, IntervalTier thee, const char32 *patchLabel, double precision);
-static TextGrid SpeechSynthesizer_and_Sound_and_IntervalTier_align2 (SpeechSynthesizer me, Sound thee, IntervalTier him, long istart, long iend, double silenceThreshold, double minSilenceDuration, double minSoundingDuration, double trimDuration);
 static Table IntervalTiers_to_Table_textAlignmentment (IntervalTier target, IntervalTier source, EditCostsTable costs);
 
-Sound SpeechSynthesizer_and_TextInterval_to_Sound (SpeechSynthesizer me, TextInterval thee, TextGrid *tg)
+autoSound SpeechSynthesizer_and_TextInterval_to_Sound (SpeechSynthesizer me, TextInterval thee, autoTextGrid *p_tg)
 {
 	try {
 		if (! thy text || thy text[0] == '\0') {
 			Melder_throw (U"No text in TextInterval.");
 		}
-		autoSound him = SpeechSynthesizer_to_Sound (me, thy text, tg, nullptr);
-		return him.transfer();
+		autoSound him = SpeechSynthesizer_to_Sound (me, thy text, p_tg, nullptr);
+		return him;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not created from TextInterval.");
 	}
 }
 
-Sound SpeechSynthesizer_and_TextGrid_to_Sound (SpeechSynthesizer me, TextGrid thee, long tierNumber, long iinterval, TextGrid *tg) {
+autoSound SpeechSynthesizer_and_TextGrid_to_Sound (SpeechSynthesizer me, TextGrid thee, long tierNumber, long iinterval, autoTextGrid *p_tg) {
 	try {
 		TextGrid_checkSpecifiedTierNumberWithinRange (thee, tierNumber);
 		IntervalTier intervalTier = (IntervalTier) thy tiers -> item [tierNumber];
@@ -60,7 +59,7 @@ Sound SpeechSynthesizer_and_TextGrid_to_Sound (SpeechSynthesizer me, TextGrid th
 		if (iinterval < 1 || iinterval > intervalTier -> intervals -> size) {
 			Melder_throw (U"Interval ", iinterval, U" does not exist on tier ", tierNumber, U".");
 		}
-		return SpeechSynthesizer_and_TextInterval_to_Sound (me, (TextInterval) intervalTier -> intervals -> item[iinterval], tg);
+		return SpeechSynthesizer_and_TextInterval_to_Sound (me, (TextInterval) intervalTier -> intervals -> item[iinterval], p_tg);
 	} catch (MelderError) {
 		Melder_throw (U"Sound not created from textGrid.");
 	}
@@ -461,7 +460,7 @@ TextGrid TextGrid_and_IntervalTier_patch (TextGrid me, IntervalTier thee, const
 
 // We assume that the Sound and the SpeechSynthesizer have the same samplingFrequency
 // schakel waarschuwingen over stiltedetectie uit
-TextGrid SpeechSynthesizer_and_Sound_and_TextInterval_align (SpeechSynthesizer me, Sound thee, TextInterval him, double silenceThreshold, double minSilenceDuration, double minSoundingDuration) {
+autoTextGrid SpeechSynthesizer_and_Sound_and_TextInterval_align (SpeechSynthesizer me, Sound thee, TextInterval him, double silenceThreshold, double minSilenceDuration, double minSoundingDuration) {
 	try {
 		if (thy xmin != his xmin || thy xmax != his xmax) {
 			Melder_throw (U"Domains of Sound and TextGrid must be equal.");
@@ -488,9 +487,9 @@ TextGrid SpeechSynthesizer_and_Sound_and_TextInterval_align (SpeechSynthesizer m
 			double wordsPerMinute_rawText = 60.0 * (str32len (his text) / 5.0) / s_thee_duration;
 			my d_wordsPerMinute =  (long) floor (0.5 * (wordsPerMinute_rawTokens + wordsPerMinute_rawText));
 		}
-		TextGrid tg2 = 0;
+		autoTextGrid tg2 = 0;
 		autoSound s2 = SpeechSynthesizer_and_TextInterval_to_Sound (me, him, &tg2);
-		autoTextGrid atg2 = tg2, s_atg2;
+		autoTextGrid silentTextGrid;
 		/*
 		 * For the synthesizer the silence threshold has to be < -30 dB, otherwise fricatives will not
 		 * be found as sounding! This is ok since silences are almost at zero amplitudes
@@ -505,7 +504,7 @@ TextGrid SpeechSynthesizer_and_Sound_and_TextInterval_align (SpeechSynthesizer m
 		double s_s2_duration = s_s2 -> xmax - s_s2 -> xmin;
 		bool hasSilence_s2 = fabs (t1_s2 - s2 -> xmin) > precision || fabs (t2_s2 - s2 -> xmax) > precision;
 		if (hasSilence_s2) {
-			s_atg2.reset (TextGrid_extractPart (atg2.peek(), t1_s2, t2_s2, true));
+			silentTextGrid = TextGrid_extractPart (tg2.peek(), t1_s2, t2_s2, true);
 		}
 		double analysisWidth = 0.02, dt = 0.005, band = 0.0;
 		// compare the durations of the two sounds to get an indication of the slope constraint of the DTW
@@ -521,7 +520,7 @@ TextGrid SpeechSynthesizer_and_Sound_and_TextInterval_align (SpeechSynthesizer m
 		//autoDTW dtw = CCs_to_DTW (m1.peek(), m2.peek(), wc, wle, wr, wer, dtr, matchStart, matchEnd, constraint);
         autoDTW dtw = Sounds_to_DTW ((hasSilence_thee ? s_thee.peek() : thee), (hasSilence_s2 ? s_s2.peek() : s2.peek()), analysisWidth, dt, band, constraint);
 		autoTextGrid result = DTW_and_TextGrid_to_TextGrid (dtw.peek(),
-			(hasSilence_s2 ? s_atg2.peek() : atg2.peek()), precision);
+			(hasSilence_s2 ? silentTextGrid.peek() : tg2.peek()), precision);
 		if (hasSilence_thee) {
 			if (t1_thee > thy xmin) {
 				TextGrid_setEarlierStartTime (result.peek(), thy xmin, U"", U"");
@@ -530,7 +529,7 @@ TextGrid SpeechSynthesizer_and_Sound_and_TextInterval_align (SpeechSynthesizer m
 				TextGrid_setLaterEndTime (result.peek(), thy xmax, U"", U"");
 			}
 		}
-		return result.transfer();
+		return result;
 	} catch (MelderError) {
 		Melder_throw (U"Sound and TextInterval not aligned.");
 	}
@@ -550,8 +549,7 @@ typedef struct structAlignmentOfSoundAndTextStruct {
 	double wordgap; // synthesizer
 } *SpeechSynthesizer_alignmentStruct;*/
 
-TextGrid SpeechSynthesizer_and_Sound_and_TextInterval_align2 (SpeechSynthesizer me, Sound thee, TextInterval him, double silenceThreshold, double minSilenceDuration, double minSoundingDuration, double trimDuration);
-TextGrid SpeechSynthesizer_and_Sound_and_TextInterval_align2 (SpeechSynthesizer me, Sound thee, TextInterval him, double silenceThreshold, double minSilenceDuration, double minSoundingDuration, double trimDuration) {
+static autoTextGrid SpeechSynthesizer_and_Sound_and_TextInterval_align2 (SpeechSynthesizer me, Sound thee, TextInterval him, double silenceThreshold, double minSilenceDuration, double minSoundingDuration, double trimDuration) {
     try {
         if (thy xmin != his xmin || thy xmax != his xmax) {
             Melder_throw (U"Domains of Sound and TextGrid must be equal.");
@@ -568,15 +566,14 @@ TextGrid SpeechSynthesizer_and_Sound_and_TextInterval_align2 (SpeechSynthesizer
          * the final plosive "t" from the word "text"
          *
          */
-        TextGrid tg_tmp = 0;
         double minPitch = 200, timeStep = 0.005, precision = thy dx;
-        autoSound thee_trimmed = Sound_trimSilences (thee, trimDuration, false, minPitch, timeStep, silenceThreshold,  minSilenceDuration, minSoundingDuration, &tg_tmp, trimLabel);
-        autoTextGrid thee_trimmer = tg_tmp;
+        autoTextGrid thee_trimmer;
+        autoSound thee_trimmed = Sound_trimSilences (thee, trimDuration, false, minPitch, timeStep, silenceThreshold,  minSilenceDuration, minSoundingDuration, &thee_trimmer, trimLabel);
 
         // 2. synthesize the sound from the TextInterval
 
-        autoSound synth = SpeechSynthesizer_and_TextInterval_to_Sound (me, him, &tg_tmp);
-        autoTextGrid tg_syn = tg_tmp;
+        autoTextGrid tg_syn;
+        autoSound synth = SpeechSynthesizer_and_TextInterval_to_Sound (me, him, &tg_syn);
 
         // 3. There should be no silences in the synthesized sound except at the start and finish.
 		//    Set the wordwap parameter to a small value like 0.001 s.
@@ -594,13 +591,13 @@ TextGrid SpeechSynthesizer_and_Sound_and_TextInterval_align2 (SpeechSynthesizer
         // 7. Patch the trimmed intervals back into the warped TextGrid
         autoTextGrid result = TextGrid_and_IntervalTier_patch (warp.peek(), (IntervalTier) thee_trimmer -> tiers ->item[1], U"trim", 2 * thy dx);
 
-        return result.transfer();
+        return result;
     } catch (MelderError) {
         Melder_throw (thee, U": sound and TextInterval not aligned.");
     }
 }
 
-TextGrid SpeechSynthesizer_and_Sound_and_IntervalTier_align (SpeechSynthesizer me, Sound thee, IntervalTier him, long istart, long iend, double silenceThreshold, double minSilenceDuration, double minSoundingDuration) {
+autoTextGrid SpeechSynthesizer_and_Sound_and_IntervalTier_align (SpeechSynthesizer me, Sound thee, IntervalTier him, long istart, long iend, double silenceThreshold, double minSilenceDuration, double minSoundingDuration) {
     try {
         if (istart < 1 || iend < istart || iend > his intervals -> size) {
             Melder_throw (U"Not avalid interval range.");
@@ -613,21 +610,21 @@ TextGrid SpeechSynthesizer_and_Sound_and_IntervalTier_align (SpeechSynthesizer m
             TextInterval ti = (TextInterval) his intervals -> item[iint];
             if (ti -> text && str32len (ti -> text) > 0) {
                 autoSound sound = Sound_extractPart (thee, ti -> xmin, ti -> xmax,  kSound_windowShape_RECTANGULAR, 1, true);
-                autoTextGrid atg = SpeechSynthesizer_and_Sound_and_TextInterval_align (me, sound.peek(), ti, silenceThreshold, minSilenceDuration, minSoundingDuration);
-                Collection_addItem (textgrids.peek(), atg.transfer());
+                autoTextGrid grid = SpeechSynthesizer_and_Sound_and_TextInterval_align (me, sound.peek(), ti, silenceThreshold, minSilenceDuration, minSoundingDuration);
+                Collection_addItem (textgrids.peek(), grid.transfer());
             }
         }
         if (textgrids -> size == 0) {
             Melder_throw (U"Nothing could be aligned. Was your IntervalTier empty?");
         }
         autoTextGrid aligned = TextGrids_to_TextGrid_appendContinuous (textgrids.peek(), true);
-        return aligned.transfer();
+        return aligned;
     } catch (MelderError) {
         Melder_throw (U"No aligned TextGrid created.");
     }
 }
 
-TextGrid SpeechSynthesizer_and_Sound_and_IntervalTier_align2 (SpeechSynthesizer me, Sound thee, IntervalTier him, long istart, long iend, double silenceThreshold, double minSilenceDuration, double minSoundingDuration, double trimDuration) {
+static autoTextGrid SpeechSynthesizer_and_Sound_and_IntervalTier_align2 (SpeechSynthesizer me, Sound thee, IntervalTier him, long istart, long iend, double silenceThreshold, double minSilenceDuration, double minSoundingDuration, double trimDuration) {
     try {
         if (istart < 1 || iend < istart || iend > his intervals -> size) {
             Melder_throw (U"Not avalid interval range.");
@@ -640,36 +637,36 @@ TextGrid SpeechSynthesizer_and_Sound_and_IntervalTier_align2 (SpeechSynthesizer
             TextInterval ti = (TextInterval) his intervals -> item[iint];
             if (ti -> text && str32len (ti -> text) > 0) {
                 autoSound sound = Sound_extractPart (thee, ti -> xmin, ti -> xmax,  kSound_windowShape_RECTANGULAR, 1, true);
-                autoTextGrid atg = SpeechSynthesizer_and_Sound_and_TextInterval_align2 (me, sound.peek(), ti, silenceThreshold, minSilenceDuration, minSoundingDuration, trimDuration);
-                Collection_addItem (textgrids.peek(), atg.transfer());
+                autoTextGrid grid = SpeechSynthesizer_and_Sound_and_TextInterval_align2 (me, sound.peek(), ti, silenceThreshold, minSilenceDuration, minSoundingDuration, trimDuration);
+                Collection_addItem (textgrids.peek(), grid.transfer());
             }
         }
         if (textgrids -> size == 0) {
             Melder_throw (U"Nothing could be aligned. Was your IntervalTier empty?");
         }
         autoTextGrid aligned = TextGrids_to_TextGrid_appendContinuous (textgrids.peek(), true);
-        return aligned.transfer();
+        return aligned;
     } catch (MelderError) {
         Melder_throw (U"No aligned TextGrid created.");
     }
 }
 
-TextGrid SpeechSynthesizer_and_Sound_and_TextGrid_align (SpeechSynthesizer me, Sound thee, TextGrid him, long tierNumber, long istart, long iend, double silenceThreshold, double minSilenceDuration, double minSoundingDuration) {
+autoTextGrid SpeechSynthesizer_and_Sound_and_TextGrid_align (SpeechSynthesizer me, Sound thee, TextGrid him, long tierNumber, long istart, long iend, double silenceThreshold, double minSilenceDuration, double minSoundingDuration) {
 	try {//TODO: check not empty tier
-		IntervalTier iTier = TextGrid_checkSpecifiedTierIsIntervalTier (him, tierNumber);
-		autoTextGrid tg = SpeechSynthesizer_and_Sound_and_IntervalTier_align (me, thee, iTier, istart, iend, silenceThreshold, minSilenceDuration, minSoundingDuration);
-		return tg.transfer();
+		IntervalTier tier = TextGrid_checkSpecifiedTierIsIntervalTier (him, tierNumber);
+		autoTextGrid grid = SpeechSynthesizer_and_Sound_and_IntervalTier_align (me, thee, tier, istart, iend, silenceThreshold, minSilenceDuration, minSoundingDuration);
+		return grid;
 	} catch (MelderError) {
 		Melder_throw (U"");
 	}
 }
 
 
-TextGrid SpeechSynthesizer_and_Sound_and_TextGrid_align2 (SpeechSynthesizer me, Sound thee, TextGrid him, long tierNumber, long istart, long iend, double silenceThreshold, double minSilenceDuration, double minSoundingDuration, double trimDuration) {
+autoTextGrid SpeechSynthesizer_and_Sound_and_TextGrid_align2 (SpeechSynthesizer me, Sound thee, TextGrid him, long tierNumber, long istart, long iend, double silenceThreshold, double minSilenceDuration, double minSoundingDuration, double trimDuration) {
     try {//TODO: check not empty tier
-    	IntervalTier iTier = TextGrid_checkSpecifiedTierIsIntervalTier (him, tierNumber);
-        autoTextGrid tg = SpeechSynthesizer_and_Sound_and_IntervalTier_align2 (me, thee, iTier, istart, iend, silenceThreshold, minSilenceDuration, minSoundingDuration, trimDuration);
-        return tg.transfer();
+    	IntervalTier tier = TextGrid_checkSpecifiedTierIsIntervalTier (him, tierNumber);
+        autoTextGrid grid = SpeechSynthesizer_and_Sound_and_IntervalTier_align2 (me, thee, tier, istart, iend, silenceThreshold, minSilenceDuration, minSoundingDuration, trimDuration);
+        return grid;
     } catch (MelderError) {
         Melder_throw (U"");
     }
diff --git a/dwtools/SpeechSynthesizer_and_TextGrid.h b/dwtools/SpeechSynthesizer_and_TextGrid.h
index ccf35ad..1f42322 100644
--- a/dwtools/SpeechSynthesizer_and_TextGrid.h
+++ b/dwtools/SpeechSynthesizer_and_TextGrid.h
@@ -27,17 +27,17 @@
 #include "TextGrid_extensions.h"
 #include "EditDistanceTable.h"
 
-Sound SpeechSynthesizer_and_TextInterval_to_Sound (SpeechSynthesizer me, TextInterval thee, TextGrid *tg);
+autoSound SpeechSynthesizer_and_TextInterval_to_Sound (SpeechSynthesizer me, TextInterval thee, autoTextGrid *tg);
 
-Sound SpeechSynthesizer_and_TextGrid_to_Sound (SpeechSynthesizer me, TextGrid thee, long itier, long iiint, TextGrid *tg);
+autoSound SpeechSynthesizer_and_TextGrid_to_Sound (SpeechSynthesizer me, TextGrid thee, long itier, long iiint, autoTextGrid *tg);
 
-TextGrid SpeechSynthesizer_and_Sound_and_TextInterval_align (SpeechSynthesizer me, Sound thee, TextInterval him,
+autoTextGrid SpeechSynthesizer_and_Sound_and_TextInterval_align (SpeechSynthesizer me, Sound thee, TextInterval him,
 	double silenceThreshold, double minSilenceDuration, double minSoundingDuration);
-TextGrid SpeechSynthesizer_and_Sound_and_IntervalTier_align (SpeechSynthesizer me, Sound thee, IntervalTier him,
+autoTextGrid SpeechSynthesizer_and_Sound_and_IntervalTier_align (SpeechSynthesizer me, Sound thee, IntervalTier him,
 	long istart, long iend, double silenceThreshold, double minSilenceDuration, double minSoundingDuration);
-TextGrid SpeechSynthesizer_and_Sound_and_TextGrid_align (SpeechSynthesizer me, Sound thee, TextGrid him,
+autoTextGrid SpeechSynthesizer_and_Sound_and_TextGrid_align (SpeechSynthesizer me, Sound thee, TextGrid him,
 	long tierNumber, long istart, long iend, double silenceThreshold, double minSilenceDuration, double minSoundingDuration);
-TextGrid SpeechSynthesizer_and_Sound_and_TextGrid_align2 (SpeechSynthesizer me, Sound thee, TextGrid him, long tierNumber, long istart, long iend, double silenceThreshold, double minSilenceDuration, double minSoundingDuration, double trimDuration);
+autoTextGrid SpeechSynthesizer_and_Sound_and_TextGrid_align2 (SpeechSynthesizer me, Sound thee, TextGrid him, long tierNumber, long istart, long iend, double silenceThreshold, double minSilenceDuration, double minSoundingDuration, double trimDuration);
 
 Table IntervalTiers__to_Table_textAlignmentment (IntervalTier target, IntervalTier source, EditCostsTable costs);
 Table TextGrids_to_Table_textAlignmentment (TextGrid target, long ttier, TextGrid source, long stier, EditCostsTable costs);
diff --git a/dwtools/manual_BSS.cpp b/dwtools/manual_BSS.cpp
index 04fa2fc..864ba8e 100644
--- a/dwtools/manual_BSS.cpp
+++ b/dwtools/manual_BSS.cpp
@@ -1,6 +1,6 @@
 /* manual_BSS.cpp
  *
- * Copyright (C) 2010-2014 David Weenink
+ * Copyright (C) 2010-2014, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -101,7 +101,7 @@ INTRO (U"Detemines the @@Covariance|covariances@ between the channels of a selec
 NORMAL (U"The covariance of a sound is determined by calculating the @@CrossCorrelationTable@ of a multichannel sound for a lag time equal to zero.")
 MAN_END
 
-MAN_BEGIN (U"Sound: To Sound (blind source separation)...", U"djmw", 20140224)
+MAN_BEGIN (U"Sound: To Sound (blind source separation)...", U"djmw", 20151030)
 INTRO (U"Analyze the selected multi-channel sound into its independent components by an iterative method.")
 NORMAL (U"The @@blind source separation@ method to find the independent components tries to simultaneously diagonalize a number of "
 	"@@CrossCorrelationTable at s that are calculated from the multi-channel sound at different lag times.")
@@ -171,7 +171,7 @@ CODE(U"s1 = To Sound: \"This is some text\", \"no\"")
 NORMAL (U"The first speech sound was created from the text \"This is some text\" at a speed of 175 words per minute.")
 CODE(U"selectObject: synth")
 CODE(U"Set speech output settings: 44100, 0.01, 80, 50, 145, \"no\", \"IPA\"")
-CODE(U"s2 = To Sound.: \"Abracadabra, abra\", 0.01, 80, 50, 145, \"yes\", \"no\", \"no\", \"yes\"")
+CODE(U"s2 = To Sound.: \"Abracadabra, abra\", \"no\"")
 NORMAL (U"The second sound \"Abracadabra, abra\" was synthesized at 145 words per minute with a somewhat larger pitch excursion (80) than the previous sound (50).")
 CODE(U"plusObject: s1")
 CODE(U"stereo = Combine to stereo")
@@ -215,6 +215,28 @@ NORMAL (U"The first two panels will not change between different sessions of pra
     "the result of the blind source separation, i.e. unmixing, will not always be the same because of two things. In the first place the unmixing always starts with an initialisation with random values of the parameters that "
     "we have to determine for the blind source separation. Therefore the iteration sequence will never be the same and the final outcomes might differ. In the second place, as was explained in the @@blind source separation@ manual, the unmixing is only "
     "unique up to a scale factor and a permutation. Therefore the channels in the unmixed sound do not necessarily correspond to the corresponding channel in our \"original\" stereo sound.")
+NORMAL (U"The complete script:")
+CODE (U"syn = Create SpeechSynthesizer: \"English\", \"default\"")
+CODE (U"s1 = To Sound: \"This is some text\", \"no\"")
+CODE (U"selectObject: syn")
+CODE (U"Set speech output settings: 44100, 0.01, 80, 50, 145, \"no\", \"IPA\"")
+CODE (U"s2 = To Sound: \"abracadabra, abra\", \"no\"")
+CODE (U"plusObject: s1")
+CODE (U"stereo = Combine to stereo")
+CODE (U"Select inner viewport: 1, 6, 0.1, 1.9")
+CODE (U"Draw: 0, 0, 0, 0, \"no\", \"Curve\"")
+CODE (U"Draw inner box")
+CODE (U"mm = Create simple MixingMatrix: \"mm\", 2, 2, \"1.0 2.0 2.0 1.0\"")
+CODE (U"plusObject: stereo")
+CODE (U"mixed = Mix")
+CODE (U"Select inner viewport: 1, 6, 2.1, 3.9")
+CODE (U"Draw: 0, 0, 0, 0, \"no\", \"Curve\"")
+CODE (U"Draw inner box")
+CODE (U"unmixed = To Sound (bss): 0.1, 1, 20, 0.00021, 100, 0.001, \"ffdiag\"")
+CODE (U"Select inner viewport: 1, 6, 4.1, 5.9")
+CODE (U"Draw: 0, 0, 0, 0, \"no\", \"Curve\"")
+CODE (U"Draw inner box")
+CODE (U"removeObject: unmixed, syn, stereo, s1, s2, mixed, mm")
 MAN_END
 
 MAN_BEGIN (U"Sound: To Sound (whiten channels)...", U"djmw", 20120303)
diff --git a/dwtools/manual_HMM.cpp b/dwtools/manual_HMM.cpp
index 950b3e4..20f4c2a 100644
--- a/dwtools/manual_HMM.cpp
+++ b/dwtools/manual_HMM.cpp
@@ -1,6 +1,6 @@
 /* manual_HMM.cpp
  *
- * Copyright (C) 2011-2014 David Weenink
+ * Copyright (C) 2011-2014, 2015 David Weenink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@ NORMAL (U"Expectation-maximization (EM) is an iterative method used to find maxi
 	"estimates of the parameters by maximizing the expected likelihood found in the E step. The "
 	"parameters found on the M step are then used to start another E step, and the process is "
 	"repeated until some criterion is satisfied. EM is frequently used for data clustering like for example in "
-	"@@TableOfReal: To GaussianMixture...|Gaussian mixtures@ or in the @@HMM & HMM_ObservationSequences: Learn...|Baum-Welch training@ of a Hidden Markov Model.")
+	"@@TableOfReal: To GaussianMixture...|Gaussian mixtures@ or in the @@HMM & HMMObservationSequences: Learn...|Baum-Welch training@ of a Hidden Markov Model.")
 MAN_END
 
 MAN_BEGIN (U"GaussianMixture", U"djmw", 20101026)
@@ -258,13 +258,13 @@ TAG (U"##Covariance matrices are")
 DEFINITION (U"defines whether the complete covariance matrices in the mixture have to be calculated or only the diagonal.")
 MAN_END
 
-MAN_BEGIN (U"HMM_ObservationSequence", U"djmw", 20140117)
-INTRO (U"An HMM_ObservationSequence models a sequence of observations. The observation sequence can be generated "
+MAN_BEGIN (U"HMMObservationSequence", U"djmw", 20140117)
+INTRO (U"An HMMObservationSequence models a sequence of observations. The observation sequence can be generated "
 	"by the @HMM or it can be used to train a model.")
 MAN_END
 
-MAN_BEGIN (U"HMM_StateSequence", U"djmw", 20101010)
-INTRO (U"An HMM_StateSequence models the sequence of states that an @HMM has traversed.")
+MAN_BEGIN (U"HMMStateSequence", U"djmw", 20101010)
+INTRO (U"An HMMStateSequence models the sequence of states that an @HMM has traversed.")
 MAN_END
 
 MAN_BEGIN (U"HMM", U"djmw", 20130410)
@@ -319,19 +319,19 @@ NORMAL (U"The symmetrized version is:")
 FORMULA (U"%D__%s_(\\la__1_,\\la__2_) = (%D(\\la__1_,\\la__2_) + %D(\\la__2_,\\la__1_))/2.")
 MAN_END
 
-MAN_BEGIN (U"HMM & HMM_ObservationSequence: Get cross-entropy", U"djmw", 20101017)
-INTRO (U"Calculates the cross-entropy between the selected @@HMM@ model and the @@HMM_ObservationSequence at .")
+MAN_BEGIN (U"HMM & HMMObservationSequence: Get cross-entropy", U"djmw", 20101017)
+INTRO (U"Calculates the cross-entropy between the selected @@HMM@ model and the @@HMMObservationSequence at .")
 NORMAL (U"The cross-entropy is a useful upper bound for the entropy of a model. An approximation to the cross-entropy for a model on a observation sequence  %O of length %N is: ")
 FORMULA (U"%H(%O) = -1/%N log %p(%O),")
 NORMAL (U"where %p(%O) is the probability of the observation sequence given the model.")
 MAN_END
 
-MAN_BEGIN (U"HMM & HMM & HMM_ObservationSequence: Get cross-entropy", U"djmw", 20101017)
+MAN_BEGIN (U"HMM & HMM & HMMObservationSequence: Get cross-entropy", U"djmw", 20101017)
 INTRO (U"Get the (symmetric) cross-entropy for the two selected @HMM models and an observation sequence.")
 NORMAL (U"See @@HMM & HMM: Get cross-entropy... at .")
 MAN_END
 
-MAN_BEGIN (U"HMM: To HMM_ObservationSequence...", U"djmw", 20101010)
+MAN_BEGIN (U"HMM: To HMMObservationSequence...", U"djmw", 20101010)
 INTRO (U"Use the selected @HMM as a generator for an observation sequence.")
 ENTRY (U"Settings")
 TAG (U"##Start state")
@@ -373,12 +373,12 @@ MAN_BEGIN (U"HMM: Get expected duration in state...", U"djmw", 20101010)
 INTRO (U"For the selected @HMM get the number of time units that the system is expected to stay in that state.")
 MAN_END
 
-MAN_BEGIN (U"HMM & HMM_StateSequence: Get probability", U"djmw", 20101010)
-INTRO (U"Get the natural logarithm of the probability that the selected @@HMM_StateSequence|state sequence@ was generated by the selected @HMM.")
+MAN_BEGIN (U"HMM & HMMStateSequence: Get probability", U"djmw", 20101010)
+INTRO (U"Get the natural logarithm of the probability that the selected @@HMMStateSequence|state sequence@ was generated by the selected @HMM.")
 MAN_END
 
-MAN_BEGIN (U"HMM & HMM_ObservationSequence: Get probability", U"djmw", 20101010)
-INTRO (U"Get the natural logarithm of the probability that the selected @@HMM_ObservationSequence|state sequence@ was generated by the selected @HMM.")
+MAN_BEGIN (U"HMM & HMMObservationSequence: Get probability", U"djmw", 20101010)
+INTRO (U"Get the natural logarithm of the probability that the selected @@HMMObservationSequence|state sequence@ was generated by the selected @HMM.")
 ENTRY (U"Algorithm")
 NORMAL (U"Viterbi")
 MAN_END
@@ -405,19 +405,19 @@ INTRO (U"Sets the probabilities that the model starts in the particular states."
 NORMAL (U"The values given will be scaled as probabilities. ")
 MAN_END
 
-MAN_BEGIN (U"HMM & HMM_ObservationSequence: To TableOfReal (bigrams)...", U"djmw", 20101019)
-INTRO (U"Get a table with bigrams and marginals form the selected @HMM_ObservationSequence and the @HMM.")
+MAN_BEGIN (U"HMM & HMMObservationSequence: To TableOfReal (bigrams)...", U"djmw", 20101019)
+INTRO (U"Get a table with bigrams and marginals form the selected @HMMObservationSequence and the @HMM.")
 NORMAL (U"The entry at row %i and column %j shows how often the %j-th symbol follows the %i-th symbol in the observation sequence.")
 ENTRY (U"Remark")
 NORMAL (U"The row and colum marginals for the first and the last element in the obsevation sequence will not be equal because there is no transition to the first and no transition from the last one.")
 MAN_END
 
-MAN_BEGIN (U"HMM_ObservationSequence: To TableOfReal (bigrams)...", U"djmw", 20101019)
-INTRO (U"Get a table with bigrams form the selected @HMM_ObservationSequence.")
-NORMAL (U"See also @@HMM & HMM_ObservationSequence: To TableOfReal (bigrams)... at .")
+MAN_BEGIN (U"HMMObservationSequence: To TableOfReal (bigrams)...", U"djmw", 20101019)
+INTRO (U"Get a table with bigrams form the selected @HMMObservationSequence.")
+NORMAL (U"See also @@HMM & HMMObservationSequence: To TableOfReal (bigrams)... at .")
 MAN_END
 
-MAN_BEGIN (U"HMM & HMM_ObservationSequences: Learn...", U"djmw", 20111130)
+MAN_BEGIN (U"HMM & HMMObservationSequences: Learn...", U"djmw", 20111130)
 INTRO (U"Train the transition and emission probabilities of the @HMM from the observations.")
 ENTRY (U"Algorithm")
 NORMAL (U"The Baum-Welch @@expectation-maximization@ procedure. It uses the forward and backward procedures to (re)estimate the parameters until convergence is reached.")
diff --git a/dwtools/praat_BSS_init.cpp b/dwtools/praat_BSS_init.cpp
index 31b49c6..97670c2 100644
--- a/dwtools/praat_BSS_init.cpp
+++ b/dwtools/praat_BSS_init.cpp
@@ -201,8 +201,9 @@ FORM (CrossCorrelationTables_createTestSet, U"CrossCorrelationTables: Create tes
 	REAL (U"Sigma", U"0.02")
 	OK
 DO
-	praat_new (CrossCorrelationTables_createTestSet (GET_INTEGER (U"Matrix dimension"),
-		GET_INTEGER (U"Number of matrices"), GET_INTEGER (U"First is positive definite"), GET_REAL (U"Sigma")), GET_STRING (U"Name"));
+	autoCrossCorrelationTables thee = CrossCorrelationTables_createTestSet (GET_INTEGER (U"Matrix dimension"),
+		GET_INTEGER (U"Number of matrices"), GET_INTEGER (U"First is positive definite"), GET_REAL (U"Sigma"));
+	praat_new (thee.transfer(), GET_STRING (U"Name"));
 END
 
 FORM (CrossCorrelationTable_createSimple, U"Create simple CrossCorrelationTable", 0)
@@ -212,8 +213,9 @@ FORM (CrossCorrelationTable_createSimple, U"Create simple CrossCorrelationTable"
 	NATURAL (U"Number of samples", U"100")
 	OK
 DO
-	praat_new (CrossCorrelationTable_createSimple (GET_STRING (U"Cross correlations"), GET_STRING (U"Centroid"),
-		GET_INTEGER (U"Number of samples")), GET_STRING (U"Name"));
+	autoCrossCorrelationTable thee = CrossCorrelationTable_createSimple (GET_STRING (U"Cross correlations"), GET_STRING (U"Centroid"),
+		GET_INTEGER (U"Number of samples"));
+	praat_new (thee.transfer(), GET_STRING (U"Name"));
 END
 
 FORM (MixingMatrix_createSimple, U"Create simple MixingMatrix", 0)
@@ -223,8 +225,9 @@ FORM (MixingMatrix_createSimple, U"Create simple MixingMatrix", 0)
 	SENTENCE (U"Mixing coefficients", U"1.0 1.0 1.0 1.0")
 	OK
 DO
-	praat_new (MixingMatrix_createSimple (GET_INTEGER (U"Number of channels"), GET_INTEGER (U"Number of components"),
-		GET_STRING (U"Mixing coefficients")), GET_STRING (U"Name"));
+	autoMixingMatrix thee = MixingMatrix_createSimple (GET_INTEGER (U"Number of channels"), GET_INTEGER (U"Number of components"),
+		GET_STRING (U"Mixing coefficients"));
+	praat_new (thee.transfer(), GET_STRING (U"Name"));
 END
 
 DIRECT (CrossCorrelationTable_help)
@@ -237,7 +240,8 @@ FORM (Sound_and_PCA_principalComponents, U"Sound & PCA: To Sound (principal comp
 DO
 	Sound me = FIRST (Sound);
 	PCA thee = FIRST (PCA);
-	praat_new (Sound_and_PCA_principalComponents (me, thee, GET_INTEGER (U"Number of components")), Thing_getName (me), U"_pc");
+	autoSound him = Sound_and_PCA_principalComponents (me, thee, GET_INTEGER (U"Number of components"));
+	praat_new (him.transfer(), my name, U"_pc");
 END
 
 FORM (Sound_and_PCA_whitenChannels, U"Sound & PCA: To Sound (white channels)", 0)
@@ -246,7 +250,8 @@ FORM (Sound_and_PCA_whitenChannels, U"Sound & PCA: To Sound (white channels)", 0
 DO
 	Sound me = FIRST (Sound);
 	PCA thee = FIRST (PCA);
-	praat_new (Sound_and_PCA_whitenChannels (me, thee, GET_INTEGER (U"Number of components")), Thing_getName (me), U"_white");
+	autoSound him = Sound_and_PCA_whitenChannels (me, thee, GET_INTEGER (U"Number of components"));
+	praat_new (him.transfer(), my name, U"_white");
 END
 
 DIRECT (CrossCorrelationTable_to_CrossCorrelationTables)
@@ -274,7 +279,8 @@ FORM (Sound_to_Covariance_channels, U"Sound: To Covariance (channels)", U"Sound:
 DO
 	LOOP {
 		iam (Sound);
-		praat_new (Sound_to_Covariance_channels (me, GET_REAL (U"left Time range"), GET_REAL (U"right Time range")), my name);
+		autoCovariance thee = Sound_to_Covariance_channels (me, GET_REAL (U"left Time range"), GET_REAL (U"right Time range"));
+		praat_new (thee.transfer(), my name);
 	}
 END
 
@@ -287,8 +293,9 @@ DO
 	double lagTime = fabs (GET_REAL (U"Lag step"));
     LOOP {
         iam (Sound);
-        praat_new (Sound_to_CrossCorrelationTable (me, GET_REAL (U"left Time range"),
-        GET_REAL (U"right Time range"), lagTime), my name);
+		autoCrossCorrelationTable thee = Sound_to_CrossCorrelationTable (me, GET_REAL (U"left Time range"),
+        GET_REAL (U"right Time range"), lagTime);
+        praat_new (thee.transfer(), my name);
     }
 END
 
@@ -351,8 +358,9 @@ FORM (CrossCorrelationTables_to_Diagonalizer, U"CrossCorrelationTables: To Diago
 DO
 	LOOP {
 		iam (CrossCorrelationTables);
-		praat_new (CrossCorrelationTables_to_Diagonalizer (me, GET_INTEGER (U"Maximum number of iterations"),
-		GET_REAL (U"Tolerance"), GET_INTEGER (U"Diagonalization method")), my name);
+		autoDiagonalizer thee = CrossCorrelationTables_to_Diagonalizer (me, GET_INTEGER (U"Maximum number of iterations"),
+		GET_REAL (U"Tolerance"), GET_INTEGER (U"Diagonalization method"));
+		praat_new (thee.transfer(), my name);
 	}
 END
 
@@ -385,13 +393,15 @@ END
 DIRECT (CrossCorrelationTable_and_Diagonalizer_diagonalize)
 	CrossCorrelationTable cct = FIRST (CrossCorrelationTable);
 	Diagonalizer d = FIRST (Diagonalizer);
-	praat_new (CrossCorrelationTable_and_Diagonalizer_diagonalize (cct, d), cct->name, U"_", d->name);
+	autoCrossCorrelationTable thee = CrossCorrelationTable_and_Diagonalizer_diagonalize (cct, d);
+	praat_new (thee.transfer(), cct -> name, U"_", d -> name);
 END
 
 DIRECT (CrossCorrelationTables_and_Diagonalizer_diagonalize)
 	CrossCorrelationTables ccts = FIRST (CrossCorrelationTables);
 	Diagonalizer d = FIRST (Diagonalizer);
-	praat_new (CrossCorrelationTables_and_Diagonalizer_diagonalize (ccts, d), ccts->name, U"_", d->name);
+	autoCrossCorrelationTables thee = CrossCorrelationTables_and_Diagonalizer_diagonalize (ccts, d);
+	praat_new (thee.transfer(), ccts->name, U"_", d->name);
 END
 
 FORM (CrossCorrelationTables_and_MixingMatrix_improveUnmixing, U"", 0)
@@ -412,7 +422,8 @@ END
 DIRECT (Diagonalizer_to_MixingMatrix)
 	LOOP {
 		iam (Diagonalizer);
-		praat_new (Diagonalizer_to_MixingMatrix (me), my name);
+		autoMixingMatrix thee = Diagonalizer_to_MixingMatrix (me);
+		praat_new (thee.transfer(), my name);
 	}
 END
 
@@ -431,10 +442,10 @@ FORM (Sound_to_MixingMatrix, U"Sound: To MixingMatrix", 0)
 DO
 	LOOP {
 		iam (Sound);
-		praat_new (Sound_to_MixingMatrix (me,
-			GET_REAL (U"left Time range"), GET_REAL (U"right Time range"), GET_INTEGER (U"Number of cross-correlations"),
-			GET_REAL (U"Lag step"), GET_INTEGER (U"Maximum number of iterations"), GET_REAL (U"Tolerance"),
-			GET_INTEGER (U"Diagonalization method")), my name);
+		autoMixingMatrix thee = Sound_to_MixingMatrix (me, GET_REAL (U"left Time range"), GET_REAL (U"right Time range"), 
+			GET_INTEGER (U"Number of cross-correlations"), GET_REAL (U"Lag step"), GET_INTEGER (U"Maximum number of iterations"),
+			GET_REAL (U"Tolerance"), GET_INTEGER (U"Diagonalization method"));
+		praat_new (thee.transfer(), my name);
 	}
 END
 
@@ -447,7 +458,8 @@ FORM (Sound_to_CrossCorrelationTables, U"Sound: To CrossCorrelationTables", 0)
 DO
 	LOOP {
 		iam (Sound);
-		praat_new (Sound_to_CrossCorrelationTables (me, GET_REAL (U"left Time range"), GET_REAL (U"right Time range"), GET_REAL (U"Lag step"), GET_INTEGER (U"Number of cross-correlations")), my name);
+		autoCrossCorrelationTables thee = Sound_to_CrossCorrelationTables (me, GET_REAL (U"left Time range"), GET_REAL (U"right Time range"), GET_REAL (U"Lag step"), GET_INTEGER (U"Number of cross-correlations"));
+		praat_new (thee.transfer(), my name);
 	}
 END
 
@@ -501,7 +513,8 @@ END
 DIRECT (TableOfReal_to_MixingMatrix)
 	LOOP {
 		iam (TableOfReal);
-		praat_new (TableOfReal_to_MixingMatrix (me), my name);
+		autoMixingMatrix thee = TableOfReal_to_MixingMatrix (me);
+		praat_new (thee.transfer(), my name);
 	}
 END
 
diff --git a/dwtools/praat_David_init.cpp b/dwtools/praat_David_init.cpp
index 96284ee..d33c17e 100644
--- a/dwtools/praat_David_init.cpp
+++ b/dwtools/praat_David_init.cpp
@@ -2149,13 +2149,15 @@ END
 DIRECT (DTW_and_TextGrid_to_TextGrid)
 	DTW me = FIRST (DTW);
 	TextGrid tg = FIRST (TextGrid);
-	praat_new (DTW_and_TextGrid_to_TextGrid (me, tg, 0), 0);
+	autoTextGrid thee = DTW_and_TextGrid_to_TextGrid (me, tg, 0);
+	praat_new (thee.transfer(), tg -> name, U"_", my name);
 END
 
 DIRECT (DTW_and_IntervalTier_to_Table)
 	DTW me = FIRST (DTW);
 	IntervalTier ti = FIRST (IntervalTier);
-	praat_new (DTW_and_IntervalTier_to_Table (me, ti, 1.0/44100), my name);
+	autoTable thee = DTW_and_IntervalTier_to_Table (me, ti, 1.0/44100);
+	praat_new (thee.transfer(), my name);
 END
 
 /******************** EditDistanceTable & EditCostsTable ********************************************/
@@ -2167,7 +2169,8 @@ END
 DIRECT (EditDistanceTable_to_TableOfReal_directions)
 	LOOP {
 		iam (EditDistanceTable);
-		praat_new (EditDistanceTable_to_TableOfReal_directions (me), my name);
+		autoTableOfReal thee = EditDistanceTable_to_TableOfReal_directions (me);
+		praat_new (thee.transfer(), my name);
 	}
 END
 
@@ -2369,7 +2372,8 @@ END
 DIRECT (EditCostsTable_to_TableOfReal)
 	LOOP {
 		iam (EditCostsTable);
-		praat_new (EditCostsTable_to_TableOfReal (me), my name);
+		autoTableOfReal thee = EditCostsTable_to_TableOfReal (me);
+		praat_new (thee.transfer(), my name);
 	}
 END
 
@@ -2383,7 +2387,8 @@ DO
 	numberOfTargetSymbols = numberOfTargetSymbols < 0 ? 0 : numberOfTargetSymbols;
 	long numberOfSourceSymbols = GET_INTEGER (U"Number of source symbols");
 	numberOfSourceSymbols = numberOfSourceSymbols < 0 ? 0 : numberOfSourceSymbols;
-	praat_new (EditCostsTable_create (numberOfTargetSymbols, numberOfSourceSymbols), GET_STRING (U"Name"));
+	autoEditCostsTable thee = EditCostsTable_create (numberOfTargetSymbols, numberOfSourceSymbols);
+	praat_new (thee.transfer(), GET_STRING (U"Name"));
 END
 
 /******************** Eigen ********************************************/
@@ -2502,19 +2507,22 @@ FORM (Eigen_and_Matrix_project, U"Eigen & Matrix: Project", U"Eigen & Matrix: Pr
 DO
 	Eigen me = FIRST_GENERIC (Eigen);
 	Matrix thee = FIRST_GENERIC (Matrix);
-	praat_new (Eigen_and_Matrix_project (me, thee, GET_INTEGER (U"Number of dimensions")), my name, U"_", thy name);
+	autoMatrix him = Eigen_and_Matrix_project (me, thee, GET_INTEGER (U"Number of dimensions"));
+	praat_new (him.transfer(), my name, U"_", thy name);
 END
 
 DIRECT (Eigen_and_SSCP_project)
 	Eigen me = FIRST_GENERIC (Eigen);
 	SSCP cp = FIRST (SSCP);
-	praat_new (Eigen_and_SSCP_project (me, cp), my name, U"_", cp->name);
+	autoSSCP thee = Eigen_and_SSCP_project (me, cp);
+	praat_new (thee.transfer(), my name, U"_", cp->name);
 END
 
 DIRECT (Eigen_and_Covariance_project)
 	Eigen me = FIRST_GENERIC (Eigen);
 	Covariance cv = FIRST (Covariance);
-	praat_new (Eigen_and_Covariance_project (me, cv), my name, U"_", cv->name);
+	autoCovariance thee = Eigen_and_Covariance_project (me, cv);
+	praat_new (thee.transfer(), my name, U"_", cv->name);
 END
 
 /******************** Index ********************************************/
@@ -2660,7 +2668,8 @@ FORM (Excitations_getItem, U"Excitations: Get item", 0)
 DO
 	LOOP {
 		iam (Excitations);
-		praat_new (Excitations_getItem (me, GET_INTEGER (U"Item number")), my name, U"_item");
+		autoExcitation thee = Excitations_getItem (me, GET_INTEGER (U"Item number"));
+		praat_new (thee.transfer(), my name, U"_item");
 	}
 END
 
@@ -2680,14 +2689,16 @@ FORM (Excitations_to_Pattern, U"Excitations: To Pattern", 0)
 DO
 	LOOP {
 		iam (Excitations);
-		praat_new (Excitations_to_Pattern (me, GET_INTEGER (U"Join")), my name);
+		autoPattern thee = Excitations_to_Pattern (me, GET_INTEGER (U"Join"));
+		praat_new (thee.transfer(), my name);
 	}
 END
 
 DIRECT (Excitations_to_TableOfReal)
 	LOOP {
 		iam (Excitations);
-		praat_new (Excitations_to_TableOfReal (me), my name);
+		autoTableOfReal thee = Excitations_to_TableOfReal (me);
+		praat_new (thee.transfer(), my name);
 	}
 END
 
@@ -3137,9 +3148,9 @@ DO
 		(f1 ? f2 : f1) = me;
 	}
 	Melder_assert (f1 != 0 && f2 != 0);
-	praat_new (BandFilterSpectrograms_crossCorrelate (f1, f2, GET_ENUM (kSounds_convolve_scaling, U"Amplitude scaling"),
-		GET_ENUM (kSounds_convolve_signalOutsideTimeDomain, U"Signal outside time domain is...")),
-		f1 -> name, U"_", f2 -> name);
+	autoSound thee = BandFilterSpectrograms_crossCorrelate (f1, f2, GET_ENUM (kSounds_convolve_scaling, U"Amplitude scaling"),
+		GET_ENUM (kSounds_convolve_signalOutsideTimeDomain, U"Signal outside time domain is..."));
+	praat_new (thee.transfer(), f1 -> name, U"_", f2 -> name);
 END
 
 FORM (FilterBanks_convolve, U"FilterBanks: Convolve", 0)
@@ -3166,9 +3177,9 @@ DO
 		(f1 ? f2 : f1) = me;
 	}
 	Melder_assert (f1 != 0 && f2 != 0);
-	praat_new (BandFilterSpectrograms_convolve (f1, f2, GET_ENUM (kSounds_convolve_scaling, U"Amplitude scaling"),
-		GET_ENUM (kSounds_convolve_signalOutsideTimeDomain, U"Signal outside time domain is...")),
-		f1 -> name, U"_", f2 -> name);
+	autoSound thee = BandFilterSpectrograms_convolve (f1, f2, GET_ENUM (kSounds_convolve_scaling, U"Amplitude scaling"),
+		GET_ENUM (kSounds_convolve_signalOutsideTimeDomain, U"Signal outside time domain is..."));
+	praat_new (thee.transfer(), f1 -> name, U"_", f2 -> name);
 END
 
 DIRECT (FilterBank_to_Intensity)
@@ -3449,9 +3460,10 @@ FORM (Intensity_to_TextGrid_detectSilences, U"Intensity: To TextGrid (silences)"
 DO
 	LOOP {
 		iam (Intensity);
-		praat_new (Intensity_to_TextGrid_detectSilences (me, GET_REAL (U"Silence threshold"),
+		autoTextGrid thee = Intensity_to_TextGrid_detectSilences (me, GET_REAL (U"Silence threshold"),
 			GET_REAL (U"Minimum silent interval duration"), GET_REAL (U"Minimum sounding interval duration"),
-			GET_STRING (U"Silent interval label"), GET_STRING (U"Sounding interval label")), my name);
+			GET_STRING (U"Silent interval label"), GET_STRING (U"Sounding interval label"));
+		praat_new (thee.transfer(), my name);
 	}
 END
 
@@ -3468,9 +3480,10 @@ FORM (IntensityTier_to_TextGrid_detectSilences, U"IntensityTier: To TextGrid (si
 DO
 	LOOP {
 		iam (IntensityTier);
-		praat_new (IntensityTier_to_TextGrid_detectSilences (me, GET_REAL (U"Time step"), GET_REAL (U"Silence threshold"),
+		autoTextGrid thee = IntensityTier_to_TextGrid_detectSilences (me, GET_REAL (U"Time step"), GET_REAL (U"Silence threshold"),
 			GET_REAL (U"Minimum silent interval duration"), GET_REAL (U"Minimum sounding interval duration"),
-			GET_STRING (U"Silent interval label"), GET_STRING (U"Sounding interval label")), my name);
+			GET_STRING (U"Silent interval label"), GET_STRING (U"Sounding interval label"));
+		praat_new (thee.transfer(), my name);
 	}
 END
 
@@ -3516,7 +3529,8 @@ END
 DIRECT (KlattTable_help) Melder_help (U"KlattTable"); END
 
 DIRECT (KlattTable_createExample)
-	praat_new (KlattTable_createExample (), U"example");
+	autoKlattTable thee = KlattTable_createExample ();
+	praat_new (thee.transfer(), U"example");
 END
 
 FORM (KlattTable_to_Sound, U"KlattTable: To Sound", U"KlattTable: To Sound...")
@@ -3548,9 +3562,10 @@ DO
 	}
 	LOOP {
 		iam (KlattTable);
-		praat_new (KlattTable_to_Sound (me, GET_REAL (U"Sampling frequency"), GET_INTEGER (U"Synthesis model"),
+		autoSound thee = KlattTable_to_Sound (me, GET_REAL (U"Sampling frequency"), GET_INTEGER (U"Synthesis model"),
 			GET_INTEGER (U"Number of formants"), GET_REAL (U"Frame duration"), GET_INTEGER (U"Voicing source"),
-			GET_REAL (U"Flutter percentage"), outputType), my name);
+			GET_REAL (U"Flutter percentage"), outputType);
+		praat_new (thee.transfer(), my name);
 	}
 END
 
@@ -3567,14 +3582,16 @@ END
 DIRECT (KlattTable_to_Table)
 	LOOP {
 		iam (KlattTable);
-		praat_new (KlattTable_to_Table (me), my name);
+		autoTable thee = KlattTable_to_Table (me);
+		praat_new (thee.transfer(), my name);
 	}
 END
 
 DIRECT (Table_to_KlattTable)
 	LOOP {
 		iam (Table);
-		praat_new (Table_to_KlattTable (me), my name);
+		autoKlattTable thee = Table_to_KlattTable (me);
+		praat_new (thee.transfer(), my name);
 	}
 END
 
@@ -3921,7 +3938,8 @@ END
 DIRECT (Matrix_transpose)
 	LOOP {
 		iam (Matrix);
-		praat_new (Matrix_transpose (me), my name, U"_transposed");
+		autoMatrix thee = Matrix_transpose (me);
+		praat_new (thee.transfer(), my name, U"_transposed");
 	}
 END
 
@@ -3931,14 +3949,16 @@ FORM (Matrix_solveEquation, U"Matrix: Solve equation", U"Matrix: Solve equation.
 DO
 	LOOP {
 		iam (Matrix);
-		praat_new (Matrix_solveEquation (me, GET_REAL (U"Tolerance")), Thing_getName (me), U"_solution");
+		autoMatrix thee = Matrix_solveEquation (me, GET_REAL (U"Tolerance"));
+		praat_new (thee.transfer(), Thing_getName (me), U"_solution");
 	}
 END
 
 DIRECT (Matrix_Categories_to_TableOfReal)
 	Matrix me = FIRST (Matrix);
 	Categories cat = FIRST (Categories);
-	praat_new (Matrix_and_Categories_to_TableOfReal (me, cat), my name, U"_", cat->name);
+	autoTableOfReal thee = Matrix_and_Categories_to_TableOfReal (me, cat);
+	praat_new (thee.transfer(), my name, U"_", cat->name);
 END
 
 FORM (Matrix_scatterPlot, U"Matrix: Scatter plot", 0)
@@ -4578,7 +4598,8 @@ END
 DIRECT (PCA_and_Configuration_to_TableOfReal_reconstruct)
 	PCA me = FIRST (PCA);
 	Configuration conf = FIRST (Configuration);
-	praat_new (PCA_and_Configuration_to_TableOfReal_reconstruct (me, conf), my name, U"_", conf->name);
+	autoTableOfReal thee = PCA_and_Configuration_to_TableOfReal_reconstruct (me, conf);
+	praat_new (thee.transfer(), my name, U"_", conf->name);
 END
 
 FORM (PCA_and_TableOfReal_to_Configuration, U"PCA & TableOfReal: To Configuration", U"PCA & TableOfReal: To Configuration...")
@@ -4591,7 +4612,8 @@ DO
 	}
 	PCA me = FIRST (PCA);
 	TableOfReal tab = FIRST_GENERIC (TableOfReal);
-	praat_new (PCA_and_TableOfReal_to_Configuration (me, tab, dimension), my name, U"_", tab->name);
+	autoConfiguration thee = PCA_and_TableOfReal_to_Configuration (me, tab, dimension);
+	praat_new (thee.transfer(), my name, U"_", tab->name);
 END
 
 FORM (PCA_and_TableOfReal_to_TableOfReal_zscores, U"PCA & TableOfReal: To TableOfReal (z-scores)", U"PCA & TableOfReal: To TableOfReal (z-scores)...")
@@ -4604,7 +4626,8 @@ DO
 	}
 	PCA me = FIRST (PCA);
 	TableOfReal thee = FIRST_GENERIC (TableOfReal);
-	praat_new (PCA_and_TableOfReal_to_TableOfReal_zscores (me, thee, dimension), my name, U"_", thy name, U"_zscores");
+	autoTableOfReal him = PCA_and_TableOfReal_to_TableOfReal_zscores (me, thee, dimension);
+	praat_new (him.transfer(), my name, U"_", thy name, U"_zscores");
 END
 
 FORM (PCA_getCentroidElement, U"PCA: Get centroid element...", 0)
@@ -4687,7 +4710,8 @@ FORM (PCA_to_TableOfReal_reconstruct1, U"PCA: To TableOfReal (reconstruct)", U"P
 DO
 	LOOP {
 		iam (PCA);
-		praat_new (PCA_to_TableOfReal_reconstruct1 (me, GET_STRING (U"Coefficients")), my name, U"_reconstructed");
+		autoTableOfReal thee = PCA_to_TableOfReal_reconstruct1 (me, GET_STRING (U"Coefficients"));
+		praat_new (thee.transfer(), my name, U"_reconstructed");
 	}
 END
 
@@ -4704,7 +4728,8 @@ DO
 		(p1 ? p2 : p1) = me;
 	}
 	Melder_assert (p1 && p2);
-	praat_new (Eigens_to_Procrustes (p1, p2, from, to), Thing_getName (p1), U"_", Thing_getName (p2));
+	autoProcrustes thee = Eigens_to_Procrustes (p1, p2, from, to);
+	praat_new (thee.transfer(), Thing_getName (p1), U"_", Thing_getName (p2));
 END
 
 
@@ -4954,8 +4979,9 @@ FORM (PitchTier_to_Pitch, U"PitchTier: To Pitch", U"PitchTier: To Pitch...")
 DO
 	LOOP {
 		iam (PitchTier);
-		praat_new (PitchTier_to_Pitch (me, GET_REAL (U"Step size"),
-		GET_REAL (U"Pitch floor"), GET_REAL (U"Pitch ceiling")), my name);
+		autoPitch thee = PitchTier_to_Pitch (me, GET_REAL (U"Step size"),
+		GET_REAL (U"Pitch floor"), GET_REAL (U"Pitch ceiling"));
+		praat_new (thee.transfer(), my name);
 	}
 END
 
@@ -4966,7 +4992,8 @@ FORM (Polygon_createSimple, U"Create simple Polygon", U"Create simple Polygon...
 	SENTENCE (U"Vertices as X-Y pairs", U"0.0 0.0  0.0 1.0  1.0 0.0")
 	OK
 DO
-	praat_new (Polygon_createSimple (GET_STRING (U"Vertices as X-Y pairs")), GET_STRING (U"Name"));
+	autoPolygon thee = Polygon_createSimple (GET_STRING (U"Vertices as X-Y pairs"));
+	praat_new (thee.transfer(), GET_STRING (U"Name"));
 END
 
 FORM (Polygon_createFromRandomVertices, U"", 0)
@@ -4978,9 +5005,10 @@ FORM (Polygon_createFromRandomVertices, U"", 0)
 	REAL (U"right Y range", U"1.0")
 	OK
 DO
-	praat_new (Polygon_createFromRandomVertices (GET_INTEGER (U"Number of vertices"),
+	autoPolygon thee = Polygon_createFromRandomVertices (GET_INTEGER (U"Number of vertices"),
 		GET_REAL (U"left X range"), GET_REAL (U"right X range"),
-		GET_REAL (U"left Y range"), GET_REAL (U"right Y range")), GET_STRING (U"Name"));
+		GET_REAL (U"left Y range"), GET_REAL (U"right Y range"));
+	praat_new (thee.transfer(), GET_STRING (U"Name"));
 END
 
 DIRECT (Polygon_getNumberOfPoints)
@@ -5049,21 +5077,24 @@ DO
 	long shift = GET_INTEGER (U"Shift");
 	LOOP {
 		iam (Polygon);
-		praat_new (Polygon_circularPermutation (me, shift), my name, U"_", shift);
+		autoPolygon thee = Polygon_circularPermutation (me, shift);
+		praat_new (thee.transfer(), my name, U"_", shift);
 	}
 END
 
 DIRECT (Polygon_simplify)
 	LOOP {
 		iam (Polygon);
-		praat_new (Polygon_simplify (me), my name, U"_s");
+		autoPolygon thee = Polygon_simplify (me);
+		praat_new (thee.transfer(), my name, U"_s");
 	}
 END
 
 DIRECT (Polygon_convexHull)
 	LOOP {
 		iam (Polygon);
-		praat_new (Polygon_convexHull (me), my name, U"_hull");
+		autoPolygon thee = Polygon_convexHull (me);
+		praat_new (thee.transfer(), my name, U"_hull");
 	}
 END
 
@@ -5073,8 +5104,9 @@ FORM (Polygon_translate, U"Polygon: Translate", U"Polygon: Translate...")
 	OK
 DO
 	LOOP {
-		iam (Polygon);
+		iam (Polygon); 
 		Polygon_translate (me, GET_REAL (U"X"), GET_REAL (U"Y"));
+		praat_dataChanged (me);
 	}
 END
 
@@ -5519,10 +5551,11 @@ FORM (Sound_and_Pitch_to_Spectrogram, U"Sound & Pitch: To Spectrogram", U"Sound
 DO
 	Sound me = FIRST (Sound);
 	Pitch thee = FIRST (Pitch);
-	praat_new (Sound_and_Pitch_to_Spectrogram (me, thee, GET_REAL (U"Analysis window duration"),
+	autoSpectrogram him = Sound_and_Pitch_to_Spectrogram (me, thee, GET_REAL (U"Analysis window duration"),
 		GET_REAL (U"Time step"), GET_REAL (U"Position of first filter"),
 		GET_REAL (U"Maximum frequency"), GET_REAL (U"Distance between filters"),
-		GET_REAL (U"Relative bandwidth")), my name, U"_", thy name);
+		GET_REAL (U"Relative bandwidth"));
+	praat_new (him.transfer(), my name, U"_", thy name);
 END
 
 FORM (Sound_and_Pitch_changeGender, U"Sound & Pitch: Change gender", U"Sound & Pitch: Change gender...")
@@ -5534,9 +5567,9 @@ FORM (Sound_and_Pitch_changeGender, U"Sound & Pitch: Change gender", U"Sound & P
 DO
 	Sound me = FIRST (Sound);
 	Pitch p = FIRST (Pitch);
-	praat_new (Sound_and_Pitch_changeGender_old (me, p, GET_REAL (U"Formant shift ratio"),
-			GET_REAL (U"New pitch median"), GET_REAL (U"Pitch range factor"), GET_REAL (U"Duration factor")),
-			my name, U"_", p->name);
+	autoSound thee = Sound_and_Pitch_changeGender_old (me, p, GET_REAL (U"Formant shift ratio"),
+		GET_REAL (U"New pitch median"), GET_REAL (U"Pitch range factor"), GET_REAL (U"Duration factor"));
+	praat_new (thee.transfer(), my name, U"_", p->name);
 END
 
 FORM (Sound_and_Pitch_changeSpeaker, U"Sound & Pitch: Change speaker", U"Sound & Pitch: Change speaker...")
@@ -5548,8 +5581,9 @@ FORM (Sound_and_Pitch_changeSpeaker, U"Sound & Pitch: Change speaker", U"Sound &
 DO
 	Sound me = FIRST (Sound);
 	Pitch p = FIRST (Pitch);
-	praat_new (Sound_and_Pitch_changeSpeaker (me, p, GET_REAL (U"Multiply formants by"),
-		GET_REAL (U"Multiply pitch by"), GET_REAL (U"Multiply pitch range by"), GET_REAL (U"Multiply duration")), my name, U"_", p->name);
+	autoSound thee = Sound_and_Pitch_changeSpeaker (me, p, GET_REAL (U"Multiply formants by"),
+		GET_REAL (U"Multiply pitch by"), GET_REAL (U"Multiply pitch range by"), GET_REAL (U"Multiply duration"));
+	praat_new (thee.transfer(), my name, U"_", p -> name);
 END
 
 FORM (Sound_and_IntervalTier_cutPartsMatchingLabel, U"Sound & IntervalTier: Cut parts matching label", 0)
@@ -5559,7 +5593,8 @@ DO
 	const char32 *label = GET_STRING (U"Label");
 	Sound me = FIRST (Sound);
 	IntervalTier thee = FIRST (IntervalTier);
-	praat_new (Sound_and_IntervalTier_cutPartsMatchingLabel (me, thee, label), my name, U"_cut");
+	autoSound him = Sound_and_IntervalTier_cutPartsMatchingLabel (me, thee, label);
+	praat_new (him.transfer(), my name, U"_cut");
 END
 
 FORM (Sound_createFromGammaTone, U"Create a gammatone", U"Create Sound from gammatone...")
@@ -5588,7 +5623,7 @@ DO
 		Melder_throw (U"Bandwidth cannot be negative.\nPlease use a positive or zero bandwidth.");
 	}
 	autoSound sound = Sound_createGammaTone (startingTime, finishingTime, samplingFrequency, gamma, f, bandwidth,
-					GET_REAL (U"Initial phase"), GET_REAL (U"Addition factor"), GET_INTEGER (U"Scale amplitudes"));
+		GET_REAL (U"Initial phase"), GET_REAL (U"Addition factor"), GET_INTEGER (U"Scale amplitudes"));
 	//Sound_create_check (sound.peek(), startingTime, finishingTime, samplingFrequency);//TODO
 	praat_new (sound.transfer(), GET_STRING (U"Name"));
 END
@@ -5611,8 +5646,8 @@ DO
 		Melder_throw (U"Amplitude range cannot be negative.\nPlease use a positive or zero amplitude range.");
 	}
 	autoSound sound = Sound_createShepardToneComplex (startingTime, finishingTime, samplingFrequency,
-					GET_REAL (U"Lowest frequency"), GET_INTEGER (U"Number of components"),
-					GET_REAL (U"Frequency change"), GET_REAL (U"Amplitude range"), octaveShiftFraction);
+		GET_REAL (U"Lowest frequency"), GET_INTEGER (U"Number of components"),
+		GET_REAL (U"Frequency change"), GET_REAL (U"Amplitude range"), octaveShiftFraction);
 	// Sound_create_check (sound, startingTime, finishingTime, samplingFrequency); //TODO
 	praat_new (sound.transfer(), GET_STRING (U"Name"));
 END
@@ -5713,10 +5748,11 @@ FORM (Sound_to_TextGrid_detectSilences, U"Sound: To TextGrid (silences)", U"Soun
 DO
 	LOOP {
 		iam (Sound);
-		praat_new (Sound_to_TextGrid_detectSilences (me, GET_REAL (U"Minimum pitch"), GET_REAL (U"Time step"),
-		GET_REAL (U"Silence threshold"), GET_REAL (U"Minimum silent interval duration"),
-		GET_REAL (U"Minimum sounding interval duration"), GET_STRING (U"Silent interval label"),
-		GET_STRING (U"Sounding interval label")), my name);
+		autoTextGrid thee = Sound_to_TextGrid_detectSilences (me, GET_REAL (U"Minimum pitch"), GET_REAL (U"Time step"),
+			GET_REAL (U"Silence threshold"), GET_REAL (U"Minimum silent interval duration"),
+			GET_REAL (U"Minimum sounding interval duration"), GET_STRING (U"Silent interval label"),
+			GET_STRING (U"Sounding interval label"));
+		praat_new (thee.transfer(), my name);
 	}
 END
 
@@ -5761,12 +5797,11 @@ DO
     const char32 *trimlabel = GET_STRING (U"Trim label");
 	LOOP {
 		iam (Sound);
-        TextGrid tg = nullptr;
+        autoTextGrid tg;
 		autoSound thee = Sound_trimSilences (me, trimDuration, onlyAtStartAndEnd, minPitch, timeStep, silenceThreshold,
-			minSilenceDuration, minSoundingDuration, (saveTextGrid ? &tg : 0), trimlabel);
-        autoTextGrid atg = tg;
+			minSilenceDuration, minSoundingDuration, ( saveTextGrid ? &tg : nullptr ), trimlabel);
         if (saveTextGrid) {
-            praat_new (atg.transfer(), my name, U"_trimmed");
+            praat_new (tg.transfer(), my name, U"_trimmed");
         }
 		praat_new (thee.transfer(), my name, U"_trimmed");
 	}
@@ -5801,9 +5836,10 @@ FORM (Sound_to_BarkSpectrogram, U"Sound: To BarkSpectrogram", U"Sound: To BarkSp
 DO
 	LOOP {
 		iam (Sound);
-		praat_new (Sound_to_BarkSpectrogram (me, GET_REAL (U"Window length"),
+		autoBarkSpectrogram thee = Sound_to_BarkSpectrogram (me, GET_REAL (U"Window length"),
 			GET_REAL (U"Time step"), GET_REAL (U"Position of first filter"),
-			GET_REAL (U"Maximum frequency"), GET_REAL (U"Distance between filters")), my name);
+			GET_REAL (U"Maximum frequency"), GET_REAL (U"Distance between filters"));
+		praat_new (thee.transfer(), my name);
 	}
 END
 
@@ -5846,11 +5882,10 @@ FORM (Sound_to_Spectrogram_pitchDependent, U"Sound: To Spectrogram (pitch-depend
 DO
 	LOOP {
 		iam (Sound);
-		praat_new (Sound_to_Spectrogram_pitchDependent (me, GET_REAL (U"Window length"),
-		GET_REAL (U"Time step"), GET_REAL (U"Position of first filter"),
-		GET_REAL (U"Maximum frequency"), GET_REAL (U"Distance between filters"),
-		GET_REAL (U"Relative bandwidth"), GET_REAL (U"Minimum pitch"),
-		GET_REAL (U"Maximum pitch")), my name);
+		autoSpectrogram thee = Sound_to_Spectrogram_pitchDependent (me, GET_REAL (U"Window length"), GET_REAL (U"Time step"), 
+			GET_REAL (U"Position of first filter"), GET_REAL (U"Maximum frequency"), GET_REAL (U"Distance between filters"),
+			GET_REAL (U"Relative bandwidth"), GET_REAL (U"Minimum pitch"), GET_REAL (U"Maximum pitch"));
+		praat_new (thee.transfer(), my name);
 	}
 END
 
@@ -5866,9 +5901,9 @@ FORM (Sound_to_MelFilter, U"Sound: To MelFilter", U"Sound: To MelFilter...")
 DO
 	LOOP {
 		iam (Sound);
-		praat_new (Sound_to_MelFilter (me, GET_REAL (U"Window length"),
-		GET_REAL (U"Time step"), GET_REAL (U"Position of first filter"),
-		GET_REAL (U"Maximum frequency"), GET_REAL (U"Distance between filters")), my name);
+		autoMelFilter thee = Sound_to_MelFilter (me, GET_REAL (U"Window length"), GET_REAL (U"Time step"), 
+			GET_REAL (U"Position of first filter"), GET_REAL (U"Maximum frequency"), GET_REAL (U"Distance between filters"));
+		praat_new (thee.transfer(), my name);
 	}
 END
 
@@ -5883,9 +5918,9 @@ FORM (Sound_to_MelSpectrogram, U"Sound: To MelSpectrogram", U"Sound: To MelSpect
 DO
 	LOOP {
 		iam (Sound);
-		praat_new (Sound_to_MelSpectrogram (me, GET_REAL (U"Window length"),
-		GET_REAL (U"Time step"), GET_REAL (U"Position of first filter"),
-		GET_REAL (U"Maximum frequency"), GET_REAL (U"Distance between filters")), my name);
+		autoMelSpectrogram thee = Sound_to_MelSpectrogram (me, GET_REAL (U"Window length"), GET_REAL (U"Time step"), 
+			GET_REAL (U"Position of first filter"), GET_REAL (U"Maximum frequency"), GET_REAL (U"Distance between filters"));
+		praat_new (thee.transfer(), my name);
 	}
 END
 
@@ -6024,8 +6059,9 @@ DO
 		if (channel > my ny) {
 			channel = 1;
 		}
-		praat_new (Sound_to_Polygon (me, channel, GET_REAL (U"left Time range"), GET_REAL (U"right Time range"),
-		GET_REAL (U"left Vertical range"), GET_REAL (U"right Vertical range"), GET_REAL (U"Connection y-value")), my name);
+		autoPolygon thee = Sound_to_Polygon (me, channel, GET_REAL (U"left Time range"), GET_REAL (U"right Time range"),
+		GET_REAL (U"left Vertical range"), GET_REAL (U"right Vertical range"), GET_REAL (U"Connection y-value"));
+		praat_new (thee.transfer(), my name);
 	}
 END
 
@@ -6040,14 +6076,15 @@ FORM (Sounds_to_Polygon_enclosed, U"Sounds: To Polygon (enclosed)", U"Sounds: To
 	OK
 DO
 	long channel = GET_INTEGER (U"Channel");
-	Sound s1 = 0, s2 = 0;
+	Sound s1 = nullptr, s2 = nullptr;
 	LOOP {
 		iam (Sound);
 		(s1 ? s2 : s1) = me;
 	}
 	Melder_assert (s1 && s2);
-	praat_new (Sounds_to_Polygon_enclosed (s1, s2, channel, GET_REAL (U"left Time range"),
-		GET_REAL (U"right Time range"), GET_REAL (U"left Vertical range"), GET_REAL (U"right Vertical range")), s1->name, U"_", s2->name);
+	autoPolygon thee = Sounds_to_Polygon_enclosed (s1, s2, channel, GET_REAL (U"left Time range"),
+		GET_REAL (U"right Time range"), GET_REAL (U"left Vertical range"), GET_REAL (U"right Vertical range"));
+	praat_new (thee.transfer(), s1->name, U"_", s2->name);
 END
 
 FORM (Sound_filterByGammaToneFilter4, U"Sound: Filter (gammatone)", U"Sound: Filter (gammatone)...")
@@ -6057,7 +6094,8 @@ FORM (Sound_filterByGammaToneFilter4, U"Sound: Filter (gammatone)", U"Sound: Fil
 DO
 	LOOP {
 		iam (Sound);
-		praat_new (Sound_filterByGammaToneFilter4 (me, GET_REAL (U"Centre frequency"), GET_REAL (U"Bandwidth")), my name, U"_filtered");
+		autoSound thee = Sound_filterByGammaToneFilter4 (me, GET_REAL (U"Centre frequency"), GET_REAL (U"Bandwidth"));
+		praat_new (thee.transfer(), my name, U"_filtered");
 	}
 END
 
@@ -6100,9 +6138,9 @@ DO
 	}
 	LOOP {
 		iam (Sound);
-		praat_new (Sound_changeSpeaker (me, minimumPitch, maximumPitch,
-		GET_REAL (U"Multiply formants by"), GET_REAL (U"Multiply pitch by"),
-		GET_REAL (U"Multiply pitch range by"), GET_REAL (U"Multiply duration by")), my name, U"_changeSpeaker");
+		autoSound thee = Sound_changeSpeaker (me, minimumPitch, maximumPitch, GET_REAL (U"Multiply formants by"), 
+			GET_REAL (U"Multiply pitch by"), GET_REAL (U"Multiply pitch range by"), GET_REAL (U"Multiply duration by"));
+		praat_new (thee.transfer(), my name, U"_changeSpeaker");
 	}
 END
 
@@ -6128,9 +6166,9 @@ DO
 	}
 	LOOP {
 		iam (Sound);
-		praat_new (Sound_changeGender_old (me, minimumPitch, maximumPitch,
-		GET_REAL (U"Formant shift ratio"), GET_REAL (U"New pitch median"),
-		pitchrf, GET_REAL (U"Duration factor")), my name, U"_changeGender");
+		autoSound thee = Sound_changeGender_old (me, minimumPitch, maximumPitch, GET_REAL (U"Formant shift ratio"), 
+			GET_REAL (U"New pitch median"), pitchrf, GET_REAL (U"Duration factor"));
+		praat_new (thee.transfer(), my name, U"_changeGender");
 	}
 END
 
@@ -6179,15 +6217,18 @@ DO
 END
 
 FORM_READ2 (Sound_readFromRawFileLE, U"Read Sound from raw Little Endian file", 0, true) {
-	praat_new (Sound_readFromRawFile (file, nullptr, 16, 1, 0, 0, 16000), MelderFile_name (file));
+	autoSound thee = Sound_readFromRawFile (file, nullptr, 16, 1, 0, 0, 16000);
+	praat_new (thee.transfer(), MelderFile_name (file));
 END2 }
 
 FORM_READ2 (Sound_readFromRawFileBE, U"Read Sound from raw 16-bit Little Endian file", 0, true) {
-	praat_new (Sound_readFromRawFile (file, nullptr, 16, 0, 0, 0, 16000), MelderFile_name (file));
+	autoSound thee = Sound_readFromRawFile (file, nullptr, 16, 0, 0, 0, 16000);
+	praat_new (thee.transfer(), MelderFile_name (file));
 END2 }
 
 FORM_READ2 (KlattTable_readFromRawTextFile, U"KlattTable_readFromRawTextFile", 0, true) {
-	praat_new (KlattTable_readFromRawTextFile (file), MelderFile_name (file));
+	autoKlattTable thee = KlattTable_readFromRawTextFile (file);
+	praat_new (thee.transfer(), MelderFile_name (file));
 END2 }
 
 /************ Spectrograms *********************************************/
@@ -6386,15 +6427,15 @@ DO
 	bool createTextGrid = GET_INTEGER (U"Create TextGrid with annotations");
 	LOOP {
 		iam (SpeechSynthesizer);
-		TextGrid tg = 0; Table t = 0;
+		autoTextGrid tg;
+		autoTable t;
 		autoSound thee = SpeechSynthesizer_to_Sound (me, text, (createTextGrid ? &tg : nullptr), (Melder_debug == -2 ? &t : nullptr));
-		autoTextGrid atg = tg; autoTable atr = t;
 		praat_new (thee.transfer(), my name);
 		if (createTextGrid) {
-			praat_new (atg.transfer(), my name);
+			praat_new (tg.transfer(), my name);
 		}
 		if (Melder_debug == -2) {
-			praat_new (atr.transfer(), my name);
+			praat_new (t.transfer(), my name);
 		}
 	}
 END
@@ -6469,15 +6510,15 @@ FORM (SpeechSynthesizer_and_TextGrid_to_Sound, U"SpeechSynthesizer & TextGrid: T
 	BOOLEAN (U"Create TextGrid with annotations", 0);
 	OK
 DO
-	bool createTextGrid = GET_INTEGER (U"Create TextGrid with annotations");
+	bool createAnnotations = GET_INTEGER (U"Create TextGrid with annotations");
 	SpeechSynthesizer me = FIRST (SpeechSynthesizer);
-	TextGrid thee = FIRST (TextGrid), tg = 0;
+	TextGrid thee = FIRST (TextGrid);
+	autoTextGrid annotations;
 	autoSound him = SpeechSynthesizer_and_TextGrid_to_Sound (me, thee, GET_INTEGER (U"Tier number"),
-		GET_INTEGER (U"Interval number"), (createTextGrid ? &tg : nullptr));
-	autoTextGrid atg = tg;
+		GET_INTEGER (U"Interval number"), ( createAnnotations ? & annotations : nullptr ));
 	praat_new (him.transfer(), my name);
-	if (createTextGrid) {
-		praat_new (atg.transfer(), my name);
+	if (createAnnotations) {
+		praat_new (annotations.transfer(), my name);
 	}
 END
 
@@ -7769,7 +7810,8 @@ END
 DIRECT (TableOfReal_to_PCA)
 	LOOP {
 		iam (TableOfReal);
-		praat_new (TableOfReal_to_PCA (me), my name);
+		autoPCA thee = TableOfReal_to_PCA (me);
+		praat_new (thee.transfer(), my name);
 	}
 END
 
@@ -7830,7 +7872,8 @@ DIRECT (TablesOfReal_to_Eigen_gsvd)
 		(t1 ? t2 : t1) = me;
 	}
 	Melder_assert (t1 && t2);
-	praat_new (TablesOfReal_to_Eigen_gsvd (t1, t2), U"");
+	autoEigen thee = TablesOfReal_to_Eigen_gsvd (t1, t2);
+	praat_new (thee.transfer(), U"");
 END
 
 FORM (TableOfReal_and_TableOfReal_crossCorrelations, U"TableOfReal & TableOfReal: Cross-correlations", 0)
diff --git a/dwtools/praat_HMM_init.cpp b/dwtools/praat_HMM_init.cpp
index 8605057..685e069 100644
--- a/dwtools/praat_HMM_init.cpp
+++ b/dwtools/praat_HMM_init.cpp
@@ -186,9 +186,10 @@ FORM (GaussianMixture_and_PCA_to_Matrix_density, U"GaussianMixture & PCA: To Mat
 DO
 	GaussianMixture me = FIRST (GaussianMixture);
 	PCA pca = FIRST (PCA);
-	praat_new (GaussianMixture_and_PCA_to_Matrix_density (me, pca, GET_INTEGER (U"X-dimension"),
+	autoMatrix thee = GaussianMixture_and_PCA_to_Matrix_density (me, pca, GET_INTEGER (U"X-dimension"),
 		GET_INTEGER (U"Y-dimension"), GET_REAL (U"left Horizontal range"), GET_REAL (U"right Horizontal range"),
-		GET_INTEGER (U"Number of columns"), GET_REAL (U"left Vertical range"), GET_REAL (U"right Vertical range"), GET_INTEGER (U"Number of rows")), my name, U"_", pca->name);
+		GET_INTEGER (U"Number of columns"), GET_REAL (U"left Vertical range"), GET_REAL (U"right Vertical range"), GET_INTEGER (U"Number of rows"));
+	praat_new (thee.transfer(), my name, U"_", pca->name);
 END
 
 FORM (GaussianMixture_extractComponent, U"GaussianMixture: Extract component", 0)
@@ -198,29 +199,32 @@ DO
 	long component = GET_INTEGER (U"Component");
 	LOOP {
 		iam (GaussianMixture);
-		Covariance cov = GaussianMixture_extractComponent (me, component);
-		praat_new (cov, my name, U"_", cov->name);
+		autoCovariance thee = GaussianMixture_extractComponent (me, component);
+		praat_new (thee.transfer(), my name, U"_", thy name);
 	}
 END
 
 DIRECT (GaussianMixture_extractCentroids)
 	LOOP {
 		iam (GaussianMixture);
-		praat_new (GaussianMixture_extractCentroids (me), my name);
+		autoTableOfReal thee = GaussianMixture_extractCentroids (me);
+		praat_new (thee.transfer(), my name);
 	}
 END
 
 DIRECT (GaussianMixture_extractMixingProbabilities)
 	LOOP {
 		iam (GaussianMixture);
-		praat_new (GaussianMixture_extractMixingProbabilities (me), my name);
+		autoTableOfReal thee = GaussianMixture_extractMixingProbabilities (me);
+		praat_new (thee.transfer(), my name);
 	}
 END
 
 DIRECT (GaussianMixture_to_PCA)
 	LOOP {
 		iam (GaussianMixture);
-		praat_new (GaussianMixture_to_PCA (me), my name);
+		autoPCA thee = GaussianMixture_to_PCA (me);
+		praat_new (thee.transfer(), my name);
 	}
 END
 
@@ -231,28 +235,32 @@ DO
 	long numberOfpoints = GET_INTEGER (U"Number of data points");
 	LOOP {
 		iam (GaussianMixture);
-		praat_new (GaussianMixture_to_TableOfReal_randomSampling (me, numberOfpoints), my name);
+		autoTableOfReal thee = GaussianMixture_to_TableOfReal_randomSampling (me, numberOfpoints);
+		praat_new (thee.transfer(), my name);
 	}
 END
 
 DIRECT (GaussianMixture_to_Covariance_between)
 	LOOP {
 		iam (GaussianMixture);
-		praat_new (GaussianMixture_to_Covariance_between (me), my name, U"_b");
+		autoCovariance thee = GaussianMixture_to_Covariance_between (me);
+		praat_new (thee.transfer(), my name, U"_b");
 	}
 END
 
 DIRECT (GaussianMixture_to_Covariance_within)
 	LOOP {
 		iam (GaussianMixture);
-		praat_new (GaussianMixture_to_Covariance_within (me), my name, U"_w");
+		autoCovariance thee = GaussianMixture_to_Covariance_within (me);
+		praat_new (thee.transfer(), my name, U"_w");
 	}
 END
 
 DIRECT (GaussianMixture_to_Covariance_total)
 	LOOP {
 		iam (GaussianMixture);
-		praat_new (GaussianMixture_to_Covariance_total (me), my name, U"_t");
+		autoCovariance thee = GaussianMixture_to_Covariance_total (me);
+		praat_new (thee.transfer(), my name, U"_t");
 	}
 END
 
@@ -318,7 +326,7 @@ DO
 	praat_new (thee.transfer(), GET_STRING (U"Name"));
 END
 
-FORM (HMM_ObservationSequence_to_HMM, U"HMM_ObservationSequence: To HMM", 0)
+FORM (HMMObservationSequence_to_HMM, U"HMMObservationSequence: To HMM", 0)
 	LABEL (U"", U"(0 states gives a non-hidden model) ")
 	INTEGER (U"Number of states", U"2")
 	BOOLEAN (U"Left to right model", 0)
@@ -326,8 +334,8 @@ FORM (HMM_ObservationSequence_to_HMM, U"HMM_ObservationSequence: To HMM", 0)
 DO
 	long numberOfStates = GET_INTEGER (U"Number of states");
 	LOOP {
-		iam (HMM_ObservationSequence);
-		autoHMM thee = HMM_createFromHMM_ObservationSequence (me, numberOfStates, GET_INTEGER (U"Left to right model"));
+		iam (HMMObservationSequence);
+		autoHMM thee = HMM_createFromHMMObservationSequence (me, numberOfStates, GET_INTEGER (U"Left to right model"));
 		praat_new (thee.transfer(), my name, U"_", numberOfStates);
 	}
 END
@@ -343,15 +351,15 @@ DO
 	}
 END
 
-FORM (HMM_and_HMM_StateSequence_drawTrellis, U"HMM & Strings: Draw trellis", 0)
+FORM (HMM_and_HMMStateSequence_drawTrellis, U"HMM & Strings: Draw trellis", 0)
 	BOOLEAN (U"Connect", 1);
 	BOOLEAN (U"Garnish", 1);
 	OK
 DO
 	autoPraatPicture picture;
 	HMM me = FIRST (HMM);
-	HMM_StateSequence hmm_ss = FIRST (HMM_StateSequence);
-	HMM_and_HMM_StateSequence_drawTrellis (me, hmm_ss, GRAPHICS, GET_INTEGER (U"Connect"), GET_INTEGER (U"Garnish"));
+	HMMStateSequence hmm_ss = FIRST (HMMStateSequence);
+	HMM_and_HMMStateSequence_drawTrellis (me, hmm_ss, GRAPHICS, GET_INTEGER (U"Connect"), GET_INTEGER (U"Garnish"));
 END
 
 DIRECT (HMM_drawForwardProbabilitiesIllustration)
@@ -473,7 +481,7 @@ DO
 	LOOP {
 		iam (HMM);
 		REQUIRE (is <= my numberOfObservationSymbols, U"Symbol number too high.")
-		HMM_Observation s = (HMM_Observation) my observationSymbols -> item[is];
+		HMMObservation s = (HMMObservation) my observationSymbols -> item[is];
 		Melder_information (s -> label);
 	}
 END
@@ -486,7 +494,7 @@ DO
 	LOOP {
 		iam (HMM);
 		REQUIRE (is <= my numberOfStates, U"State number too high.")
-		HMM_State s = (HMM_State) my states -> item[is];
+		HMMState s = (HMMState) my states -> item[is];
 		Melder_information (s -> label);
 	}
 END
@@ -509,81 +517,82 @@ DO
 		U" cross-entropy between models for observation length = ", n, U")");
 END
 
-DIRECT (HMM_and_HMM_and_HMM_ObservationSequence_getCrossEntropy)
-	HMM m1 = 0, m2 = 0; HMM_ObservationSequence hmm_os = 0;
+DIRECT (HMM_and_HMM_and_HMMObservationSequence_getCrossEntropy)
+	HMM m1 = 0, m2 = 0; HMMObservationSequence hmm_os = 0;
 	LOOP {
-		if (CLASS == classHMM_ObservationSequence) {
-			hmm_os = (HMM_ObservationSequence) OBJECT;
+		if (CLASS == classHMMObservationSequence) {
+			hmm_os = (HMMObservationSequence) OBJECT;
 		} else { (m1 ? m2 : m1) = (HMM) OBJECT; }
 	}
 	Melder_assert (m1 && m2 && hmm_os);
-	double ce = HMM_and_HMM_and_HMM_ObservationSequence_getCrossEntropy (m1, m2, hmm_os);
+	double ce = HMM_and_HMM_and_HMMObservationSequence_getCrossEntropy (m1, m2, hmm_os);
 	Melder_information (ce, U" (=symmetric cross-entropy between models)");
 END
 
-FORM (HMM_to_HMM_ObservationSequence, U"HMM: To HMM_ObservationSequence (generate observations)", U"HMM: To HMM_ObservationSequence...")
+FORM (HMM_to_HMMObservationSequence, U"HMM: To HMMObservationSequence (generate observations)", U"HMM: To HMMObservationSequence...")
 	INTEGER (U"Start state", U"0")
 	NATURAL (U"Number of observations", U"20")
 	OK
 DO
 	LOOP {
 		iam (HMM);
-		autoHMM_ObservationSequence thee = HMM_to_HMM_ObservationSequence (me, GET_INTEGER (U"Start state"), GET_INTEGER (U"Number of observations"));
+		autoHMMObservationSequence thee = HMM_to_HMMObservationSequence (me, GET_INTEGER (U"Start state"), GET_INTEGER (U"Number of observations"));
 		praat_new (thee.transfer(), my name);
 	}
 END
 
-DIRECT (HMM_and_HMM_StateSequence_getProbability)
+DIRECT (HMM_and_HMMStateSequence_getProbability)
 	HMM me = FIRST (HMM);
-	HMM_StateSequence hmm_ss = FIRST (HMM_StateSequence);
-	double lnp = HMM_and_HMM_StateSequence_getProbability (me, hmm_ss);
+	HMMStateSequence hmm_ss = FIRST (HMMStateSequence);
+	double lnp = HMM_and_HMMStateSequence_getProbability (me, hmm_ss);
 	Melder_information (lnp, U" (=ln(p), p = ", Melder_naturalLogarithm (lnp), U")");
 END
 
-DIRECT (HMM_and_HMM_ObservationSequence_getProbability)
+DIRECT (HMM_and_HMMObservationSequence_getProbability)
 	HMM me = FIRST (HMM);
-	HMM_ObservationSequence hmm_os = FIRST (HMM_ObservationSequence);
-	double lnp = HMM_and_HMM_ObservationSequence_getProbability (me, hmm_os);
+	HMMObservationSequence hmm_os = FIRST (HMMObservationSequence);
+	double lnp = HMM_and_HMMObservationSequence_getProbability (me, hmm_os);
 	Melder_information (lnp, U" (=ln(p), p = ", Melder_naturalLogarithm (lnp), U")");
 END
 
-DIRECT (HMM_and_HMM_ObservationSequence_getCrossEntropy)
+DIRECT (HMM_and_HMMObservationSequence_getCrossEntropy)
 	HMM me = FIRST (HMM);
-	HMM_ObservationSequence hmm_os = FIRST (HMM_ObservationSequence);
-	double ce = HMM_and_HMM_ObservationSequence_getCrossEntropy (me, hmm_os);
+	HMMObservationSequence hmm_os = FIRST (HMMObservationSequence);
+	double ce = HMM_and_HMMObservationSequence_getCrossEntropy (me, hmm_os);
 	Melder_information (ce, U" (= cross-entropy)");
 END
 
-DIRECT (HMM_and_HMM_ObservationSequence_getPerplexity)
+DIRECT (HMM_and_HMMObservationSequence_getPerplexity)
 	HMM me = FIRST (HMM);
-	HMM_ObservationSequence hmm_os = FIRST (HMM_ObservationSequence);
-	double py = HMM_and_HMM_ObservationSequence_getPerplexity (me, hmm_os);
+	HMMObservationSequence hmm_os = FIRST (HMMObservationSequence);
+	double py = HMM_and_HMMObservationSequence_getPerplexity (me, hmm_os);
 	Melder_information (py, U" (= perplexity)");
 END
 
-DIRECT (HMM_and_HMM_ObservationSequence_to_HMM_StateSequence)
+DIRECT (HMM_and_HMMObservationSequence_to_HMMStateSequence)
 	HMM me = FIRST (HMM);
-	HMM_ObservationSequence thee = FIRST (HMM_ObservationSequence);
-	autoHMM_StateSequence him = HMM_and_HMM_ObservationSequence_to_HMM_StateSequence (me, thee);
+	HMMObservationSequence thee = FIRST (HMMObservationSequence);
+	autoHMMStateSequence him = HMM_and_HMMObservationSequence_to_HMMStateSequence (me, thee);
 	praat_new (him.transfer(), my name, U"_", thy name, U"_states");
 END
 
-FORM (HMM_and_HMM_ObservationSequence_learn, U"HMM & HMM_ObservationSequence: Learn", U"HMM & HMM_ObservationSequences: Learn...")
+FORM (HMM_and_HMMObservationSequence_learn, U"HMM & HMMObservationSequence: Learn", U"HMM & HMMObservationSequences: Learn...")
 	POSITIVE (U"Relative precision in log(p)", U"0.001")
 	REAL (U"Minimum probability", U"0.00000000001")
+	BOOLEAN (U"Learning history in Info window", 0)
 	OK
 DO
 	double minProb = GET_REAL (U"Minimum probability");
 	REQUIRE (minProb >= 0 && minProb < 1, U"A probabilty must be >= 0 and < 1!")
-	autoHMM_ObservationSequences hmm_oss = HMM_ObservationSequences_create (); HMM hmm = 0;
+	autoHMMObservationSequences hmm_oss = HMMObservationSequences_create (); HMM hmm = 0;
 	Collection_dontOwnItems (hmm_oss.peek());
 	LOOP {
 		iam (Daata);
-		if (CLASS == classHMM_ObservationSequence) {
+		if (CLASS == classHMMObservationSequence) {
 			Collection_addItem (hmm_oss.peek(), me);
 		} else { hmm = (HMM) me; }
 	}
-	HMM_and_HMM_ObservationSequences_learn (hmm, hmm_oss.peek(), GET_REAL (U"Relative precision in log"), minProb);
+	HMM_and_HMMObservationSequences_learn (hmm, hmm_oss.peek(), GET_REAL (U"Relative precision in log"), minProb, GET_INTEGER (U"Learning history in Info window"));
 END
 
 FORM (HMM_setTransitionProbabilities, U"HMM: Set transition probabilities", U"HMM: Set transition probabilities...")
@@ -634,69 +643,69 @@ DIRECT (HMM_extractEmissionProbabilities)
 	}
 END
 
-FORM (HMM_ObservationSequence_to_TableOfReal, U"HMM_ObservationSequence: To TableOfReal ",
-      U"HMM_ObservationSequence: To TableOfReal (bigrams)...")
+FORM (HMMObservationSequence_to_TableOfReal, U"HMMObservationSequence: To TableOfReal ",
+      U"HMMObservationSequence: To TableOfReal (bigrams)...")
 	BOOLEAN (U"As probabilities", 1)
 	OK
 DO
 	LOOP {
-		iam (HMM_ObservationSequence);
-		autoTableOfReal thee = HMM_ObservationSequence_to_TableOfReal_transitions (me, GET_INTEGER (U"As probabilities"));
+		iam (HMMObservationSequence);
+		autoTableOfReal thee = HMMObservationSequence_to_TableOfReal_transitions (me, GET_INTEGER (U"As probabilities"));
 		praat_new (thee.transfer(), my name);
 	}
 END
 
-FORM (HMM_and_HMM_ObservationSequence_to_TableOfReal, U"HMM & HMM_ObservationSequence: To TableOfReal", U"HMM & HMM_ObservationSequence: To TableOfReal (bigrams)...")
+FORM (HMM_and_HMMObservationSequence_to_TableOfReal, U"HMM & HMMObservationSequence: To TableOfReal", U"HMM & HMMObservationSequence: To TableOfReal (bigrams)...")
 	BOOLEAN (U"As probabilities", 1)
 	OK
 DO
 	HMM me = FIRST (HMM);
-	HMM_ObservationSequence hmm_os = FIRST (HMM_ObservationSequence);
-	autoTableOfReal thee = HMM_and_HMM_ObservationSequence_to_TableOfReal_transitions (me, hmm_os,GET_INTEGER (U"As probabilities"));
+	HMMObservationSequence hmm_os = FIRST (HMMObservationSequence);
+	autoTableOfReal thee = HMM_and_HMMObservationSequence_to_TableOfReal_transitions (me, hmm_os,GET_INTEGER (U"As probabilities"));
 	praat_new (thee.transfer(), hmm_os -> name, U"_m");
 END
 
-FORM (HMM_and_HMM_StateSequence_to_TableOfReal, U"HMM & HMM_StateSequence: To TableOfReal", 0)
+FORM (HMM_and_HMMStateSequence_to_TableOfReal, U"HMM & HMMStateSequence: To TableOfReal", 0)
 	BOOLEAN (U"As probabilities", 1)
 	OK
 DO
 	HMM me = FIRST (HMM);
-	HMM_StateSequence hmm_ss = FIRST (HMM_StateSequence);
-	autoTableOfReal thee = HMM_and_HMM_StateSequence_to_TableOfReal_transitions (me, hmm_ss, GET_INTEGER (U"As probabilities"));
+	HMMStateSequence hmm_ss = FIRST (HMMStateSequence);
+	autoTableOfReal thee = HMM_and_HMMStateSequence_to_TableOfReal_transitions (me, hmm_ss, GET_INTEGER (U"As probabilities"));
 	praat_new (thee.transfer(), Thing_getName (hmm_ss), U"_m");
 END
 
-FORM (HMM_StateSequence_to_TableOfReal, U"HMM_StateSequence: To TableOfReal", 0)
+FORM (HMMStateSequence_to_TableOfReal, U"HMMStateSequence: To TableOfReal", 0)
 	BOOLEAN (U"As probabilities", 1)
 	OK
 DO
 	LOOP {
-		iam (HMM_StateSequence);
+		iam (HMMStateSequence);
 		autoTableOfReal thee = Strings_to_TableOfReal_transitions (me, GET_INTEGER (U"As probabilities"));
 		praat_new (thee.transfer(), my name);
 	}
 END
 
-DIRECT (HMM_ObservationSequence_to_Strings)
+DIRECT (HMMObservationSequence_to_Strings)
 	LOOP {
-		iam (HMM_ObservationSequence);
-		autoStrings thee = HMM_ObservationSequence_to_Strings (me);
+		iam (HMMObservationSequence);
+		autoStrings thee = HMMObservationSequence_to_Strings (me);
 		praat_new (thee.transfer(), my name);
 	}
 END
 
-DIRECT (Strings_to_HMM_ObservationSequence)
+DIRECT (Strings_to_HMMObservationSequence)
 	LOOP {
 		iam (Strings);
-		autoHMM_ObservationSequence thee = Strings_to_HMM_ObservationSequence (me);
+		autoHMMObservationSequence thee = Strings_to_HMMObservationSequence (me);
 		praat_new (thee.transfer(), my name);
 	}
 END
 
-DIRECT (HMM_StateSequence_to_Strings)
+DIRECT (HMMStateSequence_to_Strings)
 	LOOP {
-		iam (HMM_StateSequence);
-		autoStrings thee = HMM_StateSequence_to_Strings (me);
+		iam (HMMStateSequence);
+		autoStrings thee = HMMStateSequence_to_Strings (me);
 		praat_new (thee.transfer(), my name);
 	}
 END
@@ -773,23 +782,24 @@ DO
 	REQUIRE (lambda >= 0 && lambda < 1, U"Lambda must be in interval [0,1).")
 	REQUIRE (thy numberOfColumns == my dimension, U"The number of columns and the dimension of the model do not agree.");
 	REQUIRE (my numberOfComponents < thy numberOfRows / 2, U"Not enough data points.")
-	praat_new (GaussianMixture_and_TableOfReal_to_GaussianMixture_CEMM (me, thee,
+	autoGaussianMixture him = GaussianMixture_and_TableOfReal_to_GaussianMixture_CEMM (me, thee,
 		GET_INTEGER (U"Minimum number of components"), GET_REAL (U"Tolerance of minimizer"),
-		GET_INTEGER (U"Maximum number of iterations"), lambda, criterion), my name);
+		GET_INTEGER (U"Maximum number of iterations"), lambda, criterion);
+	praat_new (him.transfer(), my name);
 END
 
 DIRECT (GaussianMixture_and_TableOfReal_to_ClassificationTable)
 	GaussianMixture me = FIRST (GaussianMixture);
 	TableOfReal thee = FIRST (TableOfReal);
-	praat_new (GaussianMixture_and_TableOfReal_to_ClassificationTable (me, thee),
-		my name, U"_", thy name);
+	autoClassificationTable him = GaussianMixture_and_TableOfReal_to_ClassificationTable (me, thee);
+	praat_new (him.transfer(), my name, U"_", thy name);
 END
 
 DIRECT (GaussianMixture_and_TableOfReal_to_Correlation)
 	GaussianMixture me = FIRST (GaussianMixture);
 	TableOfReal thee = FIRST (TableOfReal);
-	praat_new (GaussianMixture_and_TableOfReal_to_Correlation (me, thee),
-		my name, U"_", thy name);
+	autoCorrelation him = GaussianMixture_and_TableOfReal_to_Correlation (me, thee);
+	praat_new (him.transfer(), my name, U"_", thy name);
 END
 
 FORM (GaussianMixture_and_TableOfReal_to_TableOfReal_BHEPNormalityTests, U"GaussianMixture & TableOfReal: To TableOfReal BHEP normality tests", U"GaussianMixture & TableOfReal: To TableOfReal (BHEP normality tests)...")
@@ -799,13 +809,13 @@ DO
 	GaussianMixture me = FIRST (GaussianMixture);
 	TableOfReal thee = FIRST (TableOfReal);
 	double h = GET_REAL (U"Smoothing parameter");
-	praat_new (GaussianMixture_and_TableOfReal_to_TableOfReal_BHEPNormalityTests (me, thee, h),
-		my name, U"_", thy name);
+	autoTableOfReal him = GaussianMixture_and_TableOfReal_to_TableOfReal_BHEPNormalityTests (me, thee, h);
+	praat_new (him.transfer(), my name, U"_", thy name);
 END
 
 void praat_HMM_init ();
 void praat_HMM_init () {
-	Thing_recognizeClassesByName (classHMM, classHMM_State, classHMM_Observation, classHMM_ObservationSequence, classHMM_StateSequence, classGaussianMixture, nullptr);
+	Thing_recognizeClassesByName (classHMM, classHMMState, classHMMObservation, classHMMObservationSequence, classHMMStateSequence, classGaussianMixture, nullptr);
 
 	praat_addMenuCommand (U"Objects", U"New", U"Markov models", 0, praat_HIDDEN, 0);
 	praat_addMenuCommand (U"Objects", U"New", U"Create HMM...", 0, praat_HIDDEN + praat_DEPTH_1, DO_HMM_create);
@@ -872,28 +882,28 @@ void praat_HMM_init () {
 	praat_addAction1 (classHMM, 0, U"Extract transition probabilities", 0, 1, DO_HMM_extractTransitionProbabilities);
 	praat_addAction1 (classHMM, 0, U"Extract emission probabilities", 0, 1, DO_HMM_extractEmissionProbabilities);
 
-	praat_addAction1 (classHMM, 0, U"To HMM_ObservationSequence...", 0, 0, DO_HMM_to_HMM_ObservationSequence);
-	praat_addAction2 (classHMM, 1, classHMM_StateSequence, 1, U"Draw trellis...", 0, 0, DO_HMM_and_HMM_StateSequence_drawTrellis);
-	praat_addAction2 (classHMM, 1, classHMM_StateSequence, 1, U"Get probability", 0, 0, DO_HMM_and_HMM_StateSequence_getProbability);
-	praat_addAction2 (classHMM, 1, classHMM_StateSequence, 1, U"To TableOfReal (bigrams)...", 0, 0, DO_HMM_and_HMM_StateSequence_to_TableOfReal);
-	praat_addAction2 (classHMM, 1, classHMM_ObservationSequence, 1, U"Get probability", 0, 0, DO_HMM_and_HMM_ObservationSequence_getProbability);
-	praat_addAction2 (classHMM, 1, classHMM_ObservationSequence, 1, U"Get cross-entropy", 0, 0, DO_HMM_and_HMM_ObservationSequence_getCrossEntropy);
-	praat_addAction2 (classHMM, 1, classHMM_ObservationSequence, 1, U"Get perplexity", 0, 0, DO_HMM_and_HMM_ObservationSequence_getPerplexity);
+	praat_addAction1 (classHMM, 0, U"To HMMObservationSequence...", 0, 0, DO_HMM_to_HMMObservationSequence);
+	praat_addAction2 (classHMM, 1, classHMMStateSequence, 1, U"Draw trellis...", 0, 0, DO_HMM_and_HMMStateSequence_drawTrellis);
+	praat_addAction2 (classHMM, 1, classHMMStateSequence, 1, U"Get probability", 0, 0, DO_HMM_and_HMMStateSequence_getProbability);
+	praat_addAction2 (classHMM, 1, classHMMStateSequence, 1, U"To TableOfReal (bigrams)...", 0, 0, DO_HMM_and_HMMStateSequence_to_TableOfReal);
+	praat_addAction2 (classHMM, 1, classHMMObservationSequence, 1, U"Get probability", 0, 0, DO_HMM_and_HMMObservationSequence_getProbability);
+	praat_addAction2 (classHMM, 1, classHMMObservationSequence, 1, U"Get cross-entropy", 0, 0, DO_HMM_and_HMMObservationSequence_getCrossEntropy);
+	praat_addAction2 (classHMM, 1, classHMMObservationSequence, 1, U"Get perplexity", 0, 0, DO_HMM_and_HMMObservationSequence_getPerplexity);
 
 
-	praat_addAction2 (classHMM, 1, classHMM_ObservationSequence, 1, U"To HMM_StateSequence", 0, 0, DO_HMM_and_HMM_ObservationSequence_to_HMM_StateSequence);
-	praat_addAction2 (classHMM, 2, classHMM_ObservationSequence, 1, U"Get cross-entropy", 0, 0, DO_HMM_and_HMM_and_HMM_ObservationSequence_getCrossEntropy);
-	praat_addAction2 (classHMM, 1, classHMM_ObservationSequence, 1, U"To TableOfReal (bigrams)...", 0, 0, DO_HMM_and_HMM_ObservationSequence_to_TableOfReal);
-	praat_addAction2 (classHMM, 1, classHMM_ObservationSequence, 0, U"Learn...", 0, 0, DO_HMM_and_HMM_ObservationSequence_learn);
+	praat_addAction2 (classHMM, 1, classHMMObservationSequence, 1, U"To HMMStateSequence", 0, 0, DO_HMM_and_HMMObservationSequence_to_HMMStateSequence);
+	praat_addAction2 (classHMM, 2, classHMMObservationSequence, 1, U"Get cross-entropy", 0, 0, DO_HMM_and_HMM_and_HMMObservationSequence_getCrossEntropy);
+	praat_addAction2 (classHMM, 1, classHMMObservationSequence, 1, U"To TableOfReal (bigrams)...", 0, 0, DO_HMM_and_HMMObservationSequence_to_TableOfReal);
+	praat_addAction2 (classHMM, 1, classHMMObservationSequence, 0, U"Learn...", 0, 0, DO_HMM_and_HMMObservationSequence_learn);
 
-	praat_addAction1 (classHMM_ObservationSequence, 0, U"To TableOfReal (bigrams)...", 0, 0, DO_HMM_ObservationSequence_to_TableOfReal);
-	praat_addAction1 (classHMM_ObservationSequence, 0, U"To Strings", 0, 0, DO_HMM_ObservationSequence_to_Strings);
-	praat_addAction1 (classHMM_StateSequence, 0, U"To TableOfReal (bigrams)...", 0, 0, DO_HMM_StateSequence_to_TableOfReal);
-	praat_addAction1 (classHMM_StateSequence, 0, U"To Strings", 0, 0, DO_HMM_StateSequence_to_Strings);
+	praat_addAction1 (classHMMObservationSequence, 0, U"To TableOfReal (bigrams)...", 0, 0, DO_HMMObservationSequence_to_TableOfReal);
+	praat_addAction1 (classHMMObservationSequence, 0, U"To Strings", 0, 0, DO_HMMObservationSequence_to_Strings);
+	praat_addAction1 (classHMMStateSequence, 0, U"To TableOfReal (bigrams)...", 0, 0, DO_HMMStateSequence_to_TableOfReal);
+	praat_addAction1 (classHMMStateSequence, 0, U"To Strings", 0, 0, DO_HMMStateSequence_to_Strings);
 
-	praat_addAction1 (classHMM_ObservationSequence, 0, U"To HMM...", 0, 1, DO_HMM_ObservationSequence_to_HMM);
+	praat_addAction1 (classHMMObservationSequence, 0, U"To HMM...", 0, 1, DO_HMMObservationSequence_to_HMM);
 
-	praat_addAction1 (classStrings, 0, U"To HMM_ObservationSequence", 0, praat_HIDDEN, DO_Strings_to_HMM_ObservationSequence);
+	praat_addAction1 (classStrings, 0, U"To HMMObservationSequence", 0, praat_HIDDEN, DO_Strings_to_HMMObservationSequence);
 	praat_addAction1 (classTableOfReal, 0, U"To GaussianMixture (row labels)...", U"To Covariance", praat_HIDDEN + praat_DEPTH_1, DO_TableOfReal_to_GaussianMixture_fromRowlabels);
 	praat_addAction1 (classTableOfReal, 0, U"To GaussianMixture...", U"To Covariance", praat_HIDDEN + praat_DEPTH_1, DO_TableOfReal_to_GaussianMixture);
 
diff --git a/fon/AmplitudeTier.cpp b/fon/AmplitudeTier.cpp
index 15139d0..dac752e 100644
--- a/fon/AmplitudeTier.cpp
+++ b/fon/AmplitudeTier.cpp
@@ -39,7 +39,8 @@ void AmplitudeTier_draw (AmplitudeTier me, Graphics g, double tmin, double tmax,
 
 autoAmplitudeTier PointProcess_upto_AmplitudeTier (PointProcess me, double soundPressure) {
 	try {
-		return (AmplitudeTier) PointProcess_upto_RealTier (me, soundPressure, classAmplitudeTier);
+		autoAmplitudeTier thee = PointProcess_upto_RealTier (me, soundPressure, classAmplitudeTier).static_cast_move<structAmplitudeTier>();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to AmplitudeTier.");
 	}
diff --git a/fon/FormantGrid.cpp b/fon/FormantGrid.cpp
index 01249ed..1a994c8 100644
--- a/fon/FormantGrid.cpp
+++ b/fon/FormantGrid.cpp
@@ -80,10 +80,10 @@ void FormantGrid_init (FormantGrid me, double tmin, double tmax, long numberOfFo
 	my formants = Ordered_create ();
 	my bandwidths = Ordered_create ();
 	for (long iformant = 1; iformant <= numberOfFormants; iformant ++) {
-		RealTier formant = RealTier_create (tmin, tmax);
-		Collection_addItem (my formants, formant);
-		RealTier bandwidth = RealTier_create (tmin, tmax);
-		Collection_addItem (my bandwidths, bandwidth);
+		autoRealTier formant = RealTier_create (tmin, tmax);
+		Collection_addItem (my formants, formant.transfer());
+		autoRealTier bandwidth = RealTier_create (tmin, tmax);
+		Collection_addItem (my bandwidths, bandwidth.transfer());
 	}
 	my xmin = tmin;
 	my xmax = tmax;
diff --git a/fon/IntensityTier.cpp b/fon/IntensityTier.cpp
index 334b4a7..cb20602 100644
--- a/fon/IntensityTier.cpp
+++ b/fon/IntensityTier.cpp
@@ -39,7 +39,8 @@ void IntensityTier_draw (IntensityTier me, Graphics g, double tmin, double tmax,
 
 autoIntensityTier PointProcess_upto_IntensityTier (PointProcess me, double intensity) {
 	try {
-		return (IntensityTier) PointProcess_upto_RealTier (me, intensity, classIntensityTier);
+		autoIntensityTier thee = PointProcess_upto_RealTier (me, intensity, classIntensityTier).static_cast_move<structIntensityTier>();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to IntensityTier.");
 	}
@@ -47,7 +48,8 @@ autoIntensityTier PointProcess_upto_IntensityTier (PointProcess me, double inten
 
 autoIntensityTier Intensity_downto_IntensityTier (Intensity me) {
 	try {
-		return (IntensityTier) Vector_to_RealTier (me, 1, classIntensityTier);
+		autoIntensityTier thee = Vector_to_RealTier (me, 1, classIntensityTier).static_cast_move<structIntensityTier>();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to IntensityTier.");
 	}
@@ -55,7 +57,8 @@ autoIntensityTier Intensity_downto_IntensityTier (Intensity me) {
 
 autoIntensityTier Intensity_to_IntensityTier_peaks (Intensity me) {
 	try {
-		return (IntensityTier) Vector_to_RealTier_peaks (me, 1, classIntensityTier);
+		autoIntensityTier thee = Vector_to_RealTier_peaks (me, 1, classIntensityTier).static_cast_move<structIntensityTier>();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": peaks not converted to IntensityTier.");
 	}
@@ -63,7 +66,8 @@ autoIntensityTier Intensity_to_IntensityTier_peaks (Intensity me) {
 
 autoIntensityTier Intensity_to_IntensityTier_valleys (Intensity me) {
 	try {
-		return (IntensityTier) Vector_to_RealTier_valleys (me, 1, classIntensityTier);
+		autoIntensityTier thee = Vector_to_RealTier_valleys (me, 1, classIntensityTier).static_cast_move<structIntensityTier>();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": valleys not converted to IntensityTier.");
 	}
diff --git a/fon/Ltas_to_SpectrumTier.cpp b/fon/Ltas_to_SpectrumTier.cpp
index e012cdc..c328ebc 100644
--- a/fon/Ltas_to_SpectrumTier.cpp
+++ b/fon/Ltas_to_SpectrumTier.cpp
@@ -21,7 +21,8 @@
 
 autoSpectrumTier Ltas_to_SpectrumTier_peaks (Ltas me) {
 	try {
-		return (SpectrumTier) Vector_to_RealTier_peaks (me, 1, classSpectrumTier);
+		autoSpectrumTier thee = Vector_to_RealTier_peaks (me, 1, classSpectrumTier).static_cast_move<structSpectrumTier>();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": peaks not analyzed as SpectrumTier.");
 	}
diff --git a/fon/PitchTier.cpp b/fon/PitchTier.cpp
index d330b54..a36a38d 100644
--- a/fon/PitchTier.cpp
+++ b/fon/PitchTier.cpp
@@ -51,7 +51,8 @@ void PitchTier_draw (PitchTier me, Graphics g, double tmin, double tmax,
 
 autoPitchTier PointProcess_upto_PitchTier (PointProcess me, double frequency) {
 	try {
-		return (PitchTier) PointProcess_upto_RealTier (me, frequency, classPitchTier);
+		autoPitchTier thee = PointProcess_upto_RealTier (me, frequency, classPitchTier).static_cast_move<structPitchTier>();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to PitchTier.");
 	}
diff --git a/fon/PointEditor.cpp b/fon/PointEditor.cpp
index 187aa9c..197eb60 100644
--- a/fon/PointEditor.cpp
+++ b/fon/PointEditor.cpp
@@ -216,7 +216,7 @@ autoPointEditor PointEditor_create (const char32 *title, PointProcess point, Sou
 	try {
 		autoPointEditor me = Thing_new (PointEditor);
 		if (sound) {
-			my monoSound = Sound_convertToMono (sound);
+			my monoSound = Sound_convertToMono (sound).transfer();
 		}
 		TimeSoundEditor_init (me.peek(), title, point, my monoSound, false);
 		return me;
diff --git a/fon/Praat_tests.cpp b/fon/Praat_tests.cpp
index 785f261..65f567e 100644
--- a/fon/Praat_tests.cpp
+++ b/fon/Praat_tests.cpp
@@ -264,6 +264,8 @@ int Praat_tests (int itest, char32 *arg1, char32 *arg2, char32 *arg3, char32 *ar
 				fprintf (stderr, "7\n");
 				//data = ordered;   // disabled l-value copy assignment from subclass
 				data = ordered.move();
+				//ordered = data;   // disabled l-value copy assignment from superclass
+				//ordered = data.move();   // assignment from superclass to subclass is rightfully refused by compiler
 				fprintf (stderr, "8\n");
 				data2 = newAutoData ();
 				fprintf (stderr, "8a\n");
diff --git a/fon/RealTier.cpp b/fon/RealTier.cpp
index 3eda077..62cc6be 100644
--- a/fon/RealTier.cpp
+++ b/fon/RealTier.cpp
@@ -43,7 +43,7 @@
 
 Thing_implement (RealPoint, AnyPoint, 0);
 
-RealPoint RealPoint_create (double time, double value) {
+autoRealPoint RealPoint_create (double time, double value) {
 	autoRealPoint me = Thing_new (RealPoint);
 	my number = time;
 	my value = value;
@@ -93,21 +93,21 @@ void RealTier_init (RealTier me, double tmin, double tmax) {
 	my points = SortedSetOfDouble_create ();
 }
 
-RealTier RealTier_create (double tmin, double tmax) {
+autoRealTier RealTier_create (double tmin, double tmax) {
 	try {
 		autoRealTier me = Thing_new (RealTier);
 		RealTier_init (me.peek(), tmin, tmax);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"RealTier not created.");
 	}
 }
 
-RealTier RealTier_createWithClass (double tmin, double tmax, ClassInfo klas) {
+autoRealTier RealTier_createWithClass (double tmin, double tmax, ClassInfo klas) {
 	try {
 		autoRealTier me = static_cast <RealTier> (Thing_newFromClass (klas));
 		RealTier_init (me.peek(), tmin, tmax);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (klas -> className, U" not created.");
 	}
@@ -325,7 +325,7 @@ void RealTier_draw (RealTier me, Graphics g, double tmin, double tmax, double fm
 	}
 }
 
-TableOfReal RealTier_downto_TableOfReal (RealTier me, const char32 *timeLabel, const char32 *valueLabel) {
+autoTableOfReal RealTier_downto_TableOfReal (RealTier me, const char32 *timeLabel, const char32 *valueLabel) {
 	try {
 		autoTableOfReal thee = TableOfReal_create (my numberOfPoints (), 2);
 		TableOfReal_setColumnLabel (thee.peek(), 1, timeLabel);
@@ -335,7 +335,7 @@ TableOfReal RealTier_downto_TableOfReal (RealTier me, const char32 *timeLabel, c
 			thy data [i] [1] = point -> number;
 			thy data [i] [2] = point -> value;
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to TableOfReal.");
 	}
@@ -382,7 +382,7 @@ void RealTier_interpolateQuadratically (RealTier me, long numberOfPointsPerParab
 	}
 }
 
-Table RealTier_downto_Table (RealTier me, const char32 *indexText, const char32 *timeText, const char32 *valueText) {
+autoTable RealTier_downto_Table (RealTier me, const char32 *indexText, const char32 *timeText, const char32 *valueText) {
 	try {
 		autoTable thee = Table_createWithoutColumnNames (my numberOfPoints (),
 			(indexText != NULL) + (timeText != NULL) + (valueText != NULL));
@@ -397,25 +397,25 @@ Table RealTier_downto_Table (RealTier me, const char32 *indexText, const char32
 			if (timeText != NULL)  Table_setNumericValue (thee.peek(), ipoint, ++ icol, point -> number);
 			if (valueText != NULL) Table_setNumericValue (thee.peek(), ipoint, ++ icol, point -> value);
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Table.");
 	}
 }
 
-RealTier Vector_to_RealTier (Vector me, long channel, ClassInfo klas) {
+autoRealTier Vector_to_RealTier (Vector me, long channel, ClassInfo klas) {
 	try {
 		autoRealTier thee = RealTier_createWithClass (my xmin, my xmax, klas);
 		for (long i = 1; i <= my nx; i ++) {
 			RealTier_addPoint (thee.peek(), Sampled_indexToX (me, i), my z [channel] [i]);
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to ", klas -> className, U".");
 	}
 }
 
-RealTier Vector_to_RealTier_peaks (Vector me, long channel, ClassInfo klas) {
+autoRealTier Vector_to_RealTier_peaks (Vector me, long channel, ClassInfo klas) {
 	try {
 		autoRealTier thee = RealTier_createWithClass (my xmin, my xmax, klas);
 		for (long i = 2; i < my nx; i ++) {
@@ -427,13 +427,13 @@ RealTier Vector_to_RealTier_peaks (Vector me, long channel, ClassInfo klas) {
 				RealTier_addPoint (thee.peek(), x, maximum);
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to ", klas -> className, U" (peaks).");
 	}
 }
 
-RealTier Vector_to_RealTier_valleys (Vector me, long channel, ClassInfo klas) {
+autoRealTier Vector_to_RealTier_valleys (Vector me, long channel, ClassInfo klas) {
 	try {
 		autoRealTier thee = RealTier_createWithClass (my xmin, my xmax, klas);
 		for (long i = 2; i < my nx; i ++) {
@@ -445,19 +445,19 @@ RealTier Vector_to_RealTier_valleys (Vector me, long channel, ClassInfo klas) {
 				RealTier_addPoint (thee.peek(), x, minimum);
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to ", klas -> className, U" (valleys).");
 	}
 }
 
-RealTier PointProcess_upto_RealTier (PointProcess me, double value, ClassInfo klas) {
+autoRealTier PointProcess_upto_RealTier (PointProcess me, double value, ClassInfo klas) {
 	try {
 		autoRealTier thee = RealTier_createWithClass (my xmin, my xmax, klas);
 		for (long i = 1; i <= my nt; i ++) {
 			RealTier_addPoint (thee.peek(), my t [i], value);
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to RealTier.");
 	}
diff --git a/fon/RealTier.h b/fon/RealTier.h
index 3f6da29..d0e4bee 100644
--- a/fon/RealTier.h
+++ b/fon/RealTier.h
@@ -30,7 +30,7 @@
 #include "RealTier_def.h"
 oo_CLASS_CREATE (RealPoint, AnyPoint);
 
-RealPoint RealPoint_create (double time, double value);
+autoRealPoint RealPoint_create (double time, double value);
 /*
 	Postconditions:
 		result -> time == time;
@@ -42,8 +42,8 @@ RealPoint RealPoint_create (double time, double value);
 oo_CLASS_CREATE (RealTier, Function);
 
 void RealTier_init (RealTier me, double tmin, double tmax);
-RealTier RealTier_create (double tmin, double tmax);
-RealTier RealTier_createWithClass (double tmin, double tmax, ClassInfo klas);
+autoRealTier RealTier_create (double tmin, double tmax);
+autoRealTier RealTier_createWithClass (double tmin, double tmax, ClassInfo klas);
 /*
 	Postconditions:
 		result -> xmin == tmin;
@@ -70,15 +70,15 @@ double RealTier_getStandardDeviation_points (RealTier me, double tmin, double tm
 void RealTier_addPoint (RealTier me, double t, double value);
 void RealTier_draw (RealTier me, Graphics g, double tmin, double tmax,
 	double ymin, double ymax, int garnish, const char32 *method, const char32 *quantity);
-TableOfReal RealTier_downto_TableOfReal (RealTier me, const char32 *timeLabel, const char32 *valueLabel);
+autoTableOfReal RealTier_downto_TableOfReal (RealTier me, const char32 *timeLabel, const char32 *valueLabel);
 
 void RealTier_interpolateQuadratically (RealTier me, long numberOfPointsPerParabola, int logarithmically);
 
-Table RealTier_downto_Table (RealTier me, const char32 *indexText, const char32 *timeText, const char32 *valueText);
-RealTier Vector_to_RealTier (Vector me, long channel, ClassInfo klas);
-RealTier Vector_to_RealTier_peaks (Vector me, long channel, ClassInfo klas);
-RealTier Vector_to_RealTier_valleys (Vector me, long channel, ClassInfo klas);
-RealTier PointProcess_upto_RealTier (PointProcess me, double value, ClassInfo klas);
+autoTable RealTier_downto_Table (RealTier me, const char32 *indexText, const char32 *timeText, const char32 *valueText);
+autoRealTier Vector_to_RealTier (Vector me, long channel, ClassInfo klas);
+autoRealTier Vector_to_RealTier_peaks (Vector me, long channel, ClassInfo klas);
+autoRealTier Vector_to_RealTier_valleys (Vector me, long channel, ClassInfo klas);
+autoRealTier PointProcess_upto_RealTier (PointProcess me, double value, ClassInfo klas);
 
 void RealTier_formula (RealTier me, const char32 *expression, Interpreter interpreter, RealTier thee);
 void RealTier_multiplyPart (RealTier me, double tmin, double tmax, double factor);
diff --git a/fon/Sound.cpp b/fon/Sound.cpp
index 4002ab8..ac6e9d8 100644
--- a/fon/Sound.cpp
+++ b/fon/Sound.cpp
@@ -143,7 +143,7 @@ autoSound Sound_createSimple (long numberOfChannels, double duration, double sam
 		1.0 / samplingFrequency, 0.5 / samplingFrequency);
 }
 
-Sound Sound_convertToMono (Sound me) {
+autoSound Sound_convertToMono (Sound me) {
 	if (my ny == 1) return Data_copy (me);   // optimization
 	try {
 		autoSound thee = Sound_create (1, my xmin, my xmax, my nx, my dx, my x1);
@@ -160,13 +160,13 @@ Sound Sound_convertToMono (Sound me) {
 				thy z [1] [i] = sum / my ny;
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to mono.");
 	}
 }
 
-Sound Sound_convertToStereo (Sound me) {
+autoSound Sound_convertToStereo (Sound me) {
 	if (my ny == 2) return Data_copy (me);
 	try {
 		if (my ny > 2) {
@@ -177,13 +177,13 @@ Sound Sound_convertToStereo (Sound me) {
 		for (long i = 1; i <= my nx; i ++) {
 			thy z [1] [i] = thy z [2] [i] = my z [1] [i];
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to stereo.");
 	}
 }
 
-Sound Sounds_combineToStereo (Collection me) {
+autoSound Sounds_combineToStereo (Collection me) {
 	try {
 		long totalNumberOfChannels = 0;
 		double sharedSamplingPeriod = 0.0;
@@ -233,13 +233,13 @@ Sound Sounds_combineToStereo (Collection me) {
 				}
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (U"Sounds not combined to stereo.");
 	}
 }
 
-Sound Sound_extractChannel (Sound me, long ichan) {
+autoSound Sound_extractChannel (Sound me, long ichan) {
 	try {
 		if (ichan <= 0 || ichan > my ny)
 			Melder_throw (U"There is no channel ", ichan, U".");
@@ -247,7 +247,7 @@ Sound Sound_extractChannel (Sound me, long ichan) {
 		for (long isamp = 1; isamp <= my nx; isamp ++) {
 			thy z [1] [isamp] = my z [ichan] [isamp];
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": channel ", ichan, U" not extracted.");
 	}
@@ -305,40 +305,40 @@ double Sound_getPowerInAir (Sound me) {
 	return NUMdefined (sum2) ? sum2 / (n * my ny) / 400 : NUMundefined;
 }
 
-Sound Matrix_to_Sound_mono (Matrix me, long row) {
+autoSound Matrix_to_Sound_mono (Matrix me, long row) {
 	try {
 		autoSound thee = Sound_create (1, my xmin, my xmax, my nx, my dx, my x1);
 		if (row < 0) row = my ny + 1 + row;
 		if (row < 1) row = 1;
 		if (row > my ny) row = my ny;
 		NUMvector_copyElements (my z [row], thy z [1], 1, my nx);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Sound.");
 	}
 }
 
-Sound Matrix_to_Sound (Matrix me) {
+autoSound Matrix_to_Sound (Matrix me) {
 	try {
 		autoSound thee = Thing_new (Sound);
 		my structMatrix :: v_copy (thee.peek());
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Sound.");
 	}
 }
 
-Matrix Sound_to_Matrix (Sound me) {
+autoMatrix Sound_to_Matrix (Sound me) {
 	try {
 		autoMatrix thee = Thing_new (Matrix);
 		my structMatrix :: v_copy (thee.peek());
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Matrix.");
 	}
 }
 
-Sound Sound_upsample (Sound me) {
+autoSound Sound_upsample (Sound me) {
 	try {
 		long nfft = 1;
 		while (nfft < my nx + 2000) nfft *= 2;
@@ -358,13 +358,13 @@ Sound Sound_upsample (Sound me) {
 				thy z [channel] [i] = data [i + 2000] * factor;
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not upsampled.");
 	}
 }
 
-Sound Sound_resample (Sound me, double samplingFrequency, long precision) {
+autoSound Sound_resample (Sound me, double samplingFrequency, long precision) {
 	double upfactor = samplingFrequency * my dx;
 	if (fabs (upfactor - 2) < 1e-6) return Sound_upsample (me);
 	if (fabs (upfactor - 1) < 1e-6) return Data_copy (me);
@@ -419,13 +419,13 @@ Sound Sound_resample (Sound me, double samplingFrequency, long precision) {
 				}
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not resampled.");
 	}
 }
 
-Sound Sounds_append (Sound me, double silenceDuration, Sound thee) {
+autoSound Sounds_append (Sound me, double silenceDuration, Sound thee) {
 	try {
 		long nx_silence = lround (silenceDuration / my dx), nx = my nx + nx_silence + thy nx;
 		if (my ny != thy ny)
@@ -437,13 +437,13 @@ Sound Sounds_append (Sound me, double silenceDuration, Sound thee) {
 			NUMvector_copyElements (my z [channel], his z [channel], 1, my nx);
 			NUMvector_copyElements (thy z [channel], his z [channel] + my nx + nx_silence, 1, thy nx);
 		}
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (me, U" & ", thee, U": not appended.");
 	}
 }
 
-Sound Sounds_concatenate_e (Collection me, double overlapTime) {
+autoSound Sounds_concatenate_e (Collection me, double overlapTime) {
 	try {
 		long numberOfChannels = 0, nx = 0, numberOfSmoothingSamples;
 		double dx = 0.0;
@@ -504,13 +504,13 @@ Sound Sounds_concatenate_e (Collection me, double overlapTime) {
 		thy nx -= numberOfSmoothingSamples * (my size - 1);
 		Melder_assert (thy nx == nx);
 		thy xmax = thy nx * dx;
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (U"Sounds not concatenated.");
 	}
 }
 
-Sound Sounds_convolve (Sound me, Sound thee, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain) {
+autoSound Sounds_convolve (Sound me, Sound thee, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain) {
 	try {
 		if (my ny > 1 && thy ny > 1 && my ny != thy ny)
 			Melder_throw (U"The numbers of channels of the two sounds have to be equal or 1.");
@@ -583,13 +583,13 @@ Sound Sounds_convolve (Sound me, Sound thee, enum kSounds_convolve_scaling scali
 			} break;
 			default: Melder_fatal (U"Sounds_convolve: unimplemented scaling ", scaling);
 		}
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (me, U" & ", thee, U": not convolved.");
 	}
 }
 
-Sound Sounds_crossCorrelate (Sound me, Sound thee, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain) {
+autoSound Sounds_crossCorrelate (Sound me, Sound thee, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain) {
 	try {
 		if (my ny > 1 && thy ny > 1 && my ny != thy ny)
 			Melder_throw (U"The numbers of channels of the two sounds have to be equal or 1.");
@@ -666,13 +666,13 @@ Sound Sounds_crossCorrelate (Sound me, Sound thee, enum kSounds_convolve_scaling
 			} break;
 			default: Melder_fatal (U"Sounds_crossCorrelate: unimplemented scaling ", scaling);
 		}
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (me, U" & ", thee, U": not cross-correlated.");
 	}
 }
 
-Sound Sound_autoCorrelate (Sound me, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain) {
+autoSound Sound_autoCorrelate (Sound me, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain) {
 	try {
 		long numberOfChannels = my ny, n1 = my nx, n2 = n1 + n1 - 1, nfft = 1;
 		while (nfft < n2) nfft *= 2;
@@ -737,7 +737,7 @@ Sound Sound_autoCorrelate (Sound me, enum kSounds_convolve_scaling scaling, enum
 			} break;
 			default: Melder_fatal (U"Sounds_autoCorrelate: unimplemented scaling ", scaling);
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": autocorrelation not computed.");
 	}
@@ -892,7 +892,7 @@ void Sound_setZero (Sound me, double tmin_in, double tmax_in, int roundTimesToNe
 	}
 }
 
-Sound Sound_createAsPureTone (long numberOfChannels, double startingTime, double endTime,
+autoSound Sound_createAsPureTone (long numberOfChannels, double startingTime, double endTime,
 	double sampleRate, double frequency, double amplitude, double fadeInDuration, double fadeOutDuration)
 {
 	try {
@@ -914,13 +914,13 @@ Sound Sound_createAsPureTone (long numberOfChannels, double startingTime, double
 				my z [ichan] [isamp] = value;
 			}
 		}
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not created from tone complex.");
 	}
 }
 
-Sound Sound_createFromToneComplex (double startingTime, double endTime, double sampleRate,
+autoSound Sound_createFromToneComplex (double startingTime, double endTime, double sampleRate,
 	int phase, double frequencyStep, double firstFrequency, double ceiling, long numberOfComponents)
 {
 	try {
@@ -962,7 +962,7 @@ Sound Sound_createFromToneComplex (double startingTime, double endTime, double s
 					value += cos (firstOmegaT + (icomp - 1) * omegaStepT);
 			amplitude [isamp] = value * factor;
 		}
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not created from tone complex.");
 	}
@@ -1055,7 +1055,7 @@ void Sound_overrideSamplingFrequency (Sound me, double rate) {
 	my xmax = my xmin + my nx * my dx;
 }
 
-Sound Sound_extractPart (Sound me, double t1, double t2, enum kSound_windowShape windowShape, double relativeWidth, bool preserveTimes) {
+autoSound Sound_extractPart (Sound me, double t1, double t2, enum kSound_windowShape windowShape, double relativeWidth, bool preserveTimes) {
 	try {
 		/*
 		 * We do not clip to the Sound's time domain.
@@ -1097,13 +1097,13 @@ Sound Sound_extractPart (Sound me, double t1, double t2, enum kSound_windowShape
 		 * Multiply by a window that extends throughout the target domain.
 		 */
 		Sound_multiplyByWindow (thee.peek(), windowShape);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": part not extracted.");
 	}
 }
 
-Sound Sound_extractPartForOverlap (Sound me, double t1, double t2, double overlap) {
+autoSound Sound_extractPartForOverlap (Sound me, double t1, double t2, double overlap) {
 	try {
 		if (t1 == t2) { t1 = my xmin; t2 = my xmax; };   // autowindow
 		if (overlap > 0.0) {
@@ -1134,7 +1134,7 @@ Sound Sound_extractPartForOverlap (Sound me, double t1, double t2, double overla
 			NUMvector_copyElements (my z [channel], thy z [channel] + 1 - ix1,
 					( ix1 < 1 ? 1 : ix1 ), ( ix2 > my nx ? my nx : ix2 ));
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": part not extracted.");
 	}
@@ -1162,11 +1162,11 @@ void Sound_filterWithFormants (Sound me, double tmin, double tmax,
 	}
 }
 
-Sound Sound_filter_oneFormant (Sound me, double frequency, double bandwidth) {
+autoSound Sound_filter_oneFormant (Sound me, double frequency, double bandwidth) {
 	try {
 		autoSound thee = Data_copy (me);
 		Sound_filterWithOneFormantInline (thee.peek(), frequency, bandwidth);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not filtered (one formant).");
 	}
@@ -1179,23 +1179,23 @@ void Sound_filterWithOneFormantInline (Sound me, double frequency, double bandwi
 	Matrix_scaleAbsoluteExtremum (me, 0.99);
 }
 
-Sound Sound_filter_preemphasis (Sound me, double frequency) {
+autoSound Sound_filter_preemphasis (Sound me, double frequency) {
 	try {
 		autoSound thee = Data_copy (me);
 		Sound_preEmphasis (thee.peek(), frequency);
 		Matrix_scaleAbsoluteExtremum (thee.peek(), 0.99);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not filtered (pre-emphasis).");
 	}
 }
 
-Sound Sound_filter_deemphasis (Sound me, double frequency) {
+autoSound Sound_filter_deemphasis (Sound me, double frequency) {
 	try {
 		autoSound thee = Data_copy (me);
 		Sound_deEmphasis (thee.peek(), frequency);
 		Matrix_scaleAbsoluteExtremum (thee.peek(), 0.99);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not filtered (de-emphasis).");
 	}
@@ -1215,7 +1215,7 @@ void Sound_reverse (Sound me, double tmin, double tmax) {
 	}
 }
 
-Sound Sounds_crossCorrelate_short (Sound me, Sound thee, double tmin, double tmax, int normalize) {
+autoSound Sounds_crossCorrelate_short (Sound me, Sound thee, double tmin, double tmax, int normalize) {
 	try {
 		if (my dx != thy dx)
 			Melder_throw (U"Sampling frequencies are not equal.");
@@ -1265,7 +1265,7 @@ Sound Sounds_crossCorrelate_short (Sound me, Sound thee, double tmin, double tma
 				his z [1] [i] *= factor;
 			}
 		}
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (me, U": not cross-correlated.");
 	}
diff --git a/fon/Sound.h b/fon/Sound.h
index 809efee..cea9915 100644
--- a/fon/Sound.h
+++ b/fon/Sound.h
@@ -98,26 +98,26 @@ autoSound Sound_createSimple (long numberOfChannels, double duration, double sam
 		thy z [i] [1..nx] == 0.0;
 */
 
-Sound Sound_convertToMono (Sound me);
-Sound Sound_convertToStereo (Sound me);
-Sound Sound_extractChannel (Sound me, long ichannel);
-Sound Sounds_combineToStereo (Collection me);
+autoSound Sound_convertToMono (Sound me);
+autoSound Sound_convertToStereo (Sound me);
+autoSound Sound_extractChannel (Sound me, long ichannel);
+autoSound Sounds_combineToStereo (Collection me);
 
 /* Levels for Sampled_getValueAtSample (me, index, level, unit) */
 #define Sound_LEVEL_MONO  0
 #define Sound_LEVEL_LEFT  1
 #define Sound_LEVEL_RIGHT  2
 
-Sound Sound_upsample (Sound me);   /* By a factor 2. */
+autoSound Sound_upsample (Sound me);   /* By a factor 2. */
 
-Sound Sound_resample (Sound me, double samplingFrequency, long precision);
+autoSound Sound_resample (Sound me, double samplingFrequency, long precision);
 /*
 	Method:
 		precision <= 1: linear interpolation.
 		precision >= 2: sinx/x interpolation with maximum depth equal to 'precision'.
 */
 
-Sound Sounds_append (Sound me, double silenceDuration, Sound thee);
+autoSound Sounds_append (Sound me, double silenceDuration, Sound thee);
 /*
 	Function:
 		append two Sounds.
@@ -135,7 +135,7 @@ Sound Sounds_append (Sound me, double silenceDuration, Sound thee);
 		result -> z [1] [i + my nx + round (silenceDuration / my dx)] == thy z [1] [i]
 */
  
-Sound Sounds_convolve (Sound me, Sound thee, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain);
+autoSound Sounds_convolve (Sound me, Sound thee, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain);
 /*
 	Function:
 		convolve two Sounds.
@@ -151,9 +151,9 @@ Sound Sounds_convolve (Sound me, Sound thee, enum kSounds_convolve_scaling scali
 			result -> z [1] [i] == result -> dx *
 				sum (j = 1..i, my z [1] [j] * thy z [1] [i - j + 1])
 */
-Sound Sounds_crossCorrelate (Sound me, Sound thee, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain);
-Sound Sounds_crossCorrelate_short (Sound me, Sound thee, double tmin, double tmax, int normalize);
-Sound Sound_autoCorrelate (Sound me, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain);
+autoSound Sounds_crossCorrelate (Sound me, Sound thee, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain);
+autoSound Sounds_crossCorrelate_short (Sound me, Sound thee, double tmin, double tmax, int normalize);
+autoSound Sound_autoCorrelate (Sound me, enum kSounds_convolve_scaling scaling, enum kSounds_convolve_signalOutsideTimeDomain signalOutsideTimeDomain);
 
 double Sound_getRootMeanSquare (Sound me, double xmin, double xmax);
 double Sound_getEnergy (Sound me, double xmin, double xmax);
@@ -165,27 +165,27 @@ double Sound_getIntensity_dB (Sound me);
 double Sound_getNearestZeroCrossing (Sound me, double position, long ichannel);
 void Sound_setZero (Sound me, double tmin, double tmax, int roundTimesToNearestZeroCrossing);
 
-Sound Sound_createAsPureTone (long numberOfChannels, double startingTime, double endTime,
+autoSound Sound_createAsPureTone (long numberOfChannels, double startingTime, double endTime,
 	double sampleRate, double frequency, double amplitude, double fadeInDuration, double fadeOutDuration);
-Sound Sound_createFromToneComplex (double startingTime, double endTime,
+autoSound Sound_createFromToneComplex (double startingTime, double endTime,
 	double sampleRate, int phase, double frequencyStep,
 	double firstFrequency, double ceiling, long numberOfComponents);
 /* Values for `phase' parameter: */
 #define Sound_TONE_COMPLEX_SINE  0
 #define Sound_TONE_COMPLEX_COSINE  1
 
-Sound Sounds_concatenate_e (Collection me, double overlapTime);
+autoSound Sounds_concatenate_e (Collection me, double overlapTime);
 void Sound_multiplyByWindow (Sound me, enum kSound_windowShape windowShape);
 void Sound_scaleIntensity (Sound me, double newAverageIntensity);
 void Sound_overrideSamplingFrequency (Sound me, double newSamplingFrequency);
-Sound Sound_extractPart (Sound me, double t1, double t2, enum kSound_windowShape windowShape, double relativeWidth, bool preserveTimes);
-Sound Sound_extractPartForOverlap (Sound me, double t1, double t2, double overlap);
+autoSound Sound_extractPart (Sound me, double t1, double t2, enum kSound_windowShape windowShape, double relativeWidth, bool preserveTimes);
+autoSound Sound_extractPartForOverlap (Sound me, double t1, double t2, double overlap);
 void Sound_filterWithFormants (Sound me, double tmin, double tmax,
 	int numberOfFormants, double formant [], double bandwidth []);
-Sound Sound_filter_oneFormant (Sound me, double frequency, double bandwidth);
+autoSound Sound_filter_oneFormant (Sound me, double frequency, double bandwidth);
 void Sound_filterWithOneFormantInline (Sound me, double frequency, double bandwidth);
-Sound Sound_filter_preemphasis (Sound me, double frequency);
-Sound Sound_filter_deemphasis (Sound me, double frequency);
+autoSound Sound_filter_preemphasis (Sound me, double frequency);
+autoSound Sound_filter_deemphasis (Sound me, double frequency);
 
 void Sound_reverse (Sound me, double tmin, double tmax);
 
@@ -193,15 +193,15 @@ void Sound_draw (Sound me, Graphics g,
 	double tmin, double tmax, double minimum, double maximum, bool garnish, const char32 *method);
 /* For method, see Vector_draw. */
 
-Matrix Sound_to_Matrix (Sound me);
+autoMatrix Sound_to_Matrix (Sound me);
 /*
 	Create a Matrix from a Sound,
 	with deep copy of all its Matrix attributes, except class information and methods.
 */
 
-Sound Matrix_to_Sound (Matrix me);
+autoSound Matrix_to_Sound (Matrix me);
 
-Sound Matrix_to_Sound_mono (Matrix me, long row);
+autoSound Matrix_to_Sound_mono (Matrix me, long row);
 /*
 	Function:
 		create a Sound from one row of a Matrix.
@@ -222,7 +222,7 @@ extern Sound Sound_clipboard;
 
 /********** Sound_audio.cpp **********/
 
-Sound Sound_recordFixedTime (int inputSource,
+autoSound Sound_recordFixedTime (int inputSource,
 	double gain, double balance, double samplingFrequency, double duration);
 	/*
 		Function:
@@ -303,17 +303,17 @@ void Sound_play (Sound me,
 /* To avoid clipping, keep the absolute amplitude below 1.000. */
 /* All are mono or stereo PCM. */
 void Sound_writeToAudioFile (Sound me, MelderFile file, int audioFileType, int numberOfBitsPerSamplePoint);
-void Sound_writeToKayFile (Sound me, MelderFile file);   /* 16 bit */
-void Sound_writeToSesamFile (Sound me, MelderFile file);   /* 12-bit SESAM/LVS */
+void Sound_writeToKayFile (Sound me, MelderFile file);   // 16-bit
+void Sound_writeToSesamFile (Sound me, MelderFile file);   // 12-bit SESAM/LVS
 
-Sound Sound_readFromSoundFile (MelderFile file);   /* AIFF, WAV, NeXT/Sun, or NIST */
-Sound Sound_readFromKayFile (MelderFile file);   /* 16 bit */
-Sound Sound_readFromSesamFile (MelderFile file);   /* 12 bit SESAM/LVS */
-Sound Sound_readFromBellLabsFile (MelderFile file);   /* 16 bit */
-Sound Sound_readFromRawAlawFile (MelderFile file);
-Sound Sound_readFromMovieFile (MelderFile file);
+autoSound Sound_readFromSoundFile (MelderFile file);   // AIFF, WAV, NeXT/Sun, or NIST
+autoSound Sound_readFromKayFile (MelderFile file);   // 16-bit
+autoSound Sound_readFromSesamFile (MelderFile file);   // 12-bit SESAM/LVS
+autoSound Sound_readFromBellLabsFile (MelderFile file);   // 16-bit
+autoSound Sound_readFromRawAlawFile (MelderFile file);
+autoSound Sound_readFromMovieFile (MelderFile file);
 
-Sound Sound_readFromRawSoundFile (MelderFile file, int encoding, int numberOfChannels, double sampleRate);
+autoSound Sound_readFromRawSoundFile (MelderFile file, int encoding, int numberOfChannels, double sampleRate);
 /*
 	'encoding' is any of the following:
 		Melder_LINEAR_8_SIGNED
@@ -337,8 +337,8 @@ void Sound_writeToRawSoundFile (Sound me, MelderFile file, int encoding);
 
 /********** Sound_enhance.cpp **********/
 
-Sound Sound_lengthen_overlapAdd (Sound me, double fmin, double fmax, double factor);
-Sound Sound_deepenBandModulation (Sound me, double enhancement_dB,
+autoSound Sound_lengthen_overlapAdd (Sound me, double fmin, double fmax, double factor);
+autoSound Sound_deepenBandModulation (Sound me, double enhancement_dB,
 	double flow, double fhigh, double slowModulation, double fastModulation, double bandSmoothing);
 
 /* End of file Sound.h */
diff --git a/fon/SoundEditor.cpp b/fon/SoundEditor.cpp
index 67ee2f8..5b2ef36 100644
--- a/fon/SoundEditor.cpp
+++ b/fon/SoundEditor.cpp
@@ -31,7 +31,7 @@ void structSoundEditor :: v_dataChanged () {
 	Sound sound = (Sound) data;
 	Melder_assert (sound != NULL);   // LongSound objects should not get v_dataChanged messages
 	Matrix_getWindowExtrema (sound, 1, sound -> nx, 1, sound -> ny, & d_sound.minimum, & d_sound.maximum);   // BUG unreadable
-	v_destroy_analysis ();
+	v_reset_analysis ();
 	SoundEditor_Parent :: v_dataChanged ();
 }
 
@@ -145,7 +145,7 @@ static void menu_cb_Cut (EDITOR_ARGS) {
 			/* Force FunctionEditor to show changes. */
 
 			Matrix_getWindowExtrema (sound, 1, sound -> nx, 1, sound -> ny, & my d_sound.minimum, & my d_sound.maximum);
-			my v_destroy_analysis ();
+			my v_reset_analysis ();
 			FunctionEditor_ungroup (me);
 			FunctionEditor_marksChanged (me, false);
 			Editor_broadcastDataChanged (me);
@@ -215,7 +215,7 @@ static void menu_cb_Paste (EDITOR_ARGS) {
 	/* Force FunctionEditor to show changes. */
 
 	Matrix_getWindowExtrema (sound, 1, sound -> nx, 1, sound -> ny, & my d_sound.minimum, & my d_sound.maximum);
-	my v_destroy_analysis ();
+	my v_reset_analysis ();
 	FunctionEditor_ungroup (me);
 	FunctionEditor_marksChanged (me, false);
 	Editor_broadcastDataChanged (me);
@@ -232,7 +232,7 @@ static void menu_cb_SetSelectionToZero (EDITOR_ARGS) {
 			sound -> z [channel] [i] = 0.0;
 		}
 	}
-	my v_destroy_analysis ();
+	my v_reset_analysis ();
 	FunctionEditor_redraw (me);
 	Editor_broadcastDataChanged (me);
 }
@@ -241,7 +241,7 @@ static void menu_cb_ReverseSelection (EDITOR_ARGS) {
 	EDITOR_IAM (SoundEditor);
 	Editor_save (me, U"Reverse selection");
 	Sound_reverse ((Sound) my data, my d_startSelection, my d_endSelection);
-	my v_destroy_analysis ();
+	my v_reset_analysis ();
 	FunctionEditor_redraw (me);
 	Editor_broadcastDataChanged (me);
 }
diff --git a/fon/SoundRecorder.cpp b/fon/SoundRecorder.cpp
index b569cd8..40ea372 100644
--- a/fon/SoundRecorder.cpp
+++ b/fon/SoundRecorder.cpp
@@ -360,13 +360,17 @@ static long getMyNsamp (SoundRecorder me) {
 }
 
 #if cocoa
-static void workProc (CFRunLoopTimerRef timer, void *void_me) {
-	(void) timer;
+	#define WORKPROC_RETURN  void
+	#define WORKPROC_ARGS  CFRunLoopTimerRef /*timer*/, void *void_me
 #elif gtk
-static gboolean workProc (void *void_me) {
+	#define WORKPROC_RETURN  gboolean
+	#define WORKPROC_ARGS  void *void_me
 #else
-static bool workProc (void *void_me) {
+	#define WORKPROC_RETURN  bool
+	#define WORKPROC_ARGS  void *void_me
 #endif
+
+static WORKPROC_RETURN workProc (WORKPROC_ARGS) {
 	iam (SoundRecorder);
 	try {
 		short buffertje [step*2];
@@ -527,8 +531,7 @@ static int portaudioStreamCallback (
 	return paContinue;
 }
 
-static void gui_button_cb_record (I, GuiButtonEvent event) {
-	(void) event;
+static void gui_button_cb_record (I, GuiButtonEvent /* event */) {
 	iam (SoundRecorder);
 	try {
 		if (my recording) return;
@@ -588,14 +591,12 @@ static void gui_button_cb_record (I, GuiButtonEvent event) {
 	}
 }
 
-static void gui_button_cb_stop (I, GuiButtonEvent event) {
-	(void) event;
+static void gui_button_cb_stop (I, GuiButtonEvent /* event */) {
 	iam (SoundRecorder);
 	stopRecording (me);
 }
 
-static void gui_button_cb_play (I, GuiButtonEvent event) {
-	(void) event;
+static void gui_button_cb_play (I, GuiButtonEvent /* event */) {
 	iam (SoundRecorder);
 	if (my recording || my nsamp == 0) return;
 	MelderAudio_play16 (my buffer, theControlPanel. sampleRate, my fakeMono ? my nsamp / 2 : my nsamp, my fakeMono ? 2 : my numberOfChannels, NULL, NULL);
@@ -632,22 +633,19 @@ static void publish (SoundRecorder me) {
 	Editor_broadcastPublication (me, sound.transfer());
 }
 
-static void gui_button_cb_cancel (I, GuiButtonEvent event) {
-	(void) event;
+static void gui_button_cb_cancel (I, GuiButtonEvent /* event */) {
 	iam (SoundRecorder);
 	stopRecording (me);
 	forget (me);
 }
 
-static void gui_button_cb_apply (I, GuiButtonEvent event) {
-	(void) event;
+static void gui_button_cb_apply (I, GuiButtonEvent /* event */) {
 	iam (SoundRecorder);
 	stopRecording (me);
 	publish (me);
 }
 
-static void gui_button_cb_ok (I, GuiButtonEvent event) {
-	(void) event;
+static void gui_button_cb_ok (I, GuiButtonEvent /* event */) {
 	iam (SoundRecorder);
 	stopRecording (me);
 	publish (me);
diff --git a/fon/Sound_PointProcess.cpp b/fon/Sound_PointProcess.cpp
index ee0305d..430765c 100644
--- a/fon/Sound_PointProcess.cpp
+++ b/fon/Sound_PointProcess.cpp
@@ -24,7 +24,7 @@
 
 #include "Sound_PointProcess.h"
 
-Sound Sound_PointProcess_to_SoundEnsemble_correlate (Sound me, PointProcess thee, double fromLag, double toLag) {
+autoSound Sound_PointProcess_to_SoundEnsemble_correlate (Sound me, PointProcess thee, double fromLag, double toLag) {
 	try {
 		if (my ny > 1)
 			Melder_throw (U"Sound has to be mono.");
@@ -48,7 +48,7 @@ Sound Sound_PointProcess_to_SoundEnsemble_correlate (Sound me, PointProcess thee
 				his z [ipoint] [isample] = jsample < 1 || jsample > my nx ? 0.0 : my z [1] [jsample];
 			}
 		}
-		return him.transfer();
+		return him;
 	} catch (MelderError) {
 		Melder_throw (me, U" & ", thee, U": Sound ensemble not created.");
 	}
diff --git a/fon/Sound_PointProcess.h b/fon/Sound_PointProcess.h
index f8b4160..66b79bd 100644
--- a/fon/Sound_PointProcess.h
+++ b/fon/Sound_PointProcess.h
@@ -1,6 +1,6 @@
 /* Sound_PointProcess.h
  *
- * Copyright (C) 2010-2011 Paul Boersma
+ * Copyright (C) 2010-2011,2015 Paul Boersma
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -20,6 +20,6 @@
 #include "Sound.h"
 #include "PointProcess.h"
 
-Sound Sound_PointProcess_to_SoundEnsemble_correlate (Sound me, PointProcess thee, double tmin, double tmax);
+autoSound Sound_PointProcess_to_SoundEnsemble_correlate (Sound me, PointProcess thee, double tmin, double tmax);
 
 /* End of file Sound_PointProcess.h */
diff --git a/fon/Sound_and_Spectrogram.cpp b/fon/Sound_and_Spectrogram.cpp
index 5e29eff..ccdfa08 100644
--- a/fon/Sound_and_Spectrogram.cpp
+++ b/fon/Sound_and_Spectrogram.cpp
@@ -41,7 +41,7 @@
 #include "enums_getValue.h"
 #include "Sound_and_Spectrogram_enums.h"
 
-Spectrogram Sound_to_Spectrogram (Sound me, double effectiveAnalysisWidth, double fmax,
+autoSpectrogram Sound_to_Spectrogram (Sound me, double effectiveAnalysisWidth, double fmax,
 	double minimumTimeStep1, double minimumFreqStep1, enum kSound_to_Spectrogram_windowShape windowType,
 	double maximumTimeOversampling, double maximumFreqOversampling)
 {
@@ -176,13 +176,13 @@ Spectrogram Sound_to_Spectrogram (Sound me, double effectiveAnalysisWidth, doubl
 				thy z [iband] [iframe] = power * oneByBinWidth;
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": spectrogram analysis not performed.");
 	}
 }
 
-Sound Spectrogram_to_Sound (Spectrogram me, double fsamp) {
+autoSound Spectrogram_to_Sound (Spectrogram me, double fsamp) {
 	try {
 		double dt = 1 / fsamp;
 		long n = (long) floor ((my xmax - my xmin) / dt);
@@ -201,7 +201,7 @@ Sound Spectrogram_to_Sound (Spectrogram me, double fsamp) {
 			}
 			thy z [1] [i] = value;
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Sound.");
 	}
diff --git a/fon/Sound_and_Spectrogram.h b/fon/Sound_and_Spectrogram.h
index 5b23991..4f3db32 100644
--- a/fon/Sound_and_Spectrogram.h
+++ b/fon/Sound_and_Spectrogram.h
@@ -2,7 +2,7 @@
 #define _Sound_and_Spectrogram_h_
 /* Sound_and_Spectrogram.h
  *
- * Copyright (C) 1992-2011 Paul Boersma
+ * Copyright (C) 1992-2011,2015 Paul Boersma
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -24,11 +24,11 @@
 
 #include "Sound_and_Spectrogram_enums.h"
 
-Spectrogram Sound_to_Spectrogram (Sound me, double effectiveAnalysisWidth, double fmax,
+autoSpectrogram Sound_to_Spectrogram (Sound me, double effectiveAnalysisWidth, double fmax,
 	double minimumTimeStep1, double minimumFreqStep1, enum kSound_to_Spectrogram_windowShape windowShape,
 	double maximumTimeOversampling, double maximumFreqOversampling);
 
-Sound Spectrogram_to_Sound (Spectrogram me, double fsamp);
+autoSound Spectrogram_to_Sound (Spectrogram me, double fsamp);
 
 /* End of Sound_and_Spectrogram.h */
 #endif
diff --git a/fon/Sound_and_Spectrum.cpp b/fon/Sound_and_Spectrum.cpp
index 5467e50..2fb7e4d 100644
--- a/fon/Sound_and_Spectrum.cpp
+++ b/fon/Sound_and_Spectrum.cpp
@@ -34,7 +34,7 @@
 #include "Sound_and_Spectrum.h"
 #include "NUM2.h"
 
-Spectrum Sound_to_Spectrum (Sound me, int fast) {
+autoSpectrum Sound_to_Spectrum (Sound me, int fast) {
 	try {
 		long numberOfSamples = my nx;
 		if (fast) {
@@ -69,13 +69,13 @@ Spectrum Sound_to_Spectrum (Sound me, int fast) {
 			re [numberOfFrequencies] = data [numberOfSamples] * scaling;
 			im [numberOfFrequencies] = 0.0;
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Spectrum.");
 	}
 }
 
-Sound Spectrum_to_Sound (Spectrum me) {
+autoSound Spectrum_to_Sound (Spectrum me) {
 	try {
 		double *re = my z [1], *im = my z [2];
 		double lastFrequency = my x1 + (my nx - 1) * my dx;
@@ -98,13 +98,13 @@ Sound Spectrum_to_Sound (Spectrum me) {
 			amp [2] = re [my nx] * scaling;
 		}
 		NUMrealft (amp, numberOfSamples, -1);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Sound.");
 	}
 }
 
-Spectrum Spectrum_lpcSmoothing (Spectrum me, int numberOfPeaks, double preemphasisFrequency) {
+autoSpectrum Spectrum_lpcSmoothing (Spectrum me, int numberOfPeaks, double preemphasisFrequency) {
 	try {
 		double gain, a [100];
 		long numberOfCoefficients = 2 * numberOfPeaks;
@@ -136,13 +136,13 @@ Spectrum Spectrum_lpcSmoothing (Spectrum me, int numberOfPeaks, double preemphas
 		}
 		re [halfnfft + 1] = scale / data [2] / (1 + thy dx * halfnfft / preemphasisFrequency);
 		im [halfnfft + 1] = 0.0;
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not smoothed.");
 	}
 }
 
-Sound Sound_filter_formula (Sound me, const char32 *formula, Interpreter interpreter) {
+autoSound Sound_filter_formula (Sound me, const char32 *formula, Interpreter interpreter) {
 	try {
 		autoSound thee = Data_copy (me);
 		if (my ny == 1) {
@@ -159,13 +159,13 @@ Sound Sound_filter_formula (Sound me, const char32 *formula, Interpreter interpr
 				NUMvector_copyElements (his z [1], thy z [ichan], 1, thy nx);
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not filtered (with formula).");
 	}
 }
 
-Sound Sound_filter_passHannBand (Sound me, double fmin, double fmax, double smooth) {
+autoSound Sound_filter_passHannBand (Sound me, double fmin, double fmax, double smooth) {
 	try {
 		autoSound thee = Data_copy (me);
 		if (my ny == 1) {
@@ -182,13 +182,13 @@ Sound Sound_filter_passHannBand (Sound me, double fmin, double fmax, double smoo
 				NUMvector_copyElements (his z [1], thy z [ichan], 1, thy nx);
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not filtered (pass Hann band).");
 	}
 }
 
-Sound Sound_filter_stopHannBand (Sound me, double fmin, double fmax, double smooth) {
+autoSound Sound_filter_stopHannBand (Sound me, double fmin, double fmax, double smooth) {
 	try {
 		autoSound thee = Data_copy (me);
 		if (my ny == 1) {
@@ -205,7 +205,7 @@ Sound Sound_filter_stopHannBand (Sound me, double fmin, double fmax, double smoo
 				NUMvector_copyElements (his z [1], thy z [ichan], 1, thy nx);
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not filtered (stop Hann band).");
 	}
diff --git a/fon/Sound_and_Spectrum.h b/fon/Sound_and_Spectrum.h
index 24c966e..ff40214 100644
--- a/fon/Sound_and_Spectrum.h
+++ b/fon/Sound_and_Spectrum.h
@@ -21,15 +21,15 @@
 #include "Spectrum.h"
 #include "Interpreter_decl.h"
 
-Spectrum Sound_to_Spectrum_at (Sound me, double tim, double windowDuration, int windowType);
+autoSpectrum Sound_to_Spectrum_at (Sound me, double tim, double windowDuration, int windowType);
 
-Spectrum Sound_to_Spectrum (Sound me, int fast);
-Sound Spectrum_to_Sound (Spectrum me);
+autoSpectrum Sound_to_Spectrum (Sound me, int fast);
+autoSound Spectrum_to_Sound (Spectrum me);
 
-Spectrum Spectrum_lpcSmoothing (Spectrum me, int numberOfPeaks, double preemphasisFrequency);
+autoSpectrum Spectrum_lpcSmoothing (Spectrum me, int numberOfPeaks, double preemphasisFrequency);
 
-Sound Sound_filter_passHannBand (Sound me, double fmin, double fmax, double smooth);
-Sound Sound_filter_stopHannBand (Sound me, double fmin, double fmax, double smooth);
-Sound Sound_filter_formula (Sound me, const char32 *formula, Interpreter interpreter);
+autoSound Sound_filter_passHannBand (Sound me, double fmin, double fmax, double smooth);
+autoSound Sound_filter_stopHannBand (Sound me, double fmin, double fmax, double smooth);
+autoSound Sound_filter_formula (Sound me, const char32 *formula, Interpreter interpreter);
 
 /* End of file Sound_and_Spectrum.h */
diff --git a/fon/Sound_audio.cpp b/fon/Sound_audio.cpp
index ce4c402..9210687 100644
--- a/fon/Sound_audio.cpp
+++ b/fon/Sound_audio.cpp
@@ -143,7 +143,7 @@ static int portaudioStreamCallback (
 	return paContinue;
 }
 
-Sound Sound_recordFixedTime (int inputSource, double gain, double balance, double sampleRate, double duration) {
+autoSound Sound_recordFixedTime (int inputSource, double gain, double balance, double sampleRate, double duration) {
 	bool inputUsesPortAudio =
 		#if defined (_WIN32)
 			MelderAudio_getInputSoundSystem () == kMelder_inputSoundSystem_MME_VIA_PORTAUDIO;
@@ -480,7 +480,7 @@ for (i = 1; i <= numberOfSamples; i ++) trace (U"Recorded ", buffer [i]);
 
 		/* Hand the resulting sound to the caller. */
 
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		if (inputUsesPortAudio) {
 			if (portaudioStream) Pa_StopStream (portaudioStream);
diff --git a/fon/Sound_enhance.cpp b/fon/Sound_enhance.cpp
index e6185bb..05c5596 100644
--- a/fon/Sound_enhance.cpp
+++ b/fon/Sound_enhance.cpp
@@ -32,7 +32,7 @@
 #include "Pitch_to_PointProcess.h"
 #include "Sound_and_Spectrum.h"
 
-Sound Sound_lengthen_overlapAdd (Sound me, double fmin, double fmax, double factor) {
+autoSound Sound_lengthen_overlapAdd (Sound me, double fmin, double fmax, double factor) {
 	try {
 		if (my ny > 1)
 			Melder_throw (U"Overlap-add works only on mono sounds.");
@@ -44,13 +44,13 @@ Sound Sound_lengthen_overlapAdd (Sound me, double fmin, double fmax, double fact
 		autoDurationTier duration = DurationTier_create (my xmin, my xmax);
 		RealTier_addPoint (duration.peek(), 0.5 * (my xmin + my xmax), factor);
 		autoSound thee = Sound_Point_Pitch_Duration_to_Sound (sound.peek(), pulses.peek(), pitchTier.peek(), duration.peek(), 1.5 / fmin);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not lengthened.");
 	}
 }
 
-Sound Sound_deepenBandModulation (Sound me, double enhancement_dB,
+autoSound Sound_deepenBandModulation (Sound me, double enhancement_dB,
 	double flow, double fhigh, double slowModulation, double fastModulation, double bandSmoothing)
 {
 	try {
@@ -101,7 +101,7 @@ Sound Sound_deepenBandModulation (Sound me, double enhancement_dB,
 					intensityFilter -> z [1] [i] *= factor;
 					intensityFilter -> z [2] [i] *= factor;
 				}
-				intensity.reset (Spectrum_to_Sound (intensityFilter.peek()));
+				intensity = Spectrum_to_Sound (intensityFilter.peek());
 				n = intensity -> nx;
 				amp = intensity -> z [1];
 				for (long i = 1; i <= n; i ++) amp [i] = pow (10, amp [i] / 2);
@@ -124,7 +124,7 @@ Sound Sound_deepenBandModulation (Sound me, double enhancement_dB,
 		thy xmax = my xmax;
 		thy nx = my nx;
 		thy x1 = my x1;
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": band modulation not deepened.");
 	}
diff --git a/fon/Sound_files.cpp b/fon/Sound_files.cpp
index c9fd2d6..ddaf6fb 100644
--- a/fon/Sound_files.cpp
+++ b/fon/Sound_files.cpp
@@ -66,7 +66,7 @@ static void Sound_alawDecode (Sound me) {
 #include <time.h>
 #include "Sound.h"
 
-Sound Sound_readFromSoundFile (MelderFile file) {
+autoSound Sound_readFromSoundFile (MelderFile file) {
 	try {
 		autoMelderFile mfile = MelderFile_open (file);
 		int numberOfChannels, encoding;
@@ -85,13 +85,13 @@ Sound Sound_readFromSoundFile (MelderFile file) {
 			Melder_throw (U"Cannot unshorten. Write to paul.boersma at uva.nl for more information.");
 		Melder_readAudioToFloat (file -> filePointer, numberOfChannels, encoding, my z, numberOfSamples);
 		mfile.close ();
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not read from sound file ", file, U".");
 	}
 }
 
-Sound Sound_readFromSesamFile (MelderFile file) {
+autoSound Sound_readFromSesamFile (MelderFile file) {
 	try {
 		autofile f = Melder_fopen (file, "rb");
 		int32_t header [1 + 128];
@@ -116,13 +116,13 @@ Sound Sound_readFromSesamFile (MelderFile file) {
 			my z [1] [i] = (double) bingeti2LE (f) * (1.0 / 2048);   // 12 bits
 		}
 		f.close (file);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not read from Sesam file ", file, U".");
 	}
 }
 
-Sound Sound_readFromBellLabsFile (MelderFile file) {
+autoSound Sound_readFromBellLabsFile (MelderFile file) {
 	try {
 		/*
 		 * Check existence and permissions of file.
@@ -181,7 +181,7 @@ Sound Sound_readFromBellLabsFile (MelderFile file) {
 			my z [1] [i] = (double) bingeti2 (f) * (1.0 / 32768);   // 16-bits big-endian
 
 		f.close (file);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not read from Bell Labs sound file ", file, U".");
 	}
@@ -191,7 +191,7 @@ static void readError () {
 	Melder_throw (U"Error reading bytes from file.");
 }
 
-Sound Sound_readFromKayFile (MelderFile file) {
+autoSound Sound_readFromKayFile (MelderFile file) {
 	try {
 		autofile f = Melder_fopen (file, "rb");
 
@@ -244,13 +244,13 @@ Sound Sound_readFromKayFile (MelderFile file) {
 			}
 		}
 		f.close (file);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not read from Kay file ", file, U".");
 	}
 }
 
-Sound Sound_readFromRawAlawFile (MelderFile file) {
+autoSound Sound_readFromRawAlawFile (MelderFile file) {
 	try {
 		double sampleRate = 8000.0;
 		autofile f = Melder_fopen (file, "rb");
@@ -260,7 +260,7 @@ Sound Sound_readFromRawAlawFile (MelderFile file) {
 		autoSound me = Sound_createSimple (1, numberOfSamples / sampleRate, sampleRate); 
 		Melder_readAudioToFloat (f, 1, Melder_ALAW, my z, numberOfSamples);
 		f.close (file);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Sound not read from raw A-law file ", file, U".");
 	}
diff --git a/fon/Sound_to_Cochleagram.cpp b/fon/Sound_to_Cochleagram.cpp
index 953e5fe..bde0004 100644
--- a/fon/Sound_to_Cochleagram.cpp
+++ b/fon/Sound_to_Cochleagram.cpp
@@ -33,7 +33,7 @@
 #include "Sound_and_Spectrum.h"
 #include "Spectrum_to_Excitation.h"
 
-Cochleagram Sound_to_Cochleagram (Sound me, double dt, double df, double dt_window, double forwardMaskingTime) {
+autoCochleagram Sound_to_Cochleagram (Sound me, double dt, double df, double dt_window, double forwardMaskingTime) {
 	try {
 		double duration = my nx * my dx;
 		long nFrames = 1 + (long) floor ((duration - dt_window) / dt);
@@ -78,13 +78,13 @@ Cochleagram Sound_to_Cochleagram (Sound me, double dt, double df, double dt_wind
 		for (long iframe = 1; iframe <= nFrames; iframe ++)
 			for (long ifreq = 1; ifreq <= nf; ifreq ++)
 				thy z [ifreq] [iframe] *= integrationCorrection;
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Cochleagram.");
 	}
 }
 
-static Sound createGammatone (double midFrequency_Hertz, double samplingFrequency) {
+static autoSound createGammatone (double midFrequency_Hertz, double samplingFrequency) {
 	double lengthOfGammatone_seconds = 50.0 / midFrequency_Hertz;   // 50 periods
 	long lengthOfGammatone_samples;
 	/* EdB's alfa1: */
@@ -102,10 +102,10 @@ static Sound createGammatone (double midFrequency_Hertz, double samplingFrequenc
 		if (time_seconds > latency) gammatone -> z [1] [itime] =
 			x * x * x * exp (- x) * cos (midFrequency_radPerSecond * timeAfterLatency);
 	}
-	return gammatone.transfer();
+	return gammatone;
 }
 
-Cochleagram Sound_to_Cochleagram_edb
+autoCochleagram Sound_to_Cochleagram_edb
 	(Sound me, double dtime, double dfreq, int hasSynapse, double replenishmentRate,
 	 double lossRate, double returnRate, double reprocessingRate)
 {
@@ -202,7 +202,7 @@ Cochleagram Sound_to_Cochleagram_edb
 				}
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Cochleagram (edb).");
 	}
diff --git a/fon/Sound_to_Cochleagram.h b/fon/Sound_to_Cochleagram.h
index bb5237e..42fe1e8 100644
--- a/fon/Sound_to_Cochleagram.h
+++ b/fon/Sound_to_Cochleagram.h
@@ -1,6 +1,6 @@
 /* Sound_to_Cochleagram.h
  *
- * Copyright (C) 1992-2011 Paul Boersma
+ * Copyright (C) 1992-2011,2015 Paul Boersma
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -20,9 +20,9 @@
 #include "Sound.h"
 #include "Cochleagram.h"
 
-Cochleagram Sound_to_Cochleagram (Sound me, double dt, double df, double windowLength, double forwardMaskingTime);
+autoCochleagram Sound_to_Cochleagram (Sound me, double dt, double df, double windowLength, double forwardMaskingTime);
 
-Cochleagram Sound_to_Cochleagram_edb
+autoCochleagram Sound_to_Cochleagram_edb
 	(Sound me, double dtime, double dfreq, int hasSynapse, double replenishmentRate,
 	 double lossRate, double returnRate, double reprocessingRate);
 
diff --git a/fon/Sound_to_Formant.cpp b/fon/Sound_to_Formant.cpp
index 0bb3b6b..4243e60 100644
--- a/fon/Sound_to_Formant.cpp
+++ b/fon/Sound_to_Formant.cpp
@@ -265,7 +265,7 @@ void Formant_sort (Formant me) {
 	}
 }
 
-static Formant Sound_to_Formant_any_inline (Sound me, double dt_in, int numberOfPoles,
+static autoFormant Sound_to_Formant_any_inline (Sound me, double dt_in, int numberOfPoles,
 	double halfdt_window, int which, double preemphasisFrequency, double safetyMargin)
 {
 	double dt = dt_in > 0.0 ? dt_in : halfdt_window / 4.0;
@@ -337,24 +337,23 @@ static Formant Sound_to_Formant_any_inline (Sound me, double dt_in, int numberOf
 		Melder_progress ((double) iframe / (double) nFrames, U"Formant analysis: frame ", iframe);
 	}
 	Formant_sort (thee.peek());
-	return thee.transfer();
+	return thee;
 }
 
-Formant Sound_to_Formant_any (Sound me, double dt, int numberOfPoles, double maximumFrequency,
+autoFormant Sound_to_Formant_any (Sound me, double dt, int numberOfPoles, double maximumFrequency,
 	double halfdt_window, int which, double preemphasisFrequency, double safetyMargin)
 {
 	double nyquist = 0.5 / my dx;
-	autoSound sound = NULL;
+	autoSound sound;
 	if (maximumFrequency <= 0.0 || fabs (maximumFrequency / nyquist - 1) < 1.0e-12) {
-		sound.reset (Data_copy (me));   // will be modified
+		sound = Data_copy (me);   // will be modified
 	} else {
-		sound.reset (Sound_resample (me, maximumFrequency * 2, 50));
+		sound = Sound_resample (me, maximumFrequency * 2, 50);
 	}
-	autoFormant thee = Sound_to_Formant_any_inline (sound.peek(), dt, numberOfPoles, halfdt_window, which, preemphasisFrequency, safetyMargin);
-	return thee.transfer();
+	return Sound_to_Formant_any_inline (sound.peek(), dt, numberOfPoles, halfdt_window, which, preemphasisFrequency, safetyMargin);
 }
 
-Formant Sound_to_Formant_burg (Sound me, double dt, double nFormants, double maximumFrequency, double halfdt_window, double preemphasisFrequency) {
+autoFormant Sound_to_Formant_burg (Sound me, double dt, double nFormants, double maximumFrequency, double halfdt_window, double preemphasisFrequency) {
 	try {
 		return Sound_to_Formant_any (me, dt, (int) (2 * nFormants), maximumFrequency, halfdt_window, 1, preemphasisFrequency, 50.0);
 	} catch (MelderError) {
@@ -362,7 +361,7 @@ Formant Sound_to_Formant_burg (Sound me, double dt, double nFormants, double max
 	}
 }
 
-Formant Sound_to_Formant_keepAll (Sound me, double dt, double nFormants, double maximumFrequency, double halfdt_window, double preemphasisFrequency) {
+autoFormant Sound_to_Formant_keepAll (Sound me, double dt, double nFormants, double maximumFrequency, double halfdt_window, double preemphasisFrequency) {
 	try {
 		return Sound_to_Formant_any (me, dt, (int) (2 * nFormants), maximumFrequency, halfdt_window, 1, preemphasisFrequency, 0.0);
 	} catch (MelderError) {
@@ -370,7 +369,7 @@ Formant Sound_to_Formant_keepAll (Sound me, double dt, double nFormants, double
 	}
 }
 
-Formant Sound_to_Formant_willems (Sound me, double dt, double nFormants, double maximumFrequency, double halfdt_window, double preemphasisFrequency) {
+autoFormant Sound_to_Formant_willems (Sound me, double dt, double nFormants, double maximumFrequency, double halfdt_window, double preemphasisFrequency) {
 	try {
 		return Sound_to_Formant_any (me, dt, (int) (2 * nFormants), maximumFrequency, halfdt_window, 2, preemphasisFrequency, 50.0);
 	} catch (MelderError) {
diff --git a/fon/Sound_to_Formant.h b/fon/Sound_to_Formant.h
index 66de4c8..c06eeab 100644
--- a/fon/Sound_to_Formant.h
+++ b/fon/Sound_to_Formant.h
@@ -1,6 +1,6 @@
 /* Sound_to_Formant.h
  *
- * Copyright (C) 1992-2011 Paul Boersma
+ * Copyright (C) 1992-2011,2015 Paul Boersma
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -20,22 +20,22 @@
 #include "Sound.h"
 #include "Formant.h"
 
-Formant Sound_to_Formant_any (Sound me, double timeStep, int numberOfPoles, double maximumFrequency,
+autoFormant Sound_to_Formant_any (Sound me, double timeStep, int numberOfPoles, double maximumFrequency,
 	double halfdt_window, int which, double preemphasisFrequency, double safetyMargin);
 /*
 	Which = 1: Burg.
 	Which = 2: Split-Levinson
 */
 
-Formant Sound_to_Formant_burg (Sound me, double timeStep, double maximumNumberOfFormants,
+autoFormant Sound_to_Formant_burg (Sound me, double timeStep, double maximumNumberOfFormants,
 	double maximumFormantFrequency, double windowLength, double preemphasisFrequency);
 /* Throws away all formants below 50 Hz and above Nyquist minus 50 Hz. */
 
-Formant Sound_to_Formant_keepAll (Sound me, double timeStep, double maximumNumberOfFormants,
+autoFormant Sound_to_Formant_keepAll (Sound me, double timeStep, double maximumNumberOfFormants,
 	double maximumFormantFrequency, double windowLength, double preemphasisFrequency);
 /* Same as previous, but keeps all formants. Good for resynthesis. */
 
-Formant Sound_to_Formant_willems (Sound me, double timeStep, double numberOfFormants,
+autoFormant Sound_to_Formant_willems (Sound me, double timeStep, double numberOfFormants,
 	double maximumFormantFrequency, double windowLength, double preemphasisFrequency);
 
 /* End of file Sound_to_Formant.h */
diff --git a/fon/Sound_to_Harmonicity.cpp b/fon/Sound_to_Harmonicity.cpp
index 5fab19b..a7b612b 100644
--- a/fon/Sound_to_Harmonicity.cpp
+++ b/fon/Sound_to_Harmonicity.cpp
@@ -26,7 +26,7 @@
 #include "Sound_to_Pitch.h"
 #include "Sound_to_Harmonicity.h"
 
-Harmonicity Sound_to_Harmonicity_ac (Sound me, double dt, double minimumPitch,
+autoHarmonicity Sound_to_Harmonicity_ac (Sound me, double dt, double minimumPitch,
 	double silenceThreshold, double periodsPerWindow)
 {
 	try {
@@ -42,13 +42,13 @@ Harmonicity Sound_to_Harmonicity_ac (Sound me, double dt, double minimumPitch,
 				thy z [1] [i] = r <= 1e-15 ? -150 : r > 1 - 1e-15 ? 150 : 10 * log10 (r / (1 - r));
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": harmonicity analysis (ac) not performed.");
 	}
 }
 
-Harmonicity Sound_to_Harmonicity_cc (Sound me, double dt, double minimumPitch,
+autoHarmonicity Sound_to_Harmonicity_cc (Sound me, double dt, double minimumPitch,
 	double silenceThreshold, double periodsPerWindow)
 {
 	try {
@@ -64,7 +64,7 @@ Harmonicity Sound_to_Harmonicity_cc (Sound me, double dt, double minimumPitch,
 				thy z [1] [i] = r <= 1e-15 ? -150 : r > 1 - 1e-15 ? 150 : 10 * log10 (r / (1 - r));
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": harmonicity analysis (cc) not performed.");
 	}
diff --git a/fon/Sound_to_Harmonicity.h b/fon/Sound_to_Harmonicity.h
index 5cbf5db..c1a062b 100644
--- a/fon/Sound_to_Harmonicity.h
+++ b/fon/Sound_to_Harmonicity.h
@@ -1,6 +1,6 @@
 /* Sound_to_Harmonicity.h
  *
- * Copyright (C) 1992-2011 Paul Boersma
+ * Copyright (C) 1992-2011,2015 Paul Boersma
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -20,13 +20,13 @@
 #include "Sound.h"
 #include "Harmonicity.h"
 
-Harmonicity Sound_to_Harmonicity_ac (Sound me, double dt, double minimumPitch,
+autoHarmonicity Sound_to_Harmonicity_ac (Sound me, double dt, double minimumPitch,
 	double silenceThreshold, double periodsPerWindow);
 
-Harmonicity Sound_to_Harmonicity_cc (Sound me, double dt, double minimumPitch,
+autoHarmonicity Sound_to_Harmonicity_cc (Sound me, double dt, double minimumPitch,
 	double silenceThreshold, double periodsPerWindow);
 
-Matrix Sound_to_Harmonicity_GNE (Sound me,
+autoMatrix Sound_to_Harmonicity_GNE (Sound me,
 	double fmin,   /* 500 Hz */
 	double fmax,   /* 4500 Hz */
 	double bandwidth,  /* 1000 Hz */
diff --git a/fon/Sound_to_Harmonicity_GNE.cpp b/fon/Sound_to_Harmonicity_GNE.cpp
index 4faac83..ccb53be 100644
--- a/fon/Sound_to_Harmonicity_GNE.cpp
+++ b/fon/Sound_to_Harmonicity_GNE.cpp
@@ -53,7 +53,7 @@ static void bandFilter (Spectrum me, double fmid, double bandwidth) {
 	}
 }
 
-Matrix Sound_to_Harmonicity_GNE (Sound me,
+autoMatrix Sound_to_Harmonicity_GNE (Sound me,
 	double fmin,   /* 500 Hz */
 	double fmax,   /* 4500 Hz */
 	double bandwidth,  /* 1000 Hz */
@@ -118,7 +118,7 @@ Matrix Sound_to_Harmonicity_GNE (Sound me,
 			}*/
 			Melder_monitor (ienvelope / (nenvelopes + 1.0), U"Computing Hilbert envelope ", ienvelope, U"...");
 			autoSound hilbertBand = Spectrum_to_Sound (hilbertBandSpectrum.peek());
-			envelope [ienvelope].reset (Sound_extractPart (band.peek(), 0, duration, kSound_windowShape_RECTANGULAR, 1.0, true));
+			envelope [ienvelope] = Sound_extractPart (band.peek(), 0, duration, kSound_windowShape_RECTANGULAR, 1.0, true);
 			/*
 			 * 3c: Compute the Hilbert envelope of the band-passed flat signal.
 			 */
@@ -161,7 +161,7 @@ Matrix Sound_to_Harmonicity_GNE (Sound me,
 			}
 		}
 
-		return cc.transfer();
+		return cc;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Harmonicity (GNE).");
 	}
diff --git a/fon/Sound_to_Intensity.cpp b/fon/Sound_to_Intensity.cpp
index c9f580f..2e51046 100644
--- a/fon/Sound_to_Intensity.cpp
+++ b/fon/Sound_to_Intensity.cpp
@@ -107,23 +107,20 @@ static autoIntensity Sound_to_Intensity_ (Sound me, double minimumPitch, double
 	}
 }
 
-Intensity Sound_to_Intensity (Sound me, double minimumPitch, double timeStep, int subtractMeanPressure) {
+autoIntensity Sound_to_Intensity (Sound me, double minimumPitch, double timeStep, int subtractMeanPressure) {
 	bool veryAccurate = false;
 	if (veryAccurate) {
 		autoSound up = Sound_upsample (me);   // because squaring doubles the frequency content, i.e. you get super-Nyquist components
-		autoIntensity thee = Sound_to_Intensity_ (up.peek(), minimumPitch, timeStep, subtractMeanPressure);
-		return thee.transfer();
+		return Sound_to_Intensity_ (up.peek(), minimumPitch, timeStep, subtractMeanPressure);
 	} else {
-		autoIntensity thee = Sound_to_Intensity_ (me, minimumPitch, timeStep, subtractMeanPressure);
-		return thee.transfer();
+		return Sound_to_Intensity_ (me, minimumPitch, timeStep, subtractMeanPressure);
 	}
 }
 
 autoIntensityTier Sound_to_IntensityTier (Sound me, double minimumPitch, double timeStep, int subtractMean) {
 	try {
 		autoIntensity intensity = Sound_to_Intensity (me, minimumPitch, timeStep, subtractMean);
-		autoIntensityTier thee = Intensity_downto_IntensityTier (intensity.peek());
-		return thee;
+		return Intensity_downto_IntensityTier (intensity.peek());
 	} catch (MelderError) {
 		Melder_throw (me, U": no IntensityTier created.");
 	}
diff --git a/fon/Sound_to_Intensity.h b/fon/Sound_to_Intensity.h
index 5d84a9b..b386819 100644
--- a/fon/Sound_to_Intensity.h
+++ b/fon/Sound_to_Intensity.h
@@ -21,7 +21,7 @@
 #include "Intensity.h"
 #include "IntensityTier.h"
 
-Intensity Sound_to_Intensity (Sound me, double minimumPitch, double timeStep, int subtractMean);
+autoIntensity Sound_to_Intensity (Sound me, double minimumPitch, double timeStep, int subtractMean);
 /*
 	Function:
 		smooth away the periodic part of a signal,
diff --git a/fon/Sound_to_Pitch.h b/fon/Sound_to_Pitch.h
index cb332e9..1e8645d 100644
--- a/fon/Sound_to_Pitch.h
+++ b/fon/Sound_to_Pitch.h
@@ -1,6 +1,6 @@
 /* Sound_to_Pitch.h
  *
- * Copyright (C) 1992-2011 Paul Boersma
+ * Copyright (C) 1992-2011,2015 Paul Boersma
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/fon/Spectrogram.cpp b/fon/Spectrogram.cpp
index 3d16b99..913c810 100644
--- a/fon/Spectrogram.cpp
+++ b/fon/Spectrogram.cpp
@@ -41,13 +41,13 @@ void structSpectrogram :: v_info () {
 	MelderInfo_writeLine (U"   First frequency band around (bin centre at): ", y1, U" Hz");
 }
 
-Spectrogram Spectrogram_create (double tmin, double tmax, long nt, double dt, double t1,
+autoSpectrogram Spectrogram_create (double tmin, double tmax, long nt, double dt, double t1,
 	double fmin, double fmax, long nf, double df, double f1)
 {
 	try {
 		autoSpectrogram me = Thing_new (Spectrogram);
 		Matrix_init (me.peek(), tmin, tmax, nt, dt, t1, fmin, fmax, nf, df, f1);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Spectrogram not created.");
 	}
@@ -120,21 +120,21 @@ void Spectrogram_paint (Spectrogram me, Graphics g,
 	}
 }
 
-Spectrogram Matrix_to_Spectrogram (Matrix me) {
+autoSpectrogram Matrix_to_Spectrogram (Matrix me) {
 	try {
 		autoSpectrogram thee = Spectrogram_create (my xmin, my xmax, my nx, my dx, my x1, my ymin, my ymax, my ny, my dy, my y1);
 		NUMmatrix_copyElements (my z, thy z, 1, my ny, 1, my nx);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Spectrogram.");
 	}
 }
 
-Matrix Spectrogram_to_Matrix (Spectrogram me) {
+autoMatrix Spectrogram_to_Matrix (Spectrogram me) {
 	try {
 		autoMatrix thee = Matrix_create (my xmin, my xmax, my nx, my dx, my x1, my ymin, my ymax, my ny, my dy, my y1);
 		NUMmatrix_copyElements (my z, thy z, 1, my ny, 1, my nx);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Matrix.");
 	}
diff --git a/fon/Spectrogram.h b/fon/Spectrogram.h
index 13b4c2c..7dcbbe2 100644
--- a/fon/Spectrogram.h
+++ b/fon/Spectrogram.h
@@ -42,7 +42,7 @@ Thing_define (Spectrogram, Matrix) {
 	z [iy] [ix]		// Power spectrum density.
 */
 
-Spectrogram Spectrogram_create (double tmin, double tmax, long nt, double dt, double t1,
+autoSpectrogram Spectrogram_create (double tmin, double tmax, long nt, double dt, double t1,
 					double fmin, double fmax, long nf, double df, double f1);
 /*
 	Function:
@@ -83,13 +83,13 @@ void Spectrogram_paint (Spectrogram me, Graphics g,
 			a boolean that determines if a box, ticks, numbers, and text are written in the margins.
 */
 
-Spectrogram Matrix_to_Spectrogram (Matrix me);
+autoSpectrogram Matrix_to_Spectrogram (Matrix me);
 /*
 	Create a Spectrogram from a Matrix,
 	with deep copy of all its attributes, except class information and methods.
 */
 
-Matrix Spectrogram_to_Matrix (Spectrogram me);
+autoMatrix Spectrogram_to_Matrix (Spectrogram me);
 /*
 	Create a Matrix from a Spectrogram,
 	with deep copy of all its attributes, except class information and methods.
diff --git a/fon/Spectrum.cpp b/fon/Spectrum.cpp
index 5ae8bc1..6c70979 100644
--- a/fon/Spectrum.cpp
+++ b/fon/Spectrum.cpp
@@ -86,11 +86,11 @@ double structSpectrum :: v_getValueAtSample (long isamp, long which, int units)
 	return NUMundefined;
 }
 
-Spectrum Spectrum_create (double fmax, long nf) {
+autoSpectrum Spectrum_create (double fmax, long nf) {
 	try {
 		autoSpectrum me = Thing_new (Spectrum);
 		Matrix_init (me.peek(), 0.0, fmax, nf, fmax / (nf - 1), 0.0, 1.0, 2.0, 2, 1.0, 1.0);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Spectrum not created.");
 	}
@@ -196,7 +196,7 @@ if(ifmin==1)ifmin=2;  /* BUG */
 	}
 }
 
-Table Spectrum_downto_Table (Spectrum me, bool includeBinNumbers, bool includeFrequency,
+autoTable Spectrum_downto_Table (Spectrum me, bool includeBinNumbers, bool includeFrequency,
 	bool includeRealPart, bool includeImaginaryPart, bool includeEnergyDensity, bool includePowerDensity)
 {
 	try {
@@ -218,7 +218,7 @@ Table Spectrum_downto_Table (Spectrum me, bool includeBinNumbers, bool includeFr
 			if (includeEnergyDensity) Table_setNumericValue (thee.peek(), ibin, ++ icol, Sampled_getValueAtSample (me, ibin, 0, 1));
 			if (includePowerDensity) Table_setNumericValue (thee.peek(), ibin, ++ icol, Sampled_getValueAtSample (me, ibin, 0, 2));
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Table.");
 	}
@@ -236,29 +236,29 @@ void Spectrum_list (Spectrum me, bool includeBinNumbers, bool includeFrequency,
 	}
 }
 
-Spectrum Matrix_to_Spectrum (Matrix me) {
+autoSpectrum Matrix_to_Spectrum (Matrix me) {
 	try {
 		if (my ny != 2)
 			Melder_throw (U"Matrix must have exactly 2 rows.");
 		autoSpectrum thee = Thing_new (Spectrum);
 		my structMatrix :: v_copy (thee.peek());
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Spectrum.");
 	}
 }
 
-Matrix Spectrum_to_Matrix (Spectrum me) {
+autoMatrix Spectrum_to_Matrix (Spectrum me) {
 	try {
 		autoMatrix thee = Thing_new (Matrix);
 		my structMatrix :: v_copy (thee.peek());
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Matrix.");
 	}
 }
 
-Spectrum Spectrum_cepstralSmoothing (Spectrum me, double bandWidth) {
+autoSpectrum Spectrum_cepstralSmoothing (Spectrum me, double bandWidth) {
 	try {
 		/*
 		 * dB-spectrum is log (power).
@@ -297,7 +297,7 @@ Spectrum Spectrum_cepstralSmoothing (Spectrum me, double bandWidth) {
 			re [i] = exp (0.5 * re [i]);   // i.e., sqrt (exp (re [i]))
 			im [i] = 0.0;
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": cepstral smoothing not computed.");
 	}
diff --git a/fon/Spectrum.h b/fon/Spectrum.h
index b542391..9398ce5 100644
--- a/fon/Spectrum.h
+++ b/fon/Spectrum.h
@@ -2,7 +2,7 @@
 #define _Spectrum_h_
 /* Spectrum.h
  *
- * Copyright (C) 1992-2011 Paul Boersma
+ * Copyright (C) 1992-2011,2015 Paul Boersma
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -40,7 +40,7 @@ oo_CLASS_CREATE (Spectrum, Matrix);
 	dy = 1; y1 = 1  // y is row number
 */
 
-Spectrum Spectrum_create (double fmax, long nf);
+autoSpectrum Spectrum_create (double fmax, long nf);
 /* Preconditions:
 		fmax > 0.0;
 		nf >= 2;
@@ -89,16 +89,16 @@ void Spectrum_draw (Spectrum me, Graphics g, double fmin, double fmax, double mi
 */
 void Spectrum_drawLogFreq (Spectrum me, Graphics g, double fmin, double fmax, double minimum, double maximum, int garnish);
 
-Table Spectrum_downto_Table (Spectrum me, bool includeBinNumbers, bool includeFrequency,
+autoTable Spectrum_downto_Table (Spectrum me, bool includeBinNumbers, bool includeFrequency,
 	bool includeRealPart, bool includeImaginaryPart, bool includeEnergyDensity, bool includePowerDensity);
 void Spectrum_list (Spectrum me, bool includeBinNumbers, bool includeFrequency,
 	bool includeRealPart, bool includeImaginaryPart, bool includeEnergyDensity, bool includePowerDensity);
 
-Spectrum Matrix_to_Spectrum (Matrix me);
+autoSpectrum Matrix_to_Spectrum (Matrix me);
 
-Matrix Spectrum_to_Matrix (Spectrum me);
+autoMatrix Spectrum_to_Matrix (Spectrum me);
 
-Spectrum Spectrum_cepstralSmoothing (Spectrum me, double bandWidth);
+autoSpectrum Spectrum_cepstralSmoothing (Spectrum me, double bandWidth);
 
 void Spectrum_passHannBand (Spectrum me, double fmin, double fmax, double smooth);
 void Spectrum_stopHannBand (Spectrum me, double fmin, double fmax, double smooth);
diff --git a/fon/SpectrumTier.cpp b/fon/SpectrumTier.cpp
index ba1c42d..b254e67 100644
--- a/fon/SpectrumTier.cpp
+++ b/fon/SpectrumTier.cpp
@@ -32,11 +32,11 @@ void structSpectrumTier :: v_info () {
 	MelderInfo_writeLine (U"Maximum power value: ", RealTier_getMaximumValue (this), U" dB/Hz");
 }
 
-SpectrumTier SpectrumTier_create (double fmin, double fmax) {
+autoSpectrumTier SpectrumTier_create (double fmin, double fmax) {
 	try {
 		autoSpectrumTier me = Thing_new (SpectrumTier);
 		RealTier_init (me.peek(), fmin, fmax);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"SpectrumTier not created.");
 	}
@@ -57,18 +57,18 @@ void SpectrumTier_list (SpectrumTier me, bool includeIndexes, bool includeFreque
 	}
 }
 
-Table SpectrumTier_downto_Table (SpectrumTier me, bool includeIndexes, bool includeFrequency, bool includePowerDensity) {
+autoTable SpectrumTier_downto_Table (SpectrumTier me, bool includeIndexes, bool includeFrequency, bool includePowerDensity) {
 	return RealTier_downto_Table (me,
 		includeIndexes ? U"index" : NULL,
 		includeFrequency ? U"freq(Hz)" : NULL,
 		includePowerDensity ? U"pow(dB/Hz)" : NULL);
 }
 
-SpectrumTier Spectrum_to_SpectrumTier_peaks (Spectrum me) {
+autoSpectrumTier Spectrum_to_SpectrumTier_peaks (Spectrum me) {
 	try {
 		autoLtas ltas = Spectrum_to_Ltas_1to1 (me);
 		autoSpectrumTier thee = Ltas_to_SpectrumTier_peaks (ltas.peek());
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": peaks not converted to SpectrumTier.");
 	}
diff --git a/fon/SpectrumTier.h b/fon/SpectrumTier.h
index c47294e..98fa62a 100644
--- a/fon/SpectrumTier.h
+++ b/fon/SpectrumTier.h
@@ -34,7 +34,7 @@ Thing_define (SpectrumTier, RealTier) {
 		override { return U"Frequency (Hz)"; }
 };
 
-SpectrumTier SpectrumTier_create (double fmin, double fmax);
+autoSpectrumTier SpectrumTier_create (double fmin, double fmax);
 /*
 	Postconditions:
 		result -> xmin == fmin;
@@ -47,9 +47,9 @@ void SpectrumTier_draw (SpectrumTier me, Graphics g, double fmin, double fmax,
 
 void SpectrumTier_list (SpectrumTier me, bool includeIndexes, bool includeFrequency, bool includePowerDensity);
 
-Table SpectrumTier_downto_Table (SpectrumTier me, bool includeIndexes, bool includeFrequency, bool includePowerDensity);
+autoTable SpectrumTier_downto_Table (SpectrumTier me, bool includeIndexes, bool includeFrequency, bool includePowerDensity);
 
-SpectrumTier Spectrum_to_SpectrumTier_peaks (Spectrum me);
+autoSpectrumTier Spectrum_to_SpectrumTier_peaks (Spectrum me);
 
 /* End of file SpectrumTier.h */
 #endif
diff --git a/fon/Spectrum_and_Spectrogram.cpp b/fon/Spectrum_and_Spectrogram.cpp
index 1a8fb6d..266aec8 100644
--- a/fon/Spectrum_and_Spectrogram.cpp
+++ b/fon/Spectrum_and_Spectrogram.cpp
@@ -25,8 +25,7 @@
 
 #include "Spectrum_and_Spectrogram.h"
 
-Spectrum Spectrogram_to_Spectrum (I, double tim) {
-	iam (Spectrogram);
+autoSpectrum Spectrogram_to_Spectrum (Spectrogram me, double tim) {
 	try {
 		autoSpectrum thee = Spectrum_create (my ymax, my ny);
 		/* Override stupid Spectrum values. */
@@ -44,19 +43,18 @@ Spectrum Spectrogram_to_Spectrum (I, double tim) {
 			thy z [1] [ifreq] = sqrt (value);
 			thy z [2] [ifreq] = 0.0;
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": spectral slice not extracted.");
 	}
 }
 
-Spectrogram Spectrum_to_Spectrogram (I) {
-	iam (Spectrum);
+autoSpectrogram Spectrum_to_Spectrogram (Spectrum me) {
 	try {
 		autoSpectrogram thee = Spectrogram_create (0, 1, 1, 1, 0.5, my xmin, my xmax, my nx, my dx, my x1);
 		for (long i = 1; i <= my nx; i ++)
 			thy z [i] [1] = my z [1] [i] * my z [1] [i] + my z [2] [i] * my z [2] [i];
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Spectrogram.");
 	}
diff --git a/fon/Spectrum_and_Spectrogram.h b/fon/Spectrum_and_Spectrogram.h
index 25bfae8..e21b5d1 100644
--- a/fon/Spectrum_and_Spectrogram.h
+++ b/fon/Spectrum_and_Spectrogram.h
@@ -1,6 +1,6 @@
 /* Spectrum_and_Spectrogram.h
  *
- * Copyright (C) 1992-2011 David Weenink & Paul Boersma
+ * Copyright (C) 1992-2011,2015 David Weenink & Paul Boersma
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
 #include "Spectrum.h"
 #include "Spectrogram.h"
 
-Spectrum Spectrogram_to_Spectrum (I, double time);
+autoSpectrum Spectrogram_to_Spectrum (Spectrogram me, double time);
 /*
 	Function:
 		Create a time slice from the Spectrogram at the time nearest to 'time'.
@@ -37,7 +37,7 @@ Spectrum Spectrogram_to_Spectrum (I, double time);
 		}
 */
  
-Spectrogram Spectrum_to_Spectrogram (I);
+autoSpectrogram Spectrum_to_Spectrogram (Spectrum me);
 /*
 	Function:
 		Create a Spectrogram with one time slice from the Spectrum.
diff --git a/fon/Spectrum_to_Excitation.cpp b/fon/Spectrum_to_Excitation.cpp
index 2b0ffbb..d6c1ee6 100644
--- a/fon/Spectrum_to_Excitation.cpp
+++ b/fon/Spectrum_to_Excitation.cpp
@@ -25,7 +25,7 @@
 
 #include "Spectrum_to_Excitation.h"
 
-Excitation Spectrum_to_Excitation (Spectrum me, double dbark) {
+autoExcitation Spectrum_to_Excitation (Spectrum me, double dbark) {
 	try {
 		long nbark = (int) floor (25.6 / dbark + 0.5);
 		double *re = my z [1], *im = my z [2]; 
@@ -68,7 +68,7 @@ Excitation Spectrum_to_Excitation (Spectrum me, double dbark) {
 		for (long i = 1; i <= nbark; i ++)
 			thy z [1] [i] = Excitation_soundPressureToPhon (sqrt (outSig [i + nbark/2]), Sampled_indexToX (thee.peek(), i));
 
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Excitation.");
 	}
diff --git a/fon/Spectrum_to_Excitation.h b/fon/Spectrum_to_Excitation.h
index 6b1b182..fe6cec6 100644
--- a/fon/Spectrum_to_Excitation.h
+++ b/fon/Spectrum_to_Excitation.h
@@ -1,6 +1,6 @@
 /* Spectrum_to_Excitation.h
  *
- * Copyright (C) 1992-2011,2014 Paul Boersma
+ * Copyright (C) 1992-2011,2014,2015 Paul Boersma
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
 #include "Spectrum.h"
 #include "Excitation.h"
 
-Excitation Spectrum_to_Excitation (Spectrum me, double df);
+autoExcitation Spectrum_to_Excitation (Spectrum me, double df);
 /*
 	Postcondition:
 		filtered with 10 ^ (1.581 + 0.75 * bark - 1.75 * sqrt (1 + bark * bark)))
diff --git a/fon/Spectrum_to_Formant.cpp b/fon/Spectrum_to_Formant.cpp
index 19dbd9e..9a98f07 100644
--- a/fon/Spectrum_to_Formant.cpp
+++ b/fon/Spectrum_to_Formant.cpp
@@ -25,7 +25,7 @@
 
 #include "Spectrum_to_Formant.h"
 
-Formant Spectrum_to_Formant (Spectrum me, int maxnFormants) {
+autoFormant Spectrum_to_Formant (Spectrum me, int maxnFormants) {
 	try {
 		long nfreq = my nx, nform = 0;
 		autoNUMvector <double> p (1, nfreq);   // power
@@ -54,7 +54,7 @@ Formant Spectrum_to_Formant (Spectrum me, int maxnFormants) {
 				if (nform == maxnFormants) break;
 			}
 		thy d_frames [1]. nFormants = nform;
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Formant.");
 	}
diff --git a/fon/Spectrum_to_Formant.h b/fon/Spectrum_to_Formant.h
index 27fd747..da33c40 100644
--- a/fon/Spectrum_to_Formant.h
+++ b/fon/Spectrum_to_Formant.h
@@ -1,6 +1,6 @@
 /* Spectrum_to_Formant.h
  *
- * Copyright (C) 1992-2011 Paul Boersma
+ * Copyright (C) 1992-2011,2015 Paul Boersma
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -20,6 +20,6 @@
 #include "Spectrum.h"
 #include "Formant.h"
 
-Formant Spectrum_to_Formant (Spectrum me, int maxnFormants);
+autoFormant Spectrum_to_Formant (Spectrum me, int maxnFormants);
 
 /* End of file Spectrum_to_Formant.h */
diff --git a/fon/SpellingChecker.cpp b/fon/SpellingChecker.cpp
index edfa714..a9e1e19 100644
--- a/fon/SpellingChecker.cpp
+++ b/fon/SpellingChecker.cpp
@@ -52,18 +52,18 @@
 
 Thing_implement (SpellingChecker, Daata, 0);
 
-SpellingChecker WordList_upto_SpellingChecker (WordList me) {
+autoSpellingChecker WordList_upto_SpellingChecker (WordList me) {
 	try {
 		autoSpellingChecker thee = Thing_new (SpellingChecker);
 		thy wordList = Data_copy (me);
 		thy separatingCharacters = Melder_dup (U".,;:()\"");
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to SpellingChecker.");
 	}
 }
 
-WordList SpellingChecker_extractWordList (SpellingChecker me) {
+autoWordList SpellingChecker_extractWordList (SpellingChecker me) {
 	return Data_copy (my wordList);
 }
 
@@ -83,7 +83,7 @@ void SpellingChecker_replaceWordList (SpellingChecker me, WordList list) {
 	}
 }
 
-SortedSetOfString SpellingChecker_extractUserDictionary (SpellingChecker me) {
+autoSortedSetOfString SpellingChecker_extractUserDictionary (SpellingChecker me) {
 	try {
 		if (! my userDictionary)
 			Melder_throw (U"This spelling checker does not contain a user dictionary.");
diff --git a/fon/SpellingChecker.h b/fon/SpellingChecker.h
index ac7fbe6..2e4c7f0 100644
--- a/fon/SpellingChecker.h
+++ b/fon/SpellingChecker.h
@@ -25,10 +25,10 @@
 #include "SpellingChecker_def.h"
 oo_CLASS_CREATE (SpellingChecker, Daata);
 
-SpellingChecker WordList_upto_SpellingChecker (WordList me);
-WordList SpellingChecker_extractWordList (SpellingChecker me);
+autoSpellingChecker WordList_upto_SpellingChecker (WordList me);
+autoWordList SpellingChecker_extractWordList (SpellingChecker me);
 void SpellingChecker_replaceWordList (SpellingChecker me, WordList list);
-SortedSetOfString SpellingChecker_extractUserDictionary (SpellingChecker me);
+autoSortedSetOfString SpellingChecker_extractUserDictionary (SpellingChecker me);
 void SpellingChecker_replaceUserDictionary (SpellingChecker me, SortedSetOfString userDictionary);
 
 bool SpellingChecker_isWordAllowed (SpellingChecker me, const char32 *word);
diff --git a/fon/TextGrid.cpp b/fon/TextGrid.cpp
index 74c0753..ba3f14b 100644
--- a/fon/TextGrid.cpp
+++ b/fon/TextGrid.cpp
@@ -43,12 +43,12 @@
 
 Thing_implement (TextPoint, AnyPoint, 0);
 
-TextPoint TextPoint_create (double time, const char32 *mark) {
+autoTextPoint TextPoint_create (double time, const char32 *mark) {
 	try {
 		autoTextPoint me = Thing_new (TextPoint);
 		my number = time;
 		my mark = Melder_dup (mark);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Text point not created.");
 	}
@@ -74,13 +74,13 @@ void TextPoint_setText (TextPoint me, const char32 *text) {
 
 Thing_implement (TextInterval, Function, 0);
 
-TextInterval TextInterval_create (double tmin, double tmax, const char32 *text) {
+autoTextInterval TextInterval_create (double tmin, double tmax, const char32 *text) {
 	try {
 		autoTextInterval me = Thing_new (TextInterval);
 		my xmin = tmin;
 		my xmax = tmax;
 		my text = Melder_dup (text);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Text interval not created.");
 	}
@@ -124,13 +124,13 @@ void structTextTier :: v_scaleX (double xminfrom, double xmaxfrom, double xminto
 	}
 }
 
-TextTier TextTier_create (double tmin, double tmax) {
+autoTextTier TextTier_create (double tmin, double tmax) {
 	try {
 		autoTextTier me = Thing_new (TextTier);
 		my points = SortedSetOfDouble_create ();
 		my xmin = tmin;
 		my xmax = tmax;
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Point tier not created.");
 	}
@@ -138,7 +138,8 @@ TextTier TextTier_create (double tmin, double tmax) {
 
 void TextTier_addPoint (TextTier me, double time, const char32 *mark) {
 	try {
-		Collection_addItem (my points, TextPoint_create (time, mark));
+		autoTextPoint point = TextPoint_create (time, mark);
+		Collection_addItem (my points, point.transfer());
 	} catch (MelderError) {
 		Melder_throw (U"Point tier: point not added.");
 	}
@@ -162,13 +163,13 @@ void structIntervalTier :: v_scaleX (double xminfrom, double xmaxfrom, double xm
 	}
 }
 
-IntervalTier IntervalTier_create (double tmin, double tmax) {
+autoIntervalTier IntervalTier_create (double tmin, double tmax) {
 	try {
 		autoIntervalTier me = Thing_new (IntervalTier);
 		my intervals = SortedSetOfDouble_create ();
 		my xmin = tmin;
 		my xmax = tmax;
-		autoTextInterval interval = TextInterval_create (tmin, tmax, NULL);
+		autoTextInterval interval = TextInterval_create (tmin, tmax, nullptr);
 		Collection_addItem (my intervals, interval.transfer());
 		return me.transfer();
 	} catch (MelderError) {
@@ -335,19 +336,19 @@ void structTextGrid :: v_scaleX (double xminfrom, double xmaxfrom, double xminto
 
 Thing_implement (TextGrid, Function, 0);
 
-TextGrid TextGrid_createWithoutTiers (double tmin, double tmax) {
+autoTextGrid TextGrid_createWithoutTiers (double tmin, double tmax) {
 	try {
 		autoTextGrid me = Thing_new (TextGrid);
 		my tiers = Ordered_create ();
 		my xmin = tmin;
 		my xmax = tmax;
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"TextGrid not created.");
 	}
 }
 
-TextGrid TextGrid_create (double tmin, double tmax, const char32 *tierNames, const char32 *pointTiers) {
+autoTextGrid TextGrid_create (double tmin, double tmax, const char32 *tierNames, const char32 *pointTiers) {
 	try {
 		autoTextGrid me = TextGrid_createWithoutTiers (tmin, tmax);
 		char32 nameBuffer [400];
@@ -382,13 +383,13 @@ TextGrid TextGrid_create (double tmin, double tmax, const char32 *tierNames, con
 		}
 		if (my numberOfTiers() == 0)
 			Melder_throw (U"Cannot create a TextGrid without tiers. Supply at least one tier name.");
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"TextGrid not created.");
 	}
 }
 
-TextTier TextTier_readFromXwaves (MelderFile file) {
+autoTextTier TextTier_readFromXwaves (MelderFile file) {
 	try {
 		char *line;
 
@@ -429,7 +430,7 @@ TextTier TextTier_readFromXwaves (MelderFile file) {
 			my xmax = point -> number + 1.0;
 		}
 		mfile.close ();
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"TextTier not read from Xwaves file.");
 	}
@@ -525,7 +526,7 @@ void TextGrid_addTier_copy (TextGrid me, Function anyTier) {
 	}
 }
 
-TextGrid TextGrid_merge (Collection textGrids) {
+autoTextGrid TextGrid_merge (Collection textGrids) {
 	try {
 		if (textGrids -> size < 1)
 			Melder_throw (U"Cannot merge zero TextGrid objects.");
@@ -536,13 +537,13 @@ TextGrid TextGrid_merge (Collection textGrids) {
 				TextGrid_addTier_copy (thee.peek(), textGrid -> tier (itier));
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (U"TextGrids not merged.");
 	}
 }
 
-TextGrid TextGrid_extractPart (TextGrid me, double tmin, double tmax, int preserveTimes) {
+autoTextGrid TextGrid_extractPart (TextGrid me, double tmin, double tmax, int preserveTimes) {
 	try {
 		autoTextGrid thee = Data_copy (me);
 		if (tmax <= tmin) return thee.transfer();
@@ -575,13 +576,13 @@ TextGrid TextGrid_extractPart (TextGrid me, double tmin, double tmax, int preser
 		thy xmin = tmin;
 		thy xmax = tmax;
 		if (! preserveTimes) Function_shiftXTo (thee.peek(), thy xmin, 0.0);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": part not extracted.");
 	}
 }
 
-static TextGrid _Label_to_TextGrid (Label me, double tmin, double tmax) {
+static autoTextGrid _Label_to_TextGrid (Label me, double tmin, double tmax) {
 	autoTextGrid thee = TextGrid_createWithoutTiers (tmin, tmax);
 	for (long itier = 1; itier <= my size; itier ++) {
 		Tier tier = (Tier) my item [itier];
@@ -597,10 +598,10 @@ static TextGrid _Label_to_TextGrid (Label me, double tmin, double tmax) {
 			Collection_addItem (intervalTier -> intervals, textInterval.transfer());
 		}
 	}
-	return thee.transfer();
+	return thee;
 }
 
-TextGrid Label_to_TextGrid (Label me, double duration) {
+autoTextGrid Label_to_TextGrid (Label me, double duration) {
 	try {
 		double tmin = 0.0, tmax = duration;
 		if (duration == 0.0) Label_suggestDomain (me, & tmin, & tmax);
@@ -611,7 +612,7 @@ TextGrid Label_to_TextGrid (Label me, double duration) {
 	}
 }
 
-TextGrid Label_Function_to_TextGrid (Label me, Any function) {
+autoTextGrid Label_Function_to_TextGrid (Label me, Any function) {
 	try {
 		return _Label_to_TextGrid (me, ((Function) function) -> xmin, ((Function) function) -> xmax);
 	} catch (MelderError) {
@@ -619,19 +620,19 @@ TextGrid Label_Function_to_TextGrid (Label me, Any function) {
 	}
 }
 
-TextTier PointProcess_upto_TextTier (PointProcess me, const char32 *text) {
+autoTextTier PointProcess_upto_TextTier (PointProcess me, const char32 *text) {
 	try {
 		autoTextTier thee = TextTier_create (my xmin, my xmax);
 		for (long i = 1; i <= my nt; i ++) {
 			TextTier_addPoint (thee.peek(), my t [i], text);
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to TextTier.");
 	}
 }
 
-PointProcess TextTier_getPoints (TextTier me, const char32 *text) {
+autoPointProcess TextTier_getPoints (TextTier me, const char32 *text) {
 	try {
 		autoPointProcess thee = PointProcess_create (my xmin, my xmax, 10);
 		for (long i = 1; i <= my numberOfPoints(); i ++) {
@@ -644,13 +645,13 @@ PointProcess TextTier_getPoints (TextTier me, const char32 *text) {
 					PointProcess_addPoint (thee.peek(), point -> number);
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": points not converted to PointProcess.");
 	}
 }
 
-PointProcess IntervalTier_getStartingPoints (IntervalTier me, const char32 *text) {
+autoPointProcess IntervalTier_getStartingPoints (IntervalTier me, const char32 *text) {
 	try {
 		autoPointProcess thee = PointProcess_create (my xmin, my xmax, 10);
 		for (long i = 1; i <= my numberOfIntervals(); i ++) {
@@ -663,13 +664,13 @@ PointProcess IntervalTier_getStartingPoints (IntervalTier me, const char32 *text
 					PointProcess_addPoint (thee.peek(), interval -> xmin);
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": starting points not gotten.");
 	}
 }
 
-PointProcess IntervalTier_getEndPoints (IntervalTier me, const char32 *text) {
+autoPointProcess IntervalTier_getEndPoints (IntervalTier me, const char32 *text) {
 	try {
 		autoPointProcess thee = PointProcess_create (my xmin, my xmax, 10);
 		for (long i = 1; i <= my numberOfIntervals(); i ++) {
@@ -682,13 +683,13 @@ PointProcess IntervalTier_getEndPoints (IntervalTier me, const char32 *text) {
 					PointProcess_addPoint (thee.peek(), interval -> xmax);
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": end points not gotten.");
 	}
 }
 
-PointProcess IntervalTier_getCentrePoints (IntervalTier me, const char32 *text) {
+autoPointProcess IntervalTier_getCentrePoints (IntervalTier me, const char32 *text) {
 	try {
 		autoPointProcess thee = PointProcess_create (my xmin, my xmax, 10);
 		for (long i = 1; i <= my numberOfIntervals(); i ++) {
@@ -701,13 +702,13 @@ PointProcess IntervalTier_getCentrePoints (IntervalTier me, const char32 *text)
 					PointProcess_addPoint (thee.peek(), 0.5 * (interval -> xmin + interval -> xmax));
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": centre points not gotten.");
 	}
 }
 
-PointProcess TextGrid_getStartingPoints (TextGrid me, long tierNumber, int which_Melder_STRING, const char32 *criterion) {
+autoPointProcess TextGrid_getStartingPoints (TextGrid me, long tierNumber, int which_Melder_STRING, const char32 *criterion) {
 	try {
 		IntervalTier tier = TextGrid_checkSpecifiedTierIsIntervalTier (me, tierNumber);
 		autoPointProcess thee = PointProcess_create (my xmin, my xmax, 10);
@@ -717,13 +718,13 @@ PointProcess TextGrid_getStartingPoints (TextGrid me, long tierNumber, int which
 				PointProcess_addPoint (thee.peek(), interval -> xmin);
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": starting points not converted to PointProcess.");
 	}
 }
 
-PointProcess TextGrid_getEndPoints (TextGrid me, long tierNumber, int which_Melder_STRING, const char32 *criterion) {
+autoPointProcess TextGrid_getEndPoints (TextGrid me, long tierNumber, int which_Melder_STRING, const char32 *criterion) {
 	try {
 		IntervalTier tier = TextGrid_checkSpecifiedTierIsIntervalTier (me, tierNumber);
 		autoPointProcess thee = PointProcess_create (my xmin, my xmax, 10);
@@ -733,13 +734,13 @@ PointProcess TextGrid_getEndPoints (TextGrid me, long tierNumber, int which_Meld
 				PointProcess_addPoint (thee.peek(), interval -> xmax);
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": end points not converted to PointProcess.");
 	}
 }
 
-PointProcess TextGrid_getCentrePoints (TextGrid me, long tierNumber, int which_Melder_STRING, const char32 *criterion) {
+autoPointProcess TextGrid_getCentrePoints (TextGrid me, long tierNumber, int which_Melder_STRING, const char32 *criterion) {
 	try {
 		IntervalTier tier = TextGrid_checkSpecifiedTierIsIntervalTier (me, tierNumber);
 		autoPointProcess thee = PointProcess_create (my xmin, my xmax, 10);
@@ -749,13 +750,13 @@ PointProcess TextGrid_getCentrePoints (TextGrid me, long tierNumber, int which_M
 				PointProcess_addPoint (thee.peek(), 0.5 * (interval -> xmin + interval -> xmax));
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": centre points not converted to PointProcess.");
 	}
 }
 
-PointProcess TextGrid_getPoints (TextGrid me, long tierNumber, int which_Melder_STRING, const char32 *criterion) {
+autoPointProcess TextGrid_getPoints (TextGrid me, long tierNumber, int which_Melder_STRING, const char32 *criterion) {
 	try {
 		TextTier tier = TextGrid_checkSpecifiedTierIsPointTier (me, tierNumber);
 		autoPointProcess thee = PointProcess_create (my xmin, my xmax, 10);
@@ -765,13 +766,13 @@ PointProcess TextGrid_getPoints (TextGrid me, long tierNumber, int which_Melder_
 				PointProcess_addPoint (thee.peek(), point -> number);
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": points not converted to PointProcess.");
 	}
 }
 
-PointProcess TextGrid_getPoints_preceded (TextGrid me, long tierNumber,
+autoPointProcess TextGrid_getPoints_preceded (TextGrid me, long tierNumber,
 	int which_Melder_STRING, const char32 *criterion,
 	int which_Melder_STRING_precededBy, const char32 *criterion_precededBy)
 {
@@ -787,13 +788,13 @@ PointProcess TextGrid_getPoints_preceded (TextGrid me, long tierNumber,
 				}
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": points not converted to PointProcess.");
 	}
 }
 
-PointProcess TextGrid_getPoints_followed (TextGrid me, long tierNumber,
+autoPointProcess TextGrid_getPoints_followed (TextGrid me, long tierNumber,
 	int which_Melder_STRING, const char32 *criterion,
 	int which_Melder_STRING_followedBy, const char32 *criterion_followedBy)
 {
@@ -809,13 +810,13 @@ PointProcess TextGrid_getPoints_followed (TextGrid me, long tierNumber,
 				}
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": points not converted to PointProcess.");
 	}
 }
 
-PointProcess IntervalTier_PointProcess_startToCentre (IntervalTier tier, PointProcess point, double phase) {
+autoPointProcess IntervalTier_PointProcess_startToCentre (IntervalTier tier, PointProcess point, double phase) {
 	try {
 		autoPointProcess thee = PointProcess_create (tier -> xmin, tier -> xmax, 10);
 		for (long i = 1; i <= point -> nt; i ++) {
@@ -827,13 +828,13 @@ PointProcess IntervalTier_PointProcess_startToCentre (IntervalTier tier, PointPr
 					PointProcess_addPoint (thee.peek(), (1 - phase) * interval -> xmin + phase * interval -> xmax);
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (tier, U" & ", point, U": starts of intervals not converted to PointProcess.");
 	}
 }
 
-PointProcess IntervalTier_PointProcess_endToCentre (IntervalTier tier, PointProcess point, double phase) {
+autoPointProcess IntervalTier_PointProcess_endToCentre (IntervalTier tier, PointProcess point, double phase) {
 	try {
 		autoPointProcess thee = PointProcess_create (tier -> xmin, tier -> xmax, 10);
 		for (long i = 1; i <= point -> nt; i ++) {
@@ -845,18 +846,18 @@ PointProcess IntervalTier_PointProcess_endToCentre (IntervalTier tier, PointProc
 					PointProcess_addPoint (thee.peek(), (1 - phase) * interval -> xmin + phase * interval -> xmax);
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (tier, U" & ", point, U": ends of intervals not converted to PointProcess.");
 	}
 }
 
-TableOfReal IntervalTier_downto_TableOfReal (IntervalTier me, const char32 *label) {
+autoTableOfReal IntervalTier_downto_TableOfReal (IntervalTier me, const char32 *label) {
 	try {
 		long n = 0;
 		for (long i = 1; i <= my numberOfIntervals(); i ++) {
 			TextInterval interval = my interval (i);
-			if (label == NULL || (label [0] == U'\0' && ! interval -> text) || (interval -> text && str32equ (interval -> text, label)))
+			if (! label || (label [0] == U'\0' && ! interval -> text) || (interval -> text && str32equ (interval -> text, label)))
 				n ++;
 		}
 		autoTableOfReal thee = TableOfReal_create (n, 3);
@@ -874,17 +875,17 @@ TableOfReal IntervalTier_downto_TableOfReal (IntervalTier me, const char32 *labe
 				thy data [n] [3] = interval -> xmax - interval -> xmin;
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to TableOfReal.");
 	}
 }
 
-TableOfReal IntervalTier_downto_TableOfReal_any (IntervalTier me) {
-	return IntervalTier_downto_TableOfReal (me, NULL);
+autoTableOfReal IntervalTier_downto_TableOfReal_any (IntervalTier me) {
+	return IntervalTier_downto_TableOfReal (me, nullptr);
 }
 
-TableOfReal TextTier_downto_TableOfReal (TextTier me, const char32 *label) {
+autoTableOfReal TextTier_downto_TableOfReal (TextTier me, const char32 *label) {
 	try {
 		long n = 0;
 		for (long i = 1; i <= my numberOfPoints(); i ++) {
@@ -903,17 +904,17 @@ TableOfReal TextTier_downto_TableOfReal (TextTier me, const char32 *label) {
 				thy data [n] [1] = point -> number;
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to TableOfReal.");
 	}
 }
 
-TableOfReal TextTier_downto_TableOfReal_any (TextTier me) {
-	return TextTier_downto_TableOfReal (me, NULL);
+autoTableOfReal TextTier_downto_TableOfReal_any (TextTier me) {
+	return TextTier_downto_TableOfReal (me, nullptr);
 }
 
-IntervalTier IntervalTier_readFromXwaves (MelderFile file) {
+autoIntervalTier IntervalTier_readFromXwaves (MelderFile file) {
 	try {
 		char *line;
 		double lastTime = 0.0;
@@ -968,7 +969,7 @@ IntervalTier IntervalTier_readFromXwaves (MelderFile file) {
 		}
 
 		mfile.close ();
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"IntervalTier not read from file ", file, U".");
 	}
@@ -988,7 +989,7 @@ void IntervalTier_writeToXwaves (IntervalTier me, MelderFile file) {
 	}
 }
 
-TextGrid PointProcess_to_TextGrid_vuv (PointProcess me, double maxT, double meanT) {
+autoTextGrid PointProcess_to_TextGrid_vuv (PointProcess me, double maxT, double meanT) {
 	try {
 		autoTextGrid thee = TextGrid_create (my xmin, my xmax, U"vuv", NULL);
 		IntervalTier tier = static_cast <IntervalTier> (thy tier (1));
@@ -1015,7 +1016,7 @@ TextGrid PointProcess_to_TextGrid_vuv (PointProcess me, double maxT, double mean
 		if (endVoiceless > beginVoiceless) {
 			IntervalTier_addInterval_unsafe (tier, beginVoiceless, endVoiceless, U"U");
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to TextGrid (vuv).");
 	}
@@ -1329,7 +1330,7 @@ static void sgmlToPraat (char *text) {
 	*praat = '\0';
 }
 
-TextGrid TextGrid_readFromChronologicalTextFile (MelderFile file) {
+autoTextGrid TextGrid_readFromChronologicalTextFile (MelderFile file) {
 	try {
 		int formatVersion = 0;
 		autoMelderReadText text = MelderReadText_createFromFile (file);
@@ -1383,7 +1384,7 @@ TextGrid TextGrid_readFromChronologicalTextFile (MelderFile file) {
 				Collection_addItem (tier -> points, point.transfer());   // not earlier: sorting depends on contents of point
 			}
 		}
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"TextGrid not read from chronological text file ", file, U".");
 	}
@@ -1485,7 +1486,7 @@ void TextGrid_writeToChronologicalTextFile (TextGrid me, MelderFile file) {
 	}
 }
 
-TextGrid TextGrid_readFromCgnSyntaxFile (MelderFile file) {
+autoTextGrid TextGrid_readFromCgnSyntaxFile (MelderFile file) {
 	try {
 		autoTextGrid me = Thing_new (TextGrid);
 		long sentenceNumber = 0;
@@ -1584,8 +1585,8 @@ TextGrid TextGrid_readFromCgnSyntaxFile (MelderFile file) {
 					}
 				} else {
 					if (tb > 0.0) {
-						TextInterval interval = TextInterval_create (0.0, tb, U"");
-						Collection_addItem (sentenceTier -> intervals, interval);
+						autoTextInterval interval = TextInterval_create (0.0, tb, U"");
+						Collection_addItem (sentenceTier -> intervals, interval.transfer());
 					} else if (tb < 0.0) {
 						Melder_throw (U"Negative times not allowed.");
 					}
@@ -1671,13 +1672,13 @@ TextGrid TextGrid_readFromCgnSyntaxFile (MelderFile file) {
 			}
 		}
 		mfile.close ();
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"TextGrid not read from CGN syntax file ", file, U".");
 	}
 }
 
-Table TextGrid_downto_Table (TextGrid me, bool includeLineNumbers, int timeDecimals, bool includeTierNames, bool includeEmptyIntervals) {
+autoTable TextGrid_downto_Table (TextGrid me, bool includeLineNumbers, int timeDecimals, bool includeTierNames, bool includeEmptyIntervals) {
 	long numberOfRows = 0;
 	for (long itier = 1; itier <= my numberOfTiers(); itier ++) {
 		Function anyTier = my tier (itier);
@@ -1744,7 +1745,7 @@ Table TextGrid_downto_Table (TextGrid me, bool includeLineNumbers, int timeDecim
 	}
 	long columns [1+2] = { 0, 1 + includeLineNumbers, 3 + includeLineNumbers + includeTierNames };   // sort by tmin and tmax
 	Table_sortRows_Assert (thee.peek(), columns, 2);
-	return thee.transfer();
+	return thee;
 }
 
 void TextGrid_list (TextGrid me, bool includeLineNumbers, int timeDecimals, bool includeTierNames, bool includeEmptyIntervals) {
@@ -1781,11 +1782,11 @@ void TextGrid_correctRoundingErrors (TextGrid me) {
 	}
 }
 
-TextGrid TextGrids_concatenate (Collection me) {
+autoTextGrid TextGrids_concatenate (Collection me) {
 	try {
 		autoTextGrid thee = TextGrids_to_TextGrid_appendContinuous (me, false);
 		TextGrid_correctRoundingErrors (thee.peek());
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (U"TextGrids not concatenated.");
 	}
diff --git a/fon/TextGrid.h b/fon/TextGrid.h
index bec715d..9c736dd 100644
--- a/fon/TextGrid.h
+++ b/fon/TextGrid.h
@@ -28,25 +28,25 @@
 #include "TextGrid_def.h"
 
 oo_CLASS_CREATE (TextPoint, AnyPoint);
-TextPoint TextPoint_create (double time, const char32 *mark);
+autoTextPoint TextPoint_create (double time, const char32 *mark);
 
 void TextPoint_setText (TextPoint me, const char32 *text);
 
 oo_CLASS_CREATE (TextInterval, Function);
-TextInterval TextInterval_create (double tmin, double tmax, const char32 *text);
+autoTextInterval TextInterval_create (double tmin, double tmax, const char32 *text);
 
 void TextInterval_setText (TextInterval me, const char32 *text);
 
 oo_CLASS_CREATE (TextTier, Function);
-TextTier TextTier_create (double tmin, double tmax);
+autoTextTier TextTier_create (double tmin, double tmax);
 
 void TextTier_addPoint (TextTier me, double time, const char32 *mark);
-TextTier TextTier_readFromXwaves (MelderFile file);
-PointProcess TextTier_getPoints (TextTier me, const char32 *text);
+autoTextTier TextTier_readFromXwaves (MelderFile file);
+autoPointProcess TextTier_getPoints (TextTier me, const char32 *text);
 
 oo_CLASS_CREATE (IntervalTier, Function);
-IntervalTier IntervalTier_create (double tmin, double tmax);
-IntervalTier IntervalTier_readFromXwaves (MelderFile file);
+autoIntervalTier IntervalTier_create (double tmin, double tmax);
+autoIntervalTier IntervalTier_readFromXwaves (MelderFile file);
 void IntervalTier_writeToXwaves (IntervalTier me, MelderFile file);
 
 long IntervalTier_timeToLowIndex (IntervalTier me, double t);
@@ -54,30 +54,30 @@ long IntervalTier_timeToIndex (IntervalTier me, double t);   // obsolete
 long IntervalTier_timeToHighIndex (IntervalTier me, double t);
 long IntervalTier_hasTime (IntervalTier me, double t);
 long IntervalTier_hasBoundary (IntervalTier me, double t);
-PointProcess IntervalTier_getStartingPoints (IntervalTier me, const char32 *text);
-PointProcess IntervalTier_getEndPoints (IntervalTier me, const char32 *text);
-PointProcess IntervalTier_getCentrePoints (IntervalTier me, const char32 *text);
-PointProcess IntervalTier_PointProcess_startToCentre (IntervalTier tier, PointProcess point, double phase);
-PointProcess IntervalTier_PointProcess_endToCentre (IntervalTier tier, PointProcess point, double phase);
+autoPointProcess IntervalTier_getStartingPoints (IntervalTier me, const char32 *text);
+autoPointProcess IntervalTier_getEndPoints (IntervalTier me, const char32 *text);
+autoPointProcess IntervalTier_getCentrePoints (IntervalTier me, const char32 *text);
+autoPointProcess IntervalTier_PointProcess_startToCentre (IntervalTier tier, PointProcess point, double phase);
+autoPointProcess IntervalTier_PointProcess_endToCentre (IntervalTier tier, PointProcess point, double phase);
 void IntervalTier_removeLeftBoundary (IntervalTier me, long iinterval);
 
 void TextTier_removePoint (TextTier me, long ipoint);
 
 oo_CLASS_CREATE (TextGrid, Function);
-TextGrid TextGrid_createWithoutTiers (double tmin, double tmax);
-TextGrid TextGrid_create (double tmin, double tmax, const char32 *tierNames, const char32 *pointTiers);
+autoTextGrid TextGrid_createWithoutTiers (double tmin, double tmax);
+autoTextGrid TextGrid_create (double tmin, double tmax, const char32 *tierNames, const char32 *pointTiers);
 
 long TextGrid_countLabels (TextGrid me, long itier, const char32 *text);
 long TextGrid_countIntervalsWhere (TextGrid me, long tierNumber, int which_Melder_STRING, const char32 *criterion);
 long TextGrid_countPointsWhere (TextGrid me, long tierNumber, int which_Melder_STRING, const char32 *criterion);
-PointProcess TextGrid_getStartingPoints (TextGrid me, long itier, int which_Melder_STRING, const char32 *criterion);
-PointProcess TextGrid_getEndPoints (TextGrid me, long itier, int which_Melder_STRING, const char32 *criterion);
-PointProcess TextGrid_getCentrePoints (TextGrid me, long itier, int which_Melder_STRING, const char32 *criterion);
-PointProcess TextGrid_getPoints (TextGrid me, long itier, int which_Melder_STRING, const char32 *criterion);
-PointProcess TextGrid_getPoints_preceded (TextGrid me, long tierNumber,
+autoPointProcess TextGrid_getStartingPoints (TextGrid me, long itier, int which_Melder_STRING, const char32 *criterion);
+autoPointProcess TextGrid_getEndPoints (TextGrid me, long itier, int which_Melder_STRING, const char32 *criterion);
+autoPointProcess TextGrid_getCentrePoints (TextGrid me, long itier, int which_Melder_STRING, const char32 *criterion);
+autoPointProcess TextGrid_getPoints (TextGrid me, long itier, int which_Melder_STRING, const char32 *criterion);
+autoPointProcess TextGrid_getPoints_preceded (TextGrid me, long tierNumber,
 	int which_Melder_STRING, const char32 *criterion,
 	int which_Melder_STRING_precededBy, const char32 *criterion_precededBy);
-PointProcess TextGrid_getPoints_followed (TextGrid me, long tierNumber,
+autoPointProcess TextGrid_getPoints_followed (TextGrid me, long tierNumber,
 	int which_Melder_STRING, const char32 *criterion,
 	int which_Melder_STRING_followedBy, const char32 *criterion_followedBy);
 
@@ -86,19 +86,19 @@ IntervalTier TextGrid_checkSpecifiedTierIsIntervalTier (TextGrid me, long tierNu
 TextTier TextGrid_checkSpecifiedTierIsPointTier (TextGrid me, long tierNumber);
 
 void TextGrid_addTier_copy (TextGrid me, Function tier);
-TextGrid TextGrid_merge (Collection textGrids);
-TextGrid TextGrid_extractPart (TextGrid me, double tmin, double tmax, int preserveTimes);
+autoTextGrid TextGrid_merge (Collection textGrids);
+autoTextGrid TextGrid_extractPart (TextGrid me, double tmin, double tmax, int preserveTimes);
 
-TextGrid Label_to_TextGrid (Label me, double duration);
-TextGrid Label_Function_to_TextGrid (Label me, Any function);
+autoTextGrid Label_to_TextGrid (Label me, double duration);
+autoTextGrid Label_Function_to_TextGrid (Label me, Any function);
 
-TextTier PointProcess_upto_TextTier (PointProcess me, const char32 *text);
-TableOfReal IntervalTier_downto_TableOfReal (IntervalTier me, const char32 *label);
-TableOfReal IntervalTier_downto_TableOfReal_any (IntervalTier me);
-TableOfReal TextTier_downto_TableOfReal (TextTier me, const char32 *label);
-TableOfReal TextTier_downto_TableOfReal_any (TextTier me);
+autoTextTier PointProcess_upto_TextTier (PointProcess me, const char32 *text);
+autoTableOfReal IntervalTier_downto_TableOfReal (IntervalTier me, const char32 *label);
+autoTableOfReal IntervalTier_downto_TableOfReal_any (IntervalTier me);
+autoTableOfReal TextTier_downto_TableOfReal (TextTier me, const char32 *label);
+autoTableOfReal TextTier_downto_TableOfReal_any (TextTier me);
 
-TextGrid PointProcess_to_TextGrid_vuv (PointProcess me, double maxT, double meanT);
+autoTextGrid PointProcess_to_TextGrid_vuv (PointProcess me, double maxT, double meanT);
 
 long TextInterval_labelLength (TextInterval me);
 long TextPoint_labelLength (TextPoint me);
@@ -123,14 +123,14 @@ void TextGrid_insertPoint (TextGrid me, int itier, double t, const char32 *mark)
 void TextGrid_setPointText (TextGrid me, int itier, long ipoint, const char32 *text);
 
 void TextGrid_writeToChronologicalTextFile (TextGrid me, MelderFile file);
-TextGrid TextGrid_readFromChronologicalTextFile (MelderFile file);
-TextGrid TextGrid_readFromCgnSyntaxFile (MelderFile file);
+autoTextGrid TextGrid_readFromChronologicalTextFile (MelderFile file);
+autoTextGrid TextGrid_readFromCgnSyntaxFile (MelderFile file);
 
-Table TextGrid_downto_Table (TextGrid me, bool includeLineNumbers, int timeDecimals, bool includeTierNames, bool includeEmptyIntervals);
+autoTable TextGrid_downto_Table (TextGrid me, bool includeLineNumbers, int timeDecimals, bool includeTierNames, bool includeEmptyIntervals);
 void TextGrid_list (TextGrid me, bool includeLineNumbers, int timeDecimals, bool includeTierNames, bool includeEmptyIntervals);
 
 void TextGrid_correctRoundingErrors (TextGrid me);
-TextGrid TextGrids_concatenate (Collection me);
+autoTextGrid TextGrids_concatenate (Collection me);
 
 /* End of file TextGrid.h */
 #endif
diff --git a/fon/TextGridEditor.cpp b/fon/TextGridEditor.cpp
index ac47e90..269c275 100644
--- a/fon/TextGridEditor.cpp
+++ b/fon/TextGridEditor.cpp
@@ -557,7 +557,7 @@ static void insertBoundaryOrPoint (TextGridEditor me, int itier, double t1, doub
 	Melder_assert (t1 <= t2);
 
 	if (intervalTier) {
-		TextInterval rightNewInterval = NULL, midNewInterval = NULL;
+		autoTextInterval rightNewInterval, midNewInterval;
 		bool t1IsABoundary = IntervalTier_hasTime (intervalTier, t1);
 		bool t2IsABoundary = IntervalTier_hasTime (intervalTier, t2);
 		if (t1 == t2 && t1IsABoundary)
@@ -609,7 +609,6 @@ static void insertBoundaryOrPoint (TextGridEditor me, int itier, double t1, doub
 				Melder_fatal (U"Boundary unequal: ", interval -> xmin, U" versus ", t1, U".");
 			interval -> xmax = t2;
 			TextInterval_setText (interval, Melder_cat (interval -> text, midNewInterval -> text));
-			forget (midNewInterval);
 		} else if (t2IsABoundary) {
 			/*
 			 * Merge mid and right interval.
@@ -620,13 +619,12 @@ static void insertBoundaryOrPoint (TextGridEditor me, int itier, double t1, doub
 			Melder_assert (rightNewInterval -> xmin == t2);
 			Melder_assert (rightNewInterval -> xmax == t2);
 			rightNewInterval -> xmin = t1;
-			TextInterval_setText (rightNewInterval, Melder_cat (midNewInterval -> text, rightNewInterval -> text));
-			forget (midNewInterval);
+			TextInterval_setText (rightNewInterval.get(), Melder_cat (midNewInterval -> text, rightNewInterval -> text));
 		} else {
 			interval -> xmax = t1;
-			if (t1 != t2) Collection_addItem (intervalTier -> intervals, midNewInterval);
+			if (t1 != t2) Collection_addItem (intervalTier -> intervals, midNewInterval.transfer());
 		}
-		Collection_addItem (intervalTier -> intervals, rightNewInterval);
+		Collection_addItem (intervalTier -> intervals, rightNewInterval.transfer());
 		if (insertSecond && ntiers >= 2 && t1 == t2) {
 			/*
 			 * Find the last time before t on another tier.
@@ -639,20 +637,19 @@ static void insertBoundaryOrPoint (TextGridEditor me, int itier, double t1, doub
 				}
 			}
 			if (tlast > interval -> xmin && tlast < t1) {
-				TextInterval newInterval = TextInterval_create (tlast, t1, U"");
+				autoTextInterval newInterval = TextInterval_create (tlast, t1, U"");
 				interval -> xmax = tlast;
-				Collection_addItem (intervalTier -> intervals, newInterval);
+				Collection_addItem (intervalTier -> intervals, newInterval.transfer());
 			}
 		}
 	} else {
-		TextPoint newPoint;
 		if (AnyTier_hasPoint (textTier, t1))
 			Melder_throw (U"Cannot add a point at ", Melder_fixed (t1, 6), U" seconds, because there is already a point there.");
 
 		Editor_save (me, U"Add point");
 
-		newPoint = TextPoint_create (t1, U"");
-		Collection_addItem (textTier -> points, newPoint);
+		autoTextPoint newPoint = TextPoint_create (t1, U"");
+		Collection_addItem (textTier -> points, newPoint.transfer());
 	}
 	my d_startSelection = my d_endSelection = t1;
 }
diff --git a/fon/TextGrid_Sound.cpp b/fon/TextGrid_Sound.cpp
index d99a5dd..f83b673 100644
--- a/fon/TextGrid_Sound.cpp
+++ b/fon/TextGrid_Sound.cpp
@@ -161,8 +161,8 @@ void TextGrid_anySound_alignInterval (TextGrid me, Function anySound, long tierN
 		autoTextGrid analysis = NULL;
 		if (! Melder_equ (interval -> text, U"")) {
 			try {
-				analysis.reset (SpeechSynthesizer_and_Sound_and_TextInterval_align
-					(synthesizer.peek(), part.peek(), interval, silenceThreshold, minSilenceDuration, minSoundingDuration));
+				analysis = SpeechSynthesizer_and_Sound_and_TextInterval_align
+					(synthesizer.peek(), part.peek(), interval, silenceThreshold, minSilenceDuration, minSoundingDuration);
 			} catch (MelderError) {
 				Melder_clearError ();   // ignore all error messages from DTW and the like
 			}
@@ -423,7 +423,7 @@ void TextGrid_Sound_draw (TextGrid me, Sound sound, Graphics g, double tmin, dou
 	}
 }
 
-Collection TextGrid_Sound_extractAllIntervals (TextGrid me, Sound sound, long tierNumber, int preserveTimes) {
+autoCollection TextGrid_Sound_extractAllIntervals (TextGrid me, Sound sound, long tierNumber, int preserveTimes) {
 	try {
 		IntervalTier tier = TextGrid_checkSpecifiedTierIsIntervalTier (me, tierNumber);
 		autoCollection collection = Collection_create (NULL, tier -> numberOfIntervals ());
@@ -433,13 +433,13 @@ Collection TextGrid_Sound_extractAllIntervals (TextGrid me, Sound sound, long ti
 			Thing_setName (interval.peek(), segment -> text ? segment -> text : U"untitled");
 			Collection_addItem (collection.peek(), interval.transfer()); 
 		}
-		return collection.transfer();
+		return collection;
 	} catch (MelderError) {
 		Melder_throw (me, U" & ", sound, U": intervals not extracted.");
 	}
 }
 
-Collection TextGrid_Sound_extractNonemptyIntervals (TextGrid me, Sound sound, long tierNumber, int preserveTimes) {
+autoCollection TextGrid_Sound_extractNonemptyIntervals (TextGrid me, Sound sound, long tierNumber, int preserveTimes) {
 	try {
 		IntervalTier tier = TextGrid_checkSpecifiedTierIsIntervalTier (me, tierNumber);
 		autoCollection collection = Collection_create (NULL, tier -> numberOfIntervals ());
@@ -452,13 +452,13 @@ Collection TextGrid_Sound_extractNonemptyIntervals (TextGrid me, Sound sound, lo
 			}
 		}
 		if (collection -> size == 0) Melder_warning (U"No non-empty intervals were found.");
-		return collection.transfer();
+		return collection;
 	} catch (MelderError) {
 		Melder_throw (me, U" & ", sound, U": non-empty intervals not extracted.");
 	}
 }
 
-Collection TextGrid_Sound_extractIntervalsWhere (TextGrid me, Sound sound, long tierNumber,
+autoCollection TextGrid_Sound_extractIntervalsWhere (TextGrid me, Sound sound, long tierNumber,
 	int comparison_Melder_STRING, const char32 *text, int preserveTimes)
 {
 	try {
@@ -475,7 +475,7 @@ Collection TextGrid_Sound_extractIntervalsWhere (TextGrid me, Sound sound, long
 		}
 		if (collection -> size == 0)
 			Melder_warning (U"No label that ", kMelder_string_getText (comparison_Melder_STRING), U" the text \"", text, U"\" was found.");
-		return collection.transfer();
+		return collection;
 	} catch (MelderError) {
 		Melder_throw (me, U" & ", sound, U": intervals not extracted.");
 	}
diff --git a/fon/TextGrid_Sound.h b/fon/TextGrid_Sound.h
index 814dc09..0cc6275 100644
--- a/fon/TextGrid_Sound.h
+++ b/fon/TextGrid_Sound.h
@@ -23,9 +23,9 @@
 
 void TextGrid_Sound_draw (TextGrid me, Sound sound, Graphics g, double tmin, double tmax,
 	bool showBoundaries, bool useTextStyles, bool garnish);
-Collection TextGrid_Sound_extractAllIntervals (TextGrid me, Sound sound, long itier, int preserveTimes);
-Collection TextGrid_Sound_extractNonemptyIntervals (TextGrid me, Sound sound, long itier, int preserveTimes);
-Collection TextGrid_Sound_extractIntervalsWhere (TextGrid me, Sound sound,
+autoCollection TextGrid_Sound_extractAllIntervals (TextGrid me, Sound sound, long itier, int preserveTimes);
+autoCollection TextGrid_Sound_extractNonemptyIntervals (TextGrid me, Sound sound, long itier, int preserveTimes);
+autoCollection TextGrid_Sound_extractIntervalsWhere (TextGrid me, Sound sound,
 	long itier, int which_Melder_STRING, const char32 *text, int preserveTimes);
 
 void TextGrid_Pitch_draw (TextGrid grid, Pitch pitch, Graphics g,
diff --git a/fon/TimeSoundAnalysisEditor.cpp b/fon/TimeSoundAnalysisEditor.cpp
index 532beb9..772ea59 100644
--- a/fon/TimeSoundAnalysisEditor.cpp
+++ b/fon/TimeSoundAnalysisEditor.cpp
@@ -51,7 +51,6 @@ static const char32 * theMessage_Cannot_compute_intensity = U"The intensity curv
 static const char32 * theMessage_Cannot_compute_pulses = U"The pulses are not defined at the edge of the sound.";
 
 void structTimeSoundAnalysisEditor :: v_destroy () {
-	v_destroy_analysis ();
 	TimeSoundAnalysisEditor_Parent :: v_destroy ();
 }
 
@@ -127,12 +126,12 @@ void structTimeSoundAnalysisEditor :: v_info () {
 	}
 }
 
-void structTimeSoundAnalysisEditor :: v_destroy_analysis () {
-	//forget (d_spectrogram);
-	//forget (d_pitch);
-	forget (d_intensity);
-	//forget_nozero (d_formant.peek());
-	//forget (d_pulses);
+void structTimeSoundAnalysisEditor :: v_reset_analysis () {
+	d_spectrogram. reset();
+	d_pitch. reset();
+	d_intensity. reset();
+	d_formant. reset();
+	d_pulses. reset();
 }
 
 enum {
@@ -308,9 +307,9 @@ static void do_log (TimeSoundAnalysisEditor me, int which) {
 				Melder_throw (theMessage_Cannot_compute_intensity);
 			}
 			if (part == TimeSoundAnalysisEditor_PART_CURSOR) {
-				value = Vector_getValueAtX (my d_intensity, tmin, Vector_CHANNEL_1, Vector_VALUE_INTERPOLATION_LINEAR);
+				value = Vector_getValueAtX (my d_intensity.get(), tmin, Vector_CHANNEL_1, Vector_VALUE_INTERPOLATION_LINEAR);
 			} else {
-				value = Intensity_getAverage (my d_intensity, tmin, tmax, my p_intensity_averagingMethod);
+				value = Intensity_getAverage (my d_intensity.get(), tmin, tmax, my p_intensity_averagingMethod);
 			}
 		} else if (str32equ (varName, U"power")) {
 			if (! my p_spectrogram_show)
@@ -417,7 +416,7 @@ static void menu_cb_timeStepSettings (EDITOR_ARGS) {
 		my pref_numberOfTimeStepsPerView () = my p_numberOfTimeStepsPerView = GET_INTEGER (U"Number of time steps per view");
 		my d_pitch. reset();
 		my d_formant. reset();
-		forget (my d_intensity);
+		my d_intensity. reset();
 		my d_pulses. reset();
 		FunctionEditor_redraw (me);
 	EDITOR_END
@@ -681,7 +680,7 @@ static void menu_cb_pitchSettings (EDITOR_ARGS) {
 		my pref_pitch_method        () = my p_pitch_method        = GET_ENUM (kTimeSoundAnalysisEditor_pitch_analysisMethod, U"Analysis method");
 		my pref_pitch_drawingMethod () = my p_pitch_drawingMethod = GET_ENUM (kTimeSoundAnalysisEditor_pitch_drawingMethod, U"Drawing method");
 		my d_pitch. reset();
-		forget (my d_intensity);
+		my d_intensity. reset();
 		my d_pulses. reset();
 		FunctionEditor_redraw (me);
 	EDITOR_END
@@ -724,7 +723,7 @@ static void menu_cb_advancedPitchSettings (EDITOR_ARGS) {
 		my pref_pitch_octaveJumpCost            () = my p_pitch_octaveJumpCost            = GET_REAL    (U"Octave-jump cost");
 		my pref_pitch_voicedUnvoicedCost        () = my p_pitch_voicedUnvoicedCost        = GET_REAL    (U"Voiced / unvoiced cost");
 		my d_pitch. reset();
-		forget (my d_intensity);
+		my d_intensity. reset();
 		my d_pulses. reset();
 		FunctionEditor_redraw (me);
 	EDITOR_END
@@ -942,7 +941,7 @@ static void menu_cb_intensitySettings (EDITOR_ARGS) {
 		my pref_intensity_viewTo               () = my p_intensity_viewTo               = GET_REAL    (U"right View range");
 		my pref_intensity_averagingMethod      () = my p_intensity_averagingMethod      = GET_ENUM    (kTimeSoundAnalysisEditor_intensity_averagingMethod, U"Averaging method");
 		my pref_intensity_subtractMeanPressure () = my p_intensity_subtractMeanPressure = GET_INTEGER (U"Subtract mean pressure");
-		forget (my d_intensity);
+		my d_intensity. reset();
 		FunctionEditor_redraw (me);
 	EDITOR_END
 }
@@ -955,7 +954,7 @@ static void menu_cb_extractVisibleIntensityContour (EDITOR_ARGS) {
 		TimeSoundAnalysisEditor_computeIntensity (me);
 		if (! my d_intensity) Melder_throw (theMessage_Cannot_compute_intensity);
 	}
-	autoIntensity publish = Data_copy (my d_intensity);
+	autoIntensity publish = Data_copy (my d_intensity.get());
 	Editor_broadcastPublication (me, publish.transfer());
 }
 
@@ -983,7 +982,7 @@ static void menu_cb_drawVisibleIntensityContour (EDITOR_ARGS) {
 			if (! my d_intensity) Melder_throw (theMessage_Cannot_compute_intensity);
 		}
 		Editor_openPraatPicture (me);
-		Intensity_draw (my d_intensity, my pictureGraphics, my d_startWindow, my d_endWindow, my p_intensity_viewFrom, my p_intensity_viewTo,
+		Intensity_draw (my d_intensity.get(), my pictureGraphics, my d_startWindow, my d_endWindow, my p_intensity_viewFrom, my p_intensity_viewTo,
 			my p_intensity_picture_garnish);
 		FunctionEditor_garnish (me);
 		Editor_closePraatPicture (me);
@@ -1003,14 +1002,14 @@ static void menu_cb_intensityListing (EDITOR_ARGS) {
 	MelderInfo_open ();
 	MelderInfo_writeLine (U"Time_s   Intensity_dB");
 	if (part == TimeSoundAnalysisEditor_PART_CURSOR) {
-		double intensity = Vector_getValueAtX (my d_intensity, tmin, Vector_CHANNEL_1, Vector_VALUE_INTERPOLATION_LINEAR);
+		double intensity = Vector_getValueAtX (my d_intensity.get(), tmin, Vector_CHANNEL_1, Vector_VALUE_INTERPOLATION_LINEAR);
 		MelderInfo_writeLine (Melder_fixed (tmin, 6), U"   ", Melder_fixed (intensity, 6));
 	} else {
 		long i, i1, i2;
-		Sampled_getWindowSamples (my d_intensity, tmin, tmax, & i1, & i2);
+		Sampled_getWindowSamples (my d_intensity.get(), tmin, tmax, & i1, & i2);
 		for (i = i1; i <= i2; i ++) {
-			double t = Sampled_indexToX (my d_intensity, i);
-			double intensity = Vector_getValueAtX (my d_intensity, t, Vector_CHANNEL_1, Vector_VALUE_INTERPOLATION_NEAREST);
+			double t = Sampled_indexToX (my d_intensity.get(), i);
+			double intensity = Vector_getValueAtX (my d_intensity.get(), t, Vector_CHANNEL_1, Vector_VALUE_INTERPOLATION_NEAREST);
 			MelderInfo_writeLine (Melder_fixed (t, 6), U"   ", Melder_fixed (intensity, 6));
 		}
 	}
@@ -1028,10 +1027,10 @@ static void menu_cb_getIntensity (EDITOR_ARGS) {
 		if (! my d_intensity) Melder_throw (theMessage_Cannot_compute_intensity);
 	}
 	if (part == TimeSoundAnalysisEditor_PART_CURSOR) {
-		Melder_information (Vector_getValueAtX (my d_intensity, tmin, Vector_CHANNEL_1, Vector_VALUE_INTERPOLATION_LINEAR), U" dB (intensity at CURSOR)");
+		Melder_information (Vector_getValueAtX (my d_intensity.get(), tmin, Vector_CHANNEL_1, Vector_VALUE_INTERPOLATION_LINEAR), U" dB (intensity at CURSOR)");
 	} else {
 		static const char32 *methodString [] = { U"median", U"mean-energy", U"mean-sones", U"mean-dB" };
-		Melder_information (Intensity_getAverage (my d_intensity, tmin, tmax, my p_intensity_averagingMethod),
+		Melder_information (Intensity_getAverage (my d_intensity.get(), tmin, tmax, my p_intensity_averagingMethod),
 			U" dB (", methodString [my p_intensity_averagingMethod], U" intensity ", TimeSoundAnalysisEditor_partString_locative (part), U")");
 	}
 }
@@ -1046,7 +1045,7 @@ static void menu_cb_getMinimumIntensity (EDITOR_ARGS) {
 		TimeSoundAnalysisEditor_computeIntensity (me);
 		if (! my d_intensity) Melder_throw (theMessage_Cannot_compute_intensity);
 	}
-	double intensity = Vector_getMinimum (my d_intensity, tmin, tmax, NUM_PEAK_INTERPOLATE_PARABOLIC);
+	double intensity = Vector_getMinimum (my d_intensity.get(), tmin, tmax, NUM_PEAK_INTERPOLATE_PARABOLIC);
 	Melder_information (intensity, U" dB (minimum intensity ", TimeSoundAnalysisEditor_partString_locative (part), U")");
 }
 
@@ -1060,7 +1059,7 @@ static void menu_cb_getMaximumIntensity (EDITOR_ARGS) {
 		TimeSoundAnalysisEditor_computeIntensity (me);
 		if (! my d_intensity) Melder_throw (theMessage_Cannot_compute_intensity);
 	}
-	double intensity = Vector_getMaximum (my d_intensity, tmin, tmax, NUM_PEAK_INTERPOLATE_PARABOLIC);
+	double intensity = Vector_getMaximum (my d_intensity.get(), tmin, tmax, NUM_PEAK_INTERPOLATE_PARABOLIC);
 	Melder_information (intensity, U" dB (maximum intensity ", TimeSoundAnalysisEditor_partString_locative (part), U")");
 }
 
@@ -1665,7 +1664,7 @@ void TimeSoundAnalysisEditor_computeIntensity (TimeSoundAnalysisEditor me) {
 		(! my d_intensity || my d_intensity -> xmin != my d_startWindow || my d_intensity -> xmax != my d_endWindow))
 	{
 		double margin = 3.2 / my p_pitch_floor;
-		forget (my d_intensity);
+		my d_intensity. reset();
 		try {
 			autoSound sound = extractSound (me, my d_startWindow - margin, my d_endWindow + margin);
 			my d_intensity = Sound_to_Intensity (sound.peek(), my p_pitch_floor,
@@ -1804,7 +1803,7 @@ static void TimeSoundAnalysisEditor_v_draw_analysis (TimeSoundAnalysisEditor me)
 	if (my p_intensity_show && my d_intensity) {
 		Graphics_setColour (my d_graphics, my p_spectrogram_show ? Graphics_YELLOW : Graphics_LIME);
 		Graphics_setLineWidth (my d_graphics, my p_spectrogram_show ? 1.0 : 3.0);
-		Intensity_drawInside (my d_intensity, my d_graphics, my d_startWindow, my d_endWindow,
+		Intensity_drawInside (my d_intensity.get(), my d_graphics, my d_startWindow, my d_endWindow,
 			my p_intensity_viewFrom, my p_intensity_viewTo);
 		Graphics_setLineWidth (my d_graphics, 1.0);
 		Graphics_setColour (my d_graphics, Graphics_BLACK);
@@ -1869,9 +1868,9 @@ static void TimeSoundAnalysisEditor_v_draw_analysis (TimeSoundAnalysisEditor me)
 			Graphics_setWindow (my d_graphics, my d_startWindow, my d_endWindow, my p_intensity_viewFrom, my p_intensity_viewTo);
 			if (my d_intensity) {
 				if (my d_startSelection == my d_endSelection) {
-					intensityCursor = Vector_getValueAtX (my d_intensity, my d_startSelection, Vector_CHANNEL_1, Vector_VALUE_INTERPOLATION_LINEAR);
+					intensityCursor = Vector_getValueAtX (my d_intensity.get(), my d_startSelection, Vector_CHANNEL_1, Vector_VALUE_INTERPOLATION_LINEAR);
 				} else {
-					intensityCursor = Intensity_getAverage (my d_intensity, my d_startSelection, my d_endSelection, my p_intensity_averagingMethod);
+					intensityCursor = Intensity_getAverage (my d_intensity.get(), my d_startSelection, my d_endSelection, my p_intensity_averagingMethod);
 				}
 			}
 			Graphics_setColour (my d_graphics, textColour);
@@ -1964,14 +1963,14 @@ int structTimeSoundAnalysisEditor :: v_click (double xbegin, double ybegin, bool
 		if (xbegin >= our d_endWindow && ybegin > 0.48 && ybegin <= 0.50) {
 			our pref_pitch_ceiling () = our p_pitch_ceiling = our p_pitch_ceiling * 1.26;
 			our d_pitch. reset();
-			forget (our d_intensity);
+			our d_intensity.reset();
 			our d_pulses. reset();
 			return 1;
 		}
 		if (xbegin >= our d_endWindow && ybegin > 0.46 && ybegin <= 0.48) {
 			our pref_pitch_ceiling () = our p_pitch_ceiling = our p_pitch_ceiling / 1.26;
 			our d_pitch. reset();
-			forget (our d_intensity);
+			our d_intensity. reset();
 			our d_pulses. reset();
 			return 1;
 		}
diff --git a/fon/TimeSoundAnalysisEditor.h b/fon/TimeSoundAnalysisEditor.h
index 60c5b39..4d30edf 100644
--- a/fon/TimeSoundAnalysisEditor.h
+++ b/fon/TimeSoundAnalysisEditor.h
@@ -59,7 +59,7 @@ Thing_define (TimeSoundAnalysisEditor, TimeSoundEditor) {
 	autoSpectrogram d_spectrogram;
 	double d_spectrogram_cursor;
 	autoPitch d_pitch;
-	Intensity d_intensity;
+	autoIntensity d_intensity;
 	autoFormant d_formant;
 	autoPointProcess d_pulses;
 	GuiMenuItem spectrogramToggle, pitchToggle, intensityToggle, formantToggle, pulsesToggle;
@@ -86,7 +86,7 @@ Thing_define (TimeSoundAnalysisEditor, TimeSoundEditor) {
 	virtual bool v_hasIntensity   () { return true; }
 	virtual bool v_hasFormants    () { return true; }
 	virtual bool v_hasPulses      () { return true; }
-	virtual void v_destroy_analysis ();
+	virtual void v_reset_analysis ();
 	virtual void v_createMenuItems_spectrum_picture (EditorMenu menu);
 	virtual void v_createMenuItems_pitch_picture (EditorMenu menu);
 	virtual void v_createMenuItems_intensity_picture (EditorMenu menu);
diff --git a/fon/TimeSoundEditor.cpp b/fon/TimeSoundEditor.cpp
index 39c56d7..6a8a9aa 100644
--- a/fon/TimeSoundEditor.cpp
+++ b/fon/TimeSoundEditor.cpp
@@ -134,7 +134,7 @@ static void do_ExtractSelectedSound (TimeSoundEditor me, bool preserveTimes) {
 	if (my d_longSound.data) {
 		extract = LongSound_extractPart (my d_longSound.data, my d_startSelection, my d_endSelection, preserveTimes);
 	} else if (my d_sound.data) {
-		extract.reset (Sound_extractPart (my d_sound.data, my d_startSelection, my d_endSelection, kSound_windowShape_RECTANGULAR, 1.0, preserveTimes));
+		extract = Sound_extractPart (my d_sound.data, my d_startSelection, my d_endSelection, kSound_windowShape_RECTANGULAR, 1.0, preserveTimes);
 	}
 	Editor_broadcastPublication (me, extract.transfer());
 }
diff --git a/fon/Transition.cpp b/fon/Transition.cpp
index 96aba4c..7645d3e 100644
--- a/fon/Transition.cpp
+++ b/fon/Transition.cpp
@@ -71,11 +71,11 @@ void Transition_init (Transition me, long numberOfStates) {
 	my data = NUMmatrix <double> (1, my numberOfStates, 1, my numberOfStates);
 }
 
-Transition Transition_create (long numberOfStates) {
+autoTransition Transition_create (long numberOfStates) {
 	try {
 		autoTransition me = Thing_new (Transition);
 		Transition_init (me.peek(), numberOfStates);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Transition not created.");
 	}
@@ -182,7 +182,7 @@ void Transition_eigen (Transition me, Matrix *out_eigenvectors, Matrix *out_eige
 	}
 }
 
-Transition Transition_power (Transition me, long power) {
+autoTransition Transition_power (Transition me, long power) {
 	try {
 		autoTransition thee = Data_copy (me);
 		autoTransition him = Data_copy (me);
@@ -197,25 +197,25 @@ Transition Transition_power (Transition me, long power) {
 				}
 			}
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": power not computed.");
 	}
 }
 
-Matrix Transition_to_Matrix (Transition me) {
+autoMatrix Transition_to_Matrix (Transition me) {
 	try {
 		autoMatrix thee = Matrix_createSimple (my numberOfStates, my numberOfStates);
 		for (long i = 1; i <= my numberOfStates; i ++)
 			for (long j = 1; j <= my numberOfStates; j ++)
 				thy z [i] [j] = my data [i] [j];
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Matrix.");
 	}
 }
 
-Transition Matrix_to_Transition (Matrix me) {
+autoTransition Matrix_to_Transition (Matrix me) {
 	try {
 		if (my nx != my ny)
 			Melder_throw (U"Matrix should be square.");
@@ -223,7 +223,7 @@ Transition Matrix_to_Transition (Matrix me) {
 		for (long i = 1; i <= my nx; i ++)
 			for (long j = 1; j <= my nx; j ++)
 				thy data [i] [j] = my z [i] [j];
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Transition.");
 	}
diff --git a/fon/Transition.h b/fon/Transition.h
index b64a535..6ab898a 100644
--- a/fon/Transition.h
+++ b/fon/Transition.h
@@ -26,16 +26,16 @@
 oo_CLASS_CREATE (Transition, Daata);
 
 void Transition_init (Transition me, long numberOfStates);
-Transition Transition_create (long numberOfStates);
+autoTransition Transition_create (long numberOfStates);
 
 void Transition_formula (Transition me, const char32 *formula);
 void Transition_drawAsNumbers (Transition me, Graphics g, int iformat, int precision);
 
 void Transition_eigen (Transition me, Matrix *eigenvectors, Matrix *eigenvalues);
-Transition Transition_power (Transition me, long power);
+autoTransition Transition_power (Transition me, long power);
 
-Matrix Transition_to_Matrix (Transition me);
-Transition Matrix_to_Transition (Matrix me);
+autoMatrix Transition_to_Matrix (Transition me);
+autoTransition Matrix_to_Transition (Matrix me);
 
 /* End of file Transition.h */
 #endif
diff --git a/fon/VocalTract.cpp b/fon/VocalTract.cpp
index 24f65cc..48dc99a 100644
--- a/fon/VocalTract.cpp
+++ b/fon/VocalTract.cpp
@@ -28,11 +28,11 @@ void structVocalTract :: v_info () {
 	MelderInfo_writeLine (U"Section length: ", Melder_single (dx), U" metres");
 }
 
-VocalTract VocalTract_create (long nx, double dx) {
+autoVocalTract VocalTract_create (long nx, double dx) {
 	try {
 		autoVocalTract me = Thing_new (VocalTract);
 		Matrix_init (me.peek(), 0, nx * dx, nx, dx, 0.5 * dx, 1, 1, 1, 1, 1);
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"VocalTract not created.");
 	}
@@ -117,7 +117,7 @@ static struct { const char32 *phone; int numberOfSections; double area [40]; }
 	10.9, 12.9, 13.15, 13, 12.5, 9.9, 3.9, 1.8, 0.32, 0.4, 0.6 } },
 { NULL, 0, { 0 } } };
 
-VocalTract VocalTract_createFromPhone (const char32 *phone) {
+autoVocalTract VocalTract_createFromPhone (const char32 *phone) {
 	try {
 		int i = 0;
 		for (;; i ++) {
@@ -129,7 +129,7 @@ VocalTract VocalTract_createFromPhone (const char32 *phone) {
 		autoVocalTract me = VocalTract_create (data [i]. numberOfSections, 0.005);
 		for (int isection = 1; isection <= my nx; isection ++)
 			my z [1] [isection] = data [i]. area [isection - 1] * 0.0001;
-		return me.transfer();
+		return me;
 	} catch (MelderError) {
 		Melder_throw (U"VocalTract not created from phone.");
 	}
@@ -139,21 +139,21 @@ void VocalTract_draw (VocalTract me, Graphics g) {
 	Matrix_drawRows (me, g, 0, 0, 0, 0, 0, 0);
 }
 
-Matrix VocalTract_to_Matrix (VocalTract me) {
+autoMatrix VocalTract_to_Matrix (VocalTract me) {
 	try {
 		autoMatrix thee = Matrix_create (my xmin, my xmax, my nx, my dx, my x1, my ymin, my ymax, my ny, my dy, my y1);
 		NUMvector_copyElements (my z [1], thy z [1], 1, my nx);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Matrix.");
 	}
 }
 
-VocalTract Matrix_to_VocalTract (Matrix me) {
+autoVocalTract Matrix_to_VocalTract (Matrix me) {
 	try {
 		autoVocalTract thee = VocalTract_create (my nx, my dx);
 		NUMvector_copyElements (my z [1], thy z [1], 1, my nx);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to VocalTract.");
 	}
diff --git a/fon/VocalTract.h b/fon/VocalTract.h
index 7043ce1..dab4122 100644
--- a/fon/VocalTract.h
+++ b/fon/VocalTract.h
@@ -40,7 +40,7 @@ Thing_define (VocalTract, Vector) {
 		z [1] [1..nx]		// The area, in square metres.
 */
 
-VocalTract VocalTract_create (long nx, double dx);
+autoVocalTract VocalTract_create (long nx, double dx);
 /*
 	Function:
 		create a VocalTract.
@@ -56,18 +56,18 @@ VocalTract VocalTract_create (long nx, double dx);
 		my z [1] [1..nx] == 1e-4; // straight tube, area 1 cm2.
  */
 
-VocalTract VocalTract_createFromPhone (const char32 *phone);
+autoVocalTract VocalTract_createFromPhone (const char32 *phone);
 /* 'phone' is one of the following: a e i o u y1 y2 y3 jery p t k x pa ta ka pi ti ki pu tu ku */
 
 void VocalTract_draw (VocalTract me, Graphics g);   /* Draw a VocalTract into a Graphics. */
 
-Matrix VocalTract_to_Matrix (VocalTract me);
+autoMatrix VocalTract_to_Matrix (VocalTract me);
 /*
 	Create a Matrix from a VocalTract,
 	with deep copy of all of its Matrix attributes, except class information and methods.
 */
 
-VocalTract Matrix_to_VocalTract (Matrix me);
+autoVocalTract Matrix_to_VocalTract (Matrix me);
 /*
 	Function:
 		create a VocalTract from a Matrix.
diff --git a/fon/VocalTract_to_Spectrum.cpp b/fon/VocalTract_to_Spectrum.cpp
index 101ed03..3432d3f 100644
--- a/fon/VocalTract_to_Spectrum.cpp
+++ b/fon/VocalTract_to_Spectrum.cpp
@@ -115,7 +115,7 @@ static void TUBE_transfer (double area [], int numberOfSections, double sectionL
 	}
 }
 
-Spectrum VocalTract_to_Spectrum
+autoSpectrum VocalTract_to_Spectrum
 	(VocalTract me, long numberOfFrequencies, double maximumFrequency,
 	 double glottalDamping, int hasRadiationDamping, int hasInternalDamping)
 {
@@ -129,7 +129,7 @@ Spectrum VocalTract_to_Spectrum
 			thy z [1] [ifreq] *= 0.02;
 			thy z [2] [ifreq] *= 0.02;
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Spectrum.");
 	}
diff --git a/fon/VocalTract_to_Spectrum.h b/fon/VocalTract_to_Spectrum.h
index c6721b4..9aaac74 100644
--- a/fon/VocalTract_to_Spectrum.h
+++ b/fon/VocalTract_to_Spectrum.h
@@ -1,6 +1,6 @@
 /* VocalTract_to_Spectrum.h
  *
- * Copyright (C) 1992-2011 Paul Boersma
+ * Copyright (C) 1992-2011,2015 Paul Boersma
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
 #include "VocalTract.h"
 #include "Spectrum.h"
 
-Spectrum VocalTract_to_Spectrum
+autoSpectrum VocalTract_to_Spectrum
     (VocalTract tube, long numberOfFrequencies, double maximumFrequency,
      double glottalDamping, int hasRadiationDamping, int hasInternalDamping);
 
diff --git a/fon/WordList.cpp b/fon/WordList.cpp
index 47e31df..b8b1d5a 100644
--- a/fon/WordList.cpp
+++ b/fon/WordList.cpp
@@ -133,7 +133,7 @@ void structWordList :: v_writeBinary (FILE *f) {
 	}
 }
 
-WordList Strings_to_WordList (Strings me) {
+autoWordList Strings_to_WordList (Strings me) {
 	try {
 		long totalLength = 0;
 		/*
@@ -165,13 +165,13 @@ WordList Strings_to_WordList (Strings me) {
 		}
 		*q = U'\0';
 		Melder_assert (q - thy string == thy length);
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to WordList.");
 	}
 }
 
-Strings WordList_to_Strings (WordList me) {
+autoStrings WordList_to_Strings (WordList me) {
 	try {
 		unsigned char *word = (unsigned char *) my string;   // BUG: explain this
 		autoStrings thee = Thing_new (Strings);
@@ -188,7 +188,7 @@ Strings WordList_to_Strings (WordList me) {
 			thy strings [i] [length] = U'\0';
 			word += length + 1;
 		}
-		return thee.transfer();
+		return thee;
 	} catch (MelderError) {
 		Melder_throw (me, U": not converted to Strings.");
 	}
@@ -233,21 +233,19 @@ static int compare (const char32 *word, const char32 *p) {
 static char32 buffer [3333+1];
 
 bool WordList_hasWord (WordList me, const char32 *word) {
-	long p, d;
-	int cf;
 	if (str32len (word) > 3333) return false;
 	Longchar_genericize32 (word, buffer);
 	if (! my length) my length = str32len (my string);
-	p = my length / 2, d = p / 2;
+	long p = my length / 2, d = p / 2;
 	while (d > 20) {
 		p = gotoStart (me, p);
-		cf = compare (buffer, my string + p);
+		int cf = compare (buffer, my string + p);
 		if (cf == 0) return true;
 		if (cf < 0) p -= d; else p += d;
 		d /= 2;
 	}
 	p = gotoStart (me, p);
-	cf = compare (buffer, my string + p);
+	int cf = compare (buffer, my string + p);
 	if (cf == 0) return true;
 	if (cf > 0) {
 		for (;;) {
diff --git a/fon/WordList.h b/fon/WordList.h
index e4fe4da..dc28fef 100644
--- a/fon/WordList.h
+++ b/fon/WordList.h
@@ -24,8 +24,8 @@
 #include "WordList_def.h"
 oo_CLASS_CREATE (WordList, Daata);
 
-WordList Strings_to_WordList (Strings me);
-Strings WordList_to_Strings (WordList me);
+autoWordList Strings_to_WordList (Strings me);
+autoStrings WordList_to_Strings (WordList me);
 
 bool WordList_hasWord (WordList me, const char32 *word);
 
diff --git a/fon/manual_Script.cpp b/fon/manual_Script.cpp
index 217da7f..19af6cf 100644
--- a/fon/manual_Script.cpp
+++ b/fon/manual_Script.cpp
@@ -3184,7 +3184,7 @@ CODE (U"nocheck Remove")
 NORMAL (U"This would cause the script to continue even if there is nothing to remove.")
 MAN_END
 
-MAN_BEGIN (U"Scripting 6.9. Calling from the command line", U"ppgb", 20151026)
+MAN_BEGIN (U"Scripting 6.9. Calling from the command line", U"ppgb", 20151031)
 INTRO (U"Previous sections of this tutorial have shown you how to run a Praat script from the Script window. "
 	"However, you can also call a Praat script from the command line (text console) instead. "
 	"Information that would normally show up in the Info window, then goes to %stdout, "
@@ -3307,22 +3307,41 @@ CODE (U"first_line = 'I love you'")
 CODE (U"second_line = 'me too'")
 CODE (U"subprocess.call(['C:\\bs\\bsProgram Files\\bs\\bsPraat.exe', 'testCommandLineCalls.praat', first_line, '0.4', second_line])")
 
-ENTRY (U"7. Running Praat interactively from the command line")
+ENTRY (U"7. Calling Praat from other programs than Python")
+NORMAL (U"Many other programs beside Python have a $$system$-like command, so that you can run a command like")
+CODE (U"system ('\"C:\\bs\\bsProgram Files\\bs\\bsPraat.exe\" testCommandLineCalls.praat \"I love you\" 0.4 \"Me too\"')")
+NORMAL (U"However, the implementation of such commands varies strongly between programs, and some programs "
+	"can make Praat think that it was started by dragging a file onto the Praat icon. In those cases, "
+	"the above $$system$ command will start up the Praat GUI and open the file rather than run it. "
+	"In such cases you could trick the $$system$ command into using a command shell, which would go like this in Windows:")
+CODE (U"system ('cmd /c \"C:\\bs\\bsProgram Files\\bs\\bsPraat.exe\" testCommandLineCalls.praat \"I love you\" 0.4 \"Me too\"')")
+NORMAL (U"or like this on the Mac or on Linux:")
+CODE (U"system ('bash \"C:\\bs\\bsProgram Files\\bs\\bsPraat.exe\" testCommandLineCalls.praat \"I love you\" 0.4 \"Me too\"')")
+NORMAL (U"It may be easier, though, to use Praat’s explicit $$--run$ option, which has been designed especially for this case:")
+CODE (U"system ('\"C:\\bs\\bsProgram Files\\bs\\bsPraat.exe\" --run testCommandLineCalls.praat \"I love you\" 0.4 \"Me too\"')")
+NORMAL (U"If you are using Praat in an automated workflow, our advice would be to always include the $$--run$ option, "
+	"even if your workflow runs correctly today without the $$--run$ option, "
+	"because the implementation of $$system$-like commands in other programs might change.")
+
+ENTRY (U"8. Running Praat interactively from the command line")
 NORMAL (U"On the Mac and Linux, you have the possibility of running the program interactively from the command line:")
 CODE (U"> /usr/bin/praat -")
 NORMAL (U"You can then type in any of the fixed and dynamic commands, and commands that handle object selection, "
 	"such as #selectObject. This method also works in pipes:")
 CODE (U"> echo \"Statistics...\" | /usr/bin/praat -")
 
-ENTRY (U"8. Calling Praat from a web server")
+ENTRY (U"9. Calling Praat from a web server")
 NORMAL (U"If you call Praat from a web server, you typically do not want to read and write its preferences and buttons files. "
 	"To achieve this, you use the ##--no-pref-files# command line option before the script name:")
-CODE (U"> /users/apache/praat --no-pref-files /user/apache/scripts/computeAnalysis.praat 1234 blibla")
+CODE (U"system ('/users/apache/praat --run --no-pref-files /user/apache/scripts/computeAnalysis.praat 1234 blibla')")
+NORMAL (U"Please note the recommended use of $$--run$ in this case.")
 
-ENTRY (U"9. All command line options")
+ENTRY (U"10. All command line options")
 TAG (U"##--open")
-DEFINITION (U"Interpret the command line arguments as files to be opened in the GUI "
-	"(instead of as a script file name and its arguments).")
+DEFINITION (U"Interpret the command line arguments as files to be opened in the GUI.")
+TAG (U"##--run")
+DEFINITION (U"Interpret the command line arguments as a script file name and its arguments "
+	"($$--run$ is superfluous when you use a Console or Terminal window).")
 TAG (U"##--no-pref-files#")
 DEFINITION (U"Ignore the preferences file and the buttons file at start-up, and don't write them when quitting (see above).")
 TAG (U"##--no-plugins#")
diff --git a/fon/manual_tutorials.cpp b/fon/manual_tutorials.cpp
index 940496e..f42b6f0 100644
--- a/fon/manual_tutorials.cpp
+++ b/fon/manual_tutorials.cpp
@@ -23,9 +23,16 @@
 void manual_tutorials_init (ManPages me);
 void manual_tutorials_init (ManPages me) {
 
-MAN_BEGIN (U"What's new?", U"ppgb", 20151028)
+MAN_BEGIN (U"What's new?", U"ppgb", 20151031)
 INTRO (U"Latest changes in Praat.")
 /*LIST_ITEM (U"• Manual page about @@drawing a vowel triangle at .")*/
+NORMAL (U"##6.0.03# (31 October 2015)")
+LIST_ITEM (U"• Corrected a bug that caused Praat to crash when the Soundrecorder window was closed.")
+LIST_ITEM (U"• Scripting: when calling Praat from the command line, added the $$--run$ option to force script execution.")
+NORMAL (U"##6.0.02# (30 October 2015)")
+LIST_ITEM (U"• Corrected the redrawing of analyses in the Sound window after a change in the sound.")
+NORMAL (U"##6.0.01# (29 October 2015)")
+LIST_ITEM (U"• Windows: fixed a bug that caused Praat to crash at start-up in some Windows versions.")
 NORMAL (U"##6.0# (28 October 2015)")
 LIST_ITEM (U"• Linux: use PulseAudio as the server for playing sound.")
 LIST_ITEM (U"• Windows: removed Praatcon.exe, because Praat.exe can now be used from the command line.")
diff --git a/fon/praat_Fon.cpp b/fon/praat_Fon.cpp
index 073a3a4..a2c094b 100644
--- a/fon/praat_Fon.cpp
+++ b/fon/praat_Fon.cpp
@@ -6287,14 +6287,14 @@ static Any cgnSyntaxFileRecognizer (int nread, const char *header, MelderFile fi
 	if (nread < 57) return NULL;
 	if (! strnequ (& header [0], "<?xml version=\"1.0\"?>", 21) ||
 	    (! strnequ (& header [22], "<!DOCTYPE ttext SYSTEM \"ttext.dtd\">", 35) &&
-	     ! strnequ (& header [23], "<!DOCTYPE ttext SYSTEM \"ttext.dtd\">", 35))) return NULL;
-	return TextGrid_readFromCgnSyntaxFile (file);
+	     ! strnequ (& header [23], "<!DOCTYPE ttext SYSTEM \"ttext.dtd\">", 35))) return nullptr;
+	return TextGrid_readFromCgnSyntaxFile (file).transfer();
 }
 
 static Any chronologicalTextGridTextFileRecognizer (int nread, const char *header, MelderFile file) {
 	if (nread < 100) return NULL;
 	if (strnequ (& header [0], "\"Praat chronological TextGrid text file\"", 40))
-		return TextGrid_readFromChronologicalTextFile (file);
+		return TextGrid_readFromChronologicalTextFile (file).transfer();
 	char headerCopy [101];
 	memcpy (headerCopy, header, 100);
 	headerCopy [100] = '\0';
@@ -6305,9 +6305,9 @@ static Any chronologicalTextGridTextFileRecognizer (int nread, const char *heade
 	if (strstr (headerCopy, "\"\001P\001r\001a\001a\001t\001 \001c\001h\001r\001o\001n\001o\001l\001o\001g\001i\001c\001a\001l\001"
 		" \001T\001e\001x\001t\001G\001r\001i\001d\001 \001t\001e\001x\001t\001 \001f\001i\001l\001e\001\""))
 	{
-		return TextGrid_readFromChronologicalTextFile (file);
+		return TextGrid_readFromChronologicalTextFile (file).transfer();
 	}
-	return NULL;
+	return nullptr;
 }
 
 static Any imageFileRecognizer (int /* nread */, const char * /* header */, MelderFile file) {
diff --git a/fon/praat_Sound_init.cpp b/fon/praat_Sound_init.cpp
index 9249ae9..35f0923 100644
--- a/fon/praat_Sound_init.cpp
+++ b/fon/praat_Sound_init.cpp
@@ -1380,12 +1380,12 @@ FORM_READ2 (Sound_readFromRawAlawFile, U"Read Sound from raw Alaw file", 0, true
 	praat_new (me.transfer(), MelderFile_name (file));
 END2 }
 
-static autoSoundRecorder theSoundRecorder;   // only one at a time can exist
+static SoundRecorder theSoundRecorder;   // only one at a time can exist
 static int thePreviousNumberOfChannels;
-static void cb_SoundRecorder_destruction (Editor /*editor*/, void* /*closure*/) {
+static void cb_SoundRecorder_destruction (Editor /* editor */, void* /* closure */) {
 	theSoundRecorder = nullptr;
 }
-static void cb_SoundRecorder_publication (Editor /*editor*/, void* /*closure*/, Daata publication) {
+static void cb_SoundRecorder_publication (Editor /* editor */, void* /* closure */, Daata publication) {
 	try {
 		praat_new (publication);
 	} catch (MelderError) {
@@ -1398,15 +1398,16 @@ static void do_Sound_record (int numberOfChannels) {
 		Melder_throw (U"Cannot record a Sound from batch.");
 	if (theSoundRecorder) {
 		if (numberOfChannels == thePreviousNumberOfChannels) {
-			Editor_raise (theSoundRecorder.get());
+			Editor_raise (theSoundRecorder);
 		} else {
-			theSoundRecorder.reset();
+			forget (theSoundRecorder);
 		}
 	}
 	if (! theSoundRecorder) {
-		theSoundRecorder = SoundRecorder_create (numberOfChannels);
-		Editor_setDestructionCallback (theSoundRecorder.get(), cb_SoundRecorder_destruction, nullptr);
-		Editor_setPublicationCallback (theSoundRecorder.get(), cb_SoundRecorder_publication, nullptr);
+		autoSoundRecorder soundRecorder = SoundRecorder_create (numberOfChannels);
+		theSoundRecorder = soundRecorder.transfer();   // YUCK; to a naked pointer, because it will be its own boss
+		Editor_setDestructionCallback (theSoundRecorder, cb_SoundRecorder_destruction, nullptr);
+		Editor_setPublicationCallback (theSoundRecorder, cb_SoundRecorder_publication, nullptr);
 	}
 	thePreviousNumberOfChannels = numberOfChannels;
 }
@@ -2226,14 +2227,14 @@ static Any macSoundOrEmptyFileRecognizer (int nread, const char *header, MelderF
 
 static Any soundFileRecognizer (int nread, const char *header, MelderFile file) {
 	if (nread < 16) return NULL;
-	if (strnequ (header, "FORM", 4) && strnequ (header + 8, "AIF", 3)) return Sound_readFromSoundFile (file);
-	if (strnequ (header, "RIFF", 4) && (strnequ (header + 8, "WAVE", 4) || strnequ (header + 8, "CDDA", 4))) return Sound_readFromSoundFile (file);
-	if (strnequ (header, ".snd", 4)) return Sound_readFromSoundFile (file);
-	if (strnequ (header, "NIST_1A", 7)) return Sound_readFromSoundFile (file);
-	if (strnequ (header, "fLaC", 4)) return Sound_readFromSoundFile (file);   // Erez Volk, March 2007
+	if (strnequ (header, "FORM", 4) && strnequ (header + 8, "AIF", 3)) return Sound_readFromSoundFile (file).transfer();
+	if (strnequ (header, "RIFF", 4) && (strnequ (header + 8, "WAVE", 4) || strnequ (header + 8, "CDDA", 4))) return Sound_readFromSoundFile (file).transfer();
+	if (strnequ (header, ".snd", 4)) return Sound_readFromSoundFile (file).transfer();
+	if (strnequ (header, "NIST_1A", 7)) return Sound_readFromSoundFile (file).transfer();
+	if (strnequ (header, "fLaC", 4)) return Sound_readFromSoundFile (file).transfer();   // Erez Volk, March 2007
 	if ((Melder_stringMatchesCriterion (MelderFile_name (file), kMelder_string_ENDS_WITH, U".mp3") ||
 	     Melder_stringMatchesCriterion (MelderFile_name (file), kMelder_string_ENDS_WITH, U".MP3"))
-		&& mp3_recognize (nread, header)) return Sound_readFromSoundFile (file);   // Erez Volk, May 2007
+		&& mp3_recognize (nread, header)) return Sound_readFromSoundFile (file).transfer();   // Erez Volk, May 2007
 	return NULL;
 }
 
@@ -2257,17 +2258,17 @@ static Any sesamFileRecognizer (int nread, const char *header, MelderFile file)
 	(void) header;
 	if (nread < 512 || (! Melder_stringMatchesCriterion (fileName, kMelder_string_ENDS_WITH, U".sdf") &&
 	                    ! Melder_stringMatchesCriterion (fileName, kMelder_string_ENDS_WITH, U".SDF"))) return NULL;
-	return Sound_readFromSesamFile (file);
+	return Sound_readFromSesamFile (file).transfer();
 }
 
 static Any bellLabsFileRecognizer (int nread, const char *header, MelderFile file) {
 	if (nread < 16 || ! strnequ (& header [0], "SIG\n", 4)) return NULL;
-	return Sound_readFromBellLabsFile (file);
+	return Sound_readFromBellLabsFile (file).transfer();
 }
 
 static Any kayFileRecognizer (int nread, const char *header, MelderFile file) {
 	if (nread <= 12 || ! strnequ (& header [0], "FORMDS16", 8)) return NULL;
-	return Sound_readFromKayFile (file);
+	return Sound_readFromKayFile (file).transfer();
 }
 
 /***** override play and record buttons in manuals *****/
@@ -2277,7 +2278,7 @@ static int recordProc (double duration) {
 	if (last == melderSound) last = NULL;
 	forget (melderSound);
 	MelderAudio_stopPlaying (MelderAudio_IMPLICIT);
-	melderSound = Sound_recordFixedTime (1, 1.0, 0.5, 44100, duration);
+	melderSound = Sound_recordFixedTime (1, 1.0, 0.5, 44100, duration).transfer();
 	if (! melderSound) return 0;
 	last = melderSound;
 	return 1;
diff --git a/sys/praat.cpp b/sys/praat.cpp
index ad160ea..5b7a811 100644
--- a/sys/praat.cpp
+++ b/sys/praat.cpp
@@ -359,8 +359,6 @@ void praat_newWithFile (autoDaata me, MelderFile file, const char32 *myName) {
 
 	if (my classInfo == classCollection) {
 		praat_new_unpackCollection (me.static_cast_move<structCollection>(), myName);
-		//praat_new_unpackCollection (static_cast<Collection> (me.transfer()), myName);
-			// yuck; this should be done with move(), but how do we cast an autoDaata to autoCollection?
 		return;
 	}
 
@@ -1058,7 +1056,7 @@ static bool tryToAttachToTheCommandLine ()
 			} else if (err == ERROR_INVALID_HANDLE) {
 				(void) 0;   // a normal case: the parent process is Windows Explorer or so, which doesn't have a console (Windows XP, 10?)
 			} else if (err == ERROR_GEN_FAILURE) {
-				(void) 0;   // another normal case: there is no parent process (Windows 7)?
+				(void) 0;   // another normal case: there is no parent process (Windows 7?)
 			} else {
 				printf ("AttachConsole() returned unknown error %d\n", (int) err);
 				Melder_fatal (U"AttachConsole() returned unknown error ", err);
@@ -1081,7 +1079,7 @@ void praat_init (const char32 *title, unsigned int argc, char **argv)
 	}
 	#if defined (UNIX)
 		setlocale (LC_ALL, "C");
-		setenv ("PULSE_LATENCY_MSEC", "1", 0);   // Rafael Laboissiere, August 2014
+		//setenv ("PULSE_LATENCY_MSEC", "1", 0);   // Rafael Laboissiere, August 2014
 	#elif defined (_WIN32)
 		setlocale (LC_ALL, "C");   // said to be superfluous
 	#elif defined (macintosh)
@@ -1128,13 +1126,16 @@ void praat_init (const char32 *title, unsigned int argc, char **argv)
 	/*
 	 * Running Praat from the command line.
 	 */
-	bool foundTheOpenOption = false;
+	bool foundTheOpenOption = false, foundTheRunOption = false;
 	while (praatP.argumentNumber < argc && argv [praatP.argumentNumber] [0] == '-') {
 		if (strequ (argv [praatP.argumentNumber], "-")) {
 			praatP.hasCommandLineInput = true;
 		} else if (strequ (argv [praatP.argumentNumber], "--open")) {
 			foundTheOpenOption = true;
 			praatP.argumentNumber += 1;
+		} else if (strequ (argv [praatP.argumentNumber], "--run")) {
+			foundTheRunOption = true;
+			praatP.argumentNumber += 1;
 		} else if (strequ (argv [praatP.argumentNumber], "--no-pref-files")) {
 			praatP.ignorePreferenceFiles = true;
 			praatP.argumentNumber += 1;
@@ -1152,8 +1153,9 @@ void praat_init (const char32 *title, unsigned int argc, char **argv)
 		} else if (strequ (argv [praatP.argumentNumber], "--help")) {
 			printf ("Usage: praat [options] script-file-name [script-arguments]\n");
 			printf ("Options:\n");
-			printf ("  --open           interpret the command line arguments as files to be opened in the GUI,\n");
-			printf ("                   instead of as a script file name and its arguments\n");
+			printf ("  --open           interpret the command line arguments as files to be opened in the GUI\n");
+			printf ("  --run            interpret the command line arguments as a script file name and its arguments\n");
+			printf ("                   (--run is superfluous when you use a Console or Terminal window)\n");
 			printf ("  --no-pref-files  don't read or write the preferences file and the buttons file\n");
 			printf ("  --no-plugins     don't activate the plugins\n");
 			printf ("  --pref-dir=DIR   set the preferences directory to DIR\n");
@@ -1178,6 +1180,7 @@ void praat_init (const char32 *title, unsigned int argc, char **argv)
 			break;
 		}
 	}
+	weWereStartedFromTheCommandLine |= foundTheRunOption;   // some external system()-like commands don't make isatty return true, so we have to help
 
 	const bool thereIsAFileNameInTheArgumentList = ( praatP.argumentNumber < argc );
 	Melder_batch = weWereStartedFromTheCommandLine && thereIsAFileNameInTheArgumentList && ! foundTheOpenOption;
diff --git a/sys/praat_version.h b/sys/praat_version.h
index b8cb4d8..586df64 100644
--- a/sys/praat_version.h
+++ b/sys/praat_version.h
@@ -1,5 +1,5 @@
-#define PRAAT_VERSION_STR 6.0
-#define PRAAT_VERSION_NUM 6000
+#define PRAAT_VERSION_STR 6.0.03
+#define PRAAT_VERSION_NUM 6003
 #define PRAAT_YEAR 2015
 #define PRAAT_MONTH October
-#define PRAAT_DAY 28
+#define PRAAT_DAY 31

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/praat.git



More information about the debian-med-commit mailing list