[med-svn] [praat] 03/08: New upstream version 6.0.34

Rafael Laboissiere rafael at debian.org
Sun Oct 15 22:33:11 UTC 2017


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

rafael pushed a commit to branch master
in repository praat.

commit 8fd7eda8626c5d9169d8d283e33d1a8db410f91c
Author: Rafael Laboissiere <rafael at debian.org>
Date:   Sat Oct 14 02:57:12 2017 -0300

    New upstream version 6.0.34
---
 EEG/EEG.cpp                                      |  126 +--
 EEG/EEG.h                                        |   18 +-
 EEG/EEGWindow.cpp                                |    2 +-
 EEG/EEGWindow.h                                  |    4 +-
 EEG/EEGWindow_prefs.h                            |   44 +-
 EEG/EEG_def.h                                    |    4 +-
 EEG/ERP.cpp                                      |   16 +-
 EEG/ERP.h                                        |    6 +-
 EEG/ERPTier.cpp                                  |   92 +-
 EEG/ERPTier.h                                    |   14 +-
 EEG/ERPTier_def.h                                |    4 +-
 EEG/ERPWindow.cpp                                |  252 ++---
 EEG/ERPWindow.h                                  |    4 +-
 EEG/ERPWindow_prefs.h                            |   44 +-
 EEG/praat_EEG.cpp                                |   34 +-
 FFNet/FFNet.cpp                                  |   14 +-
 FFNet/FFNet_def.h                                |   30 +-
 FFNet/praat_FFNet_init.cpp                       |   18 +-
 LPC/Cepstrum.cpp                                 |   14 +-
 LPC/Cepstrum.h                                   |   10 +-
 LPC/praat_LPC_init.cpp                           |   45 +-
 artsynth/Art_Speaker_to_VocalTract.cpp           |    8 +-
 artsynth/ArtwordEditor.cpp                       |    8 +-
 artsynth/Artword_Speaker_to_Sound.cpp            |    6 +-
 artsynth/Delta.cpp                               |    4 +-
 artsynth/Delta.h                                 |   24 +-
 artsynth/Speaker_to_Delta.cpp                    |   36 +-
 artsynth/praat_Artsynth.cpp                      |   12 +-
 contrib/ola/FeatureWeights.cpp                   |  124 +--
 contrib/ola/FeatureWeights.h                     |   16 +-
 contrib/ola/KNN.cpp                              |  492 ++++-----
 contrib/ola/KNN.h                                |  130 ++-
 contrib/ola/KNN_def.h                            |    2 +-
 contrib/ola/KNN_prune.cpp                        |  104 +-
 contrib/ola/KNN_prune.h                          |   44 +-
 contrib/ola/Pattern_to_Categories_cluster.cpp    |   36 +-
 contrib/ola/Pattern_to_Categories_cluster.h      |    6 +-
 contrib/ola/praat_contrib_Ola_KNN.cpp            |   28 +-
 dwsys/Collection_extensions.cpp                  |    2 +-
 dwsys/Eigen.cpp                                  |  140 +--
 dwsys/Eigen.h                                    |   30 +-
 dwsys/Eigen_def.h                                |    4 +-
 dwsys/Index.cpp                                  |    2 +-
 dwsys/Index_def.h                                |    4 +-
 dwsys/NUM2.cpp                                   |  732 ++++++------
 dwsys/NUM2.h                                     |  226 ++--
 dwsys/NUMcblas.cpp                               |  250 ++---
 dwsys/NUMcblas.h                                 |   52 +-
 dwsys/NUMclapack.cpp                             | 1286 +++++++++++-----------
 dwsys/NUMclapack.h                               |  334 +++---
 dwsys/NUMf2c.cpp                                 |   22 +-
 dwsys/NUMf2c.h                                   |   17 +-
 dwsys/NUMfft_core.h                              |   81 +-
 dwsys/NUMfft_d.cpp                               |   16 +-
 dwsys/NUMlapack.cpp                              |  230 ++--
 dwsys/NUMlapack.h                                |   48 +-
 dwsys/NUMsort2.cpp                               |   20 +-
 dwsys/NUMstring.cpp                              |   68 +-
 dwsys/Permutation.cpp                            |   10 +-
 dwsys/Permutation_def.h                          |    4 +-
 dwsys/SVD.cpp                                    |   36 +-
 dwsys/SVD_def.h                                  |    6 +-
 dwsys/SimpleVector_def.h                         |    8 +-
 dwtools/ActivationList.cpp                       |   19 +-
 dwtools/ActivationList.h                         |   38 +-
 dwtools/AffineTransform_def.h                    |    2 +-
 dwtools/CCA_def.h                                |    4 +-
 dwtools/CC_def.h                                 |    4 +-
 dwtools/CategoriesEditor.cpp                     |  128 +--
 dwtools/Configuration_def.h                      |    2 +-
 dwtools/Confusion.cpp                            |    2 +-
 dwtools/DTW_def.h                                |   12 +-
 dwtools/DataModeler.cpp                          |   42 +-
 dwtools/DataModeler_def.h                        |    4 +-
 dwtools/Discriminant_def.h                       |    6 +-
 dwtools/EEG_extensions.cpp                       |   74 +-
 dwtools/EEG_extensions.h                         |   10 +-
 dwtools/EditDistanceTable_def.h                  |    8 +-
 dwtools/Eigen_and_Matrix.cpp                     |   14 +-
 dwtools/Eigen_and_Matrix.h                       |   20 +-
 dwtools/GaussianMixture_def.h                    |    4 +-
 dwtools/HMM.cpp                                  |  484 ++++----
 dwtools/HMM.h                                    |   48 +-
 dwtools/HMM_def.h                                |   16 +-
 dwtools/KlattGrid.cpp                            |   12 +-
 dwtools/KlattGridEditors.h                       |   56 +-
 dwtools/KlattGrid_def.h                          |   32 +-
 dwtools/LongSound_extensions.cpp                 |    3 +-
 dwtools/MDS.cpp                                  |  737 ++++++-------
 dwtools/MDS.h                                    |  112 +-
 dwtools/OptimalCeilingTierEditor.h               |    8 +-
 dwtools/PCA_def.h                                |    2 +-
 dwtools/Polynomial.cpp                           |   16 +-
 dwtools/Polynomial_def.h                         |    8 +-
 dwtools/SPINET_def.h                             |    2 +-
 dwtools/SSCP.cpp                                 |   22 +-
 dwtools/SSCP.h                                   |    2 +-
 dwtools/SSCP_def.h                               |    2 +-
 dwtools/Sound_and_PCA.cpp                        |   48 +-
 dwtools/Sound_and_PCA.h                          |   17 +-
 dwtools/Sound_extensions.cpp                     |    8 +-
 dwtools/Spectrogram_extensions.cpp               |    2 +-
 dwtools/Spectrogram_extensions.h                 |    2 +-
 dwtools/SpeechSynthesizer.cpp                    |   16 +-
 dwtools/SpeechSynthesizer_def.h                  |   33 +-
 dwtools/Strings_extensions.cpp                   |   62 +-
 dwtools/Strings_extensions.h                     |   16 +-
 dwtools/TableOfReal_extensions.cpp               |   42 +-
 dwtools/TableOfReal_extensions.h                 |   12 +-
 dwtools/Table_extensions.cpp                     |  102 +-
 dwtools/TextGrid_extensions.cpp                  |   14 +-
 dwtools/TextGrid_extensions.h                    |    6 +-
 dwtools/VowelEditor.cpp                          |  156 ++-
 dwtools/praat_BSS_init.cpp                       |   50 +-
 dwtools/praat_DataModeler_init.cpp               |   78 +-
 dwtools/praat_David_init.cpp                     |  383 +++----
 dwtools/praat_HMM_init.cpp                       |    4 +-
 dwtools/praat_KlattGrid_init.cpp                 |   15 +-
 dwtools/praat_MDS_init.cpp                       |   55 +-
 external/gsl/Makefile                            |    5 +-
 external/mp3/mp3.h                               |    5 +-
 fon/AmplitudeTierEditor.h                        |    8 +-
 fon/AnyTier.cpp                                  |   44 +-
 fon/AnyTier.h                                    |   10 +-
 fon/Cochleagram_and_Excitation.cpp               |    6 +-
 fon/DurationTier.cpp                             |    4 +-
 fon/DurationTierEditor.h                         |    8 +-
 fon/Excitation.cpp                               |   26 +-
 fon/Excitation.h                                 |    6 +-
 fon/Excitation_to_Formant.cpp                    |   30 +-
 fon/Excitation_to_Formant.h                      |    4 +-
 fon/ExperimentMFC.cpp                            |   94 +-
 fon/ExperimentMFC.h                              |    8 +-
 fon/ExperimentMFC_def.h                          |   22 +-
 fon/Formant.cpp                                  |  124 +--
 fon/Formant.h                                    |   67 +-
 fon/FormantGrid.cpp                              |    4 +-
 fon/FormantGridEditor.cpp                        |   80 +-
 fon/FormantGrid_def.h                            |    8 +-
 fon/Formant_def.h                                |    2 +-
 fon/{Excitation_to_Formant.h => Formant_enums.h} |   14 +-
 fon/FunctionEditor.cpp                           |   85 +-
 fon/Function_def.h                               |   22 +-
 fon/Harmonics_def.h                              |    2 +-
 fon/Image_def.h                                  |    4 +-
 fon/Intensity.cpp                                |   12 +-
 fon/Intensity.h                                  |   12 +-
 fon/IntensityTierEditor.h                        |    8 +-
 fon/Label.cpp                                    |    8 +-
 fon/LongSound.cpp                                |   34 +-
 fon/LongSound.h                                  |    8 +-
 fon/Ltas.cpp                                     |   10 +-
 fon/Ltas.h                                       |    8 +-
 fon/ManipulationEditor.cpp                       |  101 +-
 fon/ManipulationEditor_prefs.h                   |   20 +-
 fon/Matrix.cpp                                   |    4 +-
 fon/Matrix_def.h                                 |    6 +-
 fon/MovieWindow.cpp                              |    6 +-
 fon/ParamCurve.cpp                               |    2 +-
 fon/ParamCurve.h                                 |    4 +-
 fon/Photo_def.h                                  |    4 +-
 fon/Pitch.cpp                                    |   28 +-
 fon/Pitch.h                                      |    1 -
 fon/PitchEditor.cpp                              |   38 +-
 fon/PitchTierEditor.h                            |    8 +-
 fon/Pitch_def.h                                  |   20 +-
 fon/PointEditor.cpp                              |    8 +-
 fon/PointProcess_def.h                           |    6 +-
 fon/Polygon_def.h                                |    4 +-
 fon/Praat_tests.cpp                              |    8 +-
 fon/RealTier.cpp                                 |    4 +-
 fon/RealTierEditor.cpp                           |   43 +-
 fon/RealTierEditor.h                             |    3 -
 fon/RealTier_def.h                               |   10 +-
 fon/RunnerMFC.cpp                                |   14 +-
 fon/RunnerMFC.h                                  |    4 +-
 fon/SampledXY.cpp                                |    4 +-
 fon/SampledXY_def.h                              |    2 +-
 fon/Sampled_def.h                                |    4 +-
 fon/Sound.cpp                                    |    8 +-
 fon/Sound.h                                      |    2 +-
 fon/SoundEditor.cpp                              |   22 +-
 fon/SoundRecorder.cpp                            |   62 +-
 fon/SoundRecorder.h                              |    6 +-
 fon/Sound_audio.cpp                              |    2 +-
 fon/Sound_files.cpp                              |    3 +-
 fon/SpectrogramEditor.cpp                        |    6 +-
 fon/Spectrum.cpp                                 |    2 +-
 fon/SpectrumEditor.cpp                           |   18 +-
 fon/SpectrumTier.h                               |    4 +-
 fon/Spectrum_def.h                               |    4 +-
 fon/SpellingChecker.cpp                          |    2 +-
 fon/SpellingChecker.h                            |    4 +-
 fon/TextGridEditor.cpp                           |  179 +--
 fon/TimeSoundAnalysisEditor.cpp                  |  501 +++++----
 fon/TimeSoundAnalysisEditor_prefs.h              |  120 +-
 fon/TimeSoundEditor.cpp                          |  125 ++-
 fon/TimeSoundEditor.h                            |    6 +-
 fon/Transition_def.h                             |    4 +-
 fon/Vector.cpp                                   |   80 +-
 fon/Vector.h                                     |   26 +-
 fon/WordList_def.h                               |    4 +-
 fon/manual_Script.cpp                            |   89 +-
 fon/manual_tutorials.cpp                         |    5 +-
 fon/praat_ExperimentMFC.cpp                      |    2 +-
 fon/praat_Fon.cpp                                |  179 ++-
 fon/praat_Matrix.cpp                             |   71 +-
 fon/praat_Sound.cpp                              |   78 +-
 fon/praat_TextGrid_init.cpp                      |   54 +-
 fon/praat_Tiers.cpp                              |   80 +-
 gram/Network_def.h                               |    8 +-
 gram/OTGrammar.cpp                               |    9 +-
 gram/OTGrammar.h                                 |    8 +-
 gram/OTGrammarEditor.cpp                         |   76 +-
 gram/OTGrammar_def.h                             |   18 +-
 gram/OTGrammar_enums.h                           |   18 +
 gram/OTGrammar_ex_metrics.cpp                    |    8 +-
 gram/OTGrammar_ex_tongueRoot.cpp                 |   18 +-
 gram/OTMulti.cpp                                 |   12 +-
 gram/OTMulti.h                                   |    6 +-
 gram/OTMultiEditor.cpp                           |   36 +-
 gram/OTMulti_def.h                               |    8 +-
 gram/OTMulti_ex_metrics.cpp                      |    8 +-
 gram/RBM_def.h                                   |    4 +-
 gram/manual_gram.cpp                             |   17 +-
 gram/praat_gram.cpp                              |   50 +-
 kar/Makefile                                     |    6 +-
 kar/longchar.cpp                                 |    4 +-
 kar/longchar.h                                   |    3 +-
 num/NUM.cpp                                      |  152 ++-
 num/NUMarrays.cpp                                |    1 +
 num/NUMlinprog.cpp                               |    6 +-
 num/NUMrandom.cpp                                |    6 +-
 num/NUMsort.cpp                                  |   20 +-
 stat/Regression_def.h                            |    4 +-
 stat/Table.cpp                                   |    6 +-
 stat/TableEditor.cpp                             |    6 +-
 stat/TableOfReal.cpp                             |    6 +-
 stat/TableOfReal_def.h                           |   12 +-
 stat/Table_def.h                                 |   14 +-
 stat/praat_Stat.cpp                              |   41 +-
 stat/praat_TableOfReal.cpp                       |   25 +-
 sys/ButtonEditor.cpp                             |   22 +-
 sys/Collection.cpp                               |   22 +-
 sys/Collection.h                                 |  104 +-
 sys/Data.cpp                                     |   26 +-
 sys/Data.h                                       |   96 +-
 sys/DataEditor.cpp                               |   55 +-
 sys/DataEditor.h                                 |   14 +-
 sys/DemoEditor.h                                 |    2 +-
 sys/Editor.cpp                                   |   57 +-
 sys/Editor.h                                     |    8 +-
 sys/EditorM.h                                    |  316 ++++--
 sys/Formula.cpp                                  |  264 ++---
 sys/Formula.h                                    |    2 +-
 sys/Graphics.cpp                                 |   10 +-
 sys/Graphics.h                                   |   68 +-
 sys/GraphicsP.h                                  |   14 +-
 sys/GraphicsScreen.cpp                           |    8 +-
 sys/Graphics_altitude.cpp                        |   16 +-
 sys/Graphics_colour.cpp                          |    6 +-
 sys/Graphics_grey.cpp                            |    6 +-
 sys/Graphics_image.cpp                           |  124 +--
 sys/Graphics_linesAndAreas.cpp                   |   96 +-
 sys/Graphics_record.cpp                          |   72 +-
 sys/Graphics_surface.cpp                         |   16 +-
 sys/Graphics_text.cpp                            |   52 +-
 sys/Gui.h                                        |   46 +-
 sys/GuiList.cpp                                  |   50 +-
 sys/GuiP.h                                       |   10 +-
 sys/GuiText.cpp                                  |   80 +-
 sys/GuiWindow.cpp                                |    2 +-
 sys/HyperPage.cpp                                |   66 +-
 sys/HyperPage.h                                  |   18 +-
 sys/Interpreter.cpp                              |   74 +-
 sys/Interpreter.h                                |    4 +-
 sys/ManPage.h                                    |    6 +-
 sys/ManPages.cpp                                 |   73 +-
 sys/ManPages.h                                   |   12 +-
 sys/ManPagesM.h                                  |    2 +-
 sys/Manual.cpp                                   |  109 +-
 sys/Manual.h                                     |   10 +-
 sys/MelderGui.cpp                                |    4 +-
 sys/Preferences.cpp                              |   44 +-
 sys/Preferences.h                                |   26 +-
 sys/ScriptEditor.cpp                             |   84 +-
 sys/Simple.cpp                                   |    8 +-
 sys/Simple.h                                     |    4 +-
 sys/Simple_def.h                                 |    8 +-
 sys/Strings.cpp                                  |   42 +-
 sys/StringsEditor.cpp                            |   14 +-
 sys/Strings_.h                                   |    8 +-
 sys/Strings_def.h                                |    6 +-
 sys/TextEditor.cpp                               |   69 +-
 sys/Thing.cpp                                    |   21 +-
 sys/Thing.h                                      |   26 +-
 sys/Ui.cpp                                       |  742 +++++++------
 sys/Ui.h                                         |  178 +--
 sys/UiFile.cpp                                   |    2 +-
 sys/UiPause.cpp                                  |   22 +-
 sys/abcio.cpp                                    |    6 +-
 sys/abcio.h                                      |   14 +-
 sys/enums.h                                      |    2 +-
 sys/enums_getValue.h                             |    4 +-
 sys/melder.cpp                                   |    6 +-
 sys/melder.h                                     |  120 +-
 sys/melder_audio.cpp                             |   82 +-
 sys/melder_audiofiles.cpp                        |  226 ++--
 sys/melder_debug.cpp                             |    2 +-
 sys/melder_files.cpp                             |   16 +-
 sys/melder_ftoa.cpp                              |   18 +-
 sys/melder_readtext.cpp                          |   34 +-
 sys/melder_strings.cpp                           |    2 +-
 sys/melder_sysenv.cpp                            |    2 +-
 sys/melder_textencoding.cpp                      |   56 +-
 sys/melder_token.cpp                             |   14 +-
 sys/motifEmulator.cpp                            |   24 +-
 sys/oo.h                                         |   30 +-
 sys/oo_CAN_WRITE_AS_ENCODING.h                   |   12 +-
 sys/oo_COPY.h                                    |   10 +-
 sys/oo_DESCRIPTION.h                             |   68 +-
 sys/oo_DESTROY.h                                 |    8 +-
 sys/oo_EQUAL.h                                   |   10 +-
 sys/oo_READ_BINARY.h                             |    8 +-
 sys/oo_READ_TEXT.h                               |   28 +-
 sys/oo_WRITE_BINARY.h                            |   12 +-
 sys/oo_WRITE_TEXT.h                              |   14 +-
 sys/praat.cpp                                    |   83 +-
 sys/praat.h                                      |  273 +++--
 sys/praatP.h                                     |   14 +-
 sys/praat_actions.cpp                            |   62 +-
 sys/praat_menuCommands.cpp                       |   56 +-
 sys/praat_objectMenus.cpp                        |   63 +-
 sys/praat_picture.cpp                            |  359 +++---
 sys/praat_script.cpp                             |   28 +-
 sys/praat_statistics.cpp                         |   15 +-
 sys/praat_version.h                              |    8 +-
 sys/prefs.h                                      |   10 +-
 sys/prefs_copyToInstance.h                       |   12 +-
 sys/prefs_define.h                               |   16 +-
 sys/prefs_install.h                              |   18 +-
 test/createPraatTests.praat                      |   25 +-
 test/fon/manual_Script.cpp.praat                 |   39 +
 test/stat/logisticRegression.praat               |    2 +-
 test/sys/Formula.cpp.praat                       |    2 +-
 test/sys/melder_ftoa.cpp.praat                   |    8 +
 test/sys/praat_statistics.cpp.praat              |   12 +
 347 files changed, 8735 insertions(+), 8635 deletions(-)

diff --git a/EEG/EEG.cpp b/EEG/EEG.cpp
index 976b7a3..78c6728 100644
--- a/EEG/EEG.cpp
+++ b/EEG/EEG.cpp
@@ -85,8 +85,8 @@ autoEEG EEG_create (double tmin, double tmax) {
 	}
 }
 
-long EEG_getChannelNumber (EEG me, const char32 *channelName) {
-	for (long ichan = 1; ichan <= my numberOfChannels; ichan ++) {
+integer EEG_getChannelNumber (EEG me, const char32 *channelName) {
+	for (integer ichan = 1; ichan <= my numberOfChannels; ichan ++) {
 		if (Melder_equ (my channelNames [ichan], channelName)) {
 			return ichan;
 		}
@@ -109,24 +109,24 @@ autoEEG EEG_readFromBdfFile (MelderFile file) {
 		fread (buffer, 1, 8, f); buffer [8] = '\0';
 		trace (U"Start time of recording: \"", Melder_peek8to32 (buffer), U"\"");
 		fread (buffer, 1, 8, f); buffer [8] = '\0';
-		long numberOfBytesInHeaderRecord = atol (buffer);
+		integer numberOfBytesInHeaderRecord = atol (buffer);
 		trace (U"Number of bytes in header record: ", numberOfBytesInHeaderRecord);
 		fread (buffer, 1, 44, f); buffer [44] = '\0';
 		trace (U"Version of data format: \"", Melder_peek8to32 (buffer), U"\"");
 		fread (buffer, 1, 8, f); buffer [8] = '\0';
-		long numberOfDataRecords = strtol (buffer, nullptr, 10);
+		integer numberOfDataRecords = strtol (buffer, nullptr, 10);
 		trace (U"Number of data records: ", numberOfDataRecords);
 		fread (buffer, 1, 8, f); buffer [8] = '\0';
 		double durationOfDataRecord = atof (buffer);
 		trace (U"Duration of a data record: ", durationOfDataRecord);
 		fread (buffer, 1, 4, f); buffer [4] = '\0';
-		long numberOfChannels = atol (buffer);
+		integer numberOfChannels = atol (buffer);
 		trace (U"Number of channels in data record: ", numberOfChannels);
 		if (numberOfBytesInHeaderRecord != (numberOfChannels + 1) * 256)
 			Melder_throw (U"Number of bytes in header record (", numberOfBytesInHeaderRecord,
 				U") doesn't match number of channels (", numberOfChannels, U").");
 		autostring32vector channelNames (1, numberOfChannels);
-		for (long ichannel = 1; ichannel <= numberOfChannels; ichannel ++) {
+		for (integer ichannel = 1; ichannel <= numberOfChannels; ichannel ++) {
 			fread (buffer, 1, 16, f); buffer [16] = '\0';   // labels of the channels
 			/*
 			 * Strip all final spaces.
@@ -143,39 +143,39 @@ autoEEG EEG_readFromBdfFile (MelderFile file) {
 		}
 		bool hasLetters = str32equ (channelNames [numberOfChannels], U"EDF Annotations");
 		double samplingFrequency = undefined;
-		for (long channel = 1; channel <= numberOfChannels; channel ++) {
+		for (integer channel = 1; channel <= numberOfChannels; channel ++) {
 			fread (buffer, 1, 80, f); buffer [80] = '\0';   // transducer type
 		}
-		for (long channel = 1; channel <= numberOfChannels; channel ++) {
+		for (integer channel = 1; channel <= numberOfChannels; channel ++) {
 			fread (buffer, 1, 8, f); buffer [8] = '\0';   // physical dimension of channels
 		}
 		autoNUMvector <double> physicalMinimum (1, numberOfChannels);
-		for (long ichannel = 1; ichannel <= numberOfChannels; ichannel ++) {
+		for (integer ichannel = 1; ichannel <= numberOfChannels; ichannel ++) {
 			fread (buffer, 1, 8, f); buffer [8] = '\0';
 			physicalMinimum [ichannel] = atof (buffer);
 		}
 		autoNUMvector <double> physicalMaximum (1, numberOfChannels);
-		for (long ichannel = 1; ichannel <= numberOfChannels; ichannel ++) {
+		for (integer ichannel = 1; ichannel <= numberOfChannels; ichannel ++) {
 			fread (buffer, 1, 8, f); buffer [8] = '\0';
 			physicalMaximum [ichannel] = atof (buffer);
 		}
 		autoNUMvector <double> digitalMinimum (1, numberOfChannels);
-		for (long ichannel = 1; ichannel <= numberOfChannels; ichannel ++) {
+		for (integer ichannel = 1; ichannel <= numberOfChannels; ichannel ++) {
 			fread (buffer, 1, 8, f); buffer [8] = '\0';
 			digitalMinimum [ichannel] = atof (buffer);
 		}
 		autoNUMvector <double> digitalMaximum (1, numberOfChannels);
-		for (long ichannel = 1; ichannel <= numberOfChannels; ichannel ++) {
+		for (integer ichannel = 1; ichannel <= numberOfChannels; ichannel ++) {
 			fread (buffer, 1, 8, f); buffer [8] = '\0';
 			digitalMaximum [ichannel] = atof (buffer);
 		}
-		for (long channel = 1; channel <= numberOfChannels; channel ++) {
+		for (integer channel = 1; channel <= numberOfChannels; channel ++) {
 			fread (buffer, 1, 80, f); buffer [80] = '\0';   // prefiltering
 		}
-		long numberOfSamplesPerDataRecord = 0;
-		for (long channel = 1; channel <= numberOfChannels; channel ++) {
+		integer numberOfSamplesPerDataRecord = 0;
+		for (integer channel = 1; channel <= numberOfChannels; channel ++) {
 			fread (buffer, 1, 8, f); buffer [8] = '\0';   // number of samples in each data record
-			long numberOfSamplesInThisDataRecord = atol (buffer);
+			integer numberOfSamplesInThisDataRecord = atol (buffer);
 			if (isundef (samplingFrequency)) {
 				numberOfSamplesPerDataRecord = numberOfSamplesInThisDataRecord;
 				samplingFrequency = numberOfSamplesInThisDataRecord / durationOfDataRecord;
@@ -185,7 +185,7 @@ autoEEG EEG_readFromBdfFile (MelderFile file) {
 					U" (", numberOfSamplesInThisDataRecord,
 					U") doesn't match sampling frequency of channel 1 (", samplingFrequency, U").");
 		}
-		for (long channel = 1; channel <= numberOfChannels; channel ++) {
+		for (integer channel = 1; channel <= numberOfChannels; channel ++) {
 			fread (buffer, 1, 32, f); buffer [32] = '\0';   // reserved
 		}
 		double duration = numberOfDataRecords * durationOfDataRecord;
@@ -194,15 +194,15 @@ autoEEG EEG_readFromBdfFile (MelderFile file) {
 		autoSound me = Sound_createSimple (numberOfChannels, duration, samplingFrequency);
 		Melder_assert (my nx == numberOfSamplesPerDataRecord * numberOfDataRecords);
 		autoNUMvector <unsigned char> dataBuffer ((integer) 0, 3 * numberOfSamplesPerDataRecord - 1);
-		for (long record = 1; record <= numberOfDataRecords; record ++) {
-			for (long channel = 1; channel <= numberOfChannels; channel ++) {
+		for (integer record = 1; record <= numberOfDataRecords; record ++) {
+			for (integer channel = 1; channel <= numberOfChannels; channel ++) {
 				double factor = channel == numberOfChannels ? 1.0 : physicalMinimum [channel] / digitalMinimum [channel];
 				if (channel < numberOfChannels - EEG_getNumberOfExtraSensors (him.get())) factor /= 1000000.0;
 				if (is24bit) {
-					fread (& dataBuffer [0], 3, numberOfSamplesPerDataRecord, f);
+					fread (& dataBuffer [0], 3, (size_t) numberOfSamplesPerDataRecord, f);
 					unsigned char *p = & dataBuffer [0];
-					for (long i = 1; i <= numberOfSamplesPerDataRecord; i ++) {
-						long sample = i + (record - 1) * numberOfSamplesPerDataRecord;
+					for (integer i = 1; i <= numberOfSamplesPerDataRecord; i ++) {
+						integer sample = i + (record - 1) * numberOfSamplesPerDataRecord;
 						Melder_assert (sample <= my nx);
 						uint8_t lowByte = *p ++, midByte = *p ++, highByte = *p ++;
 						uint32_t externalValue = ((uint32_t) highByte << 16) | ((uint32_t) midByte << 8) | (uint32_t) lowByte;
@@ -211,10 +211,10 @@ autoEEG EEG_readFromBdfFile (MelderFile file) {
 						my z [channel] [sample] = (int32_t) externalValue * factor;
 					}
 				} else {
-					fread (& dataBuffer [0], 2, numberOfSamplesPerDataRecord, f);
+					fread (& dataBuffer [0], 2, (size_t) numberOfSamplesPerDataRecord, f);
 					unsigned char *p = & dataBuffer [0];
-					for (long i = 1; i <= numberOfSamplesPerDataRecord; i ++) {
-						long sample = i + (record - 1) * numberOfSamplesPerDataRecord;
+					for (integer i = 1; i <= numberOfSamplesPerDataRecord; i ++) {
+						integer sample = i + (record - 1) * numberOfSamplesPerDataRecord;
 						Melder_assert (sample <= my nx);
 						uint8 lowByte = *p ++, highByte = *p ++;
 						uint16 externalValue = (uint16) ((uint16) highByte << 8) | (uint16) lowByte;
@@ -224,8 +224,8 @@ autoEEG EEG_readFromBdfFile (MelderFile file) {
 			}
 		}
 		int numberOfStatusBits = 8;
-		for (long i = 1; i <= my nx; i ++) {
-			unsigned long value = (long) my z [numberOfChannels] [i];
+		for (integer i = 1; i <= my nx; i ++) {
+			uint32 value = (uint32) (int32) my z [numberOfChannels] [i];
 			if (value & 0x0000FF00) {
 				numberOfStatusBits = 16;
 			}
@@ -235,10 +235,10 @@ autoEEG EEG_readFromBdfFile (MelderFile file) {
 			thee = TextGrid_create (0, duration, U"Mark Trigger", U"Mark Trigger");
 			autoMelderString letters;
 			double time = undefined;
-			for (long i = 1; i <= my nx; i ++) {
-				unsigned long value = (long) my z [numberOfChannels] [i];
+			for (integer i = 1; i <= my nx; i ++) {
+				uint32 value = (uint32) (int32) my z [numberOfChannels] [i];
 				for (int byte = 1; byte <= numberOfStatusBits / 8; byte ++) {
-					unsigned long mask = byte == 1 ? 0x000000ff : 0x0000ff00;
+					uint32 mask = byte == 1 ? 0x000000ff : 0x0000ff00;
 					char32 kar = byte == 1 ? (value & mask) : (value & mask) >> 8;
 					if (kar != U'\0' && kar != 20) {
 						MelderString_appendCharacter (& letters, kar);
@@ -289,8 +289,8 @@ autoEEG EEG_readFromBdfFile (MelderFile file) {
 				unsigned long bitValue = 1 << (bit - 1);
 				IntervalTier tier = (IntervalTier) thy tiers->at [bit];
 				for (long i = 1; i <= my nx; i ++) {
-					unsigned long previousValue = i == 1 ? 0 : (long) my z [numberOfChannels] [i - 1];
-					unsigned long thisValue = (long) my z [numberOfChannels] [i];
+					uint32 previousValue = i == 1 ? 0 : (uint32) (int32) my z [numberOfChannels] [i - 1];
+					uint32 thisValue = (uint32) (int32) my z [numberOfChannels] [i];
 					if ((thisValue & bitValue) != (previousValue & bitValue)) {
 						double time = i == 1 ? 0.0 : my x1 + (i - 1.5) * my dx;
 						if (time != 0.0)
@@ -410,16 +410,16 @@ autoEEG EEG_readFromBdfFile (MelderFile file) {
 	}
 }
 
-static void detrend (double *a, long numberOfSamples) {
+static void detrend (double *a, integer numberOfSamples) {
 	double firstValue = a [1], lastValue = a [numberOfSamples];
 	a [1] = a [numberOfSamples] = 0.0;
-	for (long isamp = 2; isamp < numberOfSamples; isamp ++) {
+	for (integer isamp = 2; isamp < numberOfSamples; isamp ++) {
 		a [isamp] -= ((isamp - 1.0) * lastValue + (numberOfSamples - isamp) * firstValue) / (numberOfSamples - 1);
 	}
 }
 
 void EEG_detrend (EEG me) {
-	for (long ichan = 1; ichan <= my numberOfChannels - EEG_getNumberOfExtraSensors (me); ichan ++) {
+	for (integer ichan = 1; ichan <= my numberOfChannels - EEG_getNumberOfExtraSensors (me); ichan ++) {
 		detrend (my sound -> z [ichan], my sound -> nx);
 	}
 }
@@ -427,13 +427,13 @@ void EEG_detrend (EEG me) {
 void EEG_filter (EEG me, double lowFrequency, double lowWidth, double highFrequency, double highWidth, bool doNotch50Hz) {
 	try {
 /*
-	long nsampFFT = 1;
+	integer nsampFFT = 1;
 	while (nsampFFT < my sound -> nx)
 		nsampFFT *= 2;
 	autoNUMfft_Table fftTable;
 	NUMfft_Table_init (& fftTable, nsampFFT);
 */
-		for (long ichan = 1; ichan <= my numberOfChannels - EEG_getNumberOfExtraSensors (me); ichan ++) {
+		for (integer ichan = 1; ichan <= my numberOfChannels - EEG_getNumberOfExtraSensors (me); ichan ++) {
 			autoSound channel = Sound_extractChannel (my sound.get(), ichan);
 			autoSpectrum spec = Sound_to_Spectrum (channel.get(), true);
 			Spectrum_passHannBand (spec.get(), lowFrequency, 0.0, lowWidth);
@@ -449,7 +449,7 @@ void EEG_filter (EEG me, double lowFrequency, double lowWidth, double highFreque
 	}
 }
 
-void EEG_setChannelName (EEG me, long channelNumber, const char32 *a_name) {
+void EEG_setChannelName (EEG me, integer channelNumber, const char32 *a_name) {
 	autostring32 l_name = Melder_dup (a_name);
 	Melder_free (my channelNames [channelNumber]);
 	my channelNames [channelNumber] = l_name.transfer();
@@ -461,7 +461,7 @@ void EEG_setExternalElectrodeNames (EEG me,
 {
 	if (EEG_getNumberOfExternalElectrodes (me) != 8)
 		Melder_throw (U"There aren't 8 external electrodes.");
-	const long firstExternalElectrode = EEG_getNumberOfCapElectrodes (me) + 1;
+	const integer firstExternalElectrode = EEG_getNumberOfCapElectrodes (me) + 1;
 	EEG_setChannelName (me, firstExternalElectrode, nameExg1);
 	EEG_setChannelName (me, firstExternalElectrode + 1, nameExg2);
 	EEG_setChannelName (me, firstExternalElectrode + 2, nameExg3);
@@ -473,49 +473,49 @@ void EEG_setExternalElectrodeNames (EEG me,
 }
 
 void EEG_subtractReference (EEG me, const char32 *channelNumber1_text, const char32 *channelNumber2_text) {
-	long channelNumber1 = EEG_getChannelNumber (me, channelNumber1_text);
+	integer channelNumber1 = EEG_getChannelNumber (me, channelNumber1_text);
 	if (channelNumber1 == 0)
 		Melder_throw (me, U": no channel named \"", channelNumber1_text, U"\".");
-	long channelNumber2 = EEG_getChannelNumber (me, channelNumber2_text);
+	integer channelNumber2 = EEG_getChannelNumber (me, channelNumber2_text);
 	if (channelNumber2 == 0 && channelNumber2_text [0] != '\0')
 		Melder_throw (me, U": no channel named \"", channelNumber2_text, U"\".");
-	const long numberOfElectrodeChannels = my numberOfChannels - EEG_getNumberOfExtraSensors (me);
-	for (long isamp = 1; isamp <= my sound -> nx; isamp ++) {
+	const integer numberOfElectrodeChannels = my numberOfChannels - EEG_getNumberOfExtraSensors (me);
+	for (integer isamp = 1; isamp <= my sound -> nx; isamp ++) {
 		double referenceValue = channelNumber2 == 0 ? my sound -> z [channelNumber1] [isamp] :
 			0.5 * (my sound -> z [channelNumber1] [isamp] + my sound -> z [channelNumber2] [isamp]);
-		for (long ichan = 1; ichan <= numberOfElectrodeChannels; ichan ++) {
+		for (integer ichan = 1; ichan <= numberOfElectrodeChannels; ichan ++) {
 			my sound -> z [ichan] [isamp] -= referenceValue;
 		}
 	}
 }
 
-void EEG_subtractMeanChannel (EEG me, long fromChannel, long toChannel) {
+void EEG_subtractMeanChannel (EEG me, integer fromChannel, integer toChannel) {
 	if (fromChannel < 1 || fromChannel > my numberOfChannels)
 		Melder_throw (U"No channel ", fromChannel, U".");
 	if (toChannel < 1 || toChannel > my numberOfChannels)
 		Melder_throw (U"No channel ", toChannel, U".");
 	if (fromChannel > toChannel)
 		Melder_throw (U"Channel range cannot run from ", fromChannel, U" to ", toChannel, U". Please reverse.");
-	const long numberOfElectrodeChannels = my numberOfChannels - EEG_getNumberOfExtraSensors (me);
-	for (long isamp = 1; isamp <= my sound -> nx; isamp ++) {
+	const integer numberOfElectrodeChannels = my numberOfChannels - EEG_getNumberOfExtraSensors (me);
+	for (integer isamp = 1; isamp <= my sound -> nx; isamp ++) {
 		double referenceValue = 0.0;
-		for (long ichan = fromChannel; ichan <= toChannel; ichan ++) {
+		for (integer ichan = fromChannel; ichan <= toChannel; ichan ++) {
 			referenceValue += my sound -> z [ichan] [isamp];
 		}
 		referenceValue /= (toChannel - fromChannel + 1);
-		for (long ichan = 1; ichan <= numberOfElectrodeChannels; ichan ++) {
+		for (integer ichan = 1; ichan <= numberOfElectrodeChannels; ichan ++) {
 			my sound -> z [ichan] [isamp] -= referenceValue;
 		}
 	}
 }
 
-void EEG_setChannelToZero (EEG me, long channelNumber) {
+void EEG_setChannelToZero (EEG me, integer channelNumber) {
 	try {
 		if (channelNumber < 1 || channelNumber > my numberOfChannels)
 			Melder_throw (U"No channel ", channelNumber, U".");
-		long numberOfSamples = my sound -> nx;
+		integer numberOfSamples = my sound -> nx;
 		double *channel = my sound -> z [channelNumber];
-		for (long isample = 1; isample <= numberOfSamples; isample ++) {
+		for (integer isample = 1; isample <= numberOfSamples; isample ++) {
 			channel [isample] = 0.0;
 		}
 	} catch (MelderError) {
@@ -525,7 +525,7 @@ void EEG_setChannelToZero (EEG me, long channelNumber) {
 
 void EEG_setChannelToZero (EEG me, const char32 *channelName) {
 	try {
-		long channelNumber = EEG_getChannelNumber (me, channelName);
+		integer channelNumber = EEG_getChannelNumber (me, channelName);
 		if (channelNumber == 0)
 			Melder_throw (U"No channel named \"", channelName, U"\".");
 		EEG_setChannelToZero (me, channelNumber);
@@ -544,7 +544,7 @@ void EEG_removeTriggers (EEG me, kMelder_string which, const char32 *criterion)
 	}
 }
 
-autoEEG EEG_extractChannel (EEG me, long channelNumber) {
+autoEEG EEG_extractChannel (EEG me, integer channelNumber) {
 	try {
 		if (channelNumber < 1 || channelNumber > my numberOfChannels)
 			Melder_throw (U"No channel ", channelNumber, U".");
@@ -562,7 +562,7 @@ autoEEG EEG_extractChannel (EEG me, long channelNumber) {
 
 autoEEG EEG_extractChannel (EEG me, const char32 *channelName) {
 	try {
-		long channelNumber = EEG_getChannelNumber (me, channelName);
+		integer channelNumber = EEG_getChannelNumber (me, channelName);
 		if (channelNumber == 0)
 			Melder_throw (U"No channel named \"", channelName, U"\".");
 		return EEG_extractChannel (me, channelNumber);
@@ -576,20 +576,20 @@ autoEEG EEGs_concatenate (OrderedOf<structEEG>* me) {
 		if (my size < 1)
 			Melder_throw (U"Cannot concatenate zero EEG objects.");
 		EEG first = my at [1];
-		long numberOfChannels = first -> numberOfChannels;
+		integer numberOfChannels = first -> numberOfChannels;
 		char32 **channelNames = first -> channelNames;
-		for (long ieeg = 2; ieeg <= my size; ieeg ++) {
+		for (integer ieeg = 2; ieeg <= my size; ieeg ++) {
 			EEG other = my at [ieeg];
 			if (other -> numberOfChannels != numberOfChannels)
 				Melder_throw (U"The number of channels of ", other, U" does not match the number of channels of ", first, U".");
-			for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+			for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 				if (! Melder_equ (other -> channelNames [ichan], channelNames [ichan]))
 					Melder_throw (U"Channel ", ichan, U" has a different name in ", other, U" (", other -> channelNames [ichan], U") than in ", first, U" (", channelNames [ichan], U").");
 			}
 		}
 		OrderedOf<structSound> soundList;
 		OrderedOf<structTextGrid> textgridList;
-		for (long ieeg = 1; ieeg <= my size; ieeg ++) {
+		for (integer ieeg = 1; ieeg <= my size; ieeg ++) {
 			EEG eeg = my at [ieeg];
 			soundList. addItem_ref (eeg -> sound.get());
 			textgridList. addItem_ref (eeg -> textgrid.get());
@@ -597,7 +597,7 @@ autoEEG EEGs_concatenate (OrderedOf<structEEG>* me) {
 		autoEEG thee = Thing_new (EEG);
 		thy numberOfChannels = numberOfChannels;
 		thy channelNames = NUMvector <char32 *> (1, numberOfChannels);
-		for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+		for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 			thy channelNames [ichan] = Melder_dup (channelNames [ichan]);
 		}
 		thy sound = Sounds_concatenate (soundList, 0.0);
@@ -615,7 +615,7 @@ autoEEG EEG_extractPart (EEG me, double tmin, double tmax, bool preserveTimes) {
 		autoEEG thee = Thing_new (EEG);
 		thy numberOfChannels = my numberOfChannels;
 		thy channelNames = NUMvector <char32 *> (1, my numberOfChannels);
-		for (long ichan = 1; ichan <= my numberOfChannels; ichan ++) {
+		for (integer ichan = 1; ichan <= my numberOfChannels; ichan ++) {
 			thy channelNames [ichan] = Melder_dup (my channelNames [ichan]);
 		}
 		thy sound = Sound_extractPart (my sound.get(), tmin, tmax, kSound_windowShape::RECTANGULAR, 1.0, preserveTimes);
@@ -636,12 +636,12 @@ void EEG_replaceTextGrid (EEG me, TextGrid textgrid) {
 	}
 }
 
-autoMixingMatrix EEG_to_MixingMatrix (EEG me, long maxNumberOfIterations, double tol, int method) {
+autoMixingMatrix EEG_to_MixingMatrix (EEG me, integer maxNumberOfIterations, double tol, int method) {
 	try {
 		autoCrossCorrelationTableList tables = Sound_to_CrossCorrelationTableList (my sound.get(), 0.0, 0.0, 0.002, 1);
 		autoMixingMatrix thee = MixingMatrix_create (my sound -> ny, my sound -> ny);
 		MixingMatrix_setRandomGauss ( thee.get(), 0.0, 1.0);
-		for (long ichan = 1; ichan <= my numberOfChannels; ichan ++) {
+		for (integer ichan = 1; ichan <= my numberOfChannels; ichan ++) {
 			TableOfReal_setRowLabel (thee.get(), ichan, my channelNames [ichan]);
 			TableOfReal_setColumnLabel (thee.get(), ichan, Melder_cat (U"ic", ichan));
 		}
diff --git a/EEG/EEG.h b/EEG/EEG.h
index b04d35c..c4f7a70 100644
--- a/EEG/EEG.h
+++ b/EEG/EEG.h
@@ -31,15 +31,15 @@ autoEEG EEG_readFromBdfFile (MelderFile file);
 autoEEG EEGs_concatenate (OrderedOf<structEEG>* me);
 
 void EEG_init (EEG me, double tmin, double tmax);
-long EEG_getChannelNumber (EEG me, const char32 *channelName);
-void EEG_setChannelName (EEG me, long channelNumber, const char32 *a_name);
-static inline long EEG_getNumberOfCapElectrodes (EEG me) {
+integer EEG_getChannelNumber (EEG me, const char32 *channelName);
+void EEG_setChannelName (EEG me, integer channelNumber, const char32 *a_name);
+static inline integer EEG_getNumberOfCapElectrodes (EEG me) {
 	return (my numberOfChannels - 1) & ~ 15L;   // BUG
 }
-static inline long EEG_getNumberOfExtraSensors (EEG me) {
+static inline integer EEG_getNumberOfExtraSensors (EEG me) {
 	return my numberOfChannels == 1 ? 0 : my numberOfChannels & 1 ? 1 : 8;   // BUG
 }
-static inline long EEG_getNumberOfExternalElectrodes (EEG me) {
+static inline integer EEG_getNumberOfExternalElectrodes (EEG me) {
 	return my numberOfChannels - EEG_getNumberOfCapElectrodes (me) - EEG_getNumberOfExtraSensors (me);
 }
 void EEG_setExternalElectrodeNames (EEG me, const char32 *nameExg1, const char32 *nameExg2, const char32 *nameExg3, const char32 *nameExg4,
@@ -47,17 +47,17 @@ void EEG_setExternalElectrodeNames (EEG me, const char32 *nameExg1, const char32
 void EEG_detrend (EEG me);
 void EEG_filter (EEG me, double lowFrequency, double lowWidth, double highFrequency, double highWidth, bool doNotch50Hz);
 void EEG_subtractReference (EEG me, const char32 *channelNumber1, const char32 *channelNumber2);
-void EEG_subtractMeanChannel (EEG me, long fromChannel, long toChannel);
-void EEG_setChannelToZero (EEG me, long channelNumber);
+void EEG_subtractMeanChannel (EEG me, integer fromChannel, integer toChannel);
+void EEG_setChannelToZero (EEG me, integer channelNumber);
 void EEG_setChannelToZero (EEG me, const char32 *channelName);
 void EEG_removeTriggers (EEG me, kMelder_string which, const char32 *criterion);
-autoEEG EEG_extractChannel (EEG me, long channelNumber);
+autoEEG EEG_extractChannel (EEG me, integer channelNumber);
 autoEEG EEG_extractChannel (EEG me, const char32 *channelName);
 static inline autoSound EEG_extractSound (EEG me) { return Data_copy (my sound.get()); }
 static inline autoTextGrid EEG_extractTextGrid (EEG me) { return Data_copy (my textgrid.get()); }
 autoEEG EEG_extractPart (EEG me, double tmin, double tmax, bool preserveTimes);
 void EEG_replaceTextGrid (EEG me, TextGrid textgrid);
-autoMixingMatrix EEG_to_MixingMatrix (EEG me, long maxNumberOfIterations, double tol, int method);
+autoMixingMatrix EEG_to_MixingMatrix (EEG me, integer maxNumberOfIterations, double tol, int method);
 
 /* End of file EEG.h */
 #endif
diff --git a/EEG/EEGWindow.cpp b/EEG/EEGWindow.cpp
index 276f218..3e2c1bc 100644
--- a/EEG/EEGWindow.cpp
+++ b/EEG/EEGWindow.cpp
@@ -39,7 +39,7 @@ void structEEGWindow :: v_createHelpMenuItems (EditorMenu menu) {
 	EditorMenu_addCommand (menu, U"EEGWindow help", '?', menu_cb_EEGWindowHelp);
 }
 
-const char32 * structEEGWindow :: v_getChannelName (long channelNumber) {
+const char32 * structEEGWindow :: v_getChannelName (integer channelNumber) {
 	Melder_assert (our eeg != nullptr);
 	return our eeg -> channelNames [channelNumber];
 }
diff --git a/EEG/EEGWindow.h b/EEG/EEGWindow.h
index 8fa3327..1129f23 100644
--- a/EEG/EEGWindow.h
+++ b/EEG/EEGWindow.h
@@ -2,7 +2,7 @@
 #define _EEGWindow_h_
 /* EEGWindow.h
  *
- * Copyright (C) 2011-2012,2013,2014,2015 Paul Boersma
+ * Copyright (C) 2011-2012,2013,2014,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@ Thing_define (EEGWindow, TextGridEditor) {
 		override;
 	void v_createHelpMenuItems (EditorMenu menu)
 		override;
-	const char32 * v_getChannelName (long channelNumber)
+	const char32 * v_getChannelName (integer channelNumber)
 		override;
 	void v_createMenuItems_file_extract (EditorMenu menu)
 		override;
diff --git a/EEG/EEGWindow_prefs.h b/EEG/EEGWindow_prefs.h
index 848898d..eec9339 100644
--- a/EEG/EEGWindow_prefs.h
+++ b/EEG/EEGWindow_prefs.h
@@ -1,6 +1,6 @@
 /* EEGWindow_prefs.h
  *
- * Copyright (C) 2013,2015 Paul Boersma
+ * Copyright (C) 2013,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,27 +18,27 @@
 
 prefs_begin (EEGWindow)
 
-	prefs_override_bool   (EEGWindow, showSelectionViewer,            1, false)
-	prefs_override_enum   (EEGWindow, sound_scalingStrategy,          1, kTimeSoundEditor_scalingStrategy, DEFAULT)
-	prefs_override_double (EEGWindow, sound_scaling_height,           1, U"20e-6")
-	prefs_override_double (EEGWindow, sound_scaling_minimum,          1, U"-10e-6")
-	prefs_override_double (EEGWindow, sound_scaling_maximum,          1, U"10e-6")
-	prefs_override_double (EEGWindow, picture_bottom,                 1, U"0.0")
-	prefs_override_double (EEGWindow, picture_top,                    1, U"0.0 (= auto)")
-	prefs_override_bool   (EEGWindow, spectrogram_show,               1, false);
-	prefs_override_double (EEGWindow, spectrogram_viewFrom,           1, U"0.0")   // Hz
-	prefs_override_double (EEGWindow, spectrogram_viewTo,             1, U"60.0")   // Hz
-	prefs_override_double (EEGWindow, spectrogram_windowLength,       1, U"0.5")   // seconds
-	prefs_override_double (EEGWindow, spectrogram_dynamicRange,       1, U"40.0")   // dB
-	prefs_override_long   (EEGWindow, spectrogram_timeSteps,          1, U"1000")
-	prefs_override_long   (EEGWindow, spectrogram_frequencySteps,     1, U"250")
-	prefs_override_enum   (EEGWindow, spectrogram_method,             1, kSound_to_Spectrogram_method, DEFAULT)
-	prefs_override_enum   (EEGWindow, spectrogram_windowShape,        1, kSound_to_Spectrogram_windowShape, DEFAULT)
-	prefs_override_bool   (EEGWindow, spectrogram_autoscaling,        1, true)
-	prefs_override_double (EEGWindow, spectrogram_maximum,            1, U"100.0")   // dB/Hz
-	prefs_override_double (EEGWindow, spectrogram_preemphasis,        1, U"0.0")   // dB/octave
-	prefs_override_double (EEGWindow, spectrogram_dynamicCompression, 1, U"0.0")
-	prefs_override_bool   (EEGWindow, spectrogram_picture_garnish,    1, true)
+	prefs_override_bool    (EEGWindow, showSelectionViewer,            1, false)
+	prefs_override_enum    (EEGWindow, sound_scalingStrategy,          1, kTimeSoundEditor_scalingStrategy, DEFAULT)
+	prefs_override_double  (EEGWindow, sound_scaling_height,           1, U"20e-6")
+	prefs_override_double  (EEGWindow, sound_scaling_minimum,          1, U"-10e-6")
+	prefs_override_double  (EEGWindow, sound_scaling_maximum,          1, U"10e-6")
+	prefs_override_double  (EEGWindow, picture_bottom,                 1, U"0.0")
+	prefs_override_double  (EEGWindow, picture_top,                    1, U"0.0 (= auto)")
+	prefs_override_bool    (EEGWindow, spectrogram_show,               1, false);
+	prefs_override_double  (EEGWindow, spectrogram_viewFrom,           1, U"0.0")   // Hz
+	prefs_override_double  (EEGWindow, spectrogram_viewTo,             1, U"60.0")   // Hz
+	prefs_override_double  (EEGWindow, spectrogram_windowLength,       1, U"0.5")   // seconds
+	prefs_override_double  (EEGWindow, spectrogram_dynamicRange,       1, U"40.0")   // dB
+	prefs_override_integer (EEGWindow, spectrogram_timeSteps,          1, U"1000")
+	prefs_override_integer (EEGWindow, spectrogram_frequencySteps,     1, U"250")
+	prefs_override_enum    (EEGWindow, spectrogram_method,             1, kSound_to_Spectrogram_method, DEFAULT)
+	prefs_override_enum    (EEGWindow, spectrogram_windowShape,        1, kSound_to_Spectrogram_windowShape, DEFAULT)
+	prefs_override_bool    (EEGWindow, spectrogram_autoscaling,        1, true)
+	prefs_override_double  (EEGWindow, spectrogram_maximum,            1, U"100.0")   // dB/Hz
+	prefs_override_double  (EEGWindow, spectrogram_preemphasis,        1, U"0.0")   // dB/octave
+	prefs_override_double  (EEGWindow, spectrogram_dynamicCompression, 1, U"0.0")
+	prefs_override_bool    (EEGWindow, spectrogram_picture_garnish,    1, true)
 
 prefs_end (EEGWindow)
 
diff --git a/EEG/EEG_def.h b/EEG/EEG_def.h
index 6cfa4f5..c034780 100644
--- a/EEG/EEG_def.h
+++ b/EEG/EEG_def.h
@@ -1,6 +1,6 @@
 /* EEG_def.h
  *
- * Copyright (C) 2011,2014,2015 Paul Boersma
+ * Copyright (C) 2011,2014,2015,2017 Paul Boersma
  *
  * This code 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 @@
 #define ooSTRUCT EEG
 oo_DEFINE_CLASS (EEG, Function)
 
-	oo_LONG (numberOfChannels)
+	oo_INTEGER (numberOfChannels)
 	oo_STRING_VECTOR (channelNames, numberOfChannels)
 	oo_AUTO_OBJECT (Sound, 2, sound)
 	oo_AUTO_OBJECT (TextGrid, 0, textgrid)
diff --git a/EEG/ERP.cpp b/EEG/ERP.cpp
index eda8716..973b7b2 100644
--- a/EEG/ERP.cpp
+++ b/EEG/ERP.cpp
@@ -1,6 +1,6 @@
 /* ERP.cpp
  *
- * Copyright (C) 2011-2012,2013,2014,2015,2016 Paul Boersma
+ * Copyright (C) 2011-2012,2013,2014,2015,2016,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -41,8 +41,8 @@
 
 Thing_implement (ERP, Sound, 2);
 
-long ERP_getChannelNumber (ERP me, const char32 *channelName) {
-	for (long ichan = 1; ichan <= my ny; ichan ++) {
+integer ERP_getChannelNumber (ERP me, const char32 *channelName) {
+	for (integer ichan = 1; ichan <= my ny; ichan ++) {
 		if (Melder_equ (my channelNames [ichan], channelName)) {
 			return ichan;
 		}
@@ -50,7 +50,7 @@ long ERP_getChannelNumber (ERP me, const char32 *channelName) {
 	return 0;
 }
 
-void ERP_drawChannel_number (ERP me, Graphics graphics, long channelNumber, double tmin, double tmax, double vmin, double vmax, bool garnish) {
+void ERP_drawChannel_number (ERP me, Graphics graphics, integer channelNumber, double tmin, double tmax, double vmin, double vmax, bool garnish) {
 	if (channelNumber < 1 || channelNumber > my ny) return;
 	/*
 	 * Automatic domain.
@@ -112,17 +112,17 @@ autoTable ERP_tabulate (ERP me, bool includeSampleNumbers, bool includeTime, int
 	}
 	try {
 		autoTable thee = Table_createWithoutColumnNames (my nx, includeSampleNumbers + includeTime + my ny);
-		long icol = 0;
+		integer icol = 0;
 		if (includeSampleNumbers) Table_setColumnLabel (thee.get(), ++ icol, U"sample");
 		if (includeTime) Table_setColumnLabel (thee.get(), ++ icol, U"time(s)");
-		for (long ichan = 1; ichan <= my ny; ichan ++) {
+		for (integer ichan = 1; ichan <= my ny; ichan ++) {
 			Table_setColumnLabel (thee.get(), ++ icol, Melder_cat (my channelNames [ichan], unitText));
 		}
-		for (long isamp = 1; isamp <= my nx; isamp ++) {
+		for (integer isamp = 1; isamp <= my nx; isamp ++) {
 			icol = 0;
 			if (includeSampleNumbers) Table_setNumericValue (thee.get(), isamp, ++ icol, isamp);
 			if (includeTime) Table_setStringValue (thee.get(), isamp, ++ icol, Melder_fixed (my x1 + (isamp - 1) * my dx, timeDecimals));
-			for (long ichan = 1; ichan <= my ny; ichan ++) {
+			for (integer ichan = 1; ichan <= my ny; ichan ++) {
 				Table_setStringValue (thee.get(), isamp, ++ icol, Melder_fixed (voltageScaling * my z [ichan] [isamp], voltageDecimals));
 			}
 		}
diff --git a/EEG/ERP.h b/EEG/ERP.h
index b2acc99..ede1ed9 100644
--- a/EEG/ERP.h
+++ b/EEG/ERP.h
@@ -2,7 +2,7 @@
 #define _ERP_h_
 /* ERP.h
  *
- * Copyright (C) 2011,2014,2015 Paul Boersma
+ * Copyright (C) 2011,2014,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
 /**
 	Look up the channel number from its name.
 */
-long ERP_getChannelNumber (ERP me, const char32 *channelName);
+integer ERP_getChannelNumber (ERP me, const char32 *channelName);
 
 /**
  * Draw the scalp distribution.
@@ -37,7 +37,7 @@ void ERP_drawScalp (ERP me,
 	enum kGraphics_colourScale colourScale, bool garnish);
 void ERP_drawScalp_garnish (Graphics graphics, double vmin, double vmax, enum kGraphics_colourScale colourScale);
 
-void ERP_drawChannel_number (ERP me, Graphics graphics, long channelNumber, double tmin, double tmax, double vmin, double vmax, bool garnish);
+void ERP_drawChannel_number (ERP me, Graphics graphics, integer channelNumber, double tmin, double tmax, double vmin, double vmax, bool garnish);
 void ERP_drawChannel_name (ERP me, Graphics graphics, const char32 *channelName, double tmin, double tmax, double vmin, double vmax, bool garnish);
 
 autoTable ERP_tabulate (ERP me, bool includeSampleNumbers, bool includeTime, int timeDecimals, int voltageDecimals, int units);
diff --git a/EEG/ERPTier.cpp b/EEG/ERPTier.cpp
index a0a063c..af1dc1a 100644
--- a/EEG/ERPTier.cpp
+++ b/EEG/ERPTier.cpp
@@ -45,8 +45,8 @@ Thing_implement (ERPPoint, AnyPoint, 0);
 
 Thing_implement (ERPTier, AnyTier, 0);
 
-long ERPTier_getChannelNumber (ERPTier me, const char32 *channelName) {
-	for (long ichan = 1; ichan <= my numberOfChannels; ichan ++) {
+integer ERPTier_getChannelNumber (ERPTier me, const char32 *channelName) {
+	for (integer ichan = 1; ichan <= my numberOfChannels; ichan ++) {
 		if (Melder_equ (my channelNames [ichan], channelName)) {
 			return ichan;
 		}
@@ -54,14 +54,14 @@ long ERPTier_getChannelNumber (ERPTier me, const char32 *channelName) {
 	return 0;
 }
 
-double ERPTier_getMean (ERPTier me, long pointNumber, long channelNumber, double tmin, double tmax) {
+double ERPTier_getMean (ERPTier me, integer pointNumber, integer channelNumber, double tmin, double tmax) {
 	if (pointNumber < 1 || pointNumber > my points.size) return undefined;
 	if (channelNumber < 1 || channelNumber > my numberOfChannels) return undefined;
 	ERPPoint point = my points.at [pointNumber];
 	return Vector_getMean (point -> erp.get(), tmin, tmax, channelNumber);
 }
 
-double ERPTier_getMean (ERPTier me, long pointNumber, const char32 *channelName, double tmin, double tmax) {
+double ERPTier_getMean (ERPTier me, integer pointNumber, const char32 *channelName, double tmin, double tmax) {
 	return ERPTier_getMean (me, pointNumber, ERPTier_getChannelNumber (me, channelName), tmin, tmax);
 }
 
@@ -72,19 +72,19 @@ static autoERPTier EEG_PointProcess_to_ERPTier (EEG me, PointProcess events, dou
 		thy numberOfChannels = my numberOfChannels - EEG_getNumberOfExtraSensors (me);
 		Melder_assert (thy numberOfChannels > 0);
 		thy channelNames = NUMvector <char32 *> (1, thy numberOfChannels);
-		for (long ichan = 1; ichan <= thy numberOfChannels; ichan ++) {
+		for (integer ichan = 1; ichan <= thy numberOfChannels; ichan ++) {
 			thy channelNames [ichan] = Melder_dup (my channelNames [ichan]);
 		}
-		long numberOfEvents = events -> nt;
+		integer numberOfEvents = events -> nt;
 		double soundDuration = toTime - fromTime;
 		double samplingPeriod = my sound -> dx;
-		long numberOfSamples = (long) floor (soundDuration / samplingPeriod) + 1;
+		integer numberOfSamples = (integer) floor (soundDuration / samplingPeriod) + 1;
 		if (numberOfSamples < 1)
 			Melder_throw (U"Time window too short.");
 		double midTime = 0.5 * (fromTime + toTime);
 		double soundPhysicalDuration = numberOfSamples * samplingPeriod;
 		double firstTime = midTime - 0.5 * soundPhysicalDuration + 0.5 * samplingPeriod;   // distribute the samples evenly over the time domain
-		for (long ievent = 1; ievent <= numberOfEvents; ievent ++) {
+		for (integer ievent = 1; ievent <= numberOfEvents; ievent ++) {
 			double eegEventTime = events -> t [ievent];
 			autoERPPoint event = Thing_new (ERPPoint);
 			event -> number = eegEventTime;
@@ -92,10 +92,10 @@ static autoERPTier EEG_PointProcess_to_ERPTier (EEG me, PointProcess events, dou
 			double erpEventTime = 0.0;
 			double eegSample = 1 + (eegEventTime - my sound -> x1) / samplingPeriod;
 			double erpSample = 1 + (erpEventTime - firstTime) / samplingPeriod;
-			long sampleDifference = lround (eegSample - erpSample);
-			for (long ichannel = 1; ichannel <= thy numberOfChannels; ichannel ++) {
-				for (long isample = 1; isample <= numberOfSamples; isample ++) {
-					long jsample = isample + sampleDifference;
+			integer sampleDifference = lround (eegSample - erpSample);
+			for (integer ichannel = 1; ichannel <= thy numberOfChannels; ichannel ++) {
+				for (integer isample = 1; isample <= numberOfSamples; isample ++) {
+					integer jsample = isample + sampleDifference;
 					event -> erp -> z [ichannel] [isample] = jsample < 1 || jsample > my sound -> nx ? 0.0 : my sound -> z [ichannel] [jsample];
 				}
 			}
@@ -185,18 +185,18 @@ autoERPTier EEG_to_ERPTier_triggers_preceded (EEG me, double fromTime, double to
 }
 
 void ERPTier_subtractBaseline (ERPTier me, double tmin, double tmax) {
-	long numberOfEvents = my points.size;
+	integer numberOfEvents = my points.size;
 	if (numberOfEvents < 1)
 		return;   // nothing to do
 	ERPPoint firstEvent = my points.at [1];
-	long numberOfChannels = firstEvent -> erp -> ny;
-	long numberOfSamples = firstEvent -> erp -> nx;
-	for (long ievent = 1; ievent <= numberOfEvents; ievent ++) {
+	integer numberOfChannels = firstEvent -> erp -> ny;
+	integer numberOfSamples = firstEvent -> erp -> nx;
+	for (integer ievent = 1; ievent <= numberOfEvents; ievent ++) {
 		ERPPoint event = my points.at [ievent];
-		for (long ichannel = 1; ichannel <= numberOfChannels; ichannel ++) {
+		for (integer ichannel = 1; ichannel <= numberOfChannels; ichannel ++) {
 			double mean = Vector_getMean (event -> erp.get(), tmin, tmax, ichannel);
 			double *channel = event -> erp -> z [ichannel];
-			for (long isample = 1; isample <= numberOfSamples; isample ++) {
+			for (integer isample = 1; isample <= numberOfSamples; isample ++) {
 				channel [isample] -= mean;
 			}
 		}
@@ -204,21 +204,21 @@ void ERPTier_subtractBaseline (ERPTier me, double tmin, double tmax) {
 }
 
 void ERPTier_rejectArtefacts (ERPTier me, double threshold) {
-	long numberOfEvents = my points.size;
+	integer numberOfEvents = my points.size;
 	if (numberOfEvents < 1)
 		return;   // nothing to do
 	ERPPoint firstEvent = my points.at [1];
-	long numberOfChannels = firstEvent -> erp -> ny;
-	long numberOfSamples = firstEvent -> erp -> nx;
+	integer numberOfChannels = firstEvent -> erp -> ny;
+	integer numberOfSamples = firstEvent -> erp -> nx;
 	if (numberOfSamples < 1)
 		return;   // nothing to do
-	for (long ievent = numberOfEvents; ievent >= 1; ievent --) {   // cycle down because of removal
+	for (integer ievent = numberOfEvents; ievent >= 1; ievent --) {   // cycle down because of removal
 		ERPPoint event = my points.at [ievent];
 		double minimum = event -> erp -> z [1] [1];
 		double maximum = minimum;
-		for (long ichannel = 1; ichannel <= (numberOfChannels & ~ 15); ichannel ++) {
+		for (integer ichannel = 1; ichannel <= (numberOfChannels & ~ 15); ichannel ++) {
 			double *channel = event -> erp -> z [ichannel];
-			for (long isample = 1; isample <= numberOfSamples; isample ++) {
+			for (integer isample = 1; isample <= numberOfSamples; isample ++) {
 				double value = channel [isample];
 				if (value < minimum) minimum = value;
 				if (value > maximum) maximum = value;
@@ -230,26 +230,26 @@ void ERPTier_rejectArtefacts (ERPTier me, double threshold) {
 	}
 }
 
-autoERP ERPTier_extractERP (ERPTier me, long eventNumber) {
+autoERP ERPTier_extractERP (ERPTier me, integer eventNumber) {
 	try {
-		long numberOfEvents = my points.size;
+		integer numberOfEvents = my points.size;
 		if (numberOfEvents < 1)
 			Melder_throw (U"No events.");
 		ERPTier_checkEventNumber (me, eventNumber);
 		ERPPoint event = my points.at [eventNumber];
-		long numberOfChannels = event -> erp -> ny;
-		long numberOfSamples = event -> erp -> nx;
+		integer numberOfChannels = event -> erp -> ny;
+		integer numberOfSamples = event -> erp -> nx;
 		autoERP thee = Thing_new (ERP);
 		event -> erp -> structSound :: v_copy (thee.get());
-		for (long ichannel = 1; ichannel <= numberOfChannels; ichannel ++) {
+		for (integer ichannel = 1; ichannel <= numberOfChannels; ichannel ++) {
 			double *oldChannel = event -> erp -> z [ichannel];
 			double *newChannel = thy z [ichannel];
-			for (long isample = 1; isample <= numberOfSamples; isample ++) {
+			for (integer isample = 1; isample <= numberOfSamples; isample ++) {
 				newChannel [isample] = oldChannel [isample];
 			}
 		}
 		thy channelNames = NUMvector <char32 *> (1, thy ny);
-		for (long ichan = 1; ichan <= thy ny; ichan ++) {
+		for (integer ichan = 1; ichan <= thy ny; ichan ++) {
 			thy channelNames [ichan] = Melder_dup (my channelNames [ichan]);
 		}
 		return thee;
@@ -260,33 +260,33 @@ autoERP ERPTier_extractERP (ERPTier me, long eventNumber) {
 
 autoERP ERPTier_to_ERP_mean (ERPTier me) {
 	try {
-		long numberOfEvents = my points.size;
+		integer numberOfEvents = my points.size;
 		if (numberOfEvents < 1)
 			Melder_throw (U"No events.");
 		ERPPoint firstEvent = my points.at [1];
-		long numberOfChannels = firstEvent -> erp -> ny;
-		long numberOfSamples = firstEvent -> erp -> nx;
+		integer numberOfChannels = firstEvent -> erp -> ny;
+		integer numberOfSamples = firstEvent -> erp -> nx;
 		autoERP mean = Thing_new (ERP);
 		firstEvent -> erp -> structSound :: v_copy (mean.get());
-		for (long ievent = 2; ievent <= numberOfEvents; ievent ++) {
+		for (integer ievent = 2; ievent <= numberOfEvents; ievent ++) {
 			ERPPoint event = my points.at [ievent];
-			for (long ichannel = 1; ichannel <= numberOfChannels; ichannel ++) {
+			for (integer ichannel = 1; ichannel <= numberOfChannels; ichannel ++) {
 				double *erpChannel = event -> erp -> z [ichannel];
 				double *meanChannel = mean -> z [ichannel];
-				for (long isample = 1; isample <= numberOfSamples; isample ++) {
+				for (integer isample = 1; isample <= numberOfSamples; isample ++) {
 					meanChannel [isample] += erpChannel [isample];
 				}
 			}
 		}
 		double factor = 1.0 / numberOfEvents;
-		for (long ichannel = 1; ichannel <= numberOfChannels; ichannel ++) {
+		for (integer ichannel = 1; ichannel <= numberOfChannels; ichannel ++) {
 			double *meanChannel = mean -> z [ichannel];
-			for (long isample = 1; isample <= numberOfSamples; isample ++) {
+			for (integer isample = 1; isample <= numberOfSamples; isample ++) {
 				meanChannel [isample] *= factor;
 			}
 		}
 		mean -> channelNames = NUMvector <char32 *> (1, mean -> ny);
-		for (long ichan = 1; ichan <= mean -> ny; ichan ++) {
+		for (integer ichan = 1; ichan <= mean -> ny; ichan ++) {
 			mean -> channelNames [ichan] = Melder_dup (my channelNames [ichan]);
 		}
 		return mean;
@@ -295,7 +295,7 @@ autoERP ERPTier_to_ERP_mean (ERPTier me) {
 	}
 }
 
-autoERPTier ERPTier_extractEventsWhereColumn_number (ERPTier me, Table table, long columnNumber, kMelder_number which, double criterion) {
+autoERPTier ERPTier_extractEventsWhereColumn_number (ERPTier me, Table table, integer columnNumber, kMelder_number which, double criterion) {
 	try {
 		Table_checkSpecifiedColumnNumberWithinRange (table, columnNumber);
 		Table_numericize_Assert (table, columnNumber);   // extraction should work even if cells are not defined
@@ -306,10 +306,10 @@ autoERPTier ERPTier_extractEventsWhereColumn_number (ERPTier me, Table table, lo
 		Function_init (thee.get(), my xmin, my xmax);
 		thy numberOfChannels = my numberOfChannels;
 		thy channelNames = NUMvector <char32 *> (1, thy numberOfChannels);
-		for (long ichan = 1; ichan <= thy numberOfChannels; ichan ++) {
+		for (integer ichan = 1; ichan <= thy numberOfChannels; ichan ++) {
 			thy channelNames [ichan] = Melder_dup (my channelNames [ichan]);
 		}
-		for (long ievent = 1; ievent <= my points.size; ievent ++) {
+		for (integer ievent = 1; ievent <= my points.size; ievent ++) {
 			ERPPoint oldEvent = my points.at [ievent];
 			TableRow row = table -> rows.at [ievent];
 			if (Melder_numberMatchesCriterion (row -> cells [columnNumber]. number, which, criterion)) {
@@ -327,7 +327,7 @@ autoERPTier ERPTier_extractEventsWhereColumn_number (ERPTier me, Table table, lo
 }
 
 autoERPTier ERPTier_extractEventsWhereColumn_string (ERPTier me, Table table,
-	long columnNumber, kMelder_string which, const char32 *criterion)
+	integer columnNumber, kMelder_string which, const char32 *criterion)
 {
 	try {
 		Table_checkSpecifiedColumnNumberWithinRange (table, columnNumber);
@@ -338,10 +338,10 @@ autoERPTier ERPTier_extractEventsWhereColumn_string (ERPTier me, Table table,
 		Function_init (thee.get(), my xmin, my xmax);
 		thy numberOfChannels = my numberOfChannels;
 		thy channelNames = NUMvector <char32 *> (1, thy numberOfChannels);
-		for (long ichan = 1; ichan <= thy numberOfChannels; ichan ++) {
+		for (integer ichan = 1; ichan <= thy numberOfChannels; ichan ++) {
 			thy channelNames [ichan] = Melder_dup (my channelNames [ichan]);
 		}
-		for (long ievent = 1; ievent <= my points.size; ievent ++) {
+		for (integer ievent = 1; ievent <= my points.size; ievent ++) {
 			ERPPoint oldEvent = my points.at [ievent];
 			TableRow row = table -> rows.at [ievent];
 			if (Melder_stringMatchesCriterion (row -> cells [columnNumber]. string, which, criterion)) {
diff --git a/EEG/ERPTier.h b/EEG/ERPTier.h
index cee9794..b2d3bb0 100644
--- a/EEG/ERPTier.h
+++ b/EEG/ERPTier.h
@@ -23,21 +23,21 @@
 
 #include "ERPTier_def.h"
 
-long ERPTier_getChannelNumber (ERPTier me, const char32 *channelName);
-static inline void ERPTier_checkEventNumber (ERPTier me, long eventNumber) {
+integer ERPTier_getChannelNumber (ERPTier me, const char32 *channelName);
+static inline void ERPTier_checkEventNumber (ERPTier me, integer eventNumber) {
 	if (eventNumber < 1)
 		Melder_throw (U"The specified event number is ", eventNumber, U" but should have been positive.");
 	if (eventNumber > my points.size)
 		Melder_throw (U"The specified event number (", eventNumber, U") exceeds the number of events (", my points.size, U").");
 }
-double ERPTier_getMean (ERPTier me, long pointNumber, long channelNumber, double tmin, double tmax);
-double ERPTier_getMean (ERPTier me, long pointNumber, const char32 *channelName, double tmin, double tmax);
+double ERPTier_getMean (ERPTier me, integer pointNumber, integer channelNumber, double tmin, double tmax);
+double ERPTier_getMean (ERPTier me, integer pointNumber, const char32 *channelName, double tmin, double tmax);
 void ERPTier_subtractBaseline (ERPTier me, double tmin, double tmax);
 void ERPTier_rejectArtefacts (ERPTier me, double threshold);
-autoERP ERPTier_extractERP (ERPTier me, long pointNumber);
+autoERP ERPTier_extractERP (ERPTier me, integer pointNumber);
 autoERP ERPTier_to_ERP_mean (ERPTier me);
-autoERPTier ERPTier_extractEventsWhereColumn_number (ERPTier me, Table table, long columnNumber, kMelder_number which, double criterion);
-autoERPTier ERPTier_extractEventsWhereColumn_string (ERPTier me, Table table, long columnNumber, kMelder_string which, const char32 *criterion);
+autoERPTier ERPTier_extractEventsWhereColumn_number (ERPTier me, Table table, integer columnNumber, kMelder_number which, double criterion);
+autoERPTier ERPTier_extractEventsWhereColumn_string (ERPTier me, Table table, integer columnNumber, kMelder_string which, const char32 *criterion);
 
 autoERPTier EEG_to_ERPTier_bit (EEG me, double fromTime, double toTime, int markerBit);
 autoERPTier EEG_to_ERPTier_marker (EEG me, double fromTime, double toTime, uint16 marker);
diff --git a/EEG/ERPTier_def.h b/EEG/ERPTier_def.h
index a9d235d..f8ec854 100644
--- a/EEG/ERPTier_def.h
+++ b/EEG/ERPTier_def.h
@@ -1,6 +1,6 @@
 /* ERPTier_def.h
  *
- * Copyright (C) 2011,2014,2015 Paul Boersma
+ * Copyright (C) 2011,2014,2015,2017 Paul Boersma
  *
  * This code 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_DEFINE_CLASS (ERPTier, Function)
 
 	oo_COLLECTION_OF (SortedSetOfDoubleOf, points, ERPPoint, 0)
 
-	oo_LONG (numberOfChannels)
+	oo_INTEGER (numberOfChannels)
 	oo_STRING_VECTOR (channelNames, numberOfChannels)
 
 	#if oo_DECLARING
diff --git a/EEG/ERPWindow.cpp b/EEG/ERPWindow.cpp
index 1580307..94c329d 100644
--- a/EEG/ERPWindow.cpp
+++ b/EEG/ERPWindow.cpp
@@ -39,71 +39,71 @@ static BiosemiLocationData biosemiCapCoordinates64 [1+64] =
 	 *     by inclination (from Cz, pos is right hemisphere, neg is left hemisphere),
      *     and azimuth (from T7 for left hemisphere, and from T8 for the right hemisphere, pos is anti-clockwise, neg is clockwise)"
 	 */
-	{0,0},
-	{ -92, -72 },   //  1 Fp1
-	{ -92, -54 },   //  2 AF7
-	{ -74, -65 },   //  3 AF3
-	{ -50, -68 },   //  4 F1
-	{ -60, -51 },   //  5 F3
-	{ -75, -41 },   //  6 F5
-	{ -92, -36 },   //  7 F7
-	{ -92, -18 },   //  8 FT7
-	{ -72, -21 },   //  9 FC5
-	{ -50, -28 },   // 10 FC3
-	{ -32, -45 },   // 11 FC1
-	{ -23,   0 },   // 12 C1
-	{ -46,   0 },   // 13 C3
-	{ -69,   0 },   // 14 C5
-	{ -92,   0 },   // 15 T7
-	{ -92,  18 },   // 16 TP7
-	{ -72,  21 },   // 17 CP5
-	{ -50,  28 },   // 18 CP3
-	{ -32,  45 },   // 19 CP1
-	{ -50,  68 },   // 20 P1
-	{ -60,  51 },   // 21 P3
-	{ -75,  41 },   // 22 P5
-	{ -92,  36 },   // 23 P7
-	{-115,  40 },   // 24 P9
-	{ -92,  54 },   // 25 PO7
-	{ -74,  65 },   // 26 PO3
-	{ -92,  72 },   // 27 O1
-	{ 115, -90 },   // 28 Iz
-	{  92, -90 },   // 29 Oz
-	{  69, -90 },   // 30 POz
-	{  46, -90 },   // 31 Pz
-	{  23, -90 },   // 32 CPz
-	{  92,  90 },   // 33 Fpz
-	{  92,  72 },   // 34 Fp2
-	{  92,  54 },   // 35 AF8
-	{  74,  65 },   // 36 AF4
-	{  69,  90 },   // 37 AFz
-	{  46,  90 },   // 38 Fz
-	{  50,  68 },   // 39 F2
-	{  60,  51 },   // 40 F4
-	{  75,  41 },   // 41 F6
-	{  92,  36 },   // 42 F8
-	{  92,  18 },   // 43 FT8
-	{  72,  21 },   // 44 FC6
-	{  50,  28 },   // 45 FC4
-	{  32,  45 },   // 46 FC2
-	{  23,  90 },   // 47 FCz
-	{   0,   0 },   // 48 Cz
-	{  23,   0 },   // 49 C2
-	{  46,   0 },   // 50 C4
-	{  69,   0 },   // 51 C6
-	{  92,   0 },   // 52 T8
-	{  92, -18 },   // 53 TP8
-	{  72, -21 },   // 54 CP6
-	{  50, -28 },   // 55 CP4
-	{  32, -45 },   // 56 CP2
-	{  50, -68 },   // 57 P2
-	{  60, -51 },   // 58 P4
-	{  75, -41 },   // 59 P6
-	{  92, -36 },   // 60 P8
-	{ 115, -40 },   // 61 P10
-	{  92, -54 },   // 62 PO8
-	{  74, -65 },   // 63 PO4
-	{  92, -72 }    // 64 O2
+	{0,0,0.0,0.0},
+	{ -92, -72, 0.0, 0.0 },   //  1 Fp1
+	{ -92, -54, 0.0, 0.0 },   //  2 AF7
+	{ -74, -65, 0.0, 0.0 },   //  3 AF3
+	{ -50, -68, 0.0, 0.0 },   //  4 F1
+	{ -60, -51, 0.0, 0.0 },   //  5 F3
+	{ -75, -41, 0.0, 0.0 },   //  6 F5
+	{ -92, -36, 0.0, 0.0 },   //  7 F7
+	{ -92, -18, 0.0, 0.0 },   //  8 FT7
+	{ -72, -21, 0.0, 0.0 },   //  9 FC5
+	{ -50, -28, 0.0, 0.0 },   // 10 FC3
+	{ -32, -45, 0.0, 0.0 },   // 11 FC1
+	{ -23,   0, 0.0, 0.0 },   // 12 C1
+	{ -46,   0, 0.0, 0.0 },   // 13 C3
+	{ -69,   0, 0.0, 0.0 },   // 14 C5
+	{ -92,   0, 0.0, 0.0 },   // 15 T7
+	{ -92,  18, 0.0, 0.0 },   // 16 TP7
+	{ -72,  21, 0.0, 0.0 },   // 17 CP5
+	{ -50,  28, 0.0, 0.0 },   // 18 CP3
+	{ -32,  45, 0.0, 0.0 },   // 19 CP1
+	{ -50,  68, 0.0, 0.0 },   // 20 P1
+	{ -60,  51, 0.0, 0.0 },   // 21 P3
+	{ -75,  41, 0.0, 0.0 },   // 22 P5
+	{ -92,  36, 0.0, 0.0 },   // 23 P7
+	{-115,  40, 0.0, 0.0 },   // 24 P9
+	{ -92,  54, 0.0, 0.0 },   // 25 PO7
+	{ -74,  65, 0.0, 0.0 },   // 26 PO3
+	{ -92,  72, 0.0, 0.0 },   // 27 O1
+	{ 115, -90, 0.0, 0.0 },   // 28 Iz
+	{  92, -90, 0.0, 0.0 },   // 29 Oz
+	{  69, -90, 0.0, 0.0 },   // 30 POz
+	{  46, -90, 0.0, 0.0 },   // 31 Pz
+	{  23, -90, 0.0, 0.0 },   // 32 CPz
+	{  92,  90, 0.0, 0.0 },   // 33 Fpz
+	{  92,  72, 0.0, 0.0 },   // 34 Fp2
+	{  92,  54, 0.0, 0.0 },   // 35 AF8
+	{  74,  65, 0.0, 0.0 },   // 36 AF4
+	{  69,  90, 0.0, 0.0 },   // 37 AFz
+	{  46,  90, 0.0, 0.0 },   // 38 Fz
+	{  50,  68, 0.0, 0.0 },   // 39 F2
+	{  60,  51, 0.0, 0.0 },   // 40 F4
+	{  75,  41, 0.0, 0.0 },   // 41 F6
+	{  92,  36, 0.0, 0.0 },   // 42 F8
+	{  92,  18, 0.0, 0.0 },   // 43 FT8
+	{  72,  21, 0.0, 0.0 },   // 44 FC6
+	{  50,  28, 0.0, 0.0 },   // 45 FC4
+	{  32,  45, 0.0, 0.0 },   // 46 FC2
+	{  23,  90, 0.0, 0.0 },   // 47 FCz
+	{   0,   0, 0.0, 0.0 },   // 48 Cz
+	{  23,   0, 0.0, 0.0 },   // 49 C2
+	{  46,   0, 0.0, 0.0 },   // 50 C4
+	{  69,   0, 0.0, 0.0 },   // 51 C6
+	{  92,   0, 0.0, 0.0 },   // 52 T8
+	{  92, -18, 0.0, 0.0 },   // 53 TP8
+	{  72, -21, 0.0, 0.0 },   // 54 CP6
+	{  50, -28, 0.0, 0.0 },   // 55 CP4
+	{  32, -45, 0.0, 0.0 },   // 56 CP2
+	{  50, -68, 0.0, 0.0 },   // 57 P2
+	{  60, -51, 0.0, 0.0 },   // 58 P4
+	{  75, -41, 0.0, 0.0 },   // 59 P6
+	{  92, -36, 0.0, 0.0 },   // 60 P8
+	{ 115, -40, 0.0, 0.0 },   // 61 P10
+	{  92, -54, 0.0, 0.0 },   // 62 PO8
+	{  74, -65, 0.0, 0.0 },   // 63 PO4
+	{  92, -72, 0.0, 0.0 }    // 64 O2
 };
 
 static BiosemiLocationData biosemiCapCoordinates32 [1+32] =
@@ -114,46 +114,46 @@ static BiosemiLocationData biosemiCapCoordinates32 [1+32] =
 	 *     by inclination (from Cz, pos is right hemisphere, neg is left hemisphere),
      *     and azimuth (from T7 for left hemisphere, and from T8 for the right hemisphere, pos is anti-clockwise, neg is clockwise)"
 	 */
-	{0,0},
-	{ -92, -72 },   //  1 Fp1
-	{ -74, -65 },   //  2 AF3
-	{ -92, -36 },   //  3 F7
-	{ -60, -51 },   //  4 F3
-	{ -32, -45 },   //  5 FC1
-	{ -72, -21 },   //  6 FC5
-	{ -92,   0 },   //  7 T7
-	{ -46,   0 },   //  8 C3
-	{ -32,  45 },   //  9 CP1
-	{ -72,  21 },   // 10 CP5
-	{ -92,  36 },   // 11 P7
-	{ -60,  51 },   // 12 P3
-	{  46, -90 },   // 13 Pz
-	{ -74,  65 },   // 14 PO3
-	{ -92,  72 },   // 15 O1
-	{  92, -90 },   // 16 Oz
-	{  92, -72 },   // 17 O2
-	{  74, -65 },   // 18 PO4
-	{  60, -51 },   // 19 P4
-	{  92, -36 },   // 20 P8
-	{  72, -21 },   // 21 CP6
-	{  32, -45 },   // 22 CP2
-	{  46,   0 },   // 23 C4
-	{  92,   0 },   // 24 T8
-	{  72,  21 },   // 25 FC6
-	{  32,  45 },   // 26 FC2
-	{  60,  51 },   // 27 F4
-	{  92,  36 },   // 28 F8
-	{  74,  65 },   // 29 AF4
-	{  92,  72 },   // 30 Fp2
-	{  46,  90 },   // 31 Fz
-	{   0,   0 },   // 32 Cz
+	{0,0,0.0,0.0},
+	{ -92, -72, 0.0, 0.0 },   //  1 Fp1
+	{ -74, -65, 0.0, 0.0 },   //  2 AF3
+	{ -92, -36, 0.0, 0.0 },   //  3 F7
+	{ -60, -51, 0.0, 0.0 },   //  4 F3
+	{ -32, -45, 0.0, 0.0 },   //  5 FC1
+	{ -72, -21, 0.0, 0.0 },   //  6 FC5
+	{ -92,   0, 0.0, 0.0 },   //  7 T7
+	{ -46,   0, 0.0, 0.0 },   //  8 C3
+	{ -32,  45, 0.0, 0.0 },   //  9 CP1
+	{ -72,  21, 0.0, 0.0 },   // 10 CP5
+	{ -92,  36, 0.0, 0.0 },   // 11 P7
+	{ -60,  51, 0.0, 0.0 },   // 12 P3
+	{  46, -90, 0.0, 0.0 },   // 13 Pz
+	{ -74,  65, 0.0, 0.0 },   // 14 PO3
+	{ -92,  72, 0.0, 0.0 },   // 15 O1
+	{  92, -90, 0.0, 0.0 },   // 16 Oz
+	{  92, -72, 0.0, 0.0 },   // 17 O2
+	{  74, -65, 0.0, 0.0 },   // 18 PO4
+	{  60, -51, 0.0, 0.0 },   // 19 P4
+	{  92, -36, 0.0, 0.0 },   // 20 P8
+	{  72, -21, 0.0, 0.0 },   // 21 CP6
+	{  32, -45, 0.0, 0.0 },   // 22 CP2
+	{  46,   0, 0.0, 0.0 },   // 23 C4
+	{  92,   0, 0.0, 0.0 },   // 24 T8
+	{  72,  21, 0.0, 0.0 },   // 25 FC6
+	{  32,  45, 0.0, 0.0 },   // 26 FC2
+	{  60,  51, 0.0, 0.0 },   // 27 F4
+	{  92,  36, 0.0, 0.0 },   // 28 F8
+	{  74,  65, 0.0, 0.0 },   // 29 AF4
+	{  92,  72, 0.0, 0.0 },   // 30 Fp2
+	{  46,  90, 0.0, 0.0 },   // 31 Fz
+	{   0,   0, 0.0, 0.0 },   // 32 Cz
 };
 
 void ERP_drawScalp_garnish (Graphics graphics, double vmin, double vmax, enum kGraphics_colourScale colourScale) {
-	long n = 201;
+	integer n = 201;
 	autoNUMmatrix <double> legend (1, n, 1, 2);
-	for (long irow = 1; irow <= n; irow ++) {
-		for (long icol = 1; icol <= 2; icol ++) {
+	for (integer irow = 1; irow <= n; irow ++) {
+		for (integer icol = 1; icol <= 2; icol ++) {
 			legend [irow] [icol] = (irow - 1) / (n - 1.0);
 		}
 	}
@@ -173,12 +173,12 @@ void ERP_drawScalp (ERP me, Graphics graphics, double tmin, double tmax, double
 	//Graphics_setGrey (graphics, 1.0);
 	//Graphics_fillRectangle (graphics, -1.1, 1.1, -1.01, 1.19);
 	//Graphics_setColour (graphics, Graphics_BLACK);
-	long numberOfDrawableChannels =
+	integer numberOfDrawableChannels =
 			my ny >= 64 && Melder_equ (my channelNames [64], U"O2") ? 64 :
 			my ny >= 32 && Melder_equ (my channelNames [32], U"Cz") ? 32 :
 			0;
 	BiosemiLocationData *biosemiLocationData = numberOfDrawableChannels == 64 ? biosemiCapCoordinates64 : numberOfDrawableChannels == 32 ? biosemiCapCoordinates32 : 0;
-	for (long ichan = 1; ichan <= numberOfDrawableChannels; ichan ++) {
+	for (integer ichan = 1; ichan <= numberOfDrawableChannels; ichan ++) {
 		double inclination = (double) biosemiLocationData [ichan]. inclination;
 		double azimuth = (double) biosemiLocationData [ichan]. azimuth;
 		bool rightHemisphere = inclination >= 0.0;
@@ -187,22 +187,22 @@ void ERP_drawScalp (ERP me, Graphics graphics, double tmin, double tmax, double
 		biosemiLocationData [ichan]. topX = r * cos (theta);
 		biosemiLocationData [ichan]. topY = r * sin (theta);
 	}
-	long n = 201;
+	integer n = 201;
 	double d = 2.0 / (n - 1);
 	autoNUMvector <double> mean (1, numberOfDrawableChannels);
-	for (long ichan = 1; ichan <= numberOfDrawableChannels; ichan ++) {
+	for (integer ichan = 1; ichan <= numberOfDrawableChannels; ichan ++) {
 		mean [ichan] = tmin == tmax ?
 				Sampled_getValueAtX (me, tmin, ichan, 0, true) :
 				Vector_getMean (me, tmin, tmax, ichan);
 	}
 	autoNUMmatrix <double> image (1, n, 1, n);
-	for (long irow = 1; irow <= n; irow ++) {
+	for (integer irow = 1; irow <= n; irow ++) {
 		double y = -1.0 + (irow - 1) * d;
-		for (long icol = 1; icol <= n; icol ++) {
+		for (integer icol = 1; icol <= n; icol ++) {
 			double x = -1.0 + (icol - 1) * d;
 			if (x * x + y * y <= 1.0) {
 				double value = undefined, sum = 0.0, weight = 0.0;
-				for (long ichan = 1; ichan <= numberOfDrawableChannels; ichan ++) {
+				for (integer ichan = 1; ichan <= numberOfDrawableChannels; ichan ++) {
 					double dx = x - biosemiLocationData [ichan]. topX;
 					double dy = y - biosemiLocationData [ichan]. topY;
 					double distance = sqrt (dx * dx + dy * dy);
@@ -222,9 +222,9 @@ void ERP_drawScalp (ERP me, Graphics graphics, double tmin, double tmax, double
 	}
 	double whiteValue = colourScale == kGraphics_colourScale::BLUE_TO_RED ? 0.5 * (vmin + vmax) : vmin;
 	Graphics_setColourScale (graphics, colourScale);
-	for (long irow = 1; irow <= n; irow ++) {
+	for (integer irow = 1; irow <= n; irow ++) {
 		double y = -1.0 + (irow - 1) * d;
-		for (long icol = 1; icol <= n; icol ++) {
+		for (integer icol = 1; icol <= n; icol ++) {
 			double x = -1.0 + (icol - 1) * d;
 			if (x * x + y * y > 1.0) {
 				image [irow] [icol] = whiteValue;
@@ -275,12 +275,12 @@ void structERPWindow :: v_drawSelectionViewer () {
 	Graphics_setColour (our graphics.get(), Graphics_WINDOW_BACKGROUND_COLOUR);
 	Graphics_fillRectangle (our graphics.get(), -1.1, 1.1, -1.01, 1.19);
 	Graphics_setColour (our graphics.get(), Graphics_BLACK);
-	long numberOfDrawableChannels =
+	integer numberOfDrawableChannels =
 			erp -> ny >= 64 && Melder_equ (erp -> channelNames [64], U"O2") ? 64 :
 			erp -> ny >= 32 && Melder_equ (erp -> channelNames [32], U"Cz") ? 32 :
 			0;
 	BiosemiLocationData *biosemiLocationData = numberOfDrawableChannels == 64 ? biosemiCapCoordinates64 : numberOfDrawableChannels == 32 ? biosemiCapCoordinates32 : 0;
-	for (long ichan = 1; ichan <= numberOfDrawableChannels; ichan ++) {
+	for (integer ichan = 1; ichan <= numberOfDrawableChannels; ichan ++) {
 		double inclination = (double) biosemiLocationData [ichan]. inclination;
 		double azimuth = (double) biosemiLocationData [ichan]. azimuth;
 		bool rightHemisphere = inclination >= 0.0;
@@ -289,23 +289,23 @@ void structERPWindow :: v_drawSelectionViewer () {
 		biosemiLocationData [ichan]. topX = r * cos (theta);
 		biosemiLocationData [ichan]. topY = r * sin (theta);
 	}
-	long n = 201;
+	integer n = 201;
 	double d = 2.0 / (n - 1);
 	autoNUMvector <double> means (1, numberOfDrawableChannels);
-	for (long ichan = 1; ichan <= numberOfDrawableChannels; ichan ++) {
+	for (integer ichan = 1; ichan <= numberOfDrawableChannels; ichan ++) {
 		means [ichan] =
 			our startSelection == our endSelection ?
 				Sampled_getValueAtX (erp, our startSelection, ichan, 0, true) :
 				Vector_getMean (erp, our startSelection, our endSelection, ichan);
 	}
 	autoNUMmatrix <double> image (1, n, 1, n);
-	for (long irow = 1; irow <= n; irow ++) {
+	for (integer irow = 1; irow <= n; irow ++) {
 		double y = -1.0 + (irow - 1) * d;
-		for (long icol = 1; icol <= n; icol ++) {
+		for (integer icol = 1; icol <= n; icol ++) {
 			double x = -1.0 + (icol - 1) * d;
 			if (x * x + y * y <= 1.0) {
 				double value = undefined, sum = 0.0, weight = 0.0;
-				for (long ichan = 1; ichan <= numberOfDrawableChannels; ichan ++) {
+				for (integer ichan = 1; ichan <= numberOfDrawableChannels; ichan ++) {
 					double dx = x - biosemiLocationData [ichan]. topX;
 					double dy = y - biosemiLocationData [ichan]. topY;
 					double distance = sqrt (dx * dx + dy * dy);
@@ -324,8 +324,8 @@ void structERPWindow :: v_drawSelectionViewer () {
 		}
 	}
 	double minimum = 0.0, maximum = 0.0;
-	for (long irow = 1; irow <= n; irow ++) {
-		for (long icol = 1; icol <= n; icol ++) {
+	for (integer irow = 1; irow <= n; irow ++) {
+		for (integer icol = 1; icol <= n; icol ++) {
 			double value = image [irow] [icol];
 			if (value < minimum) minimum = value;
 			else if (value > maximum) maximum = value;
@@ -343,9 +343,9 @@ void structERPWindow :: v_drawSelectionViewer () {
 		minimum = - absoluteExtremum;
 		maximum = absoluteExtremum;
 	}
-	for (long irow = 1; irow <= n; irow ++) {
+	for (integer irow = 1; irow <= n; irow ++) {
 		double y = -1.0 + (irow - 1) * d;
-		for (long icol = 1; icol <= n; icol ++) {
+		for (integer icol = 1; icol <= n; icol ++) {
 			double x = -1.0 + (icol - 1) * d;
 			if (x * x + y * y > 1.0) {
 				image [irow] [icol] = minimum +
@@ -389,15 +389,15 @@ void structERPWindow :: v_drawSelectionViewer () {
 	Graphics_setLineWidth (our graphics.get(), 1.0);
 }
 
+OPTIONMENU_ENUM_VARIABLE (kGraphics_colourScale, v_prefs_scalpColourSpace)
 void structERPWindow :: v_prefs_addFields (EditorCommand cmd) {
-	UiField _radio_;
-	OPTIONMENU_ENUM (U"Scalp colour space", kGraphics_colourScale, kGraphics_colourScale::BLUE_TO_RED)
+	OPTIONMENU_ENUM_FIELD (v_prefs_scalpColourSpace, U"Scalp colour space", kGraphics_colourScale, kGraphics_colourScale::BLUE_TO_RED)
 }
 void structERPWindow :: v_prefs_setValues (EditorCommand cmd) {
-	SET_ENUM (U"Scalp colour space", kGraphics_colourScale, p_scalp_colourScale)
+	SET_ENUM (v_prefs_scalpColourSpace, kGraphics_colourScale, p_scalp_colourScale)
 }
-void structERPWindow :: v_prefs_getValues (EditorCommand cmd) {
-	pref_scalp_colourScale () = p_scalp_colourScale = GET_ENUM (kGraphics_colourScale, U"Scalp colour space");
+void structERPWindow :: v_prefs_getValues (EditorCommand /* cmd */) {
+	pref_scalp_colourScale () = p_scalp_colourScale = v_prefs_scalpColourSpace;
 	FunctionEditor_redraw (this);
 }
 
diff --git a/EEG/ERPWindow.h b/EEG/ERPWindow.h
index de720f3..2bd750d 100644
--- a/EEG/ERPWindow.h
+++ b/EEG/ERPWindow.h
@@ -2,7 +2,7 @@
 #define _ERPWindow_h_
 /* ERPWindow.h
  *
- * Copyright (C) 2012,2013,2014,2015 Paul Boersma
+ * Copyright (C) 2012,2013,2014,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 #include "ERP.h"
 
 Thing_define (ERPWindow, SoundEditor) {
-	const char32 * v_getChannelName (long channelNumber)
+	const char32 * v_getChannelName (integer channelNumber)
 		override {
 			ERP erp = (ERP) our data;
 			return erp -> channelNames [channelNumber];
diff --git a/EEG/ERPWindow_prefs.h b/EEG/ERPWindow_prefs.h
index af4fbb8..13e07d8 100644
--- a/EEG/ERPWindow_prefs.h
+++ b/EEG/ERPWindow_prefs.h
@@ -1,6 +1,6 @@
 /* ERPWindow_prefs.h
  *
- * Copyright (C) 2013,2014,2015 Paul Boersma
+ * Copyright (C) 2013,2014,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,27 +18,27 @@
 
 prefs_begin (ERPWindow)
 
-	prefs_override_bool   (ERPWindow, showSelectionViewer,            1, true)
-	prefs_override_enum   (ERPWindow, sound_scalingStrategy,          1, kTimeSoundEditor_scalingStrategy, DEFAULT)
-	prefs_override_double (ERPWindow, sound_scaling_height,           1, U"20e-6")
-	prefs_override_double (ERPWindow, sound_scaling_minimum,          1, U"-10e-6")
-	prefs_override_double (ERPWindow, sound_scaling_maximum,          1, U"10e-6")
-	prefs_override_double (ERPWindow, picture_bottom,                 1, U"0.0")
-	prefs_override_double (ERPWindow, picture_top,                    1, U"0.0 (= auto)")
-	prefs_override_bool   (ERPWindow, spectrogram_show,               1, false);
-	prefs_override_double (ERPWindow, spectrogram_viewFrom,           1, U"0.0")   // Hz
-	prefs_override_double (ERPWindow, spectrogram_viewTo,             1, U"60.0")   // Hz
-	prefs_override_double (ERPWindow, spectrogram_windowLength,       1, U"0.5")   // seconds
-	prefs_override_double (ERPWindow, spectrogram_dynamicRange,       1, U"40.0")   // dB
-	prefs_override_long   (ERPWindow, spectrogram_timeSteps,          1, U"1000")
-	prefs_override_long   (ERPWindow, spectrogram_frequencySteps,     1, U"250")
-	prefs_override_enum   (ERPWindow, spectrogram_method,             1, kSound_to_Spectrogram_method, DEFAULT)
-	prefs_override_enum   (ERPWindow, spectrogram_windowShape,        1, kSound_to_Spectrogram_windowShape, DEFAULT)
-	prefs_override_bool   (ERPWindow, spectrogram_autoscaling,        1, true)
-	prefs_override_double (ERPWindow, spectrogram_maximum,            1, U"100.0")   // dB/Hz
-	prefs_override_double (ERPWindow, spectrogram_preemphasis,        1, U"0.0")   // dB/octave
-	prefs_override_double (ERPWindow, spectrogram_dynamicCompression, 1, U"0.0")
-	prefs_override_bool   (ERPWindow, spectrogram_picture_garnish,    1, true)
+	prefs_override_bool    (ERPWindow, showSelectionViewer,            1, true)
+	prefs_override_enum    (ERPWindow, sound_scalingStrategy,          1, kTimeSoundEditor_scalingStrategy, DEFAULT)
+	prefs_override_double  (ERPWindow, sound_scaling_height,           1, U"20e-6")
+	prefs_override_double  (ERPWindow, sound_scaling_minimum,          1, U"-10e-6")
+	prefs_override_double  (ERPWindow, sound_scaling_maximum,          1, U"10e-6")
+	prefs_override_double  (ERPWindow, picture_bottom,                 1, U"0.0")
+	prefs_override_double  (ERPWindow, picture_top,                    1, U"0.0 (= auto)")
+	prefs_override_bool    (ERPWindow, spectrogram_show,               1, false);
+	prefs_override_double  (ERPWindow, spectrogram_viewFrom,           1, U"0.0")   // Hz
+	prefs_override_double  (ERPWindow, spectrogram_viewTo,             1, U"60.0")   // Hz
+	prefs_override_double  (ERPWindow, spectrogram_windowLength,       1, U"0.5")   // seconds
+	prefs_override_double  (ERPWindow, spectrogram_dynamicRange,       1, U"40.0")   // dB
+	prefs_override_integer (ERPWindow, spectrogram_timeSteps,          1, U"1000")
+	prefs_override_integer (ERPWindow, spectrogram_frequencySteps,     1, U"250")
+	prefs_override_enum    (ERPWindow, spectrogram_method,             1, kSound_to_Spectrogram_method, DEFAULT)
+	prefs_override_enum    (ERPWindow, spectrogram_windowShape,        1, kSound_to_Spectrogram_windowShape, DEFAULT)
+	prefs_override_bool    (ERPWindow, spectrogram_autoscaling,        1, true)
+	prefs_override_double  (ERPWindow, spectrogram_maximum,            1, U"100.0")   // dB/Hz
+	prefs_override_double  (ERPWindow, spectrogram_preemphasis,        1, U"0.0")   // dB/octave
+	prefs_override_double  (ERPWindow, spectrogram_dynamicCompression, 1, U"0.0")
+	prefs_override_bool    (ERPWindow, spectrogram_picture_garnish,    1, true)
 
 	prefs_add_enum_with_data (ERPWindow, scalp_colourScale,           1, kGraphics_colourScale, BLUE_TO_RED)
 
diff --git a/EEG/praat_EEG.cpp b/EEG/praat_EEG.cpp
index 135ce6e..ada626c 100644
--- a/EEG/praat_EEG.cpp
+++ b/EEG/praat_EEG.cpp
@@ -105,14 +105,14 @@ OK
 	FIND_ONE (EEG)
 		if (EEG_getNumberOfExternalElectrodes (me) == 8) {
 			const long offsetExternalElectrode = EEG_getNumberOfCapElectrodes (me);
-			SET_STRING (U"External electrode 1", my channelNames [offsetExternalElectrode + 1])
-			SET_STRING (U"External electrode 2", my channelNames [offsetExternalElectrode + 2])
-			SET_STRING (U"External electrode 3", my channelNames [offsetExternalElectrode + 3])
-			SET_STRING (U"External electrode 4", my channelNames [offsetExternalElectrode + 4])
-			SET_STRING (U"External electrode 5", my channelNames [offsetExternalElectrode + 5])
-			SET_STRING (U"External electrode 6", my channelNames [offsetExternalElectrode + 6])
-			SET_STRING (U"External electrode 7", my channelNames [offsetExternalElectrode + 7])
-			SET_STRING (U"External electrode 8", my channelNames [offsetExternalElectrode + 8])
+			SET_STRING (externalElectrode1, my channelNames [offsetExternalElectrode + 1])
+			SET_STRING (externalElectrode2, my channelNames [offsetExternalElectrode + 2])
+			SET_STRING (externalElectrode3, my channelNames [offsetExternalElectrode + 3])
+			SET_STRING (externalElectrode4, my channelNames [offsetExternalElectrode + 4])
+			SET_STRING (externalElectrode5, my channelNames [offsetExternalElectrode + 5])
+			SET_STRING (externalElectrode6, my channelNames [offsetExternalElectrode + 6])
+			SET_STRING (externalElectrode7, my channelNames [offsetExternalElectrode + 7])
+			SET_STRING (externalElectrode8, my channelNames [offsetExternalElectrode + 8])
 		}
 DO
 	MODIFY_EACH (EEG)
@@ -154,7 +154,7 @@ DO
 }
 
 FORM (MODIFY_EEG_subtractMeanChannel, U"Subtract mean channel", nullptr) {
-	LABEL (U"label", U"Range of reference channels:")
+	LABEL (U"Range of reference channels:")
 	NATURAL (fromChannel, U"From channel", U"1")
 	NATURAL (toChannel, U"To channel", U"32")
 	OK
@@ -527,13 +527,13 @@ DO
 // MARK: Modify
 
 FORM (MODIFY_ERP_formula, U"ERP: Formula", U"ERP: Formula...") {
-	LABEL (U"label1", U"! `x' is the time in seconds, `col' is the sample number.")
-	LABEL (U"label2", U"x = x1   ! time associated with first sample")
-	LABEL (U"label3", U"for col from 1 to ncol")
-	LABEL (U"label4", U"   self [col] = ...")
-	TEXTFIELD (formula, U"formula", U"self")
-	LABEL (U"label5", U"   x = x + dx")
-	LABEL (U"label6", U"endfor")
+	LABEL (U"! `x` is the time in seconds, `col` is the sample number.")
+	LABEL (U"x = x1   ! time associated with first sample")
+	LABEL (U"for col from 1 to ncol")
+	LABEL (U"   self [col] = ...")
+	TEXTFIELD (formula, nullptr, U"self")
+	LABEL (U"   x = x + dx")
+	LABEL (U"endfor")
 	OK
 DO
 	MODIFY_EACH_WEAK (ERP)
@@ -546,7 +546,7 @@ FORM (MODIFY_ERP_formula_part, U"ERP: Formula (part)", U"ERP: Formula...") {
 	REAL (toTime, U"To time", U"0.0 (= all)")
 	NATURAL (fromChannel, U"From channel", U"1")
 	NATURAL (toChannel, U"To channel", U"2")
-	TEXTFIELD (formula, U"formula", U"2 * self")
+	TEXTFIELD (formula, U"Formula:", U"2 * self")
 	OK
 DO
 	MODIFY_EACH_WEAK (ERP)
diff --git a/FFNet/FFNet.cpp b/FFNet/FFNet.cpp
index 8dc22bc..b3d84ee 100644
--- a/FFNet/FFNet.cpp
+++ b/FFNet/FFNet.cpp
@@ -160,12 +160,12 @@ static void bookkeeping (FFNet me) {
 		my w = NUMvector<double> (1, my nWeights);
 	}
 	my activity = NUMvector<double> (1, my nNodes);
-	my isbias = NUMvector<long> (1, my nNodes);
-	my nodeFirst = NUMvector<long> (1, my nNodes);
-	my nodeLast = NUMvector<long> (1, my nNodes);
-	my wFirst = NUMvector<long> (1, my nNodes);
-	my wLast = NUMvector<long> (1, my nNodes);
-	my wSelected = NUMvector<long> (1, my nWeights);
+	my isbias = NUMvector<integer> (1, my nNodes);
+	my nodeFirst = NUMvector<integer> (1, my nNodes);
+	my nodeLast = NUMvector<integer> (1, my nNodes);
+	my wFirst = NUMvector<integer> (1, my nNodes);
+	my wLast = NUMvector<integer> (1, my nNodes);
+	my wSelected = NUMvector<integer> (1, my nWeights);
 	my error = NUMvector<double> (1, my nNodes);
 	my deriv = NUMvector<double> (1, my nNodes);
 	my dwi = NUMvector<double> (1, my nWeights);
@@ -226,7 +226,7 @@ void FFNet_init (FFNet me, long numberOfInputs, long nodesInLayer1, long nodesIn
 		numberOfLayers --;
 	}
 	my nLayers = numberOfLayers;
-	my nUnitsInLayer = NUMvector<long> (0, numberOfLayers);
+	my nUnitsInLayer = NUMvector<integer> (0, numberOfLayers);
 
 	my nUnitsInLayer [numberOfLayers --] = numberOfOutputs;
 	if (nodesInLayer2 > 0) {
diff --git a/FFNet/FFNet_def.h b/FFNet/FFNet_def.h
index 92d5fd7..59255b5 100644
--- a/FFNet/FFNet_def.h
+++ b/FFNet/FFNet_def.h
@@ -26,9 +26,9 @@
 #define ooSTRUCT FFNet
 oo_DEFINE_CLASS (FFNet, Daata)
 
-	oo_LONG (nLayers)	/* number of layers */
+	oo_INTEGER (nLayers)	/* number of layers */
 	
-	oo_LONG_VECTOR_FROM (nUnitsInLayer, 0, nLayers)
+	oo_INTEGER_VECTOR_FROM (nUnitsInLayer, 0, nLayers)
 
 	oo_INT (outputsAreLinear)
 
@@ -38,15 +38,15 @@ oo_DEFINE_CLASS (FFNet, Daata)
 
 	oo_AUTO_COLLECTION (Categories, outputCategories, SimpleString, 0)
 
-	oo_LONG (nWeights)	/* number of weights */
+	oo_INTEGER (nWeights)	/* number of weights */
 
 	oo_DOUBLE_VECTOR (w, nWeights)
 	
 	#if ! oo_READING && ! oo_WRITING && ! oo_COMPARING
-		oo_LONG (nNodes)
-		oo_LONG (nInputs)
-		oo_LONG (nOutputs)
-		oo_LONG (dimension)
+		oo_INTEGER (nNodes)
+		oo_INTEGER (nInputs)
+		oo_INTEGER (nOutputs)
+		oo_INTEGER (dimension)
 
 		#if oo_DECLARING
 			double (*nonLinearity) (FFNet /* me */, double /* x */, double * /* deriv */);
@@ -57,8 +57,8 @@ oo_DEFINE_CLASS (FFNet, Daata)
 		
 		#if oo_DECLARING
 			oo_DOUBLE (accumulatedCost)
-			oo_LONG (nPatterns)
-			oo_LONG (currentPattern)
+			oo_INTEGER (nPatterns)
+			oo_INTEGER (currentPattern)
 			double **inputPattern, **targetActivation;
 		#endif
 		#if oo_DECLARING || oo_DESTROYING
@@ -66,15 +66,15 @@ oo_DEFINE_CLASS (FFNet, Daata)
 		#endif
 
 		oo_DOUBLE_VECTOR (activity, nNodes)
-		oo_LONG_VECTOR (isbias, nNodes)
-		oo_LONG_VECTOR (nodeFirst, nNodes)
-		oo_LONG_VECTOR (nodeLast, nNodes)
-		oo_LONG_VECTOR (wFirst, nNodes)
-		oo_LONG_VECTOR (wLast, nNodes)
+		oo_INTEGER_VECTOR (isbias, nNodes)
+		oo_INTEGER_VECTOR (nodeFirst, nNodes)
+		oo_INTEGER_VECTOR (nodeLast, nNodes)
+		oo_INTEGER_VECTOR (wFirst, nNodes)
+		oo_INTEGER_VECTOR (wLast, nNodes)
 			
 		oo_DOUBLE_VECTOR (deriv, nNodes)	
 		oo_DOUBLE_VECTOR (error, nNodes)	
-		oo_LONG_VECTOR (wSelected, nWeights)
+		oo_INTEGER_VECTOR (wSelected, nWeights)
 		oo_DOUBLE_VECTOR (dw, nWeights)
 		oo_DOUBLE_VECTOR (dwi, nWeights)
 	#endif
diff --git a/FFNet/praat_FFNet_init.cpp b/FFNet/praat_FFNet_init.cpp
index f3dcef8..8f54a96 100644
--- a/FFNet/praat_FFNet_init.cpp
+++ b/FFNet/praat_FFNet_init.cpp
@@ -72,7 +72,7 @@ DO
 }
 
 FORM (NEWMANY_FFNet_createIrisExample, U"Create iris example", U"Create iris example...") {
-	LABEL (U"", U"For the feedforward neural net we need to know the:")
+	LABEL (U"For the feedforward neural net we need to know the:")
 	INTEGER (numberOfUnits1, U"Number of units in hidden layer 1", U"0")
 	INTEGER (numberOfUnits2, U"Number of units in hidden layer 2", U"0")
 	OK
@@ -140,7 +140,7 @@ DO
 }
 	
 FORM (GRAPHICS_FFNet_drawWeightsToLayer, U"FFNet: Draw weights to layer", nullptr) {
-	LABEL (U"", U"Warning: Disapproved. Use \"Draw weights..\" instead.")
+	LABEL (U"Warning: Disapproved. Use \"Draw weights..\" instead.")
 	NATURAL (layer, U"Layer number", U"1")
 	RADIO (scale, U"Scale", 1)
 		RADIOBUTTON (U"by maximum of all weights to layer")
@@ -281,8 +281,8 @@ DO
 }
 
 FORM (MODIFY_FFNet_reset, U"FFNet: Reset", U"FFNet: Reset...") {
-	LABEL (U"", U"Warning: this command destroys all previous learning.")
-	LABEL (U"", U"New weights will be randomly chosen from the interval [-range, +range].")
+	LABEL (U"Warning: this command destroys all previous learning.")
+	LABEL (U"New weights will be randomly chosen from the interval [-range, +range].")
 	POSITIVE (range, U"Range", U"0.1")
 	OK
 DO
@@ -292,8 +292,8 @@ DO
 }
 	
 FORM (MODIFY_FFNet_selectBiasesInLayer, U"FFNet: Select biases", U"FFNet: Select biases...") {
-	LABEL (U"", U"WARNING: This command induces very specific behaviour ")
-	LABEL (U"", U"during a following learning phase.")
+	LABEL (U"WARNING: This command induces very specific behaviour ")
+	LABEL (U"during a following learning phase.")
 	NATURAL (layer, U"Layer number", U"1")
 	OK
 DO
@@ -318,7 +318,7 @@ DO
 }
 
 FORM (NEW_FFNet_weightsToMatrix, U"FFNet: Weights to Matrix ", nullptr) {
-	LABEL (U"", U"Warning: Use \"Extract weights..\" instead.")
+	LABEL (U"Warning: Use \"Extract weights..\" instead.")
 	NATURAL (layer, U"Layer number", U"1")
 	OK
 DO
@@ -459,7 +459,7 @@ FORM (MODIFY_FFNet_PatternList_ActivationList_learnSlow, U"FFNet & PatternList &
 	// NATURAL (U"Layer", U"1")
 	NATURAL (maximumNumberOfEpochs, U"Maximum number of epochs", U"100")
 	POSITIVE (tolerance, U"Tolerance of minimizer", U"1e-7")
-	LABEL (U"Specifics", U"Specific for this minimization")
+	LABEL (U"Specific for this minimization")
 	POSITIVE (learningRate, U"Learning rate", U"0.1")
 	REAL (momentum, U"Momentum", U"0.9")
 	RADIO (costFunctionType, U"Cost function", 1)
@@ -512,7 +512,7 @@ DO
 FORM (MODIFY_FFNet_PatternList_Categories_learnSlow, U"FFNet & PatternList & Categories: Learn slow", U"FFNet & PatternList & Categories: Learn slow...") {
 	NATURAL (maximumNumberOfEpochs, U"Maximum number of epochs", U"100")
 	POSITIVE (tolerance, U"Tolerance of minimizer", U"1e-7")
-	LABEL (U"Specifics", U"Specific for this minimization")
+	LABEL (U"Specific for this minimization")
 	POSITIVE (learningRate, U"Learning rate", U"0.1")
 	REAL (momentum, U"Momentum", U"0.9")
 	RADIO (costFunctionType, U"Cost function", 1)
diff --git a/LPC/Cepstrum.cpp b/LPC/Cepstrum.cpp
index e74d6de..487143b 100644
--- a/LPC/Cepstrum.cpp
+++ b/LPC/Cepstrum.cpp
@@ -30,24 +30,22 @@
 Thing_implement (Cepstrum, Matrix, 2);
 Thing_implement (PowerCepstrum, Cepstrum, 2); // derives from Matrix therefore also version 2
 
-double structCepstrum :: v_getValueAtSample (long isamp, long which, int units) {
-	(void) units;
+double structCepstrum :: v_getValueAtSample (integer isamp, integer which, int /* units */) {
 	if (which == 0) {
-		return z[1][isamp];
+		return z [1] [isamp];
 	} else {
 		// dB's
-		return 20.0 * log10 (fabs(z[1][isamp]) + 1e-30);
+		return 20.0 * log10 (fabs (z [1] [isamp]) + 1e-30);
 	}
 	return undefined;
 }
 
-double structPowerCepstrum :: v_getValueAtSample (long isamp, long which, int units) {
-	(void) units;
+double structPowerCepstrum :: v_getValueAtSample (integer isamp, integer which, int /* units */) {
 	if (which == 0) {
-		return z[1][isamp];
+		return z [1] [isamp];
 	} else {
 		// dB's
-		return 10.0 * log10 (z[1][isamp] + 1e-30); // always positive
+		return 10.0 * log10 (z [1] [isamp] + 1e-30); // always positive
 	}
 	return undefined;
 }
diff --git a/LPC/Cepstrum.h b/LPC/Cepstrum.h
index 12c7a1f..290034a 100644
--- a/LPC/Cepstrum.h
+++ b/LPC/Cepstrum.h
@@ -32,9 +32,8 @@
 #include "Matrix.h"
 
 Thing_define (Cepstrum, Matrix) {
-	// overridden methods:
-	public:
-		virtual double v_getValueAtSample (long isamp, long which, int units);
+	double v_getValueAtSample (integer isamp, integer which, int units)
+		override;
 };
 
 /*
@@ -43,9 +42,8 @@ Thing_define (Cepstrum, Matrix) {
 */
 
 Thing_define (PowerCepstrum, Cepstrum) {
-	// overridden methods:
-	public:
-		virtual double v_getValueAtSample (long isamp, long which, int units);
+	double v_getValueAtSample (integer isamp, integer which, int units)
+		override;
 };
 
 /*
diff --git a/LPC/praat_LPC_init.cpp b/LPC/praat_LPC_init.cpp
index 8c86a4a..c808860 100644
--- a/LPC/praat_LPC_init.cpp
+++ b/LPC/praat_LPC_init.cpp
@@ -106,7 +106,7 @@ FORM (GRAPHICS_PowerCepstrum_drawTiltLine, U"PowerCepstrum: Draw tilt line", U"P
 	praat_Quefrency_RANGE(fromQuefrency,toQuefrency)
 	REAL (fromAmplitude_dB, U"left Amplitude range (dB)", U"0.0")
 	REAL (toAmplitude_dB, U"right Amplitude range (dB)", U"0.0")
-	LABEL (U"", U"Parameters for the tilt line fit")
+	LABEL (U"Parameters for the tilt line fit")
 	REAL (fromQuefrency_tiltLine, U"left Tilt line quefrency range (s)", U"0.001")
 	REAL (toQuefrency_tiltLine, U"right Tilt line quefrency range (s)", U"0.0 (= end)")
 	OPTIONMENU (lineType, U"Line type", 1)
@@ -123,9 +123,9 @@ DO
 }
 
 FORM (MODIFY_PowerCepstrum_formula, U"PowerCepstrum: Formula...", U"PowerCepstrum: Formula...") {
-	LABEL (U"label", U"y := y1; for row := 1 to nrow do { x := x1; "
+	LABEL (U"y := y1; for row := 1 to nrow do { x := x1; "
 		"for col := 1 to ncol do { self [row, col] := `formula' ; x := x + dx } y := y + dy }")
-	TEXTFIELD (formula, U"formula", U"self")
+	TEXTFIELD (formula, U"Formula:", U"self")
 	OK
 DO
 	MODIFY_EACH (PowerCepstrum)
@@ -410,11 +410,11 @@ DO
 }
 
 FORM (REAL_PowerCepstrogram_getCPPS_hillenbrand, U"PowerCepstrogram: Get CPPS", nullptr) {
-	LABEL (U"", U"Smoothing:")
+	LABEL (U"Smoothing:")
 	BOOLEAN (subtractTiltBeforeSmoothing, U"Subtract tilt before smoothing", true)
 	REAL (smoothinWindowDuration, U"Time averaging window (s)", U"0.001")
 	REAL (quefrencySmoothinWindowDuration, U"Quefrency averaging window (s)", U"0.00005")
-	LABEL (U"", U"Peak search:")
+	LABEL (U"Peak search:")
 	REAL (fromPitch, U"left Peak search pitch range (Hz)", U"60.0")
 	REAL (toPitch, U"right Peak search pitch range (Hz)", U"330.0")
 	OK
@@ -425,11 +425,11 @@ DO
 }
 
 FORM (REAL_PowerCepstrogram_getCPPS, U"PowerCepstrogram: Get CPPS", nullptr) {
-	LABEL (U"", U"Smoothing:")
+	LABEL (U"Smoothing:")
 	BOOLEAN (subtractTiltBeforeSmoothing, U"Subtract tilt before smoothing", true)
 	REAL (smoothingWindowDuration, U"Time averaging window (s)", U"0.02")
 	REAL (quefrencySmoothingWindowDuration, U"Quefrency averaging window (s)", U"0.0005")
-	LABEL (U"", U"Peak search:")
+	LABEL (U"Peak search:")
 	REAL (fromPitch, U"left Peak search pitch range (Hz)", U"60.0")
 	REAL (toPitch, U"right Peak search pitch range (Hz)", U"330.0")
 	POSITIVE (tolerance, U"Tolerance (0-1)", U"0.05")
@@ -438,7 +438,7 @@ FORM (REAL_PowerCepstrogram_getCPPS, U"PowerCepstrogram: Get CPPS", nullptr) {
 		RADIOBUTTON (U"Parabolic")
 		RADIOBUTTON (U"Cubic")
 		RADIOBUTTON (U"Sinc70")
-	LABEL (U"", U"Tilt line:")
+	LABEL (U"Tilt line:")
 	REAL (fromQuefrency_tiltLine, U"left Tilt line quefrency range (s)", U"0.001")
 	REAL (toQuefrency_tiltLine, U"right Tilt line quefrency range (s)", U"0.0 (= end)")
 	OPTIONMENU (lineType, U"Line type", 2)
@@ -455,12 +455,11 @@ DO
 }
 
 FORM (MODIFY_PowerCepstrogram_formula, U"PowerCepstrogram: Formula", nullptr) {
-	LABEL (U"label", U"Do for all times and quefrencies:")
-	LABEL (U"label", U"   `x' is the time in seconds")
-	LABEL (U"label", U"   `y' is the quefrency in seconds")
-	LABEL (U"label", U"   `self' is the current value")
-	LABEL (U"label", U"   Replace all values with:")
-	TEXTFIELD (formula, U"formula", U"sqrt(self)")
+	LABEL (U"Do for all times and quefrencies:")
+	LABEL (U"   `x` is the time in seconds")
+	LABEL (U"   `y` is the quefrency in seconds")
+	LABEL (U"   `self` is the current value")
+	TEXTFIELD (formula, U"   Replace all values with:", U"sqrt(self)")
 	OK
 DO
 	MODIFY_EACH_WEAK (PowerCepstrogram)
@@ -526,13 +525,13 @@ DIRECT (NEW_Cepstrumc_to_LPC) {
 }
 
 FORM (NEW1_Cepstrumc_to_DTW, U"Cepstrumc: To DTW", U"Cepstrumc: To DTW...") {
-	LABEL (U"", U"Distance calculation between Cepstra")
+	LABEL (U"Distance calculation between Cepstra")
 	REAL (cepstralWeight, U"Cepstral weight", U"1.0")
 	REAL (logEnergyWeight, U"Log energy weight", U"0.0")
 	REAL (regressionWeight, U"Regression weight", U"0.0")
 	REAL (regressionLogEnergyWeight, U"Regression weight log energy", U"0.0")
 	REAL (windowDuration, U"Window for regression coefficients (seconds)", U"0.056")
-	LABEL (U"", U"Boundary conditions for time warp")
+	LABEL (U"Boundary conditions for time warp")
 	BOOLEAN (matchBeginPositions, U"Match begin positions", false)
 	BOOLEAN (matchEndPositions, U"Match end positions", false)
 	RADIO (slopeConstraintType, U"Slope constraints", 1)
@@ -568,8 +567,8 @@ FORM (MODIFY_Formant_formula, U"Formant: Formula", nullptr) {
 	praat_TimeFunction_RANGE(fromTime,toTime)
 	NATURAL (fromFormant, U"left Formant range", U"1")
 	NATURAL (toFormant, U"right Formant range", U"5")
-	LABEL (U"", U"Formant frequencies in odd numbered rows")
-	LABEL (U"", U"Formant bandwidths in even numbered rows")
+	LABEL (U"Formant frequencies in odd numbered rows")
+	LABEL (U"Formant bandwidths in even numbered rows")
 	SENTENCE (formula, U"Formula", U"if row mod 2 = 1 and self[row,col]/self[row+1,col] < 5 then 0 else self fi")
 	OK
 DO
@@ -818,10 +817,10 @@ DO
 }
 
 static void Sound_to_LPC_addWarning (UiForm dia) {
-	LABEL (U"", U"Warning 1:  for formant analysis, use \"To Formant\" instead.")
-	LABEL (U"", U"Warning 2:  if you do use \"To LPC\", you may want to resample first.")
-	LABEL (U"", U"Click Help for more details.")
-	LABEL (U"", U"")
+	LABEL (U"Warning 1:  for formant analysis, use \"To Formant\" instead.")
+	LABEL (U"Warning 2:  if you do use \"To LPC\", you may want to resample first.")
+	LABEL (U"Click Help for more details.")
+	LABEL (U"")
 }
 
 FORM (NEW_Sound_to_LPC_auto, U"Sound: To LPC (autocorrelation)", U"Sound: To LPC (autocorrelation)...") {
@@ -886,7 +885,7 @@ FORM (NEW_Sound_to_MFCC, U"Sound: To MFCC", U"Sound: To MFCC...") {
 	NATURAL (numberOfCoefficients, U"Number of coefficients", U"12")
 	POSITIVE (windowLength, U"Window length (s)", U"0.015")
 	POSITIVE (timeStep, U"Time step (s)", U"0.005")
-	LABEL (U"", U"Filter bank parameters")
+	LABEL (U"Filter bank parameters")
 	POSITIVE (firstFilterFrequency, U"First filter frequency (mel)", U"100.0")
 	POSITIVE (distancBetweenFilters, U"Distance between filters (mel)", U"100.0")
 	REAL (maximumFrequency, U"Maximum frequency (mel)", U"0.0");
diff --git a/artsynth/Art_Speaker_to_VocalTract.cpp b/artsynth/Art_Speaker_to_VocalTract.cpp
index d3970ca..1b32596 100644
--- a/artsynth/Art_Speaker_to_VocalTract.cpp
+++ b/artsynth/Art_Speaker_to_VocalTract.cpp
@@ -1,6 +1,6 @@
 /* Art_Speaker_to_VocalTract.cpp
  *
- * Copyright (C) 1992-2011,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -26,8 +26,8 @@ autoVocalTract Art_Speaker_to_VocalTract (Art art, Speaker speaker) {
 	Art_Speaker_intoDelta (art, speaker, delta.get());
 	double area [300];
 	constexpr double sectionLength = 0.001;   // one millimetre
-	int numberOfSections = 0;
-	for (long isection = 1; isection <= 27; isection ++) {
+	integer numberOfSections = 0;
+	for (integer isection = 1; isection <= 27; isection ++) {
 		Delta_Tube tube = delta -> tube + 37 + isection;
 		int numberOfConstantSections = lround (tube -> Dxeq / sectionLength);
 		double constantArea = tube -> Dyeq * tube -> Dzeq;
@@ -35,7 +35,7 @@ autoVocalTract Art_Speaker_to_VocalTract (Art art, Speaker speaker) {
 			area [++ numberOfSections] = constantArea;
 	}
 	autoVocalTract thee = VocalTract_create (numberOfSections, sectionLength);
-	for (long isection = 1; isection <= numberOfSections; isection ++)
+	for (integer isection = 1; isection <= numberOfSections; isection ++)
 		thy z [1] [isection] = area [isection];
 	return thee;
 }
diff --git a/artsynth/ArtwordEditor.cpp b/artsynth/ArtwordEditor.cpp
index 721b231..9b9505f 100644
--- a/artsynth/ArtwordEditor.cpp
+++ b/artsynth/ArtwordEditor.cpp
@@ -39,11 +39,11 @@ static void updateList (ArtwordEditor me) {
 
 static void gui_button_cb_removeTarget (ArtwordEditor me, GuiButtonEvent /* event */) {
 	Artword artword = (Artword) my data;
-	long numberOfSelectedPositions;
-	long *selectedPositions = GuiList_getSelectedPositions (my list, & numberOfSelectedPositions);   // BUG memory
+	integer numberOfSelectedPositions;
+	integer *selectedPositions = GuiList_getSelectedPositions (my list, & numberOfSelectedPositions);   // BUG memory
 	if (selectedPositions) {
-		for (long ipos = numberOfSelectedPositions; ipos > 0; ipos --) {
-			long position = selectedPositions [ipos];
+		for (integer ipos = numberOfSelectedPositions; ipos > 0; ipos --) {
+			integer position = selectedPositions [ipos];
 			Melder_assert (position >= 1 && position <= INT16_MAX);
 			Artword_removeTarget (artword, my muscle, (int16) position);   // guarded conversion
 		}
diff --git a/artsynth/Artword_Speaker_to_Sound.cpp b/artsynth/Artword_Speaker_to_Sound.cpp
index 6a9b81d..0e9475f 100644
--- a/artsynth/Artword_Speaker_to_Sound.cpp
+++ b/artsynth/Artword_Speaker_to_Sound.cpp
@@ -1,6 +1,6 @@
 /* Artword_Speaker_to_Sound.cpp
  *
- * Copyright (C) 1992-2011,2015,2016 Paul Boersma
+ * Copyright (C) 1992-2011,2015,2016,2017 Paul Boersma
  *
  * This code 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 @@ autoSound Artword_Speaker_to_Sound (Artword artword, Speaker speaker,
 {
 	try {
 		autoSound result = Sound_createSimple (1, artword -> totalTime, fsamp);
-		long numberOfSamples = result -> nx;
+		integer numberOfSamples = result -> nx;
 		double minTract [1+78], maxTract [1+78];   // for drawing
 		double Dt = 1.0 / fsamp / oversampling,
 			rho0 = 1.14,
@@ -101,7 +101,7 @@ autoSound Artword_Speaker_to_Sound (Artword artword, Speaker speaker,
 			totalVolume += t->V;
 		}
 		//Melder_casual (U"Starting volume: ", totalVolume * 1000, U" litres.");
-		for (long sample = 1; sample <= numberOfSamples; sample ++) {
+		for (integer sample = 1; sample <= numberOfSamples; sample ++) {
 			double time = (sample - 1) / fsamp;
 			Artword_intoArt (artword, art.get(), time);
 			Art_Speaker_intoDelta (art.get(), speaker, delta.get());
diff --git a/artsynth/Delta.cpp b/artsynth/Delta.cpp
index 6d7269f..5861706 100644
--- a/artsynth/Delta.cpp
+++ b/artsynth/Delta.cpp
@@ -25,7 +25,7 @@ void structDelta :: v_destroy () noexcept {
 	Delta_Parent :: v_destroy ();
 }
 
-void Delta_init (Delta me, int numberOfTubes) {
+void Delta_init (Delta me, integer numberOfTubes) {
 	Melder_assert (numberOfTubes >= 1);
 	my numberOfTubes = numberOfTubes;
 	my tube = NUMvector <struct structDelta_Tube> (1, numberOfTubes);
@@ -35,7 +35,7 @@ void Delta_init (Delta me, int numberOfTubes) {
 	}
 }
 
-autoDelta Delta_create (int numberOfTubes) {
+autoDelta Delta_create (integer numberOfTubes) {
 	autoDelta me = Thing_new (Delta);
 	Delta_init (me.get(), numberOfTubes);
 	return me;
diff --git a/artsynth/Delta.h b/artsynth/Delta.h
index 22b1e3f..ba05800 100644
--- a/artsynth/Delta.h
+++ b/artsynth/Delta.h
@@ -2,7 +2,7 @@
 #define _Delta_h_
 /* Delta.h
  *
- * Copyright (C) 1992-2011,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,18 +25,18 @@ struct structDelta_Tube
 {
 	/* Structure: static. */
 
-	Delta_Tube left1;   /* If null: closed at left edge. */
-	Delta_Tube left2;   /* If not null: two merging streams. */
-	Delta_Tube right1;  /* If null: radiation at right edge. */
-	Delta_Tube right2;  /* If not null: a stream splitting into two. */
-	long parallel;   /* Parallel subdivision. */
+	Delta_Tube left1;   // if null: closed at left edge
+	Delta_Tube left2;   // if not null: two merging streams
+	Delta_Tube right1;  // if null: radiation at right edge
+	Delta_Tube right2;  // if not null: a stream splitting into two
+	integer parallel;   // parallel subdivision
 
 	/* Controlled by articulation: quasistatic. */
 
 	double Dxeq, Dyeq, Dzeq;
 	double mass, k1, k3, Brel, s1, s3, dy;
-	double k1left1, k1left2, k1right1, k1right2;   /* Linear coupling factors. */
-	double k3left1, k3left2, k3right1, k3right2;   /* Cubic coupling factors. */
+	double k1left1, k1left2, k1right1, k1right2;   // linear coupling factors
+	double k3left1, k3left2, k3right1, k3right2;   // cubic coupling factors
 
 	/* Dynamic. */
 
@@ -53,16 +53,16 @@ struct structDelta_Tube
 };
 
 Thing_define (Delta, Thing) {
-	int numberOfTubes;              // >= 1
-	struct structDelta_Tube *tube;  // tube [1..numberOfTubes]
+	integer numberOfTubes;           // >= 1
+	struct structDelta_Tube *tube;   // tube [1..numberOfTubes]
 
 	void v_destroy () noexcept
 		override;
 };
 
-void Delta_init (Delta me, int numberOfTubes);
+void Delta_init (Delta me, integer numberOfTubes);
 
-autoDelta Delta_create (int numberOfTubes);
+autoDelta Delta_create (integer numberOfTubes);
 /*
 	Function:
 		return a new Delta.
diff --git a/artsynth/Speaker_to_Delta.cpp b/artsynth/Speaker_to_Delta.cpp
index 1c37aab..16c943c 100644
--- a/artsynth/Speaker_to_Delta.cpp
+++ b/artsynth/Speaker_to_Delta.cpp
@@ -30,7 +30,7 @@ autoDelta Speaker_to_Delta (Speaker me) {
 
 	/* Lungs: tubes 1..23. */
 
-	for (int itube = 1; itube <= 23; itube ++) {
+	for (integer itube = 1; itube <= 23; itube ++) {
 		Delta_Tube t = thy tube + itube;
 		t -> Dx = t -> Dxeq = 10.0 * f;
 		t -> Dy = t -> Dyeq = 100.0 * f;
@@ -44,7 +44,7 @@ autoDelta Speaker_to_Delta (Speaker me) {
 
 	/* Bronchi: tubes 24..29. */
 
-	for (int itube = 24; itube <= 29; itube ++) {
+	for (integer itube = 24; itube <= 29; itube ++) {
 		Delta_Tube t = thy tube + itube;
 		t -> Dx = t -> Dxeq = 10.0 * f;
 		t -> Dy = t -> Dyeq = 15.0 * f;
@@ -57,7 +57,7 @@ autoDelta Speaker_to_Delta (Speaker me) {
 
 	/* Trachea: tubes 30..35; four of these may be replaced by conus elasticus (see below). */
 
-	for (int itube = 30; itube <= 35; itube ++) {
+	for (integer itube = 30; itube <= 35; itube ++) {
 		Delta_Tube t = thy tube + itube;
 		t -> Dx = t -> Dxeq = 10.0 * f;
 		t -> Dy = t -> Dyeq = 15.0 * f;
@@ -69,7 +69,7 @@ autoDelta Speaker_to_Delta (Speaker me) {
 	}
 
 	if (SMOOTH_LUNGS) {
-		struct { int itube; double Dy, Dz, parallel; } data [] = {
+		struct { integer itube; double Dy, Dz, parallel; } data [] = {
 			{  7, 120.0, 240.0, 5000.0 }, {  8, 120.0, 240.0, 5000.0 }, {  9, 120.0, 240.0, 5000.0 },
 			{ 10, 120.0, 240.0, 5000.0 }, { 11, 120.0, 240.0, 5000.0 }, { 12, 120.0, 240.0, 5000.0 },
 			{ 13, 120.0, 240.0, 2500.0 }, { 14, 120.0, 240.0, 1250.0 }, { 15, 120.0, 240.0,  640.0 },
@@ -77,19 +77,19 @@ autoDelta Speaker_to_Delta (Speaker me) {
 			{ 19,  70.0,  70.0,   40.0 }, { 20,  35.0,  35.0,   20.0 }, { 21,  18.0,  18.0,   10.0 },
 			{ 22,  12.0,  12.0,    5.0 }, { 23,  12.0,  12.0,    3.0 }, { 24,  18.0,   9.0,    2.0 },
 			{ 25,  18.0,  19.0,    2.0 }, { } };
-		for (int i = 0; data [i]. itube; i ++) {
+		for (integer i = 0; data [i]. itube; i ++) {
 			Delta_Tube t = thy tube + data [i]. itube;
 			t -> Dy = t -> Dyeq = data [i]. Dy * f;
 			t -> Dz = t -> Dzeq = data [i]. Dz * f;
 			t -> parallel = data [i]. parallel;
 		}
-		for (int itube = 26; itube <= 35; itube ++) {
+		for (integer itube = 26; itube <= 35; itube ++) {
 			Delta_Tube t = thy tube + itube;
 			t -> Dy = t -> Dyeq = 11.0 * f;
 			t -> Dz = t -> Dzeq = 14.0 * f;
 			t -> parallel = 1;
 		}
-		for (int itube = FIRST_TUBE; itube <= 18; itube ++) {
+		for (integer itube = FIRST_TUBE; itube <= 18; itube ++) {
 			Delta_Tube t = thy tube + itube;
 			t -> Dx = t -> Dxeq = 10.0 * f;
 			t -> mass = 10.0 * my relativeSize * t -> Dx * t -> Dz;   // 10 mm
@@ -97,7 +97,7 @@ autoDelta Speaker_to_Delta (Speaker me) {
 			t -> k3 = 0.0;
 			t -> Brel = 1.0;
 		}
-		for (int itube = 19; itube <= 35; itube ++) {
+		for (integer itube = 19; itube <= 35; itube ++) {
 			Delta_Tube t = thy tube + itube;
 			t -> Dx = t -> Dxeq = 10.0 * f;
 			t -> mass = 3.0 * my relativeSize * t -> Dx * t -> Dz;   // 3 mm
@@ -185,7 +185,7 @@ autoDelta Speaker_to_Delta (Speaker me) {
 		thy tube [85]. Brel = 0.2;
 		thy tube [86]. Brel = 0.2;
 
-		for (int itube = 79; itube <= 86; itube ++) {
+		for (integer itube = 79; itube <= 86; itube ++) {
 			Delta_Tube t = thy tube + itube;
 			t -> mass = t -> Dx * t -> Dz / (30.0 * f);
 			t -> k3 = t -> k1 * (20.0 / t -> Dz) * (20.0 / t -> Dz);
@@ -199,7 +199,7 @@ autoDelta Speaker_to_Delta (Speaker me) {
 	 * Fill in the values of the glottal shunt only if we want to model it.
 	 */
 	if (my shunt.Dx != 0.0) {
-		for (int itube = 87; itube <= 89; itube ++) {
+		for (integer itube = 87; itube <= 89; itube ++) {
 			Delta_Tube t = thy tube + itube;
 			t -> Dx = t -> Dxeq = my shunt.Dx;
 			t -> Dy = t -> Dyeq = my shunt.Dy;
@@ -219,9 +219,9 @@ autoDelta Speaker_to_Delta (Speaker me) {
 
 	/* Pharynx and mouth: tubes 38..64. */
 
-	for (int itube = 38; itube <= 64; itube ++) {
+	for (integer itube = 38; itube <= 64; itube ++) {
 		Delta_Tube t = thy tube + itube;
-		int i = itube - 37;
+		integer i = itube - 37;
 		t -> Dx = t -> Dxeq = sqrt (( dx = xmm [i] - xmm [i + 1], dx * dx ) + ( dy = ymm [i] - ymm [i + 1], dy * dy ));
 		t -> Dyeq = sqrt (( dx = xe [i] - xi [i], dx * dx ) + ( dy = ye [i] - yi [i], dy * dy ));
 		if (closed [i]) t -> Dyeq = - t -> Dyeq;
@@ -236,7 +236,7 @@ autoDelta Speaker_to_Delta (Speaker me) {
 
 	/* Nose: tubes 65..78. */
 
-	for (int itube = 65; itube <= 78; itube ++) {
+	for (integer itube = 65; itube <= 78; itube ++) {
 		Delta_Tube t = thy tube + itube;
 		t -> Dx = t -> Dxeq = my nose.Dx;
 		t -> Dy = t -> Dyeq = my nose.weq [itube - 65];
@@ -252,7 +252,7 @@ autoDelta Speaker_to_Delta (Speaker me) {
 	 * every tube is connected on the left to the previous tube (index one lower).
 	 * This corresponds to a two-mass model of the vocal cords without shunt.
 	 */
-	for (int itube = SMOOTH_LUNGS ? FIRST_TUBE : 1; itube <= thy numberOfTubes; itube ++) {
+	for (integer itube = SMOOTH_LUNGS ? FIRST_TUBE : 1; itube <= thy numberOfTubes; itube ++) {
 		Delta_Tube t = thy tube + itube;
 		t -> s1 = 5e6 * t -> Dx * t -> Dz;
 		t -> s3 = t -> s1 / (0.9e-3 * 0.9e-3);
@@ -302,7 +302,7 @@ autoDelta Speaker_to_Delta (Speaker me) {
 	} else {
 
 		/* Disconnect tubes 79..86 on both sides. */
-		for (int itube = 79; itube <= 86; itube ++)
+		for (integer itube = 79; itube <= 86; itube ++)
 			thy tube [itube]. left1 = thy tube [itube]. right1 = nullptr;
 	}
 
@@ -310,7 +310,7 @@ autoDelta Speaker_to_Delta (Speaker me) {
 	 * Create a side branch from tube 34/35 (or 85/86) to tube 38/39 with tubes 87..89.
 	 */
 	if (my shunt.Dx != 0.0) {
-		int topOfTrachea = ( my cord.numberOfMasses == 10 ? 86 : 35 );
+		integer topOfTrachea = ( my cord.numberOfMasses == 10 ? 86 : 35 );
 
 		/* Create a three-way interface below the shunt.
 		 * Connect lowest shunt tube (87) with top of trachea (34/35 or 85/86).
@@ -330,7 +330,7 @@ autoDelta Speaker_to_Delta (Speaker me) {
 	} else {
 
 		/* Disconnect tubes 87..89 on both sides. */
-		for (int itube = 87; itube <= 89; itube ++)
+		for (integer itube = 87; itube <= 89; itube ++)
 			thy tube [itube]. left1 = thy tube [itube]. right1 = nullptr;
 	}
 
@@ -348,7 +348,7 @@ autoDelta Speaker_to_Delta (Speaker me) {
 	thy tube [64]. right1 = nullptr;   // radiation at the lips
 	thy tube [78]. right1 = nullptr;   // radiation at the nostrils
 
-	for (int itube = 1; itube <= thy numberOfTubes; itube ++) {
+	for (integer itube = 1; itube <= thy numberOfTubes; itube ++) {
 		Delta_Tube t = thy tube + itube;
 		Melder_assert (! t->left1 || t->left1->right1 == t || t->left1->right2 == t);
 		Melder_assert (! t->left2 || t->left2->right1 == t);
diff --git a/artsynth/praat_Artsynth.cpp b/artsynth/praat_Artsynth.cpp
index 826bff9..ed6babf 100644
--- a/artsynth/praat_Artsynth.cpp
+++ b/artsynth/praat_Artsynth.cpp
@@ -41,11 +41,11 @@ DO
 FORM (WINDOW_Art_viewAndEdit, U"View & Edit Articulation", nullptr) {
 	static double muscles [1 + (int) kArt_muscle::MAX];
 	for (int i = 1; i <= (int) kArt_muscle::MAX; i ++)
-		UiForm_addReal4 (dia, & muscles [i], kArt_muscle_getText ((kArt_muscle) i), kArt_muscle_getText ((kArt_muscle) i), U"0.0");
+		UiForm_addReal (dia, & muscles [i], nullptr /* GUI-only */, kArt_muscle_getText ((kArt_muscle) i), U"0.0");
 OK
 	FIND_ONE (Art)
 	for (int i = 1; i <= (int) kArt_muscle::MAX; i ++)
-		SET_REAL (kArt_muscle_getText ((kArt_muscle) i), my art [i]);
+		SET_REAL (muscles [i], my art [i])
 DO
 	FIND_ONE (Art)
 		if (theCurrentPraatApplication -> batch)
@@ -275,9 +275,9 @@ DIRECT (GRAPHICS_VocalTract_draw) {
 }
 
 FORM (MODIFY_VocalTract_formula, U"VocalTract Formula", U"Matrix: Formula...") {
-	LABEL (U"label", U"`x' is the distance form the glottis in metres, `col' is the section number, `self' is in m\u00B2")
-	LABEL (U"label", U"x := x1;   for col := 1 to ncol do { self [col] := `formula' ; x := x + dx }")
-	TEXTFIELD (formula, U"formula", U"0")
+	LABEL (U"`x` is the distance form the glottis in metres, `col` is the section number, `self` is in m\u00B2")
+	LABEL (U"x := x1;   for col := 1 to ncol do { self [col] := `formula' ; x := x + dx }")
+	TEXTFIELD (formula, U"Formula:", U"0")
 	OK
 DO
 	MODIFY_EACH_WEAK (VocalTract)
@@ -296,7 +296,7 @@ DIRECT (NEW_VocalTract_to_Matrix) {
 }
 
 FORM (NEW_VocalTract_to_Spectrum, U"From Vocal Tract to Spectrum", nullptr) {
-	LABEL (U"", U"Compute transfer function")
+	LABEL (U"Compute transfer function")
 	NATURAL (numberOfFequencies, U"Number of frequencies", U"4097")
 	POSITIVE (maximumFrequency, U"Maximum frequency (Hz)", U"5000.0")
 	REAL (glottalDamping, U"Glottal damping", U"0.1")
diff --git a/contrib/ola/FeatureWeights.cpp b/contrib/ola/FeatureWeights.cpp
index 1bc2cb8..945eed9 100644
--- a/contrib/ola/FeatureWeights.cpp
+++ b/contrib/ola/FeatureWeights.cpp
@@ -1,6 +1,6 @@
 /* FeatureWeights.cpp
  *
- * Copyright (C) 2007-2008 Ola So"der, 2010-2012,2015,2016 Paul Boersma
+ * Copyright (C) 2007-2008 Ola So"der, 2010-2012,2015,2016,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -63,14 +63,14 @@ autoFeatureWeights FeatureWeights_create
     // Parameters                //
     ///////////////////////////////
 
-    long nweights       // number of weights
+    integer nweights       // number of weights
 )
 
 {
 	try {
 		autoFeatureWeights me = Thing_new (FeatureWeights);
 		my fweights = TableOfReal_create (1, nweights);
-		for (long i = 1; i <= nweights; i ++) {
+		for (integer i = 1; i <= nweights; i ++) {
 			my fweights -> data [1] [i] = 1;
 		}
 		return me;
@@ -83,7 +83,7 @@ autoFeatureWeights FeatureWeights_create
 // Compute prior probabilities                                                             //
 /////////////////////////////////////////////////////////////////////////////////////////////
 
-long FeatureWeights_computePriors
+integer FeatureWeights_computePriors
 (
     ///////////////////////////////
     // Parameters                //
@@ -91,18 +91,18 @@ long FeatureWeights_computePriors
 
     Categories c,       // source categories
                         //
-    long * indices,     // Out: instances indices ..
+    integer * indices,  // Out: instances indices ..
                         //  
     double * priors     // Out: .. and their prior probabilities
                         //
 )
 
 {
-    long nc = 0;
-    for (long y = 1; y <= c->size; y ++)
+    integer nc = 0;
+    for (integer y = 1; y <= c->size; y ++)
     {
-        long ifriend = -1;
-        for (long sc = 0; sc < nc; sc ++)
+        integer ifriend = -1;
+        for (integer sc = 0; sc < nc; sc ++)
             if (FeatureWeights_areFriends (c->at [y], c->at [indices [sc]])) ifriend = sc;
 
         if (ifriend < 0)
@@ -116,7 +116,7 @@ long FeatureWeights_computePriors
             priors [ifriend] ++;
         }
     }
-    for (long q = 0; q < nc; q++) priors [q] /= c->size;
+    for (integer q = 0; q < nc; q++) priors [q] /= c->size;
     return nc;
 }
 
@@ -130,11 +130,11 @@ autoFeatureWeights FeatureWeights_compute           // Obsolete
     // Parameters                //
     ///////////////////////////////
 
-    PatternList pp,     // Source pattern
+    PatternList pp, // Source pattern
                     //
     Categories c,   // Source categories
                     //
-    long k          // k(!)
+    integer k       // k(!)
 )
 
 {
@@ -154,11 +154,11 @@ autoFeatureWeights FeatureWeights_computeWrapperInt
 
     KNN me,         // Classifier
                     //
-    long k,         // k(!)
+    integer k,      // k(!)
                     //
     int d,          // distance weighting
                     //
-    long nseeds,    // the number of seeds
+    integer nseeds, // the number of seeds
                     //
     double alfa,    // shrinkage factor
                     //
@@ -179,35 +179,35 @@ autoFeatureWeights FeatureWeights_computeWrapperInt
 		autoNUMvector <double> results ((integer) 0, nseeds);
 
 		autoThingVector <structFeatureWeights> cs ((integer) 0, nseeds);
-		for (long y = 0; y <= nseeds; y++) {
+		for (integer y = 0; y <= nseeds; y++) {
 			cs [y] = FeatureWeights_create (my input -> nx);
 		}
 
-		for (long x = 1; x <= my input -> nx; x ++)
+		for (integer x = 1; x <= my input -> nx; x ++)
 			cs [nseeds] -> fweights -> data [1] [x] = pivot;
 
 		results [nseeds] = KNN_evaluate (me, cs [nseeds].get(), k, d, emode);
 
 		while (range > 0 && results [nseeds] < stop)
 		{
-			long best = nseeds;
+			integer best = nseeds;
 
 			if (mode == 2)
 			{
-				for (long x = 1; x <= (my input)->nx; x ++)
+				for (integer x = 1; x <= (my input)->nx; x ++)
 				{
-					for (long y = 0; y < nseeds; y ++)
+					for (integer y = 0; y < nseeds; y ++)
 					{
 						cs[y]->fweights->data[1][x] = NUMrandomUniform(OlaMAX(0, cs[nseeds]->fweights->data[1][x] - range),
 													  OlaMIN(1, cs[nseeds]->fweights->data[1][x] + range));
 						results[y] = KNN_evaluate (me, cs [y].get(), k, d, emode);
 					}
-					for (long q = 0; q < nseeds; q++)
+					for (integer q = 0; q < nseeds; q++)
 						if (results[q] > results[best]) best = q;
 
 					if (results[best] > results[nseeds])
 					{
-						for (long x = 1; x <= (my input)->nx; x++)   // HELP FIXME the same index for an inner and an outer loop!!!
+						for (integer x = 1; x <= (my input)->nx; x++)   // HELP FIXME the same index for an inner and an outer loop!!!
 							cs[nseeds]->fweights->data[1][x] = cs[best]->fweights->data[1][x];
 						results[nseeds] = results[best];
 					}
@@ -215,9 +215,9 @@ autoFeatureWeights FeatureWeights_computeWrapperInt
 			}
 			else
 			{
-				for (long y = 0; y < nseeds; y++)
+				for (integer y = 0; y < nseeds; y++)
 				{
-					for (long x = 1; x <= (my input)->nx; x++)
+					for (integer x = 1; x <= (my input)->nx; x++)
 					{
 						cs[y]->fweights->data[1][x] = NUMrandomUniform(OlaMAX(0, cs[nseeds]->fweights->data[1][x] - range),
 													  OlaMIN(1, cs[nseeds]->fweights->data[1][x] + range));
@@ -225,12 +225,12 @@ autoFeatureWeights FeatureWeights_computeWrapperInt
 					results[y] = KNN_evaluate (me, cs [y].get(), k, d, emode);
 				}
 
-				for (long q = 0; q < nseeds; q++)
+				for (integer q = 0; q < nseeds; q++)
 					if (results[q] > results[best]) best = q;
 
 				if (results[best] > results[nseeds])
 				{
-					for (long x = 1; x <= (my input)->nx; x++)
+					for (integer x = 1; x <= (my input)->nx; x++)
 						cs[nseeds]->fweights->data[1][x] = cs[best]->fweights->data[1][x];
 					results[nseeds] = results[best];
 				}
@@ -257,15 +257,15 @@ autoFeatureWeights FeatureWeights_computeWrapperExt
 
     KNN nn,         // Classifier
                     //
-    PatternList pp,     // test pattern
+    PatternList pp, // test pattern
                     //
     Categories c,   // test categories
                     //
-    long k,         // k(!)
+    integer k,      // k(!)
                     //
     int d,          // distance weighting
                     //
-    long nseeds,    // the number of seeds
+    integer nseeds, // the number of seeds
                     //
     double alfa,    // shrinkage factor
                     //
@@ -284,35 +284,35 @@ autoFeatureWeights FeatureWeights_computeWrapperExt
 		autoNUMvector <double> results ((integer) 0, nseeds);
 
 		autoThingVector <structFeatureWeights> cs ((integer) 0, nseeds);
-		for (long y = 0; y <= nseeds; y++) {
+		for (integer y = 0; y <= nseeds; y++) {
 			cs [y] = FeatureWeights_create (pp -> nx);
 		}
 
-		for (long x = 1; x <= pp -> nx; x ++)
+		for (integer x = 1; x <= pp -> nx; x ++)
 			cs [nseeds] -> fweights -> data [1] [x] = pivot;
 
 		results [nseeds] = FeatureWeights_evaluate (cs [nseeds].get(), nn, pp, c, k, d);
 
 		while (range > 0 && results [nseeds] < stop)
 		{
-			long best = nseeds;
+			integer best = nseeds;
 
 			if (mode == 2)
 			{
-				for (long x = 1; x <= pp->nx; x++)
+				for (integer x = 1; x <= pp->nx; x++)
 				{
-					for (long y = 0; y < nseeds; y++)
+					for (integer y = 0; y < nseeds; y++)
 					{
 						cs[y]->fweights->data[1][x] = NUMrandomUniform(OlaMAX(0, (cs[nseeds]->fweights)->data[1][x] - range),
 													  OlaMIN(1, cs[nseeds]->fweights->data[1][x] + range));
 						results[y] = FeatureWeights_evaluate (cs[y].get(), nn, pp, c, k, d);
 					}
-					for (long q = 0; q < nseeds; q++)
+					for (integer q = 0; q < nseeds; q++)
 						if (results[q] > results[best]) best = q;
 
 					if (results[best] > results[nseeds])
 					{
-						for (long x = 1; x <= pp->nx; x++)   // BUG: a loop over x inside a loop over x; just hope mode is never 2
+						for (integer x = 1; x <= pp->nx; x++)   // BUG: a loop over x inside a loop over x; just hope mode is never 2
 							cs[nseeds]->fweights->data[1][x] = cs[best]->fweights->data[1][x];
 						results[nseeds] = results[best];
 					}
@@ -320,9 +320,9 @@ autoFeatureWeights FeatureWeights_computeWrapperExt
 			}
 			else
 			{
-				for (long y = 0; y < nseeds; y++)
+				for (integer y = 0; y < nseeds; y++)
 				{
-					for (long x = 1; x <= pp->nx; x++)
+					for (integer x = 1; x <= pp->nx; x++)
 					{
 						cs[y]->fweights->data[1][x] = NUMrandomUniform(OlaMAX(0, cs[nseeds]->fweights->data[1][x] - range),
 													  OlaMIN(1, cs[nseeds]->fweights->data[1][x] + range));
@@ -330,12 +330,12 @@ autoFeatureWeights FeatureWeights_computeWrapperExt
 					results[y] = FeatureWeights_evaluate (cs [y].get(), nn, pp, c, k, d);
 				}
 
-				for (long q = 0; q < nseeds; q++)
+				for (integer q = 0; q < nseeds; q++)
 					if (results[q] > results[best]) best = q;
 
 				if (results[best] > results[nseeds])
 				{
-					for (long x = 1; x <= pp->nx; x++)
+					for (integer x = 1; x <= pp->nx; x++)
 						cs[nseeds]->fweights->data[1][x] = cs[best]->fweights->data[1][x];
 					results[nseeds] = results[best];
 				}
@@ -370,7 +370,7 @@ double FeatureWeights_evaluate      // Obsolete - use *_EvaluateWithTestSet
                                     //
     Categories c,                   // test categories
                                     //
-    long k,                         // k(!)
+    integer k,                      // k(!)
                                     //
     int d                           // distance weighting
                                     //
@@ -380,7 +380,7 @@ double FeatureWeights_evaluate      // Obsolete - use *_EvaluateWithTestSet
 	try {
 		autoCategories o = KNN_classifyToCategories (nn, pp, fws, k, d);
 		double hits = 0.0;
-		for (long y = 1; y <= o->size; y ++)
+		for (integer y = 1; y <= o->size; y ++)
 			if (FeatureWeights_areFriends (o->at [y], c->at [y])) hits ++;
 		hits /= o->size;
 		return hits;
@@ -399,11 +399,11 @@ autoFeatureWeights FeatureWeights_computeRELIEF
     // Parameters                //
     ///////////////////////////////
 
-    PatternList pp,         // source pattern
+    PatternList pp,     // source pattern
                         //
     Categories c,       // source categories
                         //
-    long k              // k(!)
+    integer k           // k(!)
                         //
 )
 
@@ -415,7 +415,7 @@ autoFeatureWeights FeatureWeights_computeRELIEF
 	// Initial weights <- 0        //
 	/////////////////////////////////
 
-	for (long i = 1; i <= p->nx; i++) {
+	for (integer i = 1; i <= p->nx; i++) {
 		my fweights -> data [1] [i] = 0.0;
 	}
 
@@ -425,25 +425,25 @@ autoFeatureWeights FeatureWeights_computeRELIEF
 
 	autoNUMvector <double> min ((integer) 0, p->nx - 1);
 	autoNUMvector <double> max ((integer) 0, p->nx - 1);
-	for (long x = 1; x <= p -> nx; x ++) {
+	for (integer x = 1; x <= p -> nx; x ++) {
 		max [x] = p -> z [1] [x];   // BUG: this will just crash because of array index out of bounds
 		min [x] = max [x];
 	}
 
-	for (long y = 1; y <= p -> ny; y ++) {
-		for (long x = 1; x <= p->nx; x++) {
+	for (integer y = 1; y <= p -> ny; y ++) {
+		for (integer x = 1; x <= p->nx; x++) {
 			if (p->z[y][x] > max[x]) max[x] = p->z[y][x];
 			if (p->z[y][x] < min[x]) min[x] = p->z[y][x];
 		}
 	}
 
 	autoNUMvector <double> alfa ((integer) 0, p -> nx - 1);
-	for (long x = 1; x <= p -> nx; x ++) {
+	for (integer x = 1; x <= p -> nx; x ++) {
 		alfa [x] = max [x] - min [x];   // BUG: this will just crash because of array index out of bounds
 	}
 
-	for (long y = 1; y <= p->ny; y++) {
-		for (long x = 1; x <= p->nx; x++) {
+	for (integer y = 1; y <= p->ny; y++) {
+		for (integer x = 1; x <= p->nx; x++) {
 			if (alfa [x] != 0.0) {
 				p->z[y][x] = (p->z[y][x] - min[x]) / alfa[x];
 			} else {
@@ -457,38 +457,38 @@ autoFeatureWeights FeatureWeights_computeRELIEF
 	/////////////////////////////////
 
 	autoNUMvector <double> priors ((integer) 0, c->size - 1);   // worst-case allocations
-	autoNUMvector <long> classes ((integer) 0, c->size - 1);//
-	autoNUMvector <long> enemies ((integer) 0, c->size - 1);//
-	autoNUMvector <long> friends ((integer) 0, c->size - 1);//
-	long nclasses = FeatureWeights_computePriors (c, classes.peek(), priors.peek());
+	autoNUMvector <integer> classes ((integer) 0, c->size - 1);//
+	autoNUMvector <integer> enemies ((integer) 0, c->size - 1);//
+	autoNUMvector <integer> friends ((integer) 0, c->size - 1);//
+	integer nclasses = FeatureWeights_computePriors (c, classes.peek(), priors.peek());
 	Melder_assert (nclasses >= 2);
 
 	/////////////////////////////////
 	// Updating the w.vector       //
 	/////////////////////////////////
 
-	for (long y = 1; y <= p -> ny; y ++) {
+	for (integer y = 1; y <= p -> ny; y ++) {
 
-		long nfriends = KNN_kFriends (p.get(), p.get(), c, y, k, friends.peek());
-		long nenemies = KNN_kUniqueEnemies (p.get(), p.get(), c, y, nclasses - 1, enemies.peek());
+		integer nfriends = KNN_kFriends (p.get(), p.get(), c, y, k, friends.peek());
+		integer nenemies = KNN_kUniqueEnemies (p.get(), p.get(), c, y, nclasses - 1, enemies.peek());
 
 		if (nfriends && nenemies) {
 			autoNUMvector <double> classps ((integer) 0, nenemies - 1);
-			for (long eq = 0; eq < nenemies; eq ++) {
-				for (long iq = 0; iq < nclasses; iq ++) {
+			for (integer eq = 0; eq < nenemies; eq ++) {
+				for (integer iq = 0; iq < nclasses; iq ++) {
 					if (FeatureWeights_areFriends (c->at [enemies [eq]], c->at [classes [iq]])) {
 						classps [eq] = priors [iq];
 						break;
 					}
 				}
 			}
-			for (long x = 1; x <= p -> nx; x ++) {
+			for (integer x = 1; x <= p -> nx; x ++) {
 				double p1 = 0.0;
 				double p2 = 0.0;
-				for (long ec = 0; ec < nfriends; ec ++) {
+				for (integer ec = 0; ec < nfriends; ec ++) {
 					p1 += fabs (p -> z [y] [x] - p -> z [friends [ec]] [x]) / (p -> ny * nfriends);
 				}
-				for (long ec = 0; ec < nenemies; ec++) {
+				for (integer ec = 0; ec < nenemies; ec++) {
 					p2 += (fabs (p->z[y][x] - p->z[enemies[ec]][x]) * classps[ec]) / p->ny;
 				}
 				my fweights -> data [1] [x] = my fweights -> data [1] [x] - p1 + p2;
diff --git a/contrib/ola/FeatureWeights.h b/contrib/ola/FeatureWeights.h
index 6fb30f2..3d09333 100644
--- a/contrib/ola/FeatureWeights.h
+++ b/contrib/ola/FeatureWeights.h
@@ -2,7 +2,7 @@
 #define _FeatureWeights_h_
 /* FeatureWeights.h
  *
- * Copyright (C) 2007-2008 Ola Söder
+ * Copyright (C) 2007-2008 Ola Söder, 2011,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -58,31 +58,31 @@
 // Create
 autoFeatureWeights FeatureWeights_create
 (
-    long nweights           // number of weights
+    integer nweights        // number of weights
 );
 
 // Compute prior probabilities
-long FeatureWeights_computePriors
+integer FeatureWeights_computePriors
 (
     Categories c,           // source categories
-    long * indices,         // Out: instances indices ..
+    integer * indices,      // Out: instances indices ..
     double * priors         // Out: .. and their prior probabilities
 );
 
 // Compute feature weights (obsolete)
 autoFeatureWeights FeatureWeights_compute
 (
-    PatternList pp,             // Source pattern
+    PatternList pp,         // Source pattern
     Categories c,           // Source categories
-    long k                  // k(!)
+    integer k               // k(!)
 );
 
 // Compute feature weights according to the RELIEF-F algorithm
 autoFeatureWeights FeatureWeights_computeRELIEF
 (
-    PatternList pp,             // source pattern
+    PatternList pp,         // source pattern
     Categories c,           // source categories
-    long k                  // k(!)
+    integer k              // k(!)
 );
 
 /* End of file FeatureWeights.h */
diff --git a/contrib/ola/KNN.cpp b/contrib/ola/KNN.cpp
index cb4b6b5..1c3164a 100644
--- a/contrib/ola/KNN.cpp
+++ b/contrib/ola/KNN.cpp
@@ -1,6 +1,6 @@
 /* KNN.cpp
  *
- * Copyright (C) 2008 Ola So"der, 2010-2012,2016 Paul Boersma
+ * Copyright (C) 2008 Ola So"der, 2010-2012,2016,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -163,12 +163,12 @@ typedef struct
 {
         KNN me;
         PatternList ps;
-        long * output;
+        integer * output;
         FeatureWeights fws;
-        long k;
+        integer k;
         int dist;
-        long istart;
-        long istop;
+        integer istart;
+        integer istop;
 
 } KNN_input_ToCategories_t;
 
@@ -180,19 +180,19 @@ autoCategories KNN_classifyToCategories
 
     KNN me,             // the classifier being used
                         //
-    PatternList ps,         // the pattern to classify
+    PatternList ps,     // the pattern to classify
                         //
     FeatureWeights fws, // feature weights
                         //
-    long k,             // the number of sought after neighbours
+    integer k,          // the number of sought after neighbours
                         //
     int dist            // distance weighting
 )
 
 {
     int nthreads = KNN_getNumberOfCPUs();
-    long *outputindices = NUMvector <long> (0, ps->ny);
-    long chunksize =  ps->ny / nthreads;
+    integer *outputindices = NUMvector <integer> (0, ps->ny);
+    integer chunksize =  ps->ny / nthreads;
 
     Melder_assert(nthreads > 0); 
     Melder_assert(k > 0 && k <= my nInstances);
@@ -203,8 +203,8 @@ autoCategories KNN_classifyToCategories
         nthreads = ps->ny;
     }
 
-    long istart = 1;
-    long istop = chunksize;
+    integer istart = 1;
+    integer istop = chunksize;
 
     autoCategories output = Categories_create ();
     KNN_input_ToCategories_t ** input = (KNN_input_ToCategories_t **) malloc(nthreads * sizeof(KNN_input_ToCategories_t *));
@@ -260,7 +260,7 @@ autoCategories KNN_classifyToCategories
         return autoCategories();
     }
 
-	for (long i = 1; i <= ps -> ny; i ++) {
+	for (integer i = 1; i <= ps -> ny; i ++) {
 		output -> addItem_move (Data_copy (my output->at [outputindices [i]]));
 	}
 	NUMvector_free (outputindices, 0);
@@ -284,16 +284,16 @@ void * KNN_classifyToCategoriesAux
                   ((KNN_input_ToCategories_t *) input)->istop <= ((KNN_input_ToCategories_t *) input)->ps->ny &&
                   ((KNN_input_ToCategories_t *) input)->istart <= ((KNN_input_ToCategories_t *) input)->istop);
     
-    long ncollected;
-    long ncategories;
+    integer ncollected;
+    integer ncategories;
 
-    long *indices = NUMvector <long> (0, ((KNN_input_ToCategories_t *) input)->k);
-    long *freqindices = NUMvector <long> (0, ((KNN_input_ToCategories_t *) input)->k);
+    integer *indices = NUMvector <integer> (0, ((KNN_input_ToCategories_t *) input)->k);
+    integer *freqindices = NUMvector <integer> (0, ((KNN_input_ToCategories_t *) input)->k);
 
     double *distances = NUMvector <double> (0, ((KNN_input_ToCategories_t *) input)->k);
     double *freqs = NUMvector <double> (0, ((KNN_input_ToCategories_t *) input)->k);
  
-    for (long y = ((KNN_input_ToCategories_t *) input)->istart; y <= ((KNN_input_ToCategories_t *) input)->istop; ++y)
+    for (integer y = ((KNN_input_ToCategories_t *) input)->istart; y <= ((KNN_input_ToCategories_t *) input)->istop; ++y)
     {
         /////////////////////////////////////////
         // Localizing the k nearest neighbours //
@@ -325,12 +325,12 @@ void * KNN_classifyToCategoriesAux
         switch(((KNN_input_ToCategories_t *) input)->dist)
         {
             case kOla_DISTANCE_WEIGHTED_VOTING:
-                for (long c = 0; c < ncategories; ++c)
+                for (integer c = 0; c < ncategories; ++c)
                     freqs[c] *= 1 / OlaMAX(distances[c], kOla_MINFLOAT);
                 break;
 
             case kOla_SQUARED_DISTANCE_WEIGHTED_VOTING:
-                for (long c = 0; c < ncategories; ++c)
+                for (integer c = 0; c < ncategories; ++c)
                     freqs[c] *= 1 / OlaMAX(OlaSQUARE(distances[c]), kOla_MINFLOAT);
         }
 
@@ -355,10 +355,10 @@ typedef struct {
 	Categories uniqueCategories;
 	TableOfReal output;
 	FeatureWeights fws;
-	long k;
+	integer k;
 	int dist;
-	long istart;
-	long istop;
+	integer istart;
+	integer istop;
 } KNN_input_ToTableOfReal_t;
 
 autoTableOfReal KNN_classifyToTableOfReal
@@ -369,20 +369,20 @@ autoTableOfReal KNN_classifyToTableOfReal
 
     KNN me,             // the classifier being used
                         //
-    PatternList ps,         // source PatternList
+    PatternList ps,     // source PatternList
                         //
     FeatureWeights fws, // feature weights
                         //
-    long k,             // the number of sought after neighbours
+    integer k,          // the number of sought after neighbours
                         //
     int dist            // distance weighting
 )
 
 {
     int nthreads = KNN_getNumberOfCPUs();
-    long chunksize =  ps->ny / nthreads;
+    integer chunksize =  ps->ny / nthreads;
     autoCategories uniqueCategories = Categories_selectUniqueItems (my output.get());
-    long ncategories = Categories_getSize (uniqueCategories.get());
+    integer ncategories = Categories_getSize (uniqueCategories.get());
    
     Melder_assert (nthreads > 0);
     Melder_assert (ncategories > 0);
@@ -397,8 +397,8 @@ autoTableOfReal KNN_classifyToTableOfReal
         nthreads = ps->ny;
     }
 
-    long istart = 1;
-    long istop = chunksize;
+    integer istart = 1;
+    integer istop = chunksize;
 
     KNN_input_ToTableOfReal_t ** input = (KNN_input_ToTableOfReal_t **) malloc (nthreads * sizeof (KNN_input_ToTableOfReal_t *));
     
@@ -407,7 +407,7 @@ autoTableOfReal KNN_classifyToTableOfReal
 
     autoTableOfReal output = TableOfReal_create(ps->ny, ncategories);
 
-    for (long i = 1; i <= ncategories; i ++)
+    for (integer i = 1; i <= ncategories; i ++)
         TableOfReal_setColumnLabel (output.get(), i, SimpleString_c (uniqueCategories->at [i]));
 
     for (int i = 0; i < nthreads; i ++)
@@ -472,20 +472,20 @@ void * KNN_classifyToTableOfRealAux
 )
 
 {
-    long ncategories = Categories_getSize (((KNN_input_ToTableOfReal_t *) input)->uniqueCategories);
-    autoNUMvector <long> indices ((integer) 0, ((KNN_input_ToTableOfReal_t *) input)->k);
+    integer ncategories = Categories_getSize (((KNN_input_ToTableOfReal_t *) input)->uniqueCategories);
+    autoNUMvector <integer> indices ((integer) 0, ((KNN_input_ToTableOfReal_t *) input)->k);
     autoNUMvector <double> distances ((integer) 0, ((KNN_input_ToTableOfReal_t *) input)->k);
 
-    for (long y = ((KNN_input_ToTableOfReal_t *) input)->istart; y <= ((KNN_input_ToTableOfReal_t *) input)->istop; ++y)
+    for (integer y = ((KNN_input_ToTableOfReal_t *) input)->istart; y <= ((KNN_input_ToTableOfReal_t *) input)->istop; ++y)
     {
         KNN_kNeighbours(((KNN_input_ToTableOfReal_t *) input)->ps, 
                         ((KNN_input_ToTableOfReal_t *) input)->me->input.get(),
                         ((KNN_input_ToTableOfReal_t *) input)->fws, y, 
                         ((KNN_input_ToTableOfReal_t *) input)->k, indices.peek(), distances.peek());
 
-        for(long i = 0; i < ((KNN_input_ToTableOfReal_t *) input)->k; ++i)
+        for (integer i = 0; i < ((KNN_input_ToTableOfReal_t *) input)->k; ++i)
         {
-            for(long j = 1; j <= ncategories; ++j) {
+            for (integer j = 1; j <= ncategories; ++j) {
                 if (FeatureWeights_areFriends (((KNN_input_ToTableOfReal_t *) input) -> me -> output->at [indices [i]],
 											   ((KNN_input_ToTableOfReal_t *) input) -> uniqueCategories->at [j]))
 				{
@@ -498,44 +498,44 @@ void * KNN_classifyToTableOfRealAux
     switch (((KNN_input_ToTableOfReal_t *) input)->dist)
     {
         case kOla_DISTANCE_WEIGHTED_VOTING:
-            for (long y = ((KNN_input_ToTableOfReal_t *) input) -> istart; y <= ((KNN_input_ToTableOfReal_t *) input) -> istop; y ++)
+            for (integer y = ((KNN_input_ToTableOfReal_t *) input) -> istart; y <= ((KNN_input_ToTableOfReal_t *) input) -> istop; y ++)
             {
-                double sum = 0;
-                for(long c = 1; c <= ncategories; ++c)
+                real80 sum = 0.0;
+                for (integer c = 1; c <= ncategories; c ++)
                 {
                     ((KNN_input_ToTableOfReal_t *) input)->output->data[y][c] *= 1 / OlaMAX(distances[c], kOla_MINFLOAT);
                     sum += ((KNN_input_ToTableOfReal_t *) input)->output->data[y][c];
                 } 
                 
-                for(long c = 1; c <= ncategories; ++c)
+                for (integer c = 1; c <= ncategories; c ++)
                     ((KNN_input_ToTableOfReal_t *) input)->output->data[y][c] /= sum;
 
             }
             break;
 
         case kOla_SQUARED_DISTANCE_WEIGHTED_VOTING:
-            for (long y = ((KNN_input_ToTableOfReal_t *) input)->istart; y <= ((KNN_input_ToTableOfReal_t *) input)->istop; ++y)
+            for (integer y = ((KNN_input_ToTableOfReal_t *) input)->istart; y <= ((KNN_input_ToTableOfReal_t *) input)->istop; ++y)
             {
-                double sum = 0;
-                for(long c = 1; c <= ncategories; ++c)
+                real80 sum = 0.0;
+                for (integer c = 1; c <= ncategories; c ++)
                 {
                     ((KNN_input_ToTableOfReal_t *) input)->output->data[y][c] *= 1 / OlaMAX(OlaSQUARE(distances[c]), kOla_MINFLOAT);
                     sum += ((KNN_input_ToTableOfReal_t *) input)->output->data[y][c];
                 } 
 
-                for(long c = 1; c <= ncategories; ++c)
+                for (integer c = 1; c <= ncategories; c ++)
                     ((KNN_input_ToTableOfReal_t *) input)->output->data[y][c] /= sum;
             }
             break;
 
         case kOla_FLAT_VOTING: 
-            for (long y = ((KNN_input_ToTableOfReal_t *) input)->istart; y <= ((KNN_input_ToTableOfReal_t *) input)->istop; ++y)
+            for (integer y = ((KNN_input_ToTableOfReal_t *) input)->istart; y <= ((KNN_input_ToTableOfReal_t *) input)->istop; ++y)
             {
-                double sum = 0;
-                for(long c = 1; c <= ncategories; ++c)
+                real80 sum = 0.0;
+                for (integer c = 1; c <= ncategories; c ++)
                     sum += ((KNN_input_ToTableOfReal_t *) input)->output->data[y][c];
 
-                for(long c = 1; c <= ncategories; ++c)
+                for (integer c = 1; c <= ncategories; c ++)
                     ((KNN_input_ToTableOfReal_t *) input)->output->data[y][c] /= sum;
             }
 
@@ -555,17 +555,17 @@ autoCategories KNN_classifyFold
 
     KNN me,             // the classifier being used
                         //
-    PatternList ps,         // source PatternList
+    PatternList ps,     // source PatternList
                         //
     FeatureWeights fws, // feature weights
                         //
-    long k,             // the number of sought after neighbours
+    integer k,          // the number of sought after neighbours
                         //
     int dist,           // distance weighting
                         //
-    long begin,         // fold start, inclusive [...
+    integer begin,      // fold start, inclusive [...
                         //
-    long end            // fold end, inclusive ...]
+    integer end         // fold end, inclusive ...]
                         //
 )
 
@@ -575,21 +575,21 @@ autoCategories KNN_classifyFold
     Melder_assert(begin > 0 && begin <= ps->ny);
 
     if (begin > end) 
-        OlaSWAP(long, begin, end);         
+        OlaSWAP(integer, begin, end);
 
     if (k > my nInstances - (end - begin))
         k = my nInstances - (end - begin);
 
-    long ncollected;
-    long ncategories;
-    autoNUMvector <long> indices ((integer) 0, k);
-    autoNUMvector <long> freqindices ((integer) 0, k);
+    integer ncollected;
+    integer ncategories;
+    autoNUMvector <integer> indices ((integer) 0, k);
+    autoNUMvector <integer> freqindices ((integer) 0, k);
     autoNUMvector <double> distances ((integer) 0, k);
     autoNUMvector <double> freqs ((integer) 0, k);
-    autoNUMvector <long> outputindices ((integer) 0, ps->ny);
-    long noutputindices = 0;
+    autoNUMvector <integer> outputindices ((integer) 0, ps->ny);
+    integer noutputindices = 0;
 
-    for (long y = begin; y <= end; ++y)
+    for (integer y = begin; y <= end; ++y)
     {
         /////////////////////////////////////////
         // Localizing the k nearest neighbours //
@@ -610,12 +610,12 @@ autoCategories KNN_classifyFold
         switch (dist)
         {
             case kOla_DISTANCE_WEIGHTED_VOTING:
-                for (long c = 0; c < ncategories; c ++)
+                for (integer c = 0; c < ncategories; c ++)
                     freqs [c] *= 1.0 / OlaMAX (distances [c], kOla_MINFLOAT);
                 break;
 
             case kOla_SQUARED_DISTANCE_WEIGHTED_VOTING:
-                for (long c = 0; c < ncategories; c ++)
+                for (integer c = 0; c < ncategories; c ++)
                     freqs [c] *= 1.0 / OlaMAX (OlaSQUARE (distances [c]), kOla_MINFLOAT);
         }
 
@@ -624,7 +624,7 @@ autoCategories KNN_classifyFold
     }
 
 	autoCategories output = Categories_create ();
-	for (long o = 0; o < noutputindices; o ++) {
+	for (integer o = 0; o < noutputindices; o ++) {
 		output -> addItem_move (Data_copy (my output->at [outputindices [o]]));
 	}
 	return output;
@@ -644,7 +644,7 @@ double KNN_evaluate
                         //
     FeatureWeights fws, // feature weights
                         //
-    long k,             // the number of sought after neighbours
+    integer k,          // the number of sought after neighbours
                         //
     int dist,           // distance weighting
                         //
@@ -654,7 +654,7 @@ double KNN_evaluate
 
 {
     double correct = 0.0;
-    long adder;
+    integer adder;
 
     switch(mode)
     {
@@ -676,10 +676,10 @@ double KNN_evaluate
     if (adder == 0)
         return -1;
 
-    for (long begin = 1; begin <= my nInstances; begin += adder)
+    for (integer begin = 1; begin <= my nInstances; begin += adder)
     {
         autoCategories c = KNN_classifyFold (me, my input.get(), fws, k, dist, begin, OlaMIN (begin + adder - 1, my nInstances));
-        for (long y = 1; y <= c->size; y ++)
+        for (integer y = 1; y <= c->size; y ++)
             if (FeatureWeights_areFriends (c->at [y], my output->at [begin + y - 1]))
                 correct += 1.0;
     }
@@ -700,13 +700,13 @@ double KNN_evaluateWithTestSet
 
     KNN me,             // the classifier being used
                         //
-    PatternList p,          // The vectors of the test set
+    PatternList p,      // The vectors of the test set
                         //
     Categories c,       // The categories of the test set
                         //
     FeatureWeights fws, // feature weights
                         //
-    long k,             // the number of sought after neighbours
+    integer k,          // the number of sought after neighbours
                         //
     int dist            // distance weighting
                         //
@@ -715,7 +715,7 @@ double KNN_evaluateWithTestSet
 {
     double correct = 0.0;
     autoCategories t = KNN_classifyToCategories (me, p, fws, k, dist);
-	for (long y = 1; y <= t->size; y ++)
+	for (integer y = 1; y <= t->size; y ++)
 		if (FeatureWeights_areFriends (t->at [y], c->at [y])) correct += 1.0;
 	return correct / c->size;
 }
@@ -727,8 +727,8 @@ double KNN_evaluateWithTestSet
     typedef struct structsoil
     {
         double performance;
-        long dist;
-        long k;
+        integer dist;
+        integer k;
     } soil;
 
 double KNN_modelSearch
@@ -741,7 +741,7 @@ double KNN_modelSearch
                         //
     FeatureWeights fws, // feature weights
                         //
-    long * k,           // valid long *, to hold the output value of k
+    integer * k,        // valid integer *, to hold the output value of k
                         //
     int * dist,         // valid int *, to hold the output value dist_weight
                         //
@@ -749,7 +749,7 @@ double KNN_modelSearch
                         //
     double rate,        // learning rate
                         //
-    long nseeds         // the number of seeds to be used
+    integer nseeds      // the number of seeds to be used
                         //
 )
 
@@ -762,7 +762,7 @@ double KNN_modelSearch
 			kOla_FLAT_VOTING
 		};
 
-		long max = *k;
+		integer max = *k;
 		double range = (double) max / 2.0;
 		double pivot = range;
 
@@ -770,23 +770,23 @@ double KNN_modelSearch
 		double drange = 1.0;
 		double drate = rate / range;
 
-		soil best = {0, lround(dpivot), lround(dpivot)};
+		soil best = { 0, (integer) lround (dpivot), (integer) lround (dpivot) };
 		autoNUMvector <soil> field ((integer) 0, nseeds - 1);
 
 		while (range > 0)
 		{
-			for (long n = 0; n < nseeds; n++)
+			for (integer n = 0; n < nseeds; n++)
 			{
 				field[n].k = lround (NUMrandomUniform (OlaMAX (pivot - range, 1), OlaMIN (pivot + range, max)));
 				field[n].dist = lround (NUMrandomUniform (OlaMAX (dpivot - drange, 0), OlaMIN (dpivot + drange, 2)));
 				field[n].performance = KNN_evaluate (me, fws, field[n].k, dists[field[n].dist], mode);
 			}
 
-			long maxindex = 0;
-			for (long n = 1; n < nseeds; n++)
-				if (field[n].performance > field[maxindex].performance) maxindex = n;
+			integer maxindex = 0;
+			for (integer n = 1; n < nseeds; n ++)
+				if (field [n]. performance > field [maxindex]. performance) maxindex = n;
 
-			if (field[maxindex].performance > best.performance)
+			if (field [maxindex]. performance > best. performance)
 			{
 				pivot = field[maxindex].k;
 				dpivot = field[maxindex].dist;
@@ -815,20 +815,20 @@ double KNN_modelSearch
 
 double KNN_distanceEuclidean
 (
-    PatternList ps,         // PatternList 1
+    PatternList ps,     // PatternList 1
                         //
-    PatternList pt,         // PatternList 2
+    PatternList pt,     // PatternList 2
                         //
     FeatureWeights fws, // Feature weights
                         //
-    long rows,          // Vector index of pattern 1
+    integer rows,       // Vector index of pattern 1
                         //
-    long rowt           // Vector index of pattern 2
+    integer rowt        // Vector index of pattern 2
 )
 
 {
     double distance = 0.0;
-    for (long x = 1; x <= ps->nx; ++x)
+    for (integer x = 1; x <= ps->nx; ++x)
         distance += OlaSQUARE ((ps->z[rows][x] - pt->z[rowt][x]) * fws->fweights->data[1][x]);
     return sqrt (distance);
 }
@@ -839,38 +839,38 @@ double KNN_distanceEuclidean
 
 double KNN_distanceManhattan
 (
-    PatternList ps,     // PatternList 1
+    PatternList ps, // PatternList 1
                     //
-    PatternList pt,     // PatternList 2
+    PatternList pt, // PatternList 2
                     //
-    long rows,      // Vector index of pattern 1
+    integer rows,   // Vector index of pattern 1
                     //
-    long rowt       // Vector index of pattern 2
+    integer rowt    // Vector index of pattern 2
                     //
 )
 
 {
-    double distance = 0.0;
-    for (long x = 1; x <= ps->nx; ++x)
+    real80 distance = 0.0;
+    for (integer x = 1; x <= ps->nx; x ++)
         distance += fabs (ps->z[rows][x] - pt->z[rowt][x]);
-    return distance;
+    return (real) distance;
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////////
 // Find longest distance                                                                   //
 /////////////////////////////////////////////////////////////////////////////////////////////
 
-long KNN_max
+integer KNN_max
 (
     double * distances,     // an array of distances containing ...
                             //
-    long ndistances         // ndistances distances
+    integer ndistances      // ndistances distances
                             //
 )
 
 {
-    long maxndx = 0;
-    for (long maxc = 1; maxc < ndistances; ++maxc)
+    integer maxndx = 0;
+    for (integer maxc = 1; maxc < ndistances; maxc ++)
         if (distances[maxc] > distances[maxndx]) 
             maxndx = maxc;
     return maxndx;
@@ -881,33 +881,33 @@ long KNN_max
 // Locate k neighbours, skip one + disposal of distance                                    //
 /////////////////////////////////////////////////////////////////////////////////////////////
 
-long KNN_kNeighboursSkip
+integer KNN_kNeighboursSkip
 (
     ///////////////////////////////
     // Parameters                //
     ///////////////////////////////
 
-    PatternList j,          // source pattern
+    PatternList j,      // source pattern
                         //
-    PatternList p,          // target pattern (where neighbours are sought for)
+    PatternList p,      // target pattern (where neighbours are sought for)
                         //
     FeatureWeights fws, // feature weights
                         //
-    long jy,            // source instance index
+    integer jy,         // source instance index
                         //
-    long k,             // the number of sought after neighbours
+    integer k,          // the number of sought after neighbours
                         //
-    long * indices,     // memory space to contain the indices of
+    integer * indices,  // memory space to contain the indices of
                         // the k neighbours
                         //
-    long skipper        // the index of the instance to be skipped
+    integer skipper     // the index of the instance to be skipped
                         //
 )
 
 {
-    long maxi;
-    long dc = 0;
-    long py = 1;
+    integer maxi;
+    integer dc = 0;
+    integer py = 1;
 
     autoNUMvector <double> distances ((integer) 0, k - 1);
 
@@ -951,23 +951,23 @@ long KNN_kNeighboursSkip
 // by [begin ... end]                                                           //
 //////////////////////////////////////////////////////////////////////////////////
 
-long KNN_kNeighboursSkipRange
+integer KNN_kNeighboursSkipRange
 (
     ///////////////////////////////
     // Parameters                //
     ///////////////////////////////
 
-    PatternList j,          // source-pattern (where the unknown is located)
+    PatternList j,      // source-pattern (where the unknown is located)
                         //
-    PatternList p,          // target pattern (where neighbours are sought for)
+    PatternList p,      // target pattern (where neighbours are sought for)
                         //
     FeatureWeights fws, // feature weights
                         //
-    long jy,            // the index of the unknown instance in the source pattern
+    integer jy,         // the index of the unknown instance in the source pattern
                         //
-    long k,             // the number of sought after neighbours
+    integer k,          // the number of sought after neighbours
                         //
-    long * indices,     // a pointer to a memory-space big enough for k longs
+    integer * indices,  // a pointer to a memory-space big enough for k integers
                         // representing indices to the k neighbours in the
                         // target pattern
                         //
@@ -975,10 +975,10 @@ long KNN_kNeighboursSkipRange
                         // doubles representing the distances to the k
                         // neighbours
                         //
-    long begin,         // an index indicating the first instance in the
+    integer begin,      // an index indicating the first instance in the
                         // target pattern to be excluded from the search
                         //
-    long end            // an index indicating the last instance in the
+    integer end         // an index indicating the last instance in the
                         // range of excluded instances in the target
                         // pattern
 )
@@ -988,12 +988,12 @@ long KNN_kNeighboursSkipRange
     // Private variables         //
     ///////////////////////////////
 
-    long maxi;                      // index indicating the most distant neighbour
+    integer maxi;                   // index indicating the most distant neighbour
                                     // among the k nearest
                                     //
-    long dc = 0;                    // fetch counter
+    integer dc = 0;                 // fetch counter
                                     //
-    long py = 0;                    //
+    integer py = 0;                 //
 
     Melder_assert (jy > 0 && jy <= j->ny);
     Melder_assert (k > 0 && k <= p->ny);
@@ -1036,23 +1036,23 @@ long KNN_kNeighboursSkipRange
 // Locate k neighbours                                                                     //
 /////////////////////////////////////////////////////////////////////////////////////////////
 
-long KNN_kNeighbours
+integer KNN_kNeighbours
 (
     ///////////////////////////////
     // Parameters                //
     ///////////////////////////////
 
-    PatternList j,          // source-pattern (where the unknown is located)
+    PatternList j,      // source-pattern (where the unknown is located)
                         //
-    PatternList p,          // target pattern (where neighbours are sought for)
+    PatternList p,      // target pattern (where neighbours are sought for)
                         //
     FeatureWeights fws, // feature weights
                         //
-    long jy,            // the index of the unknown instance in the source pattern
+    integer jy,         // the index of the unknown instance in the source pattern
                         //
-    long k,             // the number of sought after neighbours
+    integer k,          // the number of sought after neighbours
                         //
-    long * indices,     // a pointer to a memory-space big enough for k longs
+    integer * indices,  // a pointer to a memory-space big enough for k integers
                         // representing indices to the k neighbours in the
                         // target pattern
     double * distances  // a pointer to a memory-space big enough for k
@@ -1062,9 +1062,9 @@ long KNN_kNeighbours
 )   
 
 {
-    long maxi;
-    long dc = 0;
-    long py = 1;
+    integer maxi;
+    integer dc = 0;
+    integer py = 1;
 
     Melder_assert (jy > 0 && jy <= j->ny);
     Melder_assert (k > 0 && k <= p->ny);
@@ -1098,7 +1098,7 @@ long KNN_kNeighbours
         ++py;
     }
 
-    long ret = OlaMIN (k, dc);
+    integer ret = OlaMIN (k, dc);
     if (ret < 1)
     {
         indices [0] = jy;
@@ -1112,31 +1112,31 @@ long KNN_kNeighbours
 // Locating k (nearest) friends                                                            //
 /////////////////////////////////////////////////////////////////////////////////////////////
 
-long KNN_kFriends
+integer KNN_kFriends
 (
     ///////////////////////////////
     // Parameters                //
     ///////////////////////////////
 
-    PatternList j,          // source-pattern
+    PatternList j,      // source pattern
                         //
-    PatternList p,          // target pattern (where friends are sought for)
+    PatternList p,      // target pattern (where friends are sought for)
                         //
     Categories c,       // categories
                         //
-    long jy,            // the index of the source instance
+    integer jy,         // the index of the source instance
                         //  
-    long k,             // the number of sought after friends
+    integer k,          // the number of sought after friends
                         //
-    long * indices      // a pointer to a memory-space big enough for k longs
+    integer * indices   // a pointer to a memory-space big enough for k integers
                         // representing indices to the k friends in the
                         // target pattern
 )
 
 {
-    long maxi;
-    long dc = 0;
-    long py = 1;
+    integer maxi;
+    integer dc = 0;
+    integer py = 1;
     autoNUMvector <double> distances ((integer) 0, k - 1);
 
     Melder_assert (jy <= j->ny  && k <= p->ny && k > 0);
@@ -1183,13 +1183,13 @@ double KNN_nearestEnemy
     // Parameters                //
     ///////////////////////////////
 
-    PatternList j,      // source-pattern
+    PatternList j,  // source-pattern
                     //
-    PatternList p,      // target pattern (where friends are sought for)
+    PatternList p,  // target pattern (where friends are sought for)
                     //
     Categories c,   // categories
                     //
-    long jy         // the index of the source instance
+    integer jy      // the index of the source instance
                     //
 )
 
@@ -1197,7 +1197,7 @@ double KNN_nearestEnemy
     double distance = KNN_distanceManhattan(j, p, jy, 1);
     Melder_assert(jy > 0 && jy <= j->ny );
 
-    for (long y = 2; y <= p->ny; y++)
+    for (integer y = 2; y <= p->ny; y++)
     {
         if (FeatureWeights_areEnemies (c->at [jy], c->at [y]))
         {
@@ -1214,33 +1214,33 @@ double KNN_nearestEnemy
 // Computing the number of friends among k neighbours                                      //
 /////////////////////////////////////////////////////////////////////////////////////////////
 
-long KNN_friendsAmongkNeighbours
+integer KNN_friendsAmongkNeighbours
 (
     ///////////////////////////////
     // Parameters                //
     ///////////////////////////////
 
-    PatternList j,      // source-pattern
+    PatternList j,  // source-pattern
                     //
-    PatternList p,      // target pattern (where friends are sought for)
+    PatternList p,  // target pattern (where friends are sought for)
                     //
     Categories c,   // categories
                     //
-    long jy,        // the index of the source instance
+    integer jy,     // the index of the source instance
                     //
-    long k          // k (!)
+    integer k       // k (!)
                     //
 )
 
 {
     autoNUMvector <double> distances ((integer) 0, k - 1);
-    autoNUMvector <long> indices ((integer) 0, k - 1);
-    long friends = 0;
+    autoNUMvector <integer> indices ((integer) 0, k - 1);
+    integer friends = 0;
 
     Melder_assert (jy > 0 && jy <= j->ny  && k <= p->ny && k > 0);
 
     autoFeatureWeights fws = FeatureWeights_create (p -> nx);
-    long ncollected = KNN_kNeighbours (j, p, fws.get(), jy, k, indices.peek(), distances.peek());
+    integer ncollected = KNN_kNeighbours (j, p, fws.get(), jy, k, indices.peek(), distances.peek());
 
     while (ncollected--)
         if (FeatureWeights_areFriends (c->at [jy], c->at [indices [ncollected]])) friends ++;
@@ -1253,31 +1253,31 @@ long KNN_friendsAmongkNeighbours
 // Locating k unique (nearest) enemies                                                     //
 /////////////////////////////////////////////////////////////////////////////////////////////
 
-long KNN_kUniqueEnemies
+integer KNN_kUniqueEnemies
 (
     ///////////////////////////////
     // Parameters                //
     ///////////////////////////////
 
-    PatternList j,      // source-pattern
-                    //
-    PatternList p,      // target pattern (where friends are sought for)
-                    //
-    Categories c,   // categories
-                    //
-    long jy,        // the index of the source instance
-                    //
-    long k,         // k (!)
-                    //
-    long * indices  // a memory space to hold the indices of the
-                    // located enemies
-                    //
+    PatternList j,   // source-pattern
+                     //
+    PatternList p,   // target pattern (where friends are sought for)
+                     //
+    Categories c,    // categories
+                     //
+    integer jy,      // the index of the source instance
+                     //
+    integer k,       // k (!)
+                     //
+    integer *indices // a memory space to hold the indices of the
+                     // located enemies
+                     //
 )
 
 {
-    long maxi;
-    long dc = 0;
-    long py = 1;
+    integer maxi;
+    integer dc = 0;
+    integer py = 1;
     double *distances = NUMvector <double> (0, k - 1);
 
     Melder_assert (jy <= j->ny);
@@ -1290,7 +1290,7 @@ long KNN_kUniqueEnemies
         if (FeatureWeights_areEnemies (c->at [jy], c->at [py]))
         {
             int hasfriend = 0;
-            for (long sc = 0; sc < dc; ++sc)
+            for (integer sc = 0; sc < dc; ++sc)
                 if (FeatureWeights_areFriends (c->at [py], c->at [indices [sc]])) hasfriend = 1;
 
             if (!hasfriend)
@@ -1309,7 +1309,7 @@ long KNN_kUniqueEnemies
         if (FeatureWeights_areEnemies (c->at [jy], c->at [py]))
         {
             int hasfriend = 0;
-            for (long sc = 0; sc < dc; ++sc)
+            for (integer sc = 0; sc < dc; ++sc)
                 if (FeatureWeights_areFriends (c->at [py], c->at [indices[sc]])) hasfriend = 1;
 
             if (!hasfriend)
@@ -1347,8 +1347,8 @@ autoDissimilarity KNN_patternToDissimilarity
 
 {
     autoDissimilarity output = Dissimilarity_create (p -> ny);
-	for (long y = 1; y <= p -> ny; ++ y)
-		for (long x = 1; x <= p -> ny; ++ x)
+	for (integer y = 1; y <= p -> ny; ++ y)
+		for (integer x = 1; x <= p -> ny; ++ x)
 			output -> data [y] [x] = KNN_distanceEuclidean (p, p, fws, y, x);
 	return output;
 }
@@ -1357,35 +1357,35 @@ autoDissimilarity KNN_patternToDissimilarity
 // Compute frequencies                                                                     //
 /////////////////////////////////////////////////////////////////////////////////////////////
 
-long KNN_kIndicesToFrequenciesAndDistances
+integer KNN_kIndicesToFrequenciesAndDistances
 (
     ///////////////////////////////
     // Parameters                //
     ///////////////////////////////
 
-    Categories c,       // Source categories
-                        //
-    long k,             // k (!)
-                        //
-    long * indices,     // In: indices
-                        //
-    double * distances, // Out: distances
-                        //
-    double * freqs,     // Out: and frequencies (double, sic!)
-                        //
-    long *freqindices   // Out: and indices -> freqs.
+    Categories c,        // Source categories
+                         //
+    integer k,           // k (!)
+                         //
+    integer * indices,   // In: indices
+                         //
+    double * distances,  // Out: distances
+                         //
+    double * freqs,      // Out: and frequencies (double, sic!)
+                         //
+    integer *freqindices // Out: and indices -> freqs.
 )
 
 {
-    long ncategories = 0;
+    integer ncategories = 0;
     
     Melder_assert (k <= c->size && k > 0);
     Melder_assert (distances && indices && freqs && freqindices);
 
-    for (long y = 0; y < k; ++y)
+    for (integer y = 0; y < k; ++y)
     {
         int hasfriend = 0;
-        long ifriend = 0;
+        integer ifriend = 0;
 
         while (ifriend < ncategories)
         {
@@ -1425,19 +1425,19 @@ void KNN_normalizeFloatArray
 
     double * array,     // Array to be normalized
                         //
-    long n              // The number of elements
+    integer n           // The number of elements
                         // in the array
 )
 
 {
-    long c = 0;
-    double sum = 0;
+    integer c = 0;
+    real80 sum = 0.0;
 
-    while(c < n)
-        sum += array[c++];
+    while (c < n)
+        sum += array [c ++];   // this sums over array [0 .. n-1]
 
-    while(c--)
-        array[c] /= sum;
+    while (c --)
+        array [c] /= sum;   // this scales array [0 .. n-1]
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////////
@@ -1452,7 +1452,7 @@ void KNN_removeInstance
 
     KNN me,     // Classifier
                 //
-    long y      // Index of the instance to be purged
+    integer y   // Index of the instance to be purged
                 //
 )
 
@@ -1467,10 +1467,10 @@ void KNN_removeInstance
     Melder_assert (y > 0 && y <= my nInstances);
 
     autoPatternList newPattern = PatternList_create (my nInstances - 1, my input -> nx);
-	long yt = 1;
-	for (long cy = 1; cy <= my nInstances; cy ++) {
+	integer yt = 1;
+	for (integer cy = 1; cy <= my nInstances; cy ++) {
 		if (cy != y) {
-			for (long cx = 1; cx <= my input -> nx; cx ++)
+			for (integer cx = 1; cx <= my input -> nx; cx ++)
 				newPattern -> z [yt] [cx] = my input -> z [cy] [cx];
 			yt ++;
 		}
@@ -1500,13 +1500,13 @@ void KNN_shuffleInstances
 
     autoPatternList new_input = PatternList_create (my nInstances, my input -> nx);
     autoCategories new_output = Categories_create ();
-	long y = 1;
+	integer y = 1;
 	while (my nInstances)
 	{
-		long pick = NUMrandomInteger (1, my nInstances);
+		integer pick = NUMrandomInteger (1, my nInstances);
 		new_output -> addItem_move (Data_copy (my output->at [pick]));
 
-		for (long x = 1; x <= my input -> nx; x ++)
+		for (integer x = 1; x <= my input -> nx; x ++)
 			new_input -> z [y] [x] = my input -> z [pick] [x];
 
 		KNN_removeInstance (me, pick);
@@ -1530,9 +1530,9 @@ autoPermutation KNN_SA_ToPermutation
 
     KNN me,             // the classifier being used
                         //
-    long tries,         //
+    integer tries,      //
                         //
-    long iterations,    //
+    integer iterations, //
                         //
     double step_size,   //
                         //
@@ -1571,7 +1571,7 @@ autoPermutation KNN_SA_ToPermutation
                     0, 
                     params);
 
-    for (long i = 1; i <= my nInstances; ++i)
+    for (integer i = 1; i <= my nInstances; ++i)
         result->p[i] = istruct->indices[i];
 
     KNN_SA_t_destroy(istruct);
@@ -1595,17 +1595,17 @@ double KNN_SA_t_energy
         return(0);  
 
     double eCost = 0;
-    for(long i = 1; i <= ((KNN_SA_t *) istruct)->p->ny; ++i)
+    for (integer i = 1; i <= ((KNN_SA_t *) istruct)->p->ny; ++i)
     {
         /* fast and sloppy version */ 
        
         double jDist = 0;
         double kDist = 0;
 
-        long j = i - 1 > 0 ? i - 1 : ((KNN_SA_t *) istruct)->p->ny;
-        long k = i + 1 <= ((KNN_SA_t *) istruct)->p->ny ? i + 1 : 1;
+        integer j = i - 1 > 0 ? i - 1 : ((KNN_SA_t *) istruct)->p->ny;
+        integer k = i + 1 <= ((KNN_SA_t *) istruct)->p->ny ? i + 1 : 1;
 
-        for (long x = 1; x <= ((KNN_SA_t *) istruct)->p->nx; ++x)
+        for (integer x = 1; x <= ((KNN_SA_t *) istruct)->p->nx; ++x)
         {
             jDist +=    OlaSQUARE(((KNN_SA_t *) istruct)->p->z[((KNN_SA_t *) istruct)->indices[i]][x] - 
                         ((KNN_SA_t *) istruct)->p->z[((KNN_SA_t *) istruct)->indices[j]][x]);
@@ -1630,16 +1630,16 @@ double KNN_SA_t_metric
 {
     double result = 0;
 
-    for(long i = ((KNN_SA_t *) istruct1)->p->ny; i >= 1; --i)
+    for (integer i = ((KNN_SA_t *) istruct1)->p->ny; i >= 1; --i)
         if(((KNN_SA_t *) istruct1)->indices[i] !=  ((KNN_SA_t *) istruct2)->indices[i]) 
             ++result;
 
-    return(result);
+    return result;
 }
 
 void KNN_SA_t_print (void * istruct) {
     Melder_casual (U"\n");
-    for (long i = 1; i <= ((KNN_SA_t *) istruct) -> p -> ny; i ++)
+    for (integer i = 1; i <= ((KNN_SA_t *) istruct) -> p -> ny; i ++)
         Melder_casual (((KNN_SA_t *) istruct) -> indices [i]);
     Melder_casual (U"\n");
 }
@@ -1652,20 +1652,20 @@ void KNN_SA_t_step
 )
 
 {
-    long i1 = lround ((((KNN_SA_t *) istruct) -> p -> ny - 1) * gsl_rng_uniform (r)) + 1;
-    long i2 = (i1 + lround (step_size * gsl_rng_uniform (r))) % ((KNN_SA_t *) istruct) -> p -> ny + 1;
+    integer i1 = lround ((((KNN_SA_t *) istruct) -> p -> ny - 1) * gsl_rng_uniform (r)) + 1;
+    integer i2 = (i1 + lround (step_size * gsl_rng_uniform (r))) % ((KNN_SA_t *) istruct) -> p -> ny + 1;
 
     if (i1 == i2)
         return;
 
     if (i1 > i2)
-        OlaSWAP (long, i1, i2);
+        OlaSWAP (integer, i1, i2);
 
-    long partitions[i2 - i1 + 1];
+    integer partitions[i2 - i1 + 1];
 
     KNN_SA_partition(((KNN_SA_t *) istruct)->p, i1, i2, partitions);
 
-    for (long r, l = 1, stop = i2 - i1 + 1; l < stop; l ++)
+    for (integer r, l = 1, stop = i2 - i1 + 1; l < stop; l ++)
     {
         while (l < stop && partitions [l] == 1)
             l ++;
@@ -1678,7 +1678,7 @@ void KNN_SA_t_step
         if (r == stop)
             break;
         
-        OlaSWAP (long, ((KNN_SA_t *) istruct) -> indices [i1], ((KNN_SA_t *) istruct) -> indices [i2]); 
+        OlaSWAP (integer, ((KNN_SA_t *) istruct) -> indices [i1], ((KNN_SA_t *) istruct) -> indices [i2]);
     }
 }
 
@@ -1691,7 +1691,7 @@ void KNN_SA_t_copy
 {
     ((KNN_SA_t *) istruct_dest)->p = ((KNN_SA_t *) istruct_src)->p;
 
-    for(long i = 1; i <= ((KNN_SA_t *) istruct_dest)->p->ny; ++i)
+    for (integer i = 1; i <= ((KNN_SA_t *) istruct_dest)->p->ny; ++i)
         ((KNN_SA_t *) istruct_dest)->indices[i] = ((KNN_SA_t *) istruct_src)->indices[i];
 }
 
@@ -1705,9 +1705,9 @@ void * KNN_SA_t_copy_construct
     KNN_SA_t * result = (KNN_SA_t *) malloc(sizeof(KNN_SA_t));
 
     result->p = ((KNN_SA_t *) istruct)->p;
-    result->indices = (long *) malloc(sizeof(long) * (result->p->ny + 1));
+    result->indices = (integer *) malloc (sizeof(integer) * (result->p->ny + 1));
 
-    for(long i = 1; i <= result->p->ny; ++i)
+    for (integer i = 1; i <= result->p->ny; ++i)
         result->indices[i] = ((KNN_SA_t *) istruct)->indices[i];
 
     return((void *) result);
@@ -1722,9 +1722,9 @@ KNN_SA_t * KNN_SA_t_create
     KNN_SA_t * result = (KNN_SA_t *) malloc(sizeof(KNN_SA_t));
 
     result->p = p;
-    result->indices = (long *) malloc(sizeof(long) * (p->ny + 1));
+    result->indices = (integer *) malloc (sizeof (integer) * (p->ny + 1));
 
-    for(long i = 1; i <= p->ny; ++i)
+    for (integer i = 1; i <= p->ny; ++i)
         result->indices[i] = i;
 
     return(result);
@@ -1746,24 +1746,24 @@ void KNN_SA_partition
     // Parameters                //
     ///////////////////////////////
 
-    PatternList p,              // 
+    PatternList p,          //
                             //
-    long i1,                // i1 < i2
+    integer i1,             // i1 < i2
                             //
-    long i2,                //
+    integer i2,             //
                             //
-    long * result           // [0] anv. ej
+    integer * result        // [0] anv. ej
                             //
 )
 
 {
-    long c1 = (long) lround(NUMrandomUniform(i1, i2));
-    long c2 = (long) lround(NUMrandomUniform(i1, i2));
+    integer c1 = (integer) lround(NUMrandomUniform(i1, i2));
+    integer c2 = (integer) lround(NUMrandomUniform(i1, i2));
 
     double *p1 = NUMvector <double> (1, p->nx); 
     double *p2 = NUMvector <double> (1, p->nx);
 
-    for(long x = 1; x <= p->nx; ++x)
+    for (integer x = 1; x <= p->nx; ++x)
     {
         p1[x] = p->z[c1][x];
         p2[x] = p->z[c2][x];
@@ -1774,60 +1774,60 @@ void KNN_SA_partition
         double d1, d2;
         converging = false;
 
-        for(long i = i1, j = 1; i <= i2; ++i)
+        for (integer i = i1, j = 1; i <= i2; ++i)
         {
-            d1 = 0;
-            d2 = 0;
+            d1 = 0.0;
+            d2 = 0.0;
         
-            for (long x = 1; x <= p->nx; ++x)
+            for (integer x = 1; x <= p->nx; ++x)
             {
                 d1 += OlaSQUARE(p->z[i][x] - p1[x]);
                 d2 += OlaSQUARE(p->z[i][x] - p2[x]);
             }
 
-            d1 = sqrt(d1);
-            d2 = sqrt(d2);
+            d1 = sqrt (d1);
+            d2 = sqrt (d2);
 
-            if(d1 < d2)
+            if (d1 < d2)
             {
-                if(result[j] != 1)
+                if (result [j] != 1)
                 {
                     converging = true;
-                    result[j] = 1;
+                    result [j] = 1;
                 }
             }
             else
             { 
-                if(result[j] != 2)
+                if (result [j] != 2)
                 {
                     converging = true;
-                    result[j] = 2;
+                    result [j] = 2;
                 }
             }
-            ++j;
+            j ++;
         }
 
-        for (long x = 1; x <= p -> nx; x ++)
+        for (integer x = 1; x <= p -> nx; x ++)
         {
-            p1[x] = 0;
-            p2[x] = 0;
+            p1 [x] = 0.0;
+            p2 [x] = 0.0;
         }
 
-        for (long i = i1, j = 1, j1 = 1, j2 = 1; i <= i2; i ++)
+        for (integer i = i1, j = 1, j1 = 1, j2 = 1; i <= i2; i ++)
         {
             if (result [j] == 1)
             {
-                for (long x = 1; x <= p->nx; x ++)
+                for (integer x = 1; x <= p->nx; x ++)
                     p1[x] += (p->z[i][x] - p1[x]) / j1;
-                ++j1;
+                j1 ++;
             }
             else
             {
-                for (long x = 1; x <= p -> nx; x ++)
+                for (integer x = 1; x <= p -> nx; x ++)
                     p2[x] += (p->z[i][x] - p2[x]) / j2;
-                ++j2;
+                j2 ++;
             }
-            ++j;
+            j ++;
         }
     }
     NUMvector_free (p1, 1);
diff --git a/contrib/ola/KNN.h b/contrib/ola/KNN.h
index 01fd3eb..a5ae037 100644
--- a/contrib/ola/KNN.h
+++ b/contrib/ola/KNN.h
@@ -2,7 +2,7 @@
 #define _KNN_h_
 /* KNN.h
  *
- * Copyright (C) 2007-2008 Ola Söder
+ * Copyright (C) 2007-2008 Ola Söder, 2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -55,10 +55,6 @@
 #define kOla_TEN_FOLD_CROSS_VALIDATION 1
 #define kOla_LEAVE_ONE_OUT 2
 
-#define kOla_TO_TABLEOFREAL 1
-#define kOla_TO_TABLEOFREAL_ALL 2
-#define kOla_TO_CATEGORIES 4
-
 #define kOla_SQUARED_DISTANCE_WEIGHTED_VOTING 8
 #define kOla_DISTANCE_WEIGHTED_VOTING 16
 #define kOla_FLAT_VOTING 32
@@ -88,7 +84,7 @@ autoKNN KNN_create ();
 int KNN_learn
 (
     KNN me,             // the classifier to be trained
-    PatternList p,          // source pattern
+    PatternList p,      // source pattern
     Categories c,       // target categories
     int method,         // method <- REPLACE or APPEND
     int ordering        // ordering <- SHUFFLE?
@@ -98,9 +94,9 @@ int KNN_learn
 autoCategories KNN_classifyToCategories
 (
     KNN me,             // the classifier being used
-    PatternList ps,         // target pattern (where neighbours are sought for)
+    PatternList ps,     // target pattern (where neighbours are sought for)
     FeatureWeights fws, // feature weights
-    long k,             // the number of sought after neighbours
+    integer k,          // the number of sought after neighbours
     int dist            // distance weighting
 );
 
@@ -113,7 +109,7 @@ void * KNN_classifyToCategoriesAux
 // Classification - To TableOfReal
 autoTableOfReal KNN_classifyToTableOfReal
 (
-    KNN me, PatternList ps, FeatureWeights fws, long int k, int dist
+    KNN me, PatternList ps, FeatureWeights fws, integer k, int dist
 );
 
 // Classification - To TableOfReal, threading aux
@@ -126,9 +122,9 @@ void * KNN_classifyToTableOfRealAux
 autoTableOfReal KNN_classifyToTableOfRealAll
 (
     KNN me,             // the classifier being used
-    PatternList ps,         // target pattern (where neighbours are sought for)
+    PatternList ps,     // target pattern (where neighbours are sought for)
     FeatureWeights fws, // feature weights
-    long k,             // the number of sought after neighbours
+    integer k,          // the number of sought after neighbours
     int dist            // distance weighting
 );
 
@@ -136,12 +132,12 @@ autoTableOfReal KNN_classifyToTableOfRealAll
 autoCategories KNN_classifyFold
 (
     KNN me,             // the classifier being used
-    PatternList ps,         // target pattern (where neighbours are sought for)
+    PatternList ps,     // target pattern (where neighbours are sought for)
     FeatureWeights fws, // feature weights
-    long k,             // the number of sought after neighbours
+    integer k,          // the number of sought after neighbours
     int dist,           // distance weighting
-    long begin,         // fold start, inclusive [...
-    long end            // fold end, inclusive ...]
+    integer begin,      // fold start, inclusive [...
+    integer end        // fold end, inclusive ...]
 );
 
 // Evaluation
@@ -149,7 +145,7 @@ double KNN_evaluate
 (
     KNN me,             // the classifier being used
     FeatureWeights fws, // feature weights
-    long k,             // the number of sought after neighbours
+    integer k,          // the number of sought after neighbours
     int dist,           // distance weighting
     int mode            // TEN_FOLD_CROSS_VALIDATION / LEAVE_ONE_OUT
 );
@@ -158,10 +154,10 @@ double KNN_evaluate
 double KNN_evaluateWithTestSet
 (
     KNN me,             // the classifier being used
-    PatternList p,          // The vectors of the test set
-    Categories c,       // The categories of the test set
+    PatternList p,      // the vectors of the test set
+    Categories c,       // the categories of the test set
     FeatureWeights fws, // feature weights
-    long k,             // the number of sought after neighbours
+    integer k,          // the number of sought after neighbours
     int dist            // distance weighting
 );
 
@@ -170,56 +166,56 @@ double KNN_modelSearch
 (
     KNN me,             // the classifier being used
     FeatureWeights fws, // feature weights
-    long * k,           // valid long *, to hold the output value of k
-    int * dist,         // valid int *, to hold the output value dist_weight
+    integer *k,         // valid integer *, to hold the output value of k
+    int *dist,          // valid int *, to hold the output value dist_weight
     int mode,           // evaluation mode
     double rate,        // learning rate
-    long nseeds         // the number of seeds to be used
+    integer nseeds      // the number of seeds to be used
 );
 
 // Euclidean distance
 double KNN_distanceEuclidean
 (
-    PatternList ps, PatternList pt, FeatureWeights fws, long int rows, long int rowt
+    PatternList ps, PatternList pt, FeatureWeights fws, integer rows, integer rowt
 );
 
 // Manhattan distance
 double KNN_distanceManhattan
 (
-    PatternList ps, PatternList pt, long int rows, long int rowt
+    PatternList ps, PatternList pt, integer rows, integer rowt
 );
 
 // Find longest distance
-long KNN_max
+integer KNN_max
 (
     double * distances, // an array of distances containing ...
-    long ndistances     // ndistances distances
+    integer ndistances     // ndistances distances
 );
 
 // Locate k neighbours, skip one + disposal of distance
-long KNN_kNeighboursSkip
+integer KNN_kNeighboursSkip
 (
-    PatternList j, PatternList p, FeatureWeights fws, long int jy, long int k, long int* indices, long int skipper
+    PatternList j, PatternList p, FeatureWeights fws, integer jy, integer k, integer *indices, integer skipper
 );
 
 // Locate the k nearest neighbours, exclude instances within the range defined
 // by [begin ... end]
-long KNN_kNeighboursSkipRange
+integer KNN_kNeighboursSkipRange
 (
-    PatternList j, PatternList p, FeatureWeights fws, long int jy, long int k, long int* indices, double* distances, long int begin, long int end
+    PatternList j, PatternList p, FeatureWeights fws, integer jy, integer k, integer *indices, double *distances, integer begin, integer end
                         // range of excluded instances in the target
                         // pattern
 );
 
 // Locate k neighbours
-long KNN_kNeighbours
+integer KNN_kNeighbours
 (
-    PatternList j,          // source-pattern (where the unknown is located)
-    PatternList p,          // target pattern (where neighbours are sought for)
+    PatternList j,      // source-pattern (where the unknown is located)
+    PatternList p,      // target pattern (where neighbours are sought for)
     FeatureWeights fws, // feature weights
-    long jy,            // the index of the unknown instance in the source pattern
-    long k,             // the number of sought after neighbours
-    long * indices,     // a pointer to a memory-space big enough for k longs
+    integer jy,         // the index of the unknown instance in the source pattern
+    integer k,          // the number of sought after neighbours
+    integer * indices,  // a pointer to a memory-space big enough for k integers
                         // representing indices to the k neighbours in the
                         // target pattern
     double * distances  // a pointer to a memory-space big enough for k
@@ -228,9 +224,9 @@ long KNN_kNeighbours
 );
 
 // Locating k (nearest) friends
-long KNN_kFriends
+integer KNN_kFriends
 (
-    PatternList j, PatternList p, Categories c, long int jy, long int k, long int* indices
+    PatternList j, PatternList p, Categories c, integer jy, integer k, integer *indices
                         // representing indices to the k friends in the
                         // target pattern
 );
@@ -238,45 +234,45 @@ long KNN_kFriends
 // Computing the distance to the nearest enemy
 double KNN_nearestEnemy
 (
-    PatternList j, PatternList p, Categories c, long int jy
+    PatternList j, PatternList p, Categories c, integer jy
 );
 
 // Computing the number of friends among k neighbours
-long KNN_friendsAmongkNeighbours
+integer KNN_friendsAmongkNeighbours
 (
-    PatternList j, PatternList p, Categories c, long int jy, long int k
+    PatternList j, PatternList p, Categories c, integer jy, integer k
 );
 
 // Locating k unique (nearest) enemies
-long KNN_kUniqueEnemies
+integer KNN_kUniqueEnemies
 (
-    PatternList j, PatternList p, Categories c, long int jy, long int k, long int* indices
+    PatternList j, PatternList p, Categories c, integer jy, integer k, integer *indices
                         // located enemies
 );
 
 // Compute dissimilarity matrix
 autoDissimilarity KNN_patternToDissimilarity
 (
-    PatternList p,          // PatternList
-    FeatureWeights fws  // Feature weights
+    PatternList p,       // PatternList
+    FeatureWeights fws   // Feature weights
 );
 
 // Compute frequencies
-long KNN_kIndicesToFrequenciesAndDistances
+integer KNN_kIndicesToFrequenciesAndDistances
 (
-    Categories c,       // Source categories
-    long k,             // k (!)
-    long * indices,     // In: indices
-    double * distances, // Out: distances
-    double * freqs,     // Out: and frequencies (double, sic!)
-    long *freqindices   // Out: and indices -> freqs.
+    Categories c,        // Source categories
+    integer k,           // k (!)
+    integer *indices,    // In: indices
+    double *distances,   // Out: distances
+    double *freqs,       // Out: and frequencies (double, sic!)
+    integer *freqindices // Out: and indices -> freqs.
 );
 
 // Normalize array
 void KNN_normalizeFloatArray
 (
     double * array,     // Array to be normalized
-    long n              // The number of elements
+    integer n           // The number of elements
                         // in the array
 );
 
@@ -284,7 +280,7 @@ void KNN_normalizeFloatArray
 void KNN_removeInstance
 (
     KNN me,             // Classifier
-    long y              // Index of the instance to be purged
+    integer y           // Index of the instance to be purged
                         //
 );
 
@@ -299,8 +295,8 @@ void KNN_shuffleInstances
 autoPermutation KNN_SA_ToPermutation
 (
     KNN me,             // the classifier being used
-    long tries,         //
-    long iterations,    //
+    integer tries,      //
+    integer iterations, //
     double step_size,   //
     double boltzmann_c, //
     double temp_start,  //
@@ -313,7 +309,7 @@ autoPermutation KNN_SA_ToPermutation
 typedef struct
 {
     PatternList p;
-    long * indices;
+    integer *indices;
 } KNN_SA_t;
     
 // Experimental code
@@ -372,18 +368,18 @@ void KNN_SA_t_destroy
 void KNN_SA_partition
 (
     PatternList p,               
-    long i1,                 
-    long i2,                
-    long * result           
+    integer i1,
+    integer i2,
+    integer *result
 );
 
 // Compute feature weights (wrapper), evaluate using folding
 autoFeatureWeights FeatureWeights_computeWrapperInt
 (
     KNN me,                 // Classifier
-    long k,                 // k(!)
+    integer k,              // k(!)
     int d,                  // distance weighting
-    long nseeds,            // the number of seeds
+    integer nseeds,         // the number of seeds
     double alfa,            // shrinkage factor
     double stop,            // stop at
     int mode,               // mode (co/serial)
@@ -394,11 +390,11 @@ autoFeatureWeights FeatureWeights_computeWrapperInt
 autoFeatureWeights FeatureWeights_computeWrapperExt
 (
     KNN nn,                 // Classifier
-    PatternList pp,             // test pattern
+    PatternList pp,         // test pattern
     Categories c,           // test categories
-    long k,                 // k(!)
+    integer k,              // k(!)
     int d,                  // distance weighting
-    long nseeds,            // the number of seeds
+    integer nseeds,         // the number of seeds
     double alfa,            // shrinkage factor
     double stop,            // stop at
     int mode                // mode (co/serial)
@@ -409,9 +405,9 @@ double FeatureWeights_evaluate
 (
     FeatureWeights fws,     // Weights to evaluate
     KNN nn,                 // Classifier
-    PatternList pp,             // test pattern
+    PatternList pp,         // test pattern
     Categories c,           // test categories
-    long k,                 // k(!)
+    integer k,              // k(!)
     int d                   // distance weighting
 );
 
diff --git a/contrib/ola/KNN_def.h b/contrib/ola/KNN_def.h
index 5602cba..19e5c15 100644
--- a/contrib/ola/KNN_def.h
+++ b/contrib/ola/KNN_def.h
@@ -20,7 +20,7 @@
 #define ooSTRUCT KNN
 oo_DEFINE_CLASS (KNN, Daata)
 
-	oo_LONG (nInstances)
+	oo_INTEGER (nInstances)
 	oo_AUTO_OBJECT (PatternList, 2, input)
 	oo_AUTO_OBJECT (Categories, 0, output)
 
diff --git a/contrib/ola/KNN_prune.cpp b/contrib/ola/KNN_prune.cpp
index 67adcd0..ab445a5 100644
--- a/contrib/ola/KNN_prune.cpp
+++ b/contrib/ola/KNN_prune.cpp
@@ -1,6 +1,6 @@
 /* KNN_prune.cpp
  *
- * Copyright (C) 2007-2008 Ola So"der, 2010-2011,2015,2016 Paul Boersma
+ * Copyright (C) 2007-2008 Ola So"der, 2010-2011,2015,2016,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -30,23 +30,23 @@
 // Prune                                                                                   //
 /////////////////////////////////////////////////////////////////////////////////////////////
 
-long KNN_prune_prune
+integer KNN_prune_prune
 (
     KNN me,     // the classifier to be pruned
     double n,   // pruning degree: noise, 0 <= n <= 1
     double r,   // pruning redundancy: noise, 0 <= n <= 1
-    long k      // k(!)
+    integer k   // k(!)
 )
 {
 	autoCategories uniqueCategories = Categories_selectUniqueItems (my output.get());
 	if (Categories_getSize (uniqueCategories.get()) == my nInstances)
 		return 0;
-	long removals = 0;
-	long ncandidates = 0;
-	autoNUMvector <long> candidates ((integer) 0, my nInstances - 1);
+	integer removals = 0;
+	integer ncandidates = 0;
+	autoNUMvector <integer> candidates ((integer) 0, my nInstances - 1);
 	if (my nInstances <= 1)
 		return 0;
-	for (long y = 1; y <= my nInstances; y ++) {
+	for (integer y = 1; y <= my nInstances; y ++) {
 		if (KNN_prune_noisy (my input.get(), my output.get(), y, k)) {
 			if (n == 1 || NUMrandomUniform (0, 1) <= n) {
 				KNN_removeInstance (me, y);
@@ -54,16 +54,16 @@ long KNN_prune_prune
 			}
 		}
 	}
-	for (long y = 1; y <= my nInstances; ++ y) {
+	for (integer y = 1; y <= my nInstances; ++ y) {
 		if (KNN_prune_superfluous (my input.get(), my output.get(), y, k, 0) && ! KNN_prune_critical (my input.get(), my output.get(), y, k))
 			candidates [ncandidates ++] = y;
 	}
 	KNN_prune_sort (my input.get(), my output.get(), k, candidates.peek(), ncandidates);
-	for (long y = 0; y < ncandidates; ++ y) {
+	for (integer y = 0; y < ncandidates; ++ y) {
 		if (KNN_prune_superfluous (my input.get(), my output.get(), candidates [y], k, 0) && ! KNN_prune_critical (my input.get(), my output.get(), candidates [y], k)) {
 			if (r == 1.0 || NUMrandomUniform (0.0, 1.0) <= r) {
 				KNN_removeInstance (me, candidates[y]);
-				for (long i = y + 1; i < ncandidates; ++ i) {
+				for (integer i = y + 1; i < ncandidates; ++ i) {
 					if(candidates[i] > candidates[y])
 						-- candidates[i];
 				}
@@ -80,29 +80,29 @@ long KNN_prune_prune
 
 void KNN_prune_sort
 (
-    PatternList p,      // source
-    Categories c,   // source
-    long k,         // k(!)
-    long * indices, // indices of instances to be sorted
-    long nindices   // the number of instances to be sorted
+    PatternList p,     // source
+    Categories c,      // source
+    integer k,         // k(!)
+    integer * indices, // indices of instances to be sorted
+    integer nindices   // the number of instances to be sorted
 )
 {
-	long n = nindices;
-	autoNUMvector <long> h ((integer) 0, nindices - 1);
-	for (long cc = 0; cc < nindices; ++ cc)
+	integer n = nindices;
+	autoNUMvector <integer> h ((integer) 0, nindices - 1);
+	for (integer cc = 0; cc < nindices; ++ cc)
 		h [cc] = KNN_friendsAmongkNeighbours (p, p, c, indices [cc], k);
 	while (-- n) {   // insertion-sort, is heap-sort worth the effort?
-		for (long m = n; m < nindices - 1; m ++) {
+		for (integer m = n; m < nindices - 1; m ++) {
 			if (h [m - 1] > h[m]) 
 				break;
 			if (h [m - 1] < h[m]) {
-				OlaSWAP (long, indices [m - 1], indices [m]);
+				OlaSWAP (integer, indices [m - 1], indices [m]);
 			} else {
 				if (KNN_nearestEnemy (p, p, c, indices [m - 1]) < KNN_nearestEnemy (p, p, c, indices [m])) {
-					OlaSWAP (long, indices [m - 1], indices [m]);
+					OlaSWAP (integer, indices [m - 1], indices [m]);
 				} else {
 					if (NUMrandomUniform (0, 1) > 0.5) {
-						OlaSWAP (long, indices [m - 1], indices [m]);
+						OlaSWAP (integer, indices [m - 1], indices [m]);
 					}
 				}
 			}
@@ -115,23 +115,23 @@ void KNN_prune_sort
 // k-coverage                                                                              //
 /////////////////////////////////////////////////////////////////////////////////////////////
 
-long KNN_prune_kCoverage
+integer KNN_prune_kCoverage
 (
-    PatternList p,      // source
-    Categories c,   // source
-    long y,         // source instance index
-    long k,         // k(!)
-    long * indices  // Out: kCoverage set
+    PatternList p,     // source
+    Categories c,      // source
+    integer y,         // source instance index
+    integer k,         // k(!)
+    integer * indices  // Out: kCoverage set
 )
 {
 	Melder_assert (y <= p->ny);
 	Melder_assert (k > 0 && k <= p->ny);
-	long cc = 0;
+	integer cc = 0;
 	autoFeatureWeights fws = FeatureWeights_create (p -> nx);
-	autoNUMvector <long> tempindices ((integer) 0, p -> ny - 1);
-	for (long yy = 1; yy <= p -> ny; yy ++) {
+	autoNUMvector <integer> tempindices ((integer) 0, p -> ny - 1);
+	for (integer yy = 1; yy <= p -> ny; yy ++) {
 		if (y != yy && FeatureWeights_areFriends (c->at [y], c->at [yy])) {
-			long n = KNN_kNeighboursSkip (p, p, fws.get(), yy, k, tempindices.peek(), y);
+			integer n = KNN_kNeighboursSkip (p, p, fws.get(), yy, k, tempindices.peek(), y);
 			while (n) {
 				Melder_assert (n <= p -> ny);
 				if (tempindices [-- n] == y) {
@@ -150,22 +150,22 @@ long KNN_prune_kCoverage
 
 int KNN_prune_superfluous
 (
-    PatternList p,      // source
-    Categories c,   // source
-    long y,         // source instance index
-    long k,         // k(!)
-    long skipper    // Skipping instance skipper
+    PatternList p,   // source
+    Categories c,    // source
+    integer y,       // source instance index
+    integer k,       // k(!)
+    integer skipper  // Skipping instance skipper
 )
 {
 	if (y > p -> ny) y = p -> ny;   // safety belt
 	if (k > p -> ny) k = p -> ny;
 	autoFeatureWeights fws = FeatureWeights_create (p -> nx);
-	autoNUMvector <long> indices ((integer) 0, k - 1);
-	autoNUMvector <long> freqindices ((integer) 0, k - 1);
+	autoNUMvector <integer> indices ((integer) 0, k - 1);
+	autoNUMvector <integer> freqindices ((integer) 0, k - 1);
 	autoNUMvector <double> distances ((integer) 0, k - 1);
 	autoNUMvector <double> freqs ((integer) 0, k - 1);
 	if (! KNN_kNeighboursSkip (p, p, fws.get(), y, k, indices.peek(), skipper)) return 0;
-	long ncategories = KNN_kIndicesToFrequenciesAndDistances (c, k, indices.peek(), distances.peek(), freqs.peek(), freqindices.peek());
+	integer ncategories = KNN_kIndicesToFrequenciesAndDistances (c, k, indices.peek(), distances.peek(), freqs.peek(), freqindices.peek());
 	int result = FeatureWeights_areFriends (c->at [y], c->at [freqindices [KNN_max (freqs.peek(), ncategories)]]);
 	if (result)
 		return 1;
@@ -178,18 +178,18 @@ int KNN_prune_superfluous
 
 int KNN_prune_critical
 (
-    PatternList p,      // source
+    PatternList p,  // source
     Categories c,   // source
-    long y,         // source instance index
-    long k          // k(!)
+    integer y,      // source instance index
+    integer k       // k(!)
 )
 {
 	if (y > p -> ny) y = p -> ny;   // safety belt
 	if (k > p -> ny) k = p -> ny;
 	autoFeatureWeights fws = FeatureWeights_create (p -> nx);
-	autoNUMvector <long> indices ((integer) 0, k - 1);
-	long ncollected = KNN_kNeighboursSkip (p, p, fws.get(), y, k, indices.peek(), y);
-	for (long ic = 0; ic < ncollected; ic ++) {
+	autoNUMvector <integer> indices ((integer) 0, k - 1);
+	integer ncollected = KNN_kNeighboursSkip (p, p, fws.get(), y, k, indices.peek(), y);
+	for (integer ic = 0; ic < ncollected; ic ++) {
 		if (! KNN_prune_superfluous (p, c, indices [ic], k, 0) || ! KNN_prune_superfluous (p, c, indices [ic], k, y)) {
 			return 1;
 		}
@@ -204,18 +204,18 @@ int KNN_prune_critical
 
 int KNN_prune_noisy
 (
-    PatternList p,      // source
+    PatternList p,  // source
     Categories c,   // source
-    long y,         // source instance index
-    long k          // k(!)
+    integer y,      // source instance index
+    integer k       // k(!)
 )
 {
 	if (y > p -> ny) y = p -> ny;   // safety belt
 	if (k > p -> ny) k = p -> ny;
 	autoFeatureWeights fws = FeatureWeights_create (p -> nx);
-	autoNUMvector <long> indices ((integer) 0, p->ny - 1);    // the coverage is not bounded by k but by n
-	long reachability = KNN_kNeighboursSkip (p, p, fws.get(), y, k, indices.peek(), y);
-	long coverage = KNN_prune_kCoverage (p, c, y, k, indices.peek());
+	autoNUMvector <integer> indices ((integer) 0, p->ny - 1);    // the coverage is not bounded by k but by n
+	integer reachability = KNN_kNeighboursSkip (p, p, fws.get(), y, k, indices.peek(), y);
+	integer coverage = KNN_prune_kCoverage (p, c, y, k, indices.peek());
 	if (! KNN_prune_superfluous (p, c, y, k, 0) && reachability > coverage)
 		return 1;
 	return 0;
diff --git a/contrib/ola/KNN_prune.h b/contrib/ola/KNN_prune.h
index 668c7d0..4aa6aba 100644
--- a/contrib/ola/KNN_prune.h
+++ b/contrib/ola/KNN_prune.h
@@ -3,7 +3,7 @@
 
 /* KNN_prune.h
  *
- * Copyright (C) 2007-2008 Ola Söder
+ * Copyright (C) 2007-2008 Ola Söder, 2011,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -37,60 +37,60 @@
 /////////////////////////////////////////////////////
 
 // Prune
-long KNN_prune_prune
+integer KNN_prune_prune
 (
     KNN me,             // the classifier to be pruned
     double n,           // pruning degree: noise, 0 <= n <= 1
     double r,           // pruning redundancy: noise, 0 <= n <= 1
-    long k              // k(!)
+    integer k           // k(!)
 );
 
 // sort indices according to pruning order defined by rule 2
 void KNN_prune_sort
 (
-    PatternList p,          // source
+    PatternList p,      // source
     Categories c,       // source
-    long k,             // k(!)
-    long * indices,     // indices of instances to be sorted
-    long nindices       // the number of instances to be sorted
+    integer k,          // k(!)
+    integer *indices,   // indices of instances to be sorted
+    integer nindices    // the number of instances to be sorted
 );
 
 // k-coverage
-long KNN_prune_kCoverage
+integer KNN_prune_kCoverage
 (
-    PatternList p,          // source
+    PatternList p,      // source
     Categories c,       // source
-    long y,             // source instance index
-    long k,             // k(!)
-    long * indices      // Out: kCoverage set
+    integer y,          // source instance index
+    integer k,          // k(!)
+    integer * indices   // Out: kCoverage set
 );
 
 // testing for superfluousness
 int KNN_prune_superfluous
 (
-    PatternList p,          // source
+    PatternList p,      // source
     Categories c,       // source
-    long y,             // source instance index
-    long k,             // k(!)
-    long skipper        // Skipping instance skipper
+    integer y,          // source instance index
+    integer k,          // k(!)
+    integer skipper     // Skipping instance skipper
 );
 
 // testing for criticalness
 int KNN_prune_critical
 (
-    PatternList p,          // source
+    PatternList p,      // source
     Categories c,       // source
-    long y,             // source instance index
-    long k              // k(!)
+    integer y,          // source instance index
+    integer k           // k(!)
 );
 
 // testing for noisyness
 int KNN_prune_noisy
 (
-    PatternList p,          // source
+    PatternList p,      // source
     Categories c,       // source
-    long y,             // source instance index
-    long k              // k(!)
+    integer y,          // source instance index
+    integer k           // k(!)
 );
 
 /* End of file KNN_prune.h */
diff --git a/contrib/ola/Pattern_to_Categories_cluster.cpp b/contrib/ola/Pattern_to_Categories_cluster.cpp
index 724beaa..c986ab7 100644
--- a/contrib/ola/Pattern_to_Categories_cluster.cpp
+++ b/contrib/ola/Pattern_to_Categories_cluster.cpp
@@ -1,6 +1,6 @@
 /* Pattern_to_Categories_cluster.cpp
  *
- * Copyright (C) 2007-2008 Ola So"der, 2010-2011,2016 Paul Boersma
+ * Copyright (C) 2007-2008 Ola So"der, 2010-2011,2016,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -38,15 +38,15 @@ autoCategories PatternList_to_Categories_cluster
     // Parameters                //
     ///////////////////////////////
 
-    PatternList p,              // source
+    PatternList p,          // source
                             //
     FeatureWeights fws,     // feature weights
                             //
-    long k,                 // k(!)
+    integer k,              // k(!)
                             //
     double s,               // clustersize constraint 0 < s <= 1
                             //
-    long m                  // reseed maximum
+    integer m               // reseed maximum
                             //
 )
 
@@ -62,7 +62,7 @@ autoCategories PatternList_to_Categories_cluster
 
 		double progress = m;
 		autoNUMvector <double> sizes ((integer) 0, k);
-		autoNUMvector <long> seeds ((integer) 0, k);
+		autoNUMvector <integer> seeds ((integer) 0, k);
 
 		autoPatternList centroids = PatternList_create (k, p -> nx);
 		autoNUMvector <double> beta ((integer) 0, centroids -> nx);
@@ -70,20 +70,20 @@ autoCategories PatternList_to_Categories_cluster
 		do
 		{
 			double delta;
-			long nfriends  = 0;
+			integer nfriends  = 0;
 			Melder_progress (1 - (progress - m) / progress, U"");
 
-			for (long y = 1; y <= centroids->ny; y++)
+			for (integer y = 1; y <= centroids->ny; y++)
 			{
 				int ifriend = 1;
-				long ys = (long) lround(NUMrandomUniform(1, p->ny));
+				integer ys = (integer) lround (NUMrandomUniform (1, p->ny));
 
 				if (nfriends)
 				{
 					while (ifriend)
 					{
-						ys = (long) lround(NUMrandomUniform(1, p->ny));
-						for (long fc = 0; fc < nfriends; fc++)
+						ys = (integer) lround(NUMrandomUniform(1, p->ny));
+						for (integer fc = 0; fc < nfriends; fc++)
 						{
 							ifriend = 0;
 							Melder_assert (fc < k);
@@ -98,7 +98,7 @@ autoCategories PatternList_to_Categories_cluster
 				Melder_assert (nfriends <= k);
 				seeds [nfriends++] = ys;
 
-				for (long x = 1; x <= centroids->nx; x++)
+				for (integer x = 1; x <= centroids->nx; x++)
 					centroids->z[y][x] = p->z[ys][x];
 			}
 			do
@@ -107,24 +107,24 @@ autoCategories PatternList_to_Categories_cluster
 				KNN_learn (knn.get(), centroids.get(), categories.get(), kOla_REPLACE, kOla_SEQUENTIAL);
 				autoCategories interim = KNN_classifyToCategories (knn.get(), p, fws, 1, kOla_FLAT_VOTING);
 
-				for (long x = 1; x <= k; x ++)
+				for (integer x = 1; x <= k; x ++)
 					sizes [x] = 0;
 
-				for (long yp = 1; yp <= categories->size; yp ++)
+				for (integer yp = 1; yp <= categories->size; yp ++)
 				{
 					double alfa = 1;
 					Melder_assert (yp <= centroids -> ny);
 
-					for (long x = 1; x <= centroids -> nx; x ++)
+					for (integer x = 1; x <= centroids -> nx; x ++)
 					{
 						beta [x] = centroids -> z [yp] [x];
 					}
 
-					for (long ys = 1; ys <= interim->size; ys ++)
+					for (integer ys = 1; ys <= interim->size; ys ++)
 					{
 						if (FeatureWeights_areFriends (categories->at [yp], interim->at [ys]))
 						{
-							for (long x = 1; x <= p -> nx; x ++)
+							for (integer x = 1; x <= p -> nx; x ++)
 							{
 								Melder_assert (ys <= p -> ny);
 								if (alfa == 1)
@@ -142,7 +142,7 @@ autoCategories PatternList_to_Categories_cluster
 						}
 					}
 
-					for (long x = 1; x <= centroids -> nx; x ++)
+					for (integer x = 1; x <= centroids -> nx; x ++)
 					{
 						delta += fabs (beta [x] - centroids -> z [yp] [x]);
 					}
@@ -153,7 +153,7 @@ autoCategories PatternList_to_Categories_cluster
 			double smax = sizes [1];
 			double smin = sizes [1];
 
-			for (long x = 1; x <= k; x++)
+			for (integer x = 1; x <= k; x++)
 			{
 				if (smax < sizes [x]) smax = sizes [x];
 				if (smin > sizes [x]) smin = sizes [x];
diff --git a/contrib/ola/Pattern_to_Categories_cluster.h b/contrib/ola/Pattern_to_Categories_cluster.h
index f5930f5..8b217df 100644
--- a/contrib/ola/Pattern_to_Categories_cluster.h
+++ b/contrib/ola/Pattern_to_Categories_cluster.h
@@ -47,11 +47,11 @@
 // PatternList_to_Categories_cluster                                                                            
 autoCategories PatternList_to_Categories_cluster
 (
-    PatternList p,              // source
+    PatternList p,          // source
     FeatureWeights fws,     // feature weights
-    long k,                 // k(!)
+    integer k,              // k(!)
     double s,               // clustersize constraint 0 < s <= 1
-    long m                  // reseed maximum
+    integer m               // reseed maximum
 );
 
 /* End of file PatternList_to_Categories_cluster.h */
diff --git a/contrib/ola/praat_contrib_Ola_KNN.cpp b/contrib/ola/praat_contrib_Ola_KNN.cpp
index b2b66bd..5467788 100644
--- a/contrib/ola/praat_contrib_Ola_KNN.cpp
+++ b/contrib/ola/praat_contrib_Ola_KNN.cpp
@@ -83,7 +83,7 @@ DO
 
 DIRECT (INTEGER_KNN_getNumberOfInstances) {
     NUMBER_ONE (KNN)
-		long result = my nInstances;
+		integer result = my nInstances;
 	NUMBER_ONE_END (U" units")
 }
 
@@ -114,10 +114,10 @@ DO
 		KNN_modelSearch (me, fws.get(), & kmax, & dist, evaluationMethod, learningRate, numberOfSeeds);
 		switch (dist) {
 			case kOla_SQUARED_DISTANCE_WEIGHTED_VOTING:
-				Melder_information (kmax, U" (vote weighting: inversed squared distance)");
+				Melder_information (kmax, U" (vote weighting: inverse squared distance)");
 				break;
 			case kOla_DISTANCE_WEIGHTED_VOTING:
-				Melder_information (kmax, U" (vote weighting: inversed distance)");
+				Melder_information (kmax, U" (vote weighting: inverse distance)");
 				break;
 			case kOla_FLAT_VOTING:
 				Melder_information (kmax, U" (vote weighting: flat)");
@@ -228,7 +228,7 @@ DIRECT (NEW_KNN_extractOutputCategories) {
 }
 
 FORM (MODIFY_KNN_reset, U"Reset", U"KNN: Reset...") {
-    LABEL (U"", U"Warning: this command destroys all previous learning.")
+    LABEL (U"Warning: this command destroys all previous learning.")
     OK
 DO
 	MODIFY_EACH (KNN)
@@ -256,14 +256,14 @@ DO
 	FIND_ONE (KNN)
 		if (my nInstances <= 0)
 			Melder_throw (U"Instance base is empty.");
-		long oldn = my nInstances;   // save before it changes!
+		integer oldn = my nInstances;   // save before it changes!
 		if (kNeighbours < 1 || kNeighbours > my nInstances)
 			Melder_throw (U"Please select a value of k such that 0 < k < ", my nInstances + 1, U".");
 		if (noisePruningDegree <= 0.0 || noisePruningDegree > 1.0)
 			Melder_throw (U"The noise pruning degree should be between 0.0 (excluded) and 1.0 (included).");
 		if (redundancyPruningDegree <= 0.0 || redundancyPruningDegree > 1.0)
 			Melder_throw (U"The redundancy pruning degree should be between 0.0 (excluded) and 1.0 (included).");
-		long npruned = KNN_prune_prune (me, noisePruningDegree, redundancyPruningDegree, kNeighbours);   // BUG: the KNN is changed
+		integer npruned = KNN_prune_prune (me, noisePruningDegree, redundancyPruningDegree, kNeighbours);   // BUG: the KNN is changed
 		Melder_information (npruned, U" instances discarded. \n", U"Size of new instance base: ", oldn - npruned);
 	END
 }
@@ -618,8 +618,8 @@ FORM (NEW1_KNN_PatternList_Categories_to_FeatureWeights_wrapperExt, U"Feature we
 		RADIOBUTTON (U"Single feature")
 	NATURAL (kNeighbours, U"k neighbours", U"1")
 	RADIOx (voteWeighting, U"Vote weighting", 3, 1)
-		RADIOBUTTON (U"Inversed squared distance")
-		RADIOBUTTON (U"Inversed distance")
+		RADIOBUTTON (U"Inverse squared distance")
+		RADIOBUTTON (U"Inverse distance")
 		RADIOBUTTON (U"Flat")
 	OK
 DO
@@ -658,8 +658,8 @@ FORM (NEW_KNN_to_FeatureWeights_wrapperInt, U"Feature weights", U"KNN: To Featur
 		RADIOBUTTON (U"10-fold cross-validation")
 	NATURAL (kNeighbours, U"k neighbours", U"1")
 	RADIOx (voteWeighting, U"Vote weighting", 3, 1)
-		RADIOBUTTON (U"Inversed squared distance")
-		RADIOBUTTON (U"Inversed distance")
+		RADIOBUTTON (U"Inverse squared distance")
+		RADIOBUTTON (U"Inverse distance")
 		RADIOBUTTON (U"Flat")
 	OK
 DO
@@ -717,13 +717,13 @@ DO
 DIRECT (KNN_debug_KNN_SA_partition) {
     FIND_ONE (PatternList)
 		autoPatternList output = PatternList_create (my ny, my nx);
-		autoNUMvector <long> result (0, my ny);
+		autoNUMvector <integer> result (0, my ny);
 		KNN_SA_partition (me, 1, my ny, result);
 
-		for (long k = 1, c = 1; k <= output -> ny; k ++, c ++)
-			for (long i = 1; i <= my ny && k <= output -> ny; i ++)
+		for (integer k = 1, c = 1; k <= output -> ny; k ++, c ++)
+			for (integer i = 1; i <= my ny && k <= output -> ny; i ++)
 				if (result [i] == c) {
-					for(long j = 1; j <= output -> nx; ++j)
+					for(integer j = 1; j <= output -> nx; ++j)
 						output -> z [k] [j] = my z [i] [j];
 					k ++;
 				}
diff --git a/dwsys/Collection_extensions.cpp b/dwsys/Collection_extensions.cpp
index 9ae4387..ee9ba0b 100644
--- a/dwsys/Collection_extensions.cpp
+++ b/dwsys/Collection_extensions.cpp
@@ -223,7 +223,7 @@ void OrderedOfString_changeStrings (OrderedOfString me, char32 *search, char32 *
 		}
 		for (long i = 1; i <= my size; i ++) {
 			SimpleString ss = my at [i];
-			long nmatches_sub;
+			integer nmatches_sub;
 			char32 *r = use_regexp ? str_replace_regexp (ss -> string, compiled_search, replace, maximumNumberOfReplaces, &nmatches_sub) : str_replace_literal (ss -> string, search, replace, maximumNumberOfReplaces, &nmatches_sub);
 
 			// Change without error:
diff --git a/dwsys/Eigen.cpp b/dwsys/Eigen.cpp
index 401cb23..ec0028e 100644
--- a/dwsys/Eigen.cpp
+++ b/dwsys/Eigen.cpp
@@ -100,7 +100,7 @@ static void Graphics_ticks (Graphics g, double min, double max, bool hasNumber,
 	}
 }
 
-void Eigen_init (Eigen me, long numberOfEigenvalues, long dimension) {
+void Eigen_init (Eigen me, integer numberOfEigenvalues, integer dimension) {
 	my numberOfEigenvalues = numberOfEigenvalues;
 	my dimension = dimension;
 	my eigenvalues = NUMvector<double> (1, numberOfEigenvalues);
@@ -114,9 +114,9 @@ void Eigen_init (Eigen me, long numberOfEigenvalues, long dimension) {
 	Eigenvectors: the columns of the matrix V
 	Eigenvalues: D_i^2
 */
-void Eigen_initFromSquareRoot (Eigen me, double **a, long numberOfRows, long numberOfColumns) {
-	long numberOfZeroed, numberOfEigenvalues;
-	long nsv = MIN (numberOfRows, numberOfColumns);
+void Eigen_initFromSquareRoot (Eigen me, double **a, integer numberOfRows, integer numberOfColumns) {
+	integer numberOfZeroed, numberOfEigenvalues;
+	integer nsv = MIN (numberOfRows, numberOfColumns);
 
 	my dimension = numberOfColumns;
 	autoSVD svd = SVD_create_d (a, numberOfRows, numberOfColumns);
@@ -135,12 +135,12 @@ void Eigen_initFromSquareRoot (Eigen me, double **a, long numberOfRows, long num
 	numberOfEigenvalues = nsv - numberOfZeroed;
 
 	Eigen_init (me, numberOfEigenvalues, numberOfColumns);
-	long k = 0;
-	for (long i = 1; i <= nsv; i++) {
+	integer k = 0;
+	for (integer i = 1; i <= nsv; i++) {
 		double t = svd -> d[i];
 		if (t > 0.0) {
 			my eigenvalues[++k] = t * t;
-			for (long j = 1; j <= numberOfColumns; j++) {
+			for (integer j = 1; j <= numberOfColumns; j++) {
 				my eigenvectors[k][j] = svd -> v[j][i];
 			}
 		}
@@ -148,12 +148,12 @@ void Eigen_initFromSquareRoot (Eigen me, double **a, long numberOfRows, long num
 	Eigen_sort (me);
 }
 
-void Eigen_initFromSquareRootPair (Eigen me, double **a, long numberOfRows, long numberOfColumns, double **b, long numberOfRows_b) {
+void Eigen_initFromSquareRootPair (Eigen me, double **a, integer numberOfRows, integer numberOfColumns, double **b, integer numberOfRows_b) {
 	double *u = nullptr, *v = nullptr, maxsv2 = -10.0;
 	char jobu = 'N', jobv = 'N', jobq = 'Q';
-	long k, ll, m = numberOfRows, n = numberOfColumns, p = numberOfRows_b;
-	long lda = m, ldb = p, ldu = lda, ldv = ldb, ldq = n;
-	long lwork = MAX (MAX (3 * n, m), p) + n, info;
+	integer k, ll, m = numberOfRows, n = numberOfColumns, p = numberOfRows_b;
+	integer lda = m, ldb = p, ldu = lda, ldv = ldb, ldq = n;
+	integer lwork = MAX (MAX (3 * n, m), p) + n, info;
 
 	/*	Melder_assert (numberOfRows >= numberOfColumns || numberOfRows_b >= numberOfColumns);*/
 
@@ -162,7 +162,7 @@ void Eigen_initFromSquareRootPair (Eigen me, double **a, long numberOfRows, long
 	autoNUMvector<double> alpha (1, n);
 	autoNUMvector<double> beta (1, n);
 	autoNUMvector<double> work (1, lwork);
-	autoNUMvector<long> iwork (1, n);
+	autoNUMvector<integer> iwork (1, n);
 	autoNUMmatrix<double> q (1, n, 1, n);
 	autoNUMmatrix<double> ac (NUMmatrix_transpose (a, numberOfRows, numberOfColumns), 1, 1);
 	autoNUMmatrix<double> bc (NUMmatrix_transpose (b, numberOfRows_b, numberOfColumns), 1, 1);
@@ -178,7 +178,7 @@ void Eigen_initFromSquareRootPair (Eigen me, double **a, long numberOfRows, long
 	// Calculate the eigenvalues (alpha[i]/beta[i])^2 and store in alpha[i].
 
 	maxsv2 = -1.0;
-	for (long i = k + 1; i <= k + ll; i++) {
+	for (integer i = k + 1; i <= k + ll; i++) {
 		double t = alpha[i] / beta[i];
 		alpha[i] = t * t;
 		if (alpha[i] > maxsv2) {
@@ -189,7 +189,7 @@ void Eigen_initFromSquareRootPair (Eigen me, double **a, long numberOfRows, long
 	// Deselect the eigenvalues < eps * max_eigenvalue.
 
 	n = 0;
-	for (long i = k + 1; i <= k + ll; i++) {
+	for (integer i = k + 1; i <= k + ll; i++) {
 		if (alpha[i] < NUMfpp -> eps * maxsv2) {
 			n++; alpha[i] = -1.0;
 		}
@@ -201,14 +201,14 @@ void Eigen_initFromSquareRootPair (Eigen me, double **a, long numberOfRows, long
 
 	Eigen_init (me, ll - n, numberOfColumns);
 
-	long ii = 0;
-	for (long i = k + 1; i <= k + ll; i++) {
+	integer ii = 0;
+	for (integer i = k + 1; i <= k + ll; i++) {
 		if (alpha[i] == -1.0) {
 			continue;
 		}
 
 		my eigenvalues[++ii] = alpha[i];
-		for (long j = 1; j <= numberOfColumns; j++) {
+		for (integer j = 1; j <= numberOfColumns; j++) {
 			my eigenvectors[ii][j] = q[i][j];
 		}
 	}
@@ -218,10 +218,10 @@ void Eigen_initFromSquareRootPair (Eigen me, double **a, long numberOfRows, long
 	NUMnormalizeRows (my eigenvectors, my numberOfEigenvalues, numberOfColumns, 1);
 }
 
-void Eigen_initFromSymmetricMatrix (Eigen me, double **a, long n) {
+void Eigen_initFromSymmetricMatrix (Eigen me, double **a, integer n) {
 	double wt[1], temp;
 	char jobz = 'V', uplo = 'U';
-	long lwork = -1, info;
+	integer lwork = -1, info;
 
 	my dimension = my numberOfEigenvalues = n;
 
@@ -233,33 +233,33 @@ void Eigen_initFromSymmetricMatrix (Eigen me, double **a, long n) {
 
 	// Get size of work array
 
-	(void) NUMlapack_dsyev (&jobz, &uplo, &n, &my eigenvectors[1][1], &n,
-	                        &my eigenvalues[1], wt, &lwork, &info);
+	(void) NUMlapack_dsyev (& jobz, & uplo, & n, & my eigenvectors [1] [1], & n,
+	                        & my eigenvalues [1], wt, & lwork, & info);
 	if (info != 0) {
 		Melder_throw (U"dsyev initialization fails");
 	}
 
-	lwork = (long) floor (wt[0]);
-	autoNUMvector<double> work ((integer) 0, lwork);
+	lwork = (integer) floor (wt[0]);
+	autoNUMvector <double> work ((integer) 0, lwork);
 
-	(void) NUMlapack_dsyev (&jobz, &uplo, &n, &my eigenvectors[1][1], &n, &my eigenvalues[1], work.peek(), &lwork, &info);
+	(void) NUMlapack_dsyev (&jobz, &uplo, &n, &my eigenvectors[1][1], &n, &my eigenvalues[1], work.peek(), & lwork, & info);
 	if (info != 0) {
 		Melder_throw (U"dsyev fails");
 	}
 
 	// We want descending order instead of ascending.
 
-	for (long i = 1; i <= n / 2; i++) {
-		long ilast = n - i + 1;
+	for (integer i = 1; i <= n / 2; i++) {
+		integer ilast = n - i + 1;
 
-		SWAP (my eigenvalues[i], my eigenvalues[ilast])
-		for (long j = 1; j <= n; j++) {
-			SWAP (my eigenvectors[i][j], my eigenvectors[ilast][j])
+		SWAP (my eigenvalues[i], my eigenvalues [ilast])
+		for (integer j = 1; j <= n; j ++) {
+			SWAP (my eigenvectors [i] [j], my eigenvectors [ilast] [j])
 		}
 	}
 }
 
-autoEigen Eigen_create (long numberOfEigenvalues, long dimension) {
+autoEigen Eigen_create (integer numberOfEigenvalues, integer dimension) {
 	try {
 		autoEigen me = Thing_new (Eigen);
 		Eigen_init (me.get(), numberOfEigenvalues, dimension);
@@ -269,22 +269,22 @@ autoEigen Eigen_create (long numberOfEigenvalues, long dimension) {
 	}
 }
 
-long Eigen_getNumberOfEigenvectors (Eigen me) {
+integer Eigen_getNumberOfEigenvectors (Eigen me) {
 	return my numberOfEigenvalues;
 }
 
-double Eigen_getEigenvectorElement (Eigen me, long ivec, long element) {
+double Eigen_getEigenvectorElement (Eigen me, integer ivec, integer element) {
 	if (ivec > my numberOfEigenvalues || element < 1 || element > my dimension) {
 		return undefined;
 	}
 	return my eigenvectors[ivec][element];
 }
 
-long Eigen_getDimensionOfComponents (Eigen me) {
+integer Eigen_getDimensionOfComponents (Eigen me) {
 	return my dimension;
 }
 
-double Eigen_getSumOfEigenvalues (Eigen me, long from, long to) {
+double Eigen_getSumOfEigenvalues (Eigen me, integer from, integer to) {
 	if (from < 1) {
 		from = 1;
 	}
@@ -295,20 +295,20 @@ double Eigen_getSumOfEigenvalues (Eigen me, long from, long to) {
 		return undefined;
 	}
 	double sum = 0.0;
-	for (long i = from; i <= to; i++) {
+	for (integer i = from; i <= to; i++) {
 		sum += my eigenvalues[i];
 	}
 	return sum;
 }
 
-double Eigen_getCumulativeContributionOfComponents (Eigen me, long from, long to) {
+double Eigen_getCumulativeContributionOfComponents (Eigen me, integer from, integer to) {
 	double partial = 0.0, sum = 0.0;
 
 	if (to == 0) {
 		to = my numberOfEigenvalues;
 	}
 	if (from > 0 && to <= my numberOfEigenvalues && from <= to) {
-		for (long i = 1; i <= my numberOfEigenvalues; i++) {
+		for (integer i = 1; i <= my numberOfEigenvalues; i++) {
 			sum += my eigenvalues[i];
 			if (i >= from && i <= to) {
 				partial += my eigenvalues[i];
@@ -319,14 +319,14 @@ double Eigen_getCumulativeContributionOfComponents (Eigen me, long from, long to
 
 }
 
-long Eigen_getDimensionOfFraction (Eigen me, double fraction) {
+integer Eigen_getDimensionOfFraction (Eigen me, double fraction) {
 	double sum = Eigen_getSumOfEigenvalues (me, 0, 0);
 
 	if (sum == 0.0) {
 		return 1;
 	}
 
-	long n = 1;
+	integer n = 1;
 	double p = my eigenvalues[1];
 	while (p / sum < fraction && n < my numberOfEigenvalues) {
 		p += my eigenvalues[++n];
@@ -337,10 +337,10 @@ long Eigen_getDimensionOfFraction (Eigen me, double fraction) {
 void Eigen_sort (Eigen me) {
 	double temp, *e = my eigenvalues, **v = my eigenvectors;
 
-	for (long i = 1; i < my numberOfEigenvalues; i++) {
-		long k;
+	for (integer i = 1; i < my numberOfEigenvalues; i++) {
+		integer k;
 		double emax = e[k = i];
-		for (long j = i + 1; j <= my numberOfEigenvalues; j++) {
+		for (integer j = i + 1; j <= my numberOfEigenvalues; j++) {
 			if (e[j] > emax) {
 				emax = e[k = j];
 			}
@@ -350,25 +350,25 @@ void Eigen_sort (Eigen me) {
 			// Swap eigenvalues and eigenvectors
 
 			SWAP (e[i], e[k])
-			for (long j = 1; j <= my dimension; j++) {
+			for (integer j = 1; j <= my dimension; j++) {
 				SWAP (v[i][j], v[k][j])
 			}
 		}
 	}
 }
 
-void Eigen_invertEigenvector (Eigen me, long ivec) {
+void Eigen_invertEigenvector (Eigen me, integer ivec) {
 
 	if (ivec < 1 || ivec > my numberOfEigenvalues) {
 		return;
 	}
 
-	for (long j = 1; j <= my dimension; j++) {
+	for (integer j = 1; j <= my dimension; j++) {
 		my eigenvectors[ivec][j] = - my eigenvectors[ivec][j];
 	}
 }
 
-void Eigen_drawEigenvalues (Eigen me, Graphics g, long first, long last, double ymin, double ymax, bool fractionOfTotal, bool cumulative, double size_mm, const char32 *mark, bool garnish) {
+void Eigen_drawEigenvalues (Eigen me, Graphics g, integer first, integer last, double ymin, double ymax, bool fractionOfTotal, bool cumulative, double size_mm, const char32 *mark, bool garnish) {
 	double xmin = first, xmax = last, scale = 1.0, sumOfEigenvalues = 0.0;
 
 	if (first < 1) {
@@ -400,7 +400,7 @@ void Eigen_drawEigenvalues (Eigen me, Graphics g, long first, long last, double
 	}
 	Graphics_setInner (g);
 	Graphics_setWindow (g, xmin, xmax, ymin, ymax);
-	for (long i = first; i <= last; i ++) {
+	for (integer i = first; i <= last; i ++) {
 		double accu = Eigen_getSumOfEigenvalues (me, (cumulative ? 1 : i), i);
 		Graphics_mark (g, i, accu / scale, size_mm, mark);
 	}
@@ -415,7 +415,7 @@ void Eigen_drawEigenvalues (Eigen me, Graphics g, long first, long last, double
 	}
 }
 
-void Eigen_drawEigenvector (Eigen me, Graphics g, long ivec, long first, long last, double ymin, double ymax, bool weigh, double size_mm, const char32 *mark, bool connect, char32 **rowLabels, bool garnish) {
+void Eigen_drawEigenvector (Eigen me, Graphics g, integer ivec, integer first, integer last, double ymin, double ymax, bool weigh, double size_mm, const char32 *mark, bool connect, char32 **rowLabels, bool garnish) {
 	double xmin = first, xmax = last;
 
 	if (ivec < 1 || ivec > my numberOfEigenvalues) {
@@ -438,7 +438,7 @@ void Eigen_drawEigenvector (Eigen me, Graphics g, long ivec, long first, long la
 	Graphics_setInner (g);
 	Graphics_setWindow (g, xmin, xmax, ymin, ymax);
 
-	for (long i = first; i <= last; i++) {
+	for (integer i = first; i <= last; i++) {
 		Graphics_mark (g, i, w * vec[i], size_mm, mark);
 		if (connect && i > first) {
 			Graphics_line (g, i - 1.0, w * vec[i - 1], i, w * vec[i]);
@@ -466,10 +466,10 @@ void Eigens_alignEigenvectors (OrderedOf<structEigen>* me) {
 
 	Eigen e1 = my at [1];
 	double **evec1 = e1 -> eigenvectors;
-	long nev1 = e1 -> numberOfEigenvalues;
-	long dimension = e1 -> dimension;
+	integer nev1 = e1 -> numberOfEigenvalues;
+	integer dimension = e1 -> dimension;
 
-	for (long i = 2; i <= my size; i ++) {
+	for (integer i = 2; i <= my size; i ++) {
 		Eigen e2 = my at [i];
 		if (e2 -> dimension != dimension) {
 			Melder_throw (U"The dimension of the eigenvectors must be equal (offending object is ",  i, U").");
@@ -481,17 +481,17 @@ void Eigens_alignEigenvectors (OrderedOf<structEigen>* me) {
 		If r < 0 then mirror the eigenvector.
 	*/
 
-	for (long i = 2; i <= my size; i ++) {
+	for (integer i = 2; i <= my size; i ++) {
 		Eigen e2 = my at [i];
 		double **evec2 = e2 -> eigenvectors;
 
-		for (long j = 1; j <= MIN (nev1, e2 -> numberOfEigenvalues); j ++) {
+		for (integer j = 1; j <= MIN (nev1, e2 -> numberOfEigenvalues); j ++) {
 			double ip = 0.0;
-			for (long k = 1; k <= dimension; k ++) {
+			for (integer k = 1; k <= dimension; k ++) {
 				ip += evec1 [j] [k] * evec2 [j] [k];
 			}
 			if (ip < 0.0) {
-				for (long k = 1; k <= dimension; k ++) {
+				for (integer k = 1; k <= dimension; k ++) {
 					evec2 [j] [k] = - evec2 [j] [k];
 				}
 			}
@@ -499,12 +499,12 @@ void Eigens_alignEigenvectors (OrderedOf<structEigen>* me) {
 	}
 }
 
-static void Eigens_getAnglesBetweenSubspaces (Eigen me, Eigen thee, long ivec_from, long ivec_to, double *angles_degrees) {
-	long nvectors = ivec_to - ivec_from + 1;
-	for (long i = 1; i <= nvectors; i++) {
+static void Eigens_getAnglesBetweenSubspaces (Eigen me, Eigen thee, integer ivec_from, integer ivec_to, double *angles_degrees) {
+	integer nvectors = ivec_to - ivec_from + 1;
+	for (integer i = 1; i <= nvectors; i++) {
 		angles_degrees[i] = undefined;
 	}
-	long nmin = my numberOfEigenvalues < thy numberOfEigenvalues ? my numberOfEigenvalues : thy numberOfEigenvalues;
+	integer nmin = my numberOfEigenvalues < thy numberOfEigenvalues ? my numberOfEigenvalues : thy numberOfEigenvalues;
 
 	if (my dimension != thy dimension) {
 		Melder_throw (U"The eigenvectors must have the same dimension.");
@@ -522,15 +522,15 @@ static void Eigens_getAnglesBetweenSubspaces (Eigen me, Eigen thee, long ivec_fr
 		Compute C.
 	*/
 
-	for (long i = 1; i <= nvectors; i++) {
-		for (long j = 1; j <= nvectors; j++) {
-			for (long k = 1; k <= my dimension; k++) {
+	for (integer i = 1; i <= nvectors; i++) {
+		for (integer j = 1; j <= nvectors; j++) {
+			for (integer k = 1; k <= my dimension; k++) {
 				c[i][j] += my eigenvectors[ivec_from + i - 1][k] * thy eigenvectors[ivec_from + j - 1][k];
 			}
 		}
 	}
 	autoSVD svd = SVD_create_d (c.peek(), nvectors, nvectors);
-	for (long i = 1; i <= nvectors; i++) {
+	for (integer i = 1; i <= nvectors; i++) {
 		angles_degrees[i] = acos (svd -> d[i]) * 180.0 / NUMpi;
 	}
 }
@@ -544,7 +544,7 @@ double Eigens_getAngleBetweenEigenplanes_degrees (Eigen me, Eigen thee) {
 
 /* Very low level */
 
-void Eigen_and_matrix_into_matrix_principalComponents (Eigen me, double **from, long numberOfRows, long from_colbegin, double **to, long numberOfDimensionsToKeep, long to_colbegin) {
+void Eigen_and_matrix_into_matrix_principalComponents (Eigen me, double **from, integer numberOfRows, integer from_colbegin, double **to, integer numberOfDimensionsToKeep, integer to_colbegin) {
 	/*
 	 * Preconditions:
 	 * 
@@ -558,14 +558,14 @@ void Eigen_and_matrix_into_matrix_principalComponents (Eigen me, double **from,
 	if (numberOfDimensionsToKeep > my numberOfEigenvalues) {
 		Melder_throw (U"The number of dimensions to keep must not be larger than the number of eigenvalues.");
 	}
-	for (long irow = 1; irow <= numberOfRows; irow ++) {
-		for (long icol = 1; icol <= numberOfDimensionsToKeep; icol ++) {
-			double r = 0.0;
-			for (long k = 1; k <= my dimension; k ++) {
+	for (integer irow = 1; irow <= numberOfRows; irow ++) {
+		for (integer icol = 1; icol <= numberOfDimensionsToKeep; icol ++) {
+			real80 r = 0.0;
+			for (integer k = 1; k <= my dimension; k ++) {
 				// eigenvector[icol] is in row[icol] of my eigenvectors
 				r += my eigenvectors  [icol] [k] * from [irow] [from_colbegin + k - 1];
 			}
-			to [irow] [to_colbegin + icol - 1] = r;
+			to [irow] [to_colbegin + icol - 1] = (real) r;
 		}
 	}
 }
diff --git a/dwsys/Eigen.h b/dwsys/Eigen.h
index 4f19859..3e46274 100644
--- a/dwsys/Eigen.h
+++ b/dwsys/Eigen.h
@@ -24,13 +24,13 @@
 
 #include "Eigen_def.h"
 
-autoEigen Eigen_create (long numberOfEigenvalues, long dimension);
+autoEigen Eigen_create (integer numberOfEigenvalues, integer dimension);
 
-void Eigen_init (Eigen me, long numberOfEigenvalues, long dimension);
+void Eigen_init (Eigen me, integer numberOfEigenvalues, integer dimension);
 
-void Eigen_initFromSymmetricMatrix (Eigen me, double **a, long n);
+void Eigen_initFromSymmetricMatrix (Eigen me, double **a, integer n);
 
-void Eigen_initFromSquareRoot (Eigen me, double **a, long numberOfRows, long numberOfColumns);
+void Eigen_initFromSquareRoot (Eigen me, double **a, integer numberOfRows, integer numberOfColumns);
 /*
 	Calculate eigenstructure for symmetric matrix A'A (e.g. covariance matrix),
 	when only A is given.
@@ -38,7 +38,7 @@ void Eigen_initFromSquareRoot (Eigen me, double **a, long numberOfRows, long num
 	Method: SVD.
 */
 
-void Eigen_initFromSquareRootPair (Eigen me, double **a, long numberOfRows, long numberOfColumns, double **b, long numberOfRows_b);
+void Eigen_initFromSquareRootPair (Eigen me, double **a, integer numberOfRows, integer numberOfColumns, double **b, integer numberOfRows_b);
 /*
 	Calculate eigenstructure for A'Ax - lambda B'Bx = 0
 	Preconditions: numberOfRows >= numberOfColumns &&
@@ -46,17 +46,17 @@ void Eigen_initFromSquareRootPair (Eigen me, double **a, long numberOfRows, long
 	Method: Generalized SVD.
 */
 
-long Eigen_getNumberOfEigenvectors (Eigen me);
+integer Eigen_getNumberOfEigenvectors (Eigen me);
 
-long Eigen_getDimensionOfComponents (Eigen me);
+integer Eigen_getDimensionOfComponents (Eigen me);
 
-double Eigen_getCumulativeContributionOfComponents (Eigen me, long from, long to);
+double Eigen_getCumulativeContributionOfComponents (Eigen me, integer from, integer to);
 
-long Eigen_getDimensionOfFraction (Eigen me, double fraction);
+integer Eigen_getDimensionOfFraction (Eigen me, double fraction);
 
-double Eigen_getEigenvectorElement (Eigen me, long ivec, long element);
+double Eigen_getEigenvectorElement (Eigen me, integer ivec, integer element);
 
-double Eigen_getSumOfEigenvalues (Eigen me, long from, long to);
+double Eigen_getSumOfEigenvalues (Eigen me, integer from, integer to);
 
 
 void Eigen_sort (Eigen me);
@@ -64,12 +64,12 @@ void Eigen_sort (Eigen me);
 	Sort eigenvalues and corresponding eigenvectors in decreasing order.
 */
 
-void Eigen_invertEigenvector (Eigen me, long ivec);
+void Eigen_invertEigenvector (Eigen me, integer ivec);
 
-void Eigen_drawEigenvalues (Eigen me, Graphics g, long first, long last, double ymin, double ymax,
+void Eigen_drawEigenvalues (Eigen me, Graphics g, integer first, integer last, double ymin, double ymax,
 	bool fractionOfTotal, bool cumulative, double size_mm, const char32 *mark, bool garnish);
 
-void Eigen_drawEigenvector (Eigen me, Graphics g, long ivec, long first, long last, double minimum, double maximum, bool weigh,
+void Eigen_drawEigenvector (Eigen me, Graphics g, integer ivec, integer first, integer last, double minimum, double maximum, bool weigh,
 	double size_mm, const char32 *mark, bool connect, char32 **rowLabels, bool garnish);
 /*
 	Draw eigenvector. When rowLabels != nullptr, draw row text labels on bottom axis.
@@ -86,7 +86,7 @@ double Eigens_getAngleBetweenEigenplanes_degrees (Eigen me, Eigen thee);
 	Get angle between the eigenplanes, spanned by the first two eigenvectors, .
 */
 
-void Eigen_and_matrix_into_matrix_principalComponents (Eigen me, double **from, long numberOfRows, long from_colbegin, double **to, long numberOfDimensionsToKeep, long to_colbegin);
+void Eigen_and_matrix_into_matrix_principalComponents (Eigen me, double **from, integer numberOfRows, integer from_colbegin, double **to, integer numberOfDimensionsToKeep, integer to_colbegin);
 /*
  * Preconditions:
  * 
diff --git a/dwsys/Eigen_def.h b/dwsys/Eigen_def.h
index 5d9dfe8..3477635 100644
--- a/dwsys/Eigen_def.h
+++ b/dwsys/Eigen_def.h
@@ -19,8 +19,8 @@
 #define ooSTRUCT Eigen
 oo_DEFINE_CLASS (Eigen, Daata)
 
-	oo_LONG (numberOfEigenvalues)
-	oo_LONG (dimension)
+	oo_INTEGER (numberOfEigenvalues)
+	oo_INTEGER (dimension)
 	oo_DOUBLE_VECTOR (eigenvalues, numberOfEigenvalues)
 	oo_DOUBLE_MATRIX (eigenvectors, numberOfEigenvalues, dimension)
 
diff --git a/dwsys/Index.cpp b/dwsys/Index.cpp
index 58f8977..be21c7b 100644
--- a/dwsys/Index.cpp
+++ b/dwsys/Index.cpp
@@ -61,7 +61,7 @@ void Index_init (Index me, long numberOfItems) {
 	}
 	my classes = Ordered_create ();
 	my numberOfItems = numberOfItems;
-	my classIndex = NUMvector<long> (1, numberOfItems);
+	my classIndex = NUMvector<integer> (1, numberOfItems);
 }
 
 autoIndex Index_extractPart (Index me, long from, long to) {
diff --git a/dwsys/Index_def.h b/dwsys/Index_def.h
index 49d52cb..32cea46 100644
--- a/dwsys/Index_def.h
+++ b/dwsys/Index_def.h
@@ -25,8 +25,8 @@
 oo_DEFINE_CLASS (Index, Daata)
 
 	oo_AUTO_OBJECT (Ordered, 0, classes)
-	oo_LONG (numberOfItems)
-	oo_LONG_VECTOR (classIndex, numberOfItems)
+	oo_INTEGER (numberOfItems)
+	oo_INTEGER_VECTOR (classIndex, numberOfItems)
 
 	#if oo_DECLARING
 		void v_info ()
diff --git a/dwsys/NUM2.cpp b/dwsys/NUM2.cpp
index d688a25..8e542d4 100644
--- a/dwsys/NUM2.cpp
+++ b/dwsys/NUM2.cpp
@@ -98,21 +98,21 @@ struct pdf2_struct {
 	double df2;
 };
 
-void NUMdmatrix_printMatlabForm (double **m, long nr, long nc, const char32 *name) {
-	long npc = 5;
+void NUMdmatrix_printMatlabForm (double **m, integer nr, integer nc, const char32 *name) {
+	integer npc = 5;
 	ldiv_t n = ldiv (nc, npc);
 
 	MelderInfo_open ();
 	MelderInfo_write (name, U"=[");
-	for (long i = 1; i <= nr; i++) {
-		for (long j = 1; j <= n.quot; j++) {
-			for (long k = 1; k <= npc; k++) {
+	for (integer i = 1; i <= nr; i++) {
+		for (integer j = 1; j <= n.quot; j++) {
+			for (integer k = 1; k <= npc; k++) {
 				MelderInfo_write (m[i][ (j - 1) *npc + k], (k < npc ? U", " : U""));
 			}
 			MelderInfo_write (j < n.quot ? U",\n" : U"");
 		}
 
-		for (long k = 1; k <= n.rem; k++) {
+		for (integer k = 1; k <= n.rem; k++) {
 			MelderInfo_write (m[i][n.quot * npc + k], (k < n.rem ? U", " : U""));
 		}
 		MelderInfo_write (i < nr ? U";\n" : U"];\n");
@@ -120,27 +120,27 @@ void NUMdmatrix_printMatlabForm (double **m, long nr, long nc, const char32 *nam
 	MelderInfo_close ();
 }
 
-void NUMcentreRows (double **a, long rb, long re, long cb, long ce) {
-	for (long i = rb; i <= re; i++) {
+void NUMcentreRows (double **a, integer rb, integer re, integer cb, integer ce) {
+	for (integer i = rb; i <= re; i++) {
 		double rowmean = 0.0;
-		for (long j = cb; j <= ce; j++) {
+		for (integer j = cb; j <= ce; j++) {
 			rowmean += a[i][j];
 		}
 		rowmean /= (ce - cb + 1);
-		for (long j = cb; j <= ce; j++) {
+		for (integer j = cb; j <= ce; j++) {
 			a[i][j] -= rowmean;
 		}
 	}
 }
 
-void NUMcentreColumns (double **a, long rb, long re, long cb, long ce, double *centres) {
-	for (long j = cb; j <= ce; j++) {
+void NUMcentreColumns (double **a, integer rb, integer re, integer cb, integer ce, double *centres) {
+	for (integer j = cb; j <= ce; j++) {
 		double colmean = 0.0;
-		for (long i = rb; i <= re; i++) {
+		for (integer i = rb; i <= re; i++) {
 			colmean += a[i][j];
 		}
 		colmean /= (re - rb + 1);
-		for (long i = rb; i <= re; i++) {
+		for (integer i = rb; i <= re; i++) {
 			a[i][j] -= colmean;
 		}
 		if (centres) {
@@ -149,59 +149,59 @@ void NUMcentreColumns (double **a, long rb, long re, long cb, long ce, double *c
 	}
 }
 
-void NUMdoubleCentre (double **a, long rb, long re, long cb, long ce) {
+void NUMdoubleCentre (double **a, integer rb, integer re, integer cb, integer ce) {
 	NUMcentreRows (a, rb, re, cb, ce);
 	NUMcentreColumns (a, rb, re, cb, ce, NULL);
 }
 
-void NUMnormalizeColumns (double **a, long nr, long nc, double norm) {
-	Melder_assert (norm > 0);
-	for (long j = 1; j <= nc; j++) {
-		double s = 0.0;
-		for (long i = 1; i <= nr; i++) {
+void NUMnormalizeColumns (double **a, integer nr, integer nc, double norm) {
+	Melder_assert (norm > 0.0);
+	for (integer j = 1; j <= nc; j++) {
+		real80 s = 0.0;
+		for (integer i = 1; i <= nr; i++) {
 			s += a[i][j] * a[i][j];
 		}
 		if (s <= 0.0) {
 			continue;
 		}
-		s = sqrt (norm / s);
-		for (long i = 1; i <= nr; i++) {
+		s = sqrt (norm / (real) s);
+		for (integer i = 1; i <= nr; i ++) {
 			a[i][j] *= s;
 		}
 	}
 }
 
-void NUMnormalizeRows (double **a, long nr, long nc, double norm) {
+void NUMnormalizeRows (double **a, integer nr, integer nc, double norm) {
 	Melder_assert (norm > 0);
-	for (long i = 1; i <= nr; i++) {
-		double s = 0.0;
-		for (long j = 1; j <= nc; j++) {
+	for (integer i = 1; i <= nr; i++) {
+		real80 s = 0.0;
+		for (integer j = 1; j <= nc; j++) {
 			s += a[i][j] * a[i][j];
 		}
 		if (s <= 0.0) {
 			continue;
 		}
-		s = sqrt (norm / s);
-		for (long j = 1; j <= nc; j++) {
+		s = sqrt (norm / (real) s);
+		for (integer j = 1; j <= nc; j++) {
 			a[i][j] *= s;
 		}
 	}
 }
 
-void NUMnormalize (double **a, long nr, long nc, double norm) {
+void NUMnormalize (double **a, integer nr, integer nc, double norm) {
 	Melder_assert (norm > 0);
-	double sq = 0.0;
-	for (long i = 1; i <= nr; i++) {
-		for (long j = 1; j <= nc; j++) {
+	real80 sq = 0.0;
+	for (integer i = 1; i <= nr; i++) {
+		for (integer j = 1; j <= nc; j++) {
 			sq += a[i][j] * a[i][j];
 		}
 	}
 	if (sq <= 0.0) {
 		return;
 	}
-	norm = sqrt (norm / sq);
-	for (long i = 1; i <= nr; i++) {
-		for (long j = 1; j <= nc; j++) {
+	norm = sqrt (norm / (real) sq);
+	for (integer i = 1; i <= nr; i++) {
+		for (integer j = 1; j <= nc; j++) {
 			a[i][j] *= norm;
 		}
 	}
@@ -212,31 +212,31 @@ void NUMnormalize (double **a, long nr, long nc, double norm) {
  * Chan, Golub & LeVeque (1983), Algorithms for computing the sample variance: Analysis and recommendations, 
  * The American Statistician 37: 242 - 247.
  */
-void NUMstandardizeColumns (double **a, long rb, long re, long cb, long ce) {
-	long n = re - rb + 1;
+void NUMstandardizeColumns (double **a, integer rb, integer re, integer cb, integer ce) {   // BUG: wrong algorithm, use sum_mean_sumsq_variance_stdev_scalar instead
+	integer n = re - rb + 1;
 	if (n < 2) {
 		return;
 	}
-	for (long j = cb; j <= ce; j++) {
+	for (integer j = cb; j <= ce; j++) {
 		double ep = 0.0, s = 0.0, sdev, var = 0.0;
-		for (long i = rb; i <= re; i++) {
+		for (integer i = rb; i <= re; i++) {
 			s += a[i][j];
 		}
 		double ave = s / n;
-		for (long i = rb; i <= re; i++) {
+		for (integer i = rb; i <= re; i++) {
 			s = a[i][j] - ave;
 			ep += s;
 			var += s * s;
 		}
 		if (ave != 0.0) {
-			for (long i = rb; i <= re; i++) {
+			for (integer i = rb; i <= re; i++) {
 				a[i][j] -= ave;
 			}
 		}
 		if (var > 0.0) {
 			var = (var - ep * ep / n) / (n - 1);
 			sdev = sqrt (var);
-			for (long i = rb; i <= re; i++) {
+			for (integer i = rb; i <= re; i++) {
 				a[i][j] /= sdev;
 			}
 		}
@@ -259,59 +259,59 @@ void NUMmatrix_standardizeRows (double **a, integer rb, integer re, integer cb,
 	}
 }
 
-void NUMstandardizeRows (double **a, long rb, long re, long cb, long ce) {
-	long n = ce - cb + 1;
+void NUMstandardizeRows (double **a, integer rb, integer re, integer cb, integer ce) {
+	integer n = ce - cb + 1;
 	if (n < 2) {
 		return;
 	}
-	for (long i = rb; i <= re; i++) {
+	for (integer i = rb; i <= re; i++) {
 		double ep = 0.0, s = 0.0, sdev, var = 0.0;
-		for (long j = cb; j <= ce; j++) {
+		for (integer j = cb; j <= ce; j++) {
 			s += a[i][j];
 		}
 		double ave = s / n;
-		for (long j = cb; j <= ce; j++) {
+		for (integer j = cb; j <= ce; j++) {
 			s = a[i][j] - ave;
 			ep += s;
 			var += s * s;
 		}
 		if (ave != 0.0) {
-			for (long j = cb; j <= ce; j++) {
+			for (integer j = cb; j <= ce; j++) {
 				a[i][j] -= ave;
 			}
 		}
 		if (var > 0.0) {
 			var = (var - ep * ep / n) / (n - 1);
 			sdev = sqrt (var);
-			for (long j = cb; j <= ce; j++) {
+			for (integer j = cb; j <= ce; j++) {
 				a[i][j] /= sdev;
 			}
 		}
 	}
 }
 
-void NUMaverageColumns (double **a, long rb, long re, long cb, long ce) {
-	long n = re - rb + 1;
+void NUMaverageColumns (double **a, integer rb, integer re, integer cb, integer ce) {
+	integer n = re - rb + 1;
 	if (n < 2) {
 		return;
 	}
-	for (long j = cb; j <= ce; j++) {
+	for (integer j = cb; j <= ce; j++) {
 		double ave = 0.0;
-		for (long i = rb; i <= re; i++) {
+		for (integer i = rb; i <= re; i++) {
 			ave += a[i][j];
 		}
 		ave /= n;
-		for (long i = rb; i <= re; i++) {
+		for (integer i = rb; i <= re; i++) {
 			a[i][j] = ave;
 		}
 	}
 
 }
 
-void NUMvector_avevar (double *a, long n, double *p_mean, double *p_var) {
+void NUMvector_avevar (double *a, integer n, double *p_mean, double *p_var) {
 
 	double mean = 0.0;
-	for (long i = 1; i <= n; i++) {
+	for (integer i = 1; i <= n; i++) {
 		mean += a[i];
 	}
 
@@ -324,7 +324,7 @@ void NUMvector_avevar (double *a, long n, double *p_mean, double *p_var) {
 	if (p_var) {
 		double eps = 0.0, var = 0.0;
 		if (n > 1) {
-			for (long i = 1; i <= n; i++) {
+			for (integer i = 1; i <= n; i++) {
 				double s = a[i] - mean;
 				eps += s;
 				var += s * s;
@@ -338,12 +338,12 @@ void NUMvector_avevar (double *a, long n, double *p_mean, double *p_var) {
 	}
 }
 
-void NUMcolumn_avevar (double **a, long nr, long nc, long icol, double *p_mean, double *p_var) {
+void NUMcolumn_avevar (double **a, integer nr, integer nc, integer icol, double *p_mean, double *p_var) {
 
 	Melder_assert (nr > 0 && nc > 0 && icol > 0 && icol <= nc);
 
 	double mean = 0.0;
-	for (long i = 1; i <= nr; i++) {
+	for (integer i = 1; i <= nr; i++) {
 		mean += a[i][icol];
 	}
 
@@ -356,7 +356,7 @@ void NUMcolumn_avevar (double **a, long nr, long nc, long icol, double *p_mean,
 	if (p_var) {
 		double eps = 0.0, var = 0.0;
 		if (nr > 1) {
-			for (long i = 1; i <= nr; i++) {
+			for (integer i = 1; i <= nr; i++) {
 				double s = a[i][icol] - mean;
 				eps += s;
 				var += s * s;
@@ -370,12 +370,12 @@ void NUMcolumn_avevar (double **a, long nr, long nc, long icol, double *p_mean,
 	}
 }
 
-void NUMcolumn2_avevar (double **a, long nr, long nc, long icol1, long icol2, double *p_mean1, double *p_var1, double *p_mean2, double *p_var2, double *p_covar) {
+void NUMcolumn2_avevar (double **a, integer nr, integer nc, integer icol1, integer icol2, double *p_mean1, double *p_var1, double *p_mean2, double *p_var2, double *p_covar) {
 
 	Melder_assert (icol1 > 0 && icol1 <= nc && icol2 > 0 && icol2 <= nc);
 
 	double mean1 = 0.0, mean2 = 0.0;
-	for (long i = 1; i <= nr; i++) {
+	for (integer i = 1; i <= nr; i++) {
 		mean1 += a[i][icol1];
 		mean2 += a[i][icol2];
 	}
@@ -394,7 +394,7 @@ void NUMcolumn2_avevar (double **a, long nr, long nc, long icol1, long icol2, do
 		double eps1 = 0.0, eps2 = 0.0, var1 = 0.0, var2 = 0.0, covar = 0.0;
 
 		if (nr > 1) {
-			for (long i = 1; i <= nr; i++) {
+			for (integer i = 1; i <= nr; i++) {
 				double s1 = a[i][icol1] - mean1;
 				double s2 = a[i][icol2] - mean2;
 				eps1 += s1;
@@ -426,39 +426,39 @@ void NUMcolumn2_avevar (double **a, long nr, long nc, long icol1, long icol2, do
 	}
 }
 
-void NUMvector_smoothByMovingAverage (double *xin, long n, long nwindow, double *xout) {
+void NUMvector_smoothByMovingAverage (double *xin, integer n, integer nwindow, double *xout) {
 // simple averaging, out of bound values are zero
-	for (long i = 1; i <= n; i++) {
-		long jfrom = i - nwindow / 2, jto = i + nwindow / 2;
+	for (integer i = 1; i <= n; i++) {
+		integer jfrom = i - nwindow / 2, jto = i + nwindow / 2;
 		if ((nwindow % 2) == 0) {
 			jto--;
 		}
 		jfrom = jfrom < 1 ? 1 : jfrom;
 		jto = jto > n ? n : jto;
 		xout[i] = 0;
-		for (long j = jfrom; j <= jto; j++) {
+		for (integer j = jfrom; j <= jto; j++) {
 			xout[i] += xin[j];
 		}
 		xout[i] /= jto - jfrom + 1;
 	}
 }
 
-void NUMcovarianceFromColumnCentredMatrix (double **x, long nrows, long ncols, long ndf, double **covar) {
+void NUMcovarianceFromColumnCentredMatrix (double **x, integer nrows, integer ncols, integer ndf, double **covar) {
 	if (ndf < 0 || nrows - ndf < 1 || covar == 0) {
 		Melder_throw (U"Invalid arguments.");
 	}
-	for (long i = 1; i <= ncols; i++) {
-		for (long j = i; j <= ncols; j++) {
-			double sum = 0.0;
-			for (long k = 1; k <= nrows; k++) {
+	for (integer i = 1; i <= ncols; i++) {
+		for (integer j = i; j <= ncols; j++) {
+			real80 sum = 0.0;
+			for (integer k = 1; k <= nrows; k++) {
 				sum += x[k][i] * x[k][j];
 			}
-			covar[i][j] = covar[j][i] = sum / (nrows - ndf);
+			covar[i][j] = covar[j][i] = (real) sum / (nrows - ndf);
 		}
 	}
 }
 
-double NUMmultivariateKurtosis (double **x, long nrows, long ncols, int method) {
+double NUMmultivariateKurtosis (double **x, integer nrows, integer ncols, int method) {
 	double kurt = undefined;
 	if (nrows < 5) {
 		return kurt;
@@ -470,9 +470,9 @@ double NUMmultivariateKurtosis (double **x, long nrows, long ncols, int method)
 	NUMcovarianceFromColumnCentredMatrix (x, nrows, ncols, 1, covar.peek());
 	if (method == 1) { // Schott (2001, page 33)
 		kurt = 0.0;
-		for (long l = 1; l <= ncols; l++) {
+		for (integer l = 1; l <= ncols; l++) {
 			double zl = 0.0, wl, sll2 = covar[l][l] * covar[l][l];
-			for (long j = 1; j <= nrows; j++) {
+			for (integer j = 1; j <= nrows; j++) {
 				double d = x[j][l] - mean[l], d2 = d * d;
 				zl += d2 * d2;
 			}
@@ -485,21 +485,21 @@ double NUMmultivariateKurtosis (double **x, long nrows, long ncols, int method)
 	return kurt;
 }
 
-void eigenSort (double d[], double **v, long n, int sort) {
+void eigenSort (double d[], double **v, integer n, int sort) {
 	if (sort == 0) {
 		return;
 	}
-	for (long i = 1; i < n; i++) {
-		long k;
+	for (integer i = 1; i < n; i++) {
+		integer k;
 		double temp = d[k = i];
 		if (sort > 0) {
-			for (long j = i + 1; j <= n; j++) {
+			for (integer j = i + 1; j <= n; j++) {
 				if (d[j] > temp) {
 					temp = d[k = j];
 				}
 			}
 		} else {
-			for (long j = i + 1; j <= n; j++) {
+			for (integer j = i + 1; j <= n; j++) {
 				if (d[j] < temp) {
 					temp = d[k = j];
 				}
@@ -509,7 +509,7 @@ void eigenSort (double d[], double **v, long n, int sort) {
 			d[k] = d[i];
 			d[i] = temp;
 			if (v) {
-				for (long j = 1; j <= n; j++) {
+				for (integer j = 1; j <= n; j++) {
 					temp = v[j][i];
 					v[j][i] = v[j][k];
 					v[j][k] = temp;
@@ -535,8 +535,8 @@ int NUMstrcmp (const char *s1, const char *s2) {
 	}
 }
 
-void NUMlocate (double *xx, long n, double x, long *index) {
-	long ju = n + 1, jm, jl = 0;
+void NUMlocate (double *xx, integer n, double x, integer *index) {
+	integer ju = n + 1, jm, jl = 0;
 	int ascend = xx[n] >= xx[1];
 
 	while (ju - jl > 1) {
@@ -562,20 +562,20 @@ void NUMlocate (double *xx, long n, double x, long *index) {
 	Kruskal's algorithm for monotone regression (and much simpler).
 	Regression is ascending
 */
-void NUMmonotoneRegression (const double x [], long n, double xs []) {
+void NUMmonotoneRegression (const double x [], integer n, double xs []) {
 	double xt = undefined;   // only to stop gcc from complaining "may be used uninitialized"
 
-	for (long i = 1; i <= n; i++) {
+	for (integer i = 1; i <= n; i++) {
 		xs[i] = x[i];
 	}
 
-	for (long i = 2; i <= n; i++) {
+	for (integer i = 2; i <= n; i++) {
 		if (xs[i] >= xs[i - 1]) {
 			continue;
 		}
 		double sum = xs[i];
-		long nt = 1;
-		for (long j = 1; j <= i - 1; j++) {
+		integer nt = 1;
+		for (integer j = 1; j <= i - 1; j++) {
 			sum += xs[i - j];
 			nt ++;
 			xt = sum / nt; // i >= 2 -> xt always gets a value
@@ -583,85 +583,85 @@ void NUMmonotoneRegression (const double x [], long n, double xs []) {
 				break;
 			}
 		}
-		for (long j = i - nt + 1; j <= i; j++) {
+		for (integer j = i - nt + 1; j <= i; j++) {
 			xs[j] = xt;
 		}
 	}
 }
 
-double NUMvector_getNorm1 (const double v[], long n) {
-	double norm = 0;
-	for (long i = 1; i <= n; i++) {
+double NUMvector_getNorm1 (const double v[], integer n) {
+	real80 norm = 0.0;
+	for (integer i = 1; i <= n; i++) {
 		norm += fabs (v[i]);
 	}
-	return norm;
+	return (real) norm;
 }
 
-double NUMvector_getNorm2 (const double v[], long n) {
-	double norm = 0.0;
-	for (long i = 1; i <= n; i++) {
+double NUMvector_getNorm2 (const double v[], integer n) {
+	real80 norm = 0.0;
+	for (integer i = 1; i <= n; i++) {
 		norm += v[i] * v[i];
 	}
-	return sqrt (norm);
+	return sqrt ((real) norm);
 }
 
-double NUMvector_normalize1 (double v[], long n) {
-	double norm = 0.0;
-	for (long i = 1; i <= n; i++) {
+double NUMvector_normalize1 (double v[], integer n) {
+	real80 norm = 0.0;
+	for (integer i = 1; i <= n; i++) {
 		norm += fabs (v[i]);
 	}
 	if (norm > 0.0) {
-		for (long i = 1; i <= n; i++) {
+		for (integer i = 1; i <= n; i++) {
 			v[i] /= norm;
 		}
 	}
-	return norm;
+	return (real) norm;
 }
 
-double NUMvector_normalize2 (double v[], long n) {
-	double norm = 0;
-	for (long i = 1; i <= n; i++) {
+double NUMvector_normalize2 (double v[], integer n) {
+	real80 norm = 0.0;
+	for (integer i = 1; i <= n; i++) {
 		norm += v[i] * v[i];
 	}
-	norm = sqrt (norm);
+	norm = sqrtl (norm);
 	if (norm > 0) {
-		for (long i = 1; i <= n; i++) {
+		for (integer i = 1; i <= n; i++) {
 			v[i] /= norm;
 		}
 	}
-	return norm;
+	return (real) norm;
 }
 
 #undef TINY
 
-void NUMcholeskySolve (double **a, long n, double d[], double b[], double x[]) {
-	for (long i = 1; i <= n; i++) { /* Solve L.y=b */
-		double sum = b[i];
-		for (long k = i - 1; k >= 1; k--) {
+void NUMcholeskySolve (double **a, integer n, double d[], double b[], double x[]) {
+	for (integer i = 1; i <= n; i++) { /* Solve L.y=b */
+		real80 sum = b[i];
+		for (integer k = i - 1; k >= 1; k--) {
 			sum -= a[i][k] * x[k];
 		}
-		x[i] = sum / d[i];
+		x[i] = (real) sum / d[i];
 	}
-	for (long i = n; i >= 1; i--) { /* Solve L^T.x=y */
-		double sum = x[i];
-		for (long k = i + 1; k <= n; k++) {
+	for (integer i = n; i >= 1; i--) { /* Solve L^T.x=y */
+		real80 sum = x[i];
+		for (integer k = i + 1; k <= n; k++) {
 			sum -= a[k][i] * x[k];
 		}
-		x[i] = sum / d[i];
+		x[i] = (real) sum / d[i];
 	}
 }
 
-void NUMdeterminant_cholesky (double **a, long n, double *p_lnd) {
+void NUMdeterminant_cholesky (double **a, integer n, double *p_lnd) {
 	// Save the diagonal
 	autoNUMvector<double> d (1, n);
-	for (long i = 1; i <= n; i++) {
+	for (integer i = 1; i <= n; i++) {
 		d[i] = a[i][i];
 	}
 
 	//	 Cholesky decomposition in lower, leave upper intact
 
 	char uplo = 'U';
-	long lda = n, info;
+	integer lda = n, info;
 	NUMlapack_dpotf2 (&uplo, &n, &a[1][1], &lda, &info);
 	if (info != 0) {
 		Melder_throw (U"Cannot determine Cholesky decomposition.");
@@ -669,8 +669,8 @@ void NUMdeterminant_cholesky (double **a, long n, double *p_lnd) {
 
 	// Determinant from diagonal, restore diagonal
 
-	double lnd = 0.0;
-	for (long i = 1; i <= n; i++) {
+	real80 lnd = 0.0;
+	for (integer i = 1; i <= n; i++) {
 		lnd += log (a[i][i]);
 		a[i][i] = d[i];
 	}
@@ -684,14 +684,14 @@ void NUMdeterminant_cholesky (double **a, long n, double *p_lnd) {
 		}
 	}
 	if (p_lnd) {
-		*p_lnd = lnd;
+		*p_lnd = (real) lnd;
 	}
 }
 
-void NUMlowerCholeskyInverse (double **a, long n, double *lnd) {
+void NUMlowerCholeskyInverse (double **a, integer n, double *lnd) {
 
 	char uplo = 'U', diag = 'N';
-	long info;
+	integer info;
 
 	// Cholesky decomposition in lower, leave upper intact
 	// Fortran storage -> use uplo='U' to get 'L'.
@@ -705,7 +705,7 @@ void NUMlowerCholeskyInverse (double **a, long n, double *lnd) {
 
 	if (lnd) {
 		*lnd = 0.0;
-		for (long i = 1; i <= n; i++) {
+		for (integer i = 1; i <= n; i++) {
 			*lnd += log (a[i][i]);
 		}
 		*lnd *= 2.0; /* because A = L . L' */
@@ -719,58 +719,58 @@ void NUMlowerCholeskyInverse (double **a, long n, double *lnd) {
 	}
 }
 
-double **NUMinverseFromLowerCholesky (double **m, long n) {
+double **NUMinverseFromLowerCholesky (double **m, integer n) {
 	autoNUMmatrix<double> r (1, n, 1, n);
-	for (long i = 1; i <= n; i++) {
-		for (long j = 1; j <= i; j++) {
-			double sum = 0;
-			for (long k = i; k <= n; k++) {
+	for (integer i = 1; i <= n; i++) {
+		for (integer j = 1; j <= i; j++) {
+			real80 sum = 0.0;
+			for (integer k = i; k <= n; k++) {
 				sum += m[k][i] * m[k][j];
 			}
-			r[i][j] = r[j][i] = sum;
+			r[i][j] = r[j][i] = (real) sum;
 		}
 	}
 	return r.transfer();
 }
 
-double NUMmahalanobisDistance_chi (double **linv, double *v, double *m, long nr, long n) {
-	double chisq = 0;
+double NUMmahalanobisDistance_chi (double **linv, double *v, double *m, integer nr, integer n) {
+	real80 chisq = 0.0;
 	if (nr == 1) { // 1xn matrix
-		for (long j = 1; j <= n; j++) {
+		for (integer j = 1; j <= n; j++) {
 			double t = linv[1][j] * (v[j] - m[j]);
 			chisq += t * t;
 		}
 	} else { // nxn matrix
-		for (long i = n; i > 0; i--) {
+		for (integer i = n; i > 0; i--) {
 			double t = 0.0;
-			for (long j = 1; j <= i; j++) {
+			for (integer j = 1; j <= i; j++) {
 				t += linv[i][j] * (v[j] - m[j]);
 			}
 			chisq += t * t;
 		}
 	}
-	return chisq;
+	return (real) chisq;
 }
 
-double NUMtrace (double **a, long n) {
-	double trace = 0.0;
-	for (long i = 1; i <= n; i++) {
+double NUMtrace (double **a, integer n) {
+	real80 trace = 0.0;
+	for (integer i = 1; i <= n; i++) {
 		trace += a[i][i];
 	}
-	return trace;
+	return (real) trace;
 }
 
-double NUMtrace2 (double **a1, double **a2, long n) {
-	double trace = 0.0;
-	for (long i = 1; i <= n; i++) {
-		for (long k = 1; k <= n; k++) {
+double NUMtrace2 (double **a1, double **a2, integer n) {
+	real80 trace = 0.0;
+	for (integer i = 1; i <= n; i++) {
+		for (integer k = 1; k <= n; k++) {
 			trace += a1[i][k] * a2[k][i];
 		}
 	}
-	return trace;
+	return (real) trace;
 }
 
-void NUMeigensystem (double **a, long n, double **evec, double eval[]) {
+void NUMeigensystem (double **a, integer n, double **evec, double eval[]) {
 	autoEigen me = Thing_new (Eigen);
 	Eigen_initFromSymmetricMatrix (me.get(), a, n);
 	if (evec) {
@@ -781,12 +781,13 @@ void NUMeigensystem (double **a, long n, double **evec, double eval[]) {
 	}
 }
 
-void NUMdominantEigenvector (double **mns, long n, double *q, double *p_lambda, double tolerance) {
+void NUMdominantEigenvector (double **mns, integer n, double *q, double *p_lambda, double tolerance) {
 	autoNUMvector<double> z (1, n);
 
-	double lambda0, lambda = 0.0;
-	for (long k = 1; k <= n; k++) {
-		for (long l = 1; l <= n; l++) {
+	double lambda0;
+	real80 lambda = 0.0;
+	for (integer k = 1; k <= n; k++) {
+		for (integer l = 1; l <= n; l++) {
 			lambda += q[k] * mns[k][l] * q[l];
 		}
 	}
@@ -794,55 +795,55 @@ void NUMdominantEigenvector (double **mns, long n, double *q, double *p_lambda,
 		Melder_throw (U"Zero matrices ??");
 	}
 
-	long iter = 0;
+	integer iter = 0;
 	do {
 		double znorm2 = 0.0;
-		for (long l = 1; l <= n; l++) {
+		for (integer l = 1; l <= n; l++) {
 			z[l] = 0.0;
-			for (long k = 1; k <= n; k++) {
+			for (integer k = 1; k <= n; k++) {
 				z[l] += mns[l][k] * q[k];
 			}
 		}
 
-		for (long k = 1; k <= n; k++)  {
+		for (integer k = 1; k <= n; k++)  {
 			znorm2 += z[k] * z[k];
 		}
 		znorm2 = sqrt (znorm2);
 
-		for (long k = 1; k <= n; k++) {
+		for (integer k = 1; k <= n; k++) {
 			q[k] = z[k] / znorm2;
 		}
 
-		lambda0 = lambda; 
+		lambda0 = (real) lambda;
 		
 		lambda = 0.0;
-		for (long k = 1; k <= n; k++) {
-			for (long l = 1; l <= n; l++) {
+		for (integer k = 1; k <= n; k++) {
+			for (integer l = 1; l <= n; l++) {
 				lambda += q[k] * mns[k][l] * q[l];
 			}
 		}
 
-	} while (fabs (lambda - lambda0) > tolerance || ++iter < 30);
+	} while (fabs ((real) lambda - lambda0) > tolerance || ++iter < 30);
 	if (p_lambda) {
-		*p_lambda = lambda;
+		*p_lambda = (real) lambda;
 	}
 }
 
-void NUMprincipalComponents (double **a, long n, long nComponents, double **pc) {
+void NUMprincipalComponents (double **a, integer n, integer nComponents, double **pc) {
 	autoNUMmatrix<double> evec (1, n, 1, n);
 	NUMeigensystem (a, n, evec.peek(), NULL);
-	for (long i = 1; i <= n; i++) {
-		for (long j = 1; j <= nComponents; j++) {
-			double s = 0.0;
+	for (integer i = 1; i <= n; i++) {
+		for (integer j = 1; j <= nComponents; j++) {
+			real80 s = 0.0;
 			for (long k = 1; k <= n; k++) {
 				s += a[k][i] * evec[k][j]; /* times sqrt(eigenvalue) ?? */
 			}
-			pc[i][j] = s;
+			pc[i][j] = (real) s;
 		}
 	}
 }
 
-void NUMdmatrix_projectRowsOnEigenspace (double **data, long numberOfRows, long from_col, double **eigenvectors, long numberOfEigenvectors, long dimension, double **projection, long to_col) {
+void NUMdmatrix_projectRowsOnEigenspace (double **data, integer numberOfRows, integer from_col, double **eigenvectors, integer numberOfEigenvectors, integer dimension, double **projection, integer to_col) {
 	/* Input:
 	 * 	data[numberOfRows, from_col - 1 + my dimension] 
 	 * 		contains the 'numberOfRows' vectors to be projected on the eigenspace. 
@@ -857,18 +858,18 @@ void NUMdmatrix_projectRowsOnEigenspace (double **data, long numberOfRows, long
 	from_col = from_col <= 0 ? 1 : from_col;
 	to_col = to_col <= 0 ? 1 : to_col;
 
-	for (long irow = 1; irow <= numberOfRows; irow ++) {
-		for (long icol = 1; icol <= numberOfEigenvectors; icol ++) {
-			double r = 0.0;
-			for (long k = 1; k <= dimension; k ++) {
+	for (integer irow = 1; irow <= numberOfRows; irow ++) {
+		for (integer icol = 1; icol <= numberOfEigenvectors; icol ++) {
+			real80 r = 0.0;
+			for (integer k = 1; k <= dimension; k ++) {
 				r += eigenvectors  [icol] [k] * data [irow] [from_col + k - 1];
 			}
-			projection [irow] [to_col + icol - 1] = r;
+			projection [irow] [to_col + icol - 1] = (real) r;
 		}
 	}
 }
 
-void NUMdmatrix_projectColumnsOnEigenspace (double **data, long numberOfColumns, double **eigenvectors, long numberOfEigenvectors, long dimension, double **projection) {
+void NUMdmatrix_projectColumnsOnEigenspace (double **data, integer numberOfColumns, double **eigenvectors, integer numberOfEigenvectors, integer dimension, double **projection) {
 	/* Input:
 	 * 	data[dimension, numberOfColumns] 
 	 * 		contains the column vectors to be projected on the eigenspace. 
@@ -881,41 +882,42 @@ void NUMdmatrix_projectColumnsOnEigenspace (double **data, long numberOfColumns,
 	 * Project the columnvectors in matrix 'data' along the 'numberOfEigenvectors' eigenvectors into the matrix 'projection'.
 	 */
 
-	for (long icol = 1; icol <= numberOfColumns; icol++) {
-		for (long irow = 1; irow <= numberOfEigenvectors; irow++) {
-			double r = 0.0;
-			for (long k = 1; k <= dimension; k ++) {
+	for (integer icol = 1; icol <= numberOfColumns; icol++) {
+		for (integer irow = 1; irow <= numberOfEigenvectors; irow++) {
+			real80 r = 0.0;
+			for (integer k = 1; k <= dimension; k ++) {
 				r += eigenvectors  [irow] [k] * data [k] [icol];
 			}
-			projection [irow][icol] = r;
+			projection [irow][icol] = (real) r;
 		}
 	}
 }
 
-void NUMdmatrix_into_principalComponents (double **m, long nrows, long ncols, long numberOfComponents, double **pc) {
+void NUMdmatrix_into_principalComponents (double **m, integer nrows, integer ncols, integer numberOfComponents, double **pc) {
 	Melder_assert (numberOfComponents > 0 && numberOfComponents <= ncols);
 	autoNUMmatrix<double> mc (NUMmatrix_copy (m, 1, nrows, 1, ncols), 1, 1);
 
 	/*NUMcentreColumns (mc, nrows, ncols);*/
 	autoSVD svd = SVD_create_d (mc.peek(), nrows, ncols);
-	for (long i = 1; i <= nrows; i++) {
-		for (long j = 1; j <= numberOfComponents; j++) {
-			pc[i][j] = 0.0;
-			for (long k = 1; k <= ncols; k++) {
-				pc[i][j] += svd -> v[k][j] * m[i][k];
+	for (integer i = 1; i <= nrows; i++) {
+		for (integer j = 1; j <= numberOfComponents; j++) {
+			real80 sum = 0.0;
+			for (integer k = 1; k <= ncols; k++) {
+				sum += svd -> v[k][j] * m[i][k];
 			}
+			pc[i][j] = (real) sum;
 		}
 	}
 }
 
-void NUMpseudoInverse (double **y, long nr, long nc, double **yinv, double tolerance) {
+void NUMpseudoInverse (double **y, integer nr, integer nc, double **yinv, double tolerance) {
 	autoSVD me = SVD_create_d (y, nr, nc);
 
 	(void) SVD_zeroSmallSingularValues (me.get(), tolerance);
-	for (long i = 1; i <= nc; i ++) {
-		for (long j = 1; j <= nr; j ++) {
+	for (integer i = 1; i <= nc; i ++) {
+		for (integer j = 1; j <= nr; j ++) {
 			real80 s = 0.0;
-			for (long k = 1; k <= nc; k ++) {
+			for (integer k = 1; k <= nc; k ++) {
 				if (my d[k] != 0.0) {
 					s += my v [i] [k] * my u [j] [k] / my d [k];
 				}
@@ -925,11 +927,11 @@ void NUMpseudoInverse (double **y, long nr, long nc, double **yinv, double toler
 	}
 }
 
-long NUMsolveQuadraticEquation (double a, double b, double c, double *x1, double *x2) {
+integer NUMsolveQuadraticEquation (double a, double b, double c, double *x1, double *x2) {
 	return gsl_poly_solve_quadratic (a, b, c, x1, x2);
 }
 
-void NUMsolveEquation (double **a, long nr, long nc, double *b, double tolerance, double *result) {
+void NUMsolveEquation (double **a, integer nr, integer nc, double *b, double tolerance, double *result) {
 	double tol = tolerance > 0 ? tolerance : NUMfpp -> eps * nr;
 
 	if (nr <= 0 || nc <= 0) {
@@ -942,7 +944,7 @@ void NUMsolveEquation (double **a, long nr, long nc, double *b, double tolerance
 }
 
 
-void NUMsolveEquations (double **a, long nr, long nc, double **b, long ncb, double tolerance, double **x) {
+void NUMsolveEquations (double **a, integer nr, integer nc, double **b, integer ncb, double tolerance, double **x) {
 	double tol = tolerance > 0 ? tolerance : NUMfpp -> eps * nr;
 
 	if (nr <= 0 || nc <= 0) {
@@ -955,32 +957,32 @@ void NUMsolveEquations (double **a, long nr, long nc, double **b, long ncb, doub
 
 	SVD_zeroSmallSingularValues (me.get(), tol);
 
-	for (long k = 1; k <= ncb; k++) {
-		for (long j = 1; j <= nr; j++) {
+	for (integer k = 1; k <= ncb; k++) {
+		for (integer j = 1; j <= nr; j++) {
 			bt[j] = b[j][k];
 		}
 
 		SVD_solve (me.get(), bt.peek(), xt);
 
-		for (long j = 1; j <= nc; j++) {
+		for (integer j = 1; j <= nc; j++) {
 			x[j][k] = xt[j];
 		}
 	}
 }
 
 
-void NUMsolveNonNegativeLeastSquaresRegression (double **m, long nr, long nc, double *d, double tol, long itermax, double *b) {
+void NUMsolveNonNegativeLeastSquaresRegression (double **m, integer nr, integer nc, double *d, double tol, integer itermax, double *b) {
 	double difsq, difsqp = 0.0;
 
-	for (long iter = 1; iter <= itermax; iter++) {
+	for (integer iter = 1; iter <= itermax; iter++) {
 
 		// Fix all weights except b[j]
 
-		for (long j = 1; j <= nc; j++) {
+		for (integer j = 1; j <= nc; j++) {
 			double mjr = 0.0, mjmj = 0.0;
-			for (long i = 1; i <= nr; i++) {
+			for (integer i = 1; i <= nr; i++) {
 				double ri = d[i], mij = m[i][j];
-				for (long l = 1; l <= nc; l++) {
+				for (integer l = 1; l <= nc; l++) {
 					if (l != j) {
 						ri -= b[l] * m[i][l];
 					}
@@ -997,9 +999,9 @@ void NUMsolveNonNegativeLeastSquaresRegression (double **m, long nr, long nc, do
 		// Calculate t(b) and compare with previous result.
 
 		difsq = 0.0;
-		for (long i = 1; i <= nr; i++) {
+		for (integer i = 1; i <= nr; i++) {
 			double dmb = d[i];
-			for (long j = 1; j <= nc; j++) {
+			for (integer j = 1; j <= nc; j++) {
 				dmb -= m[i][j] * b[j];
 			}
 			difsq += dmb * dmb;
@@ -1023,7 +1025,7 @@ struct nr_struct {
 static void nr_func (double x, double *f, double *df, void *data) {
 	struct nr_struct *me = (struct nr_struct *) data;
 	*f = *df = 0.0;
-	for (long i = 1; i <= 3; i++) {
+	for (integer i = 1; i <= 3; i++) {
 		double t1 = (my delta[i] - x);
 		double t2 = my y[i] / t1;
 		double t3 = t2 * t2 * my delta[i];
@@ -1032,8 +1034,8 @@ static void nr_func (double x, double *f, double *df, void *data) {
 	}
 }
 
-void NUMsolveConstrainedLSQuadraticRegression (double **o, const double d[], long n, double *alpha, double *gamma) {
-	long n3 = 3, info;
+void NUMsolveConstrainedLSQuadraticRegression (double **o, const double d[], integer n, double *alpha, double *gamma) {
+	integer n3 = 3, info;
 	double eps = 1e-5, t1, t2, t3;
 
 	autoNUMmatrix<double> ftinv (1, n3, 1, n3);
@@ -1052,9 +1054,9 @@ void NUMsolveConstrainedLSQuadraticRegression (double **o, const double d[], lon
 
 	// Construct O'.O     [1..3][1..3].
 
-	for (long i = 1; i <= n3; i++) {
-		for (long j = 1; j <= n3; j++) {
-			for (long k = 1; k <= n; k++) {
+	for (integer i = 1; i <= n3; i++) {
+		for (integer j = 1; j <= n3; j++) {
+			for (integer k = 1; k <= n; k++) {
 				ftinv[i][j] += o[k][i] * o[k][j];
 			}
 		}
@@ -1077,11 +1079,11 @@ void NUMsolveConstrainedLSQuadraticRegression (double **o, const double d[], lon
 
 	// G = F^-1 B (F')^-1 (eq. 4)
 
-	for (long i = 1; i <= 3; i++) {
-		for (long j = 1; j <= 3; j++) {
-			for (long k = 1; k <= 3; k++) {
+	for (integer i = 1; i <= 3; i++) {
+		for (integer j = 1; j <= 3; j++) {
+			for (integer k = 1; k <= 3; k++) {
 				if (ftinv[k][i] != 0.0) {
-					for (long l = 1; l <= 3; l++) {
+					for (integer l = 1; l <= 3; l++) {
 						g[i][j] += ftinv[k][i] * b[k][l] * ftinv[l][j];
 					}
 				}
@@ -1098,21 +1100,21 @@ void NUMsolveConstrainedLSQuadraticRegression (double **o, const double d[], lon
 	// Construct y = P'.F'.O'.d ==> Solve (F')^-1 . P .y = (O'.d)    (page 632)
 	// Get P'F^-1 from the transpose of (F')^-1 . P
 
-	for (long i = 1; i <= 3; i++) {
-		for (long j = 1; j <= 3; j++) {
+	for (integer i = 1; i <= 3; i++) {
+		for (integer j = 1; j <= 3; j++) {
 			if (ftinv[i][j] != 0.0) {
-				for (long k = 1; k <= 3; k++) {
+				for (integer k = 1; k <= 3; k++) {
 					ftinvp[i][k] += ftinv[i][j] * p[3 + 1 - j][k]; /* is sorted desc. */
 				}
 			}
 		}
-		for (long k = 1; k <= n; k++) {
+		for (integer k = 1; k <= n; k++) {
 			otd[i] += o[k][i] * d[k];
 		}
 	}
 
-	for (long i = 1; i <= 3; i++) {
-		for (long j = 1; j <= 3; j++) {
+	for (integer i = 1; i <= 3; i++) {
+		for (integer j = 1; j <= 3; j++) {
 			ptfinvc[j][i] = ptfinv[j][i] = ftinvp[i][j];
 		}
 	}
@@ -1168,8 +1170,8 @@ void NUMsolveConstrainedLSQuadraticRegression (double **o, const double d[], lon
 
 		NUMnrbis (nr_func, delta[1] + eps, delta[2] - eps2, & me, & xlambda);
 
-		for (long i = 1; i <= 3; i++) {
-			w[i] = y[i] / (1 - xlambda / delta[i]);
+		for (integer i = 1; i <= 3; i++) {
+			w[i] = y[i] / (1.0 - xlambda / delta[i]);
 		}
 		NUMsolveEquation (ptfinv.peek(), 3, 3, w.peek(), 1e-6, chi.peek());
 	}
@@ -1182,7 +1184,7 @@ void NUMsolveConstrainedLSQuadraticRegression (double **o, const double d[], lon
 	f'(b) = - 1 / (2 alpha) + 2 * sum (x[i]^2 / (c[i] - b)^3, i=1..n)
 */
 struct nr2_struct {
-	long m;
+	integer m;
 	double delta, alpha, *x, *c;
 };
 
@@ -1191,7 +1193,7 @@ static void nr2_func (double b, double *f, double *df, void *data) {
 
 	*df = - 0.5 / my alpha;
 	*f = my delta + *df * b;
-	for (long i = 1; i <= my m; i++) {
+	for (integer i = 1; i <= my m; i++) {
 		double c1 = (my c[i] - b);
 		double c2 = my x[i] / c1;
 		double c2sq = c2 * c2;
@@ -1199,13 +1201,13 @@ static void nr2_func (double b, double *f, double *df, void *data) {
 	}
 }
 
-void NUMsolveWeaklyConstrainedLinearRegression (double **f, long n, long m, double phi[], double alpha, double delta, double t[]) {
+void NUMsolveWeaklyConstrainedLinearRegression (double **f, integer n, integer m, double phi[], double alpha, double delta, double t[]) {
 	autoNUMmatrix<double> u (1, m, 1, m);
 	autoNUMvector<double> c (1, m);
 	autoNUMvector<double> x (1, n);
-	autoNUMvector<long> indx (1, m);
+	autoNUMvector<integer> indx (1, m);
 
-	for (long j = 1; j <= m; j++) {
+	for (integer j = 1; j <= m; j++) {
 		t[j] = 0.0;
 	}
 
@@ -1224,15 +1226,15 @@ void NUMsolveWeaklyConstrainedLinearRegression (double **f, long n, long m, doub
 	double **ut = svd -> v;
 	NUMindexx (sqrtc, m, indx.peek());
 
-	for (long j = m; j > 0; j--) {
+	for (integer j = m; j > 0; j--) {
 		double tmp = sqrtc [indx[j]];
 		c[m - j + 1] = tmp * tmp;
-		for (long k = 1; k <= m; k++) {
+		for (integer k = 1; k <= m; k++) {
 			u[m - j + 1][k] = ut [indx[j]] [k];
 		}
 	}
 
-	long q = 1;
+	integer q = 1;
 	double tol = 1e-6;
 	while (q < m && (c[m - q] - c[m]) < tol) {
 		q++;
@@ -1240,9 +1242,9 @@ void NUMsolveWeaklyConstrainedLinearRegression (double **f, long n, long m, doub
 
 	// step 2: x = U'F'phi
 
-	for (long i = 1; i <= m; i++) {
-		for (long j = 1; j <= m; j++) {
-			for (long k = 1; k <= n; k++) {
+	for (integer i = 1; i <= m; i++) {
+		for (integer j = 1; j <= m; j++) {
+			for (integer k = 1; k <= n; k++) {
 				x[i] += u[j][i] * f[k][j] * phi[k];
 			}
 		}
@@ -1258,11 +1260,11 @@ void NUMsolveWeaklyConstrainedLinearRegression (double **f, long n, long m, doub
 	me.c = c.peek();
 
 	double xqsq = 0.0;
-	for (long j = m - q + 1; j <= m; j++) {
+	for (integer j = m - q + 1; j <= m; j++) {
 		xqsq += x[j] * x[j];
 	}
 
-	long r = m;
+	integer r = m;
 	if (xqsq < tol) { /* xqsq == 0 */
 		double fm, df;
 		r = m - q;
@@ -1270,11 +1272,11 @@ void NUMsolveWeaklyConstrainedLinearRegression (double **f, long n, long m, doub
 		nr2_func (c[m], &fm, &df, & me);
 		if (fm >= 0.0) { /* step 3.b1 */
 			x[r + 1] = sqrt (fm);
-			for (long j = 1; j <= r; j++) {
+			for (integer j = 1; j <= r; j++) {
 				x[j] /= c[j] - c[m];
 			}
-			for (long j = 1; j <= r + 1; j++) {
-				for (long k = 1; k <= r + 1; k++) {
+			for (integer j = 1; j <= r + 1; j++) {
+				for (integer k = 1; k <= r + 1; k++) {
 					t[j] += u[j][k] * x[k];
 				}
 			}
@@ -1286,7 +1288,7 @@ void NUMsolveWeaklyConstrainedLinearRegression (double **f, long n, long m, doub
 	// step 3a & 3b2, determine interval lower bound for Newton-Raphson root finder
 
 	double xCx = 0.0;
-	for (long j = 1; j <= r; j++) {
+	for (integer j = 1; j <= r; j++) {
 		xCx += x[j] * x[j] / c[j];
 	}
 	double b0, bmin = delta > 0.0 ? - xCx / delta : -2.0 * sqrt (alpha * xCx);
@@ -1296,14 +1298,14 @@ void NUMsolveWeaklyConstrainedLinearRegression (double **f, long n, long m, doub
 
 	NUMnrbis (nr2_func, bmin + eps, c[m] - eps, & me, & b0);
 
-	for (long j = 1; j <= r; j++) {
-		for (long k = 1; k <= r; k++) {
+	for (integer j = 1; j <= r; j++) {
+		for (integer k = 1; k <= r; k++) {
 			t[j] += u[j][k] * x[k] / (c[k] - b0);
 		}
 	}
 }
 
-void NUMProcrustes (double **x, double **y, long nPoints, long nDimensions, double **t, double v[], double *s) {
+void NUMProcrustes (double **x, double **y, integer nPoints, integer nDimensions, double **t, double v[], double *s) {
 	bool orthogonal = ! v || ! s; // else similarity transform
 
 	autoNUMmatrix<double> c (1, nDimensions, 1, nDimensions);
@@ -1321,9 +1323,9 @@ void NUMProcrustes (double **x, double **y, long nPoints, long nDimensions, doub
 	if (! orthogonal) {
 		NUMcentreColumns (yc.peek(), 1, nPoints, 1, nDimensions, NULL);
 	}
-	for (long i = 1; i <= nDimensions; i++) {
-		for (long j = 1; j <= nDimensions; j++) {
-			for (long k = 1; k <= nPoints; k++) {
+	for (integer i = 1; i <= nDimensions; i++) {
+		for (integer j = 1; j <= nDimensions; j++) {
+			for (integer k = 1; k <= nPoints; k++) {
 				c[i][j] += x[k][i] * yc[k][j];
 			}
 		}
@@ -1333,7 +1335,7 @@ void NUMProcrustes (double **x, double **y, long nPoints, long nDimensions, doub
 
 	autoSVD svd = SVD_create_d (c.peek(), nDimensions, nDimensions);
 	double trace = 0.0;
-	for (long i = 1; i <= nDimensions; i++) {
+	for (integer i = 1; i <= nDimensions; i++) {
 		trace += svd -> d[i];
 	}
 
@@ -1343,10 +1345,10 @@ void NUMProcrustes (double **x, double **y, long nPoints, long nDimensions, doub
 
 	// 3. T = QP'
 
-	for (long i = 1; i <= nDimensions; i++) {
-		for (long j = 1; j <= nDimensions; j++) {
+	for (integer i = 1; i <= nDimensions; i++) {
+		for (integer j = 1; j <= nDimensions; j++) {
 			t[i][j] = 0.0;
-			for (long k = 1; k <= nDimensions; k++) {
+			for (integer k = 1; k <= nDimensions; k++) {
 				t[i][j] += svd -> v[i][k] * svd -> u[j][k];
 			}
 		}
@@ -1360,9 +1362,9 @@ void NUMProcrustes (double **x, double **y, long nPoints, long nDimensions, doub
 		// 4. Dilation factor s = (tr X'JYT) / (tr Y'JY)
 		// First we need YT.
 
-		for (long i = 1; i <= nPoints; i++) {
-			for (long j = 1; j <= nDimensions; j++) {
-				for (long k = 1; k <= nDimensions; k++) {
+		for (integer i = 1; i <= nPoints; i++) {
+			for (integer j = 1; j <= nDimensions; j++) {
+				for (integer k = 1; k <= nDimensions; k++) {
 					yt[i][j] += y[i][k] * t[k][j];
 				}
 			}
@@ -1375,14 +1377,14 @@ void NUMProcrustes (double **x, double **y, long nPoints, long nDimensions, doub
 		// tr X'J YT == tr xc' yt
 
 		double traceXtJYT = 0.0;
-		for (long i = 1; i <= nDimensions; i++) {
-			for (long j = 1; j <= nPoints; j++) {
+		for (integer i = 1; i <= nDimensions; i++) {
+			for (integer j = 1; j <= nPoints; j++) {
 				traceXtJYT += xc[j][i] * yt[j][i];
 			}
 		}
 		double traceYtJY = 0.0;
-		for (long i = 1; i <= nDimensions; i++) {
-			for (long j = 1; j <= nPoints; j++) {
+		for (integer i = 1; i <= nDimensions; i++) {
+			for (integer j = 1; j <= nPoints; j++) {
 				traceYtJY += y[j][i] * yc[j][i];
 			}
 		}
@@ -1391,8 +1393,8 @@ void NUMProcrustes (double **x, double **y, long nPoints, long nDimensions, doub
 
 		// 5. Translation vector tr = (X - sYT)'1 / nPoints
 
-		for (long i = 1; i <= nDimensions; i++) {
-			for (long j = 1; j <= nPoints; j++) {
+		for (integer i = 1; i <= nDimensions; i++) {
+			for (integer j = 1; j <= nPoints; j++) {
 				v[i] += x[j][i] - *s * yt[j][i];
 			}
 			v[i] /= nPoints;
@@ -1401,8 +1403,8 @@ void NUMProcrustes (double **x, double **y, long nPoints, long nDimensions, doub
 }
 
 
-void NUMmspline (double knot[], long nKnots, long order, long i, double x, double *y) {
-	long jj, nSplines = nKnots - order;
+void NUMmspline (double knot[], integer nKnots, integer order, integer i, double x, double *y) {
+	integer jj, nSplines = nKnots - order;
 	if (nSplines <= 0) {
 		Melder_throw (U"No splines.");
 	}
@@ -1428,9 +1430,9 @@ void NUMmspline (double knot[], long nKnots, long order, long i, double x, doubl
 
 	// Calculate M[i](x|1,t) according to eq.2.
 
-	long ito = i + order - 1;
+	integer ito = i + order - 1;
 	autoNUMvector<double> m (i, ito);
-	for (long j = i; j <= ito; j++) {
+	for (integer j = i; j <= ito; j++) {
 		if (x >= knot[j] && x < knot[j + 1]) {
 			m[j] = 1 / (knot[j + 1] - knot[j]);
 		}
@@ -1438,8 +1440,8 @@ void NUMmspline (double knot[], long nKnots, long order, long i, double x, doubl
 
 	// Iterate to get M[i](x|k,t)
 
-	for (long k = 2; k <= order; k++) {
-		for (long j = i; j <= i + order - k; j++) {
+	for (integer k = 2; k <= order; k++) {
+		for (integer j = i; j <= i + order - k; j++) {
 			double kj = knot[j], kjpk = knot[j + k];
 			if (kjpk > kj) {
 				m[j] = k * ((x - kj) * m[j] + (kjpk - x) * m[j + 1]) / ((k - 1) * (kjpk - kj));
@@ -1449,8 +1451,8 @@ void NUMmspline (double knot[], long nKnots, long order, long i, double x, doubl
 	*y = m[i];
 }
 
-void NUMispline (double aknot[], long nKnots, long order, long i, double x, double *y) {
-	long j, orderp1 = order + 1;
+void NUMispline (double aknot[], integer nKnots, integer order, integer i, double x, double *y) {
+	integer j, orderp1 = order + 1;
 
 	*y = 0.0;
 
@@ -1472,7 +1474,7 @@ void NUMispline (double aknot[], long nKnots, long order, long i, double x, doub
 	//	'j-k+1 <= i <= j'
 	// 2. the summation index m starts at 'i+1' instead of 'i'
 
-	for (long m = i + 1; m <= j; m++) {
+	for (integer m = i + 1; m <= j; m++) {
 		double r;
 		NUMmspline (aknot, nKnots, orderp1, m, x, &r);
 		*y += (aknot[m + orderp1] - aknot[m]) * r;
@@ -1480,9 +1482,9 @@ void NUMispline (double aknot[], long nKnots, long order, long i, double x, doub
 	*y /= orderp1;
 }
 
-double NUMwilksLambda (double *lambda, long from, long to) {
+double NUMwilksLambda (double *lambda, integer from, integer to) {
 	double result = 1.0;
-	for (long i = from; i <= to; i++) {
+	for (integer i = from; i <= to; i++) {
 		result /= (1.0 + lambda[i]);
 	}
 	return result;
@@ -1502,7 +1504,7 @@ double NUMfactln (int n) {
 
 void NUMnrbis (void (*f) (double x, double *fx, double *dfx, void *closure), double xmin, double xmax, void *closure, double *root) {
 	double df, fx, fh, fl, tmp, xh, xl, tol;
-	long itermax = 60;
+	integer itermax = 60;
 
 	(*f) (xmin, &fl, &df, closure);
 	if (fl == 0.0) {
@@ -1534,7 +1536,7 @@ void NUMnrbis (void (*f) (double x, double *fx, double *dfx, void *closure), dou
 	*root = 0.5 * (xmin + xmax);
 	(*f) (*root, &fx, &df, closure);
 
-	for (long iter = 1; iter <= itermax; iter++) {
+	for (integer iter = 1; iter <= itermax; iter++) {
 		if ((((*root - xh) * df - fx) * ((*root - xl) * df - fx) >= 0.0) || (fabs (2.0 * fx) > fabs (dxold * df))) {
 			dxold = dx;
 			dx = 0.5 * (xh - xl);
@@ -1572,7 +1574,7 @@ double NUMridders (double (*f) (double x, void *closure), double x1, double x2,
 		tol may be zero;
 	*/
 	double x3, x4, d, root = undefined, tol;
-	long itermax = 100;
+	integer itermax = 100;
 
 	double f1 = f (x1, closure);
 	if (f1 == 0.0) {
@@ -1592,7 +1594,7 @@ double NUMridders (double (*f) (double x, void *closure), double x1, double x2,
 		return undefined;
 	}
 
-	for (long iter = 1; iter <= itermax; iter++) {
+	for (integer iter = 1; iter <= itermax; iter++) {
 		x3 = 0.5 * (x1 + x2);
 		double f3 = f (x3, closure);
 		if (f3 == 0.0) {
@@ -1704,7 +1706,7 @@ double NUMridders (double (*f) (double x, void *closure), double x1, double x2,
 	}
 
 	{
-		static long nwarnings = 0;
+		static integer nwarnings = 0;
 		nwarnings++;
 		Melder_warning (U"NUMridders: maximum number of iterations (", itermax, U") exceeded.");
 	}
@@ -1911,7 +1913,7 @@ double NUMlnBeta (double a, double b) {
 	return status == GSL_SUCCESS ? result.val : undefined;
 }
 
-double NUMnormalityTest_HenzeZirkler (double **data, long n, long p, double *beta, double *tnb, double *lnmu, double *lnvar) {
+double NUMnormalityTest_HenzeZirkler (double **data, integer n, integer p, double *beta, double *tnb, double *lnmu, double *lnvar) {
 	if (*beta <= 0) {
 		*beta = (1.0 / sqrt (2.0)) * pow ((1.0 + 2 * p) / 4.0, 1.0 / (p + 4)) * pow (n, 1.0 / (p + 4));
 	}
@@ -1943,8 +1945,8 @@ double NUMnormalityTest_HenzeZirkler (double **data, long n, long p, double *bet
 			We use d[j][k] = ||Y[j]-Y[k]||^2 = (Y[j]-Y[k])'S^(-1)(Y[j]-Y[k])
 			So d[j][k]= d[k][j] and d[j][j] = 0
 		*/
-		for (long j = 1; j <= n; j++) {
-			for (long k = 1; k < j; k++) {
+		for (integer j = 1; j <= n; j++) {
+			for (integer k = 1; k < j; k++) {
 				djk = NUMmahalanobisDistance_chi (covar.peek(), x[j], x[k], p, p);
 				sumjk += 2.0 * exp (-b1 * djk); // factor 2 because d[j][k] == d[k][j]
 			}
@@ -2081,8 +2083,8 @@ b2 = & work[n+1];
 aa = & work[n+n+1];
 for (i=1; i<=n+n+n; i++) work[i]=0;
 */
-int NUMburg (double x[], long n, double a[], int m, double *xms) {
-	for (long j = 1; j <= m; j++) {
+int NUMburg (double x[], integer n, double a[], int m, double *xms) {
+	for (integer j = 1; j <= m; j++) {
 		a[j] = 0.0;
 	}
 
@@ -2093,7 +2095,7 @@ int NUMburg (double x[], long n, double a[], int m, double *xms) {
 	// (3)
 
 	double p = 0.0;
-	for (long j = 1; j <= n; j++) {
+	for (integer j = 1; j <= n; j++) {
 		p += x[j] * x[j];
 	}
 
@@ -2106,15 +2108,15 @@ int NUMburg (double x[], long n, double a[], int m, double *xms) {
 
 	b1[1] = x[1];
 	b2[n - 1] = x[n];
-	for (long j = 2; j <= n - 1; j++) {
+	for (integer j = 2; j <= n - 1; j++) {
 		b1[j] = b2[j - 1] = x[j];
 	}
 
-	for (long i = 1; i <= m; i++) {
+	for (integer i = 1; i <= m; i++) {
 		// (7)
 
 		double num = 0.0, denum = 0.0;
-		for (long j = 1; j <= n - i; j++) {
+		for (integer j = 1; j <= n - i; j++) {
 			num += b1[j] * b2[j];
 			denum += b1[j] * b1[j] + b2[j] * b2[j];
 		}
@@ -2131,7 +2133,7 @@ int NUMburg (double x[], long n, double a[], int m, double *xms) {
 
 		// (5)
 
-		for (long j = 1; j <= i - 1; j++) {
+		for (integer j = 1; j <= i - 1; j++) {
 			a[j] = aa[j] - a[i] * aa[i - j];
 		}
 
@@ -2139,10 +2141,10 @@ int NUMburg (double x[], long n, double a[], int m, double *xms) {
 
 			// (8)  Watch out: i -> i+1
 
-			for (long j = 1; j <= i; j++) {
+			for (integer j = 1; j <= i; j++) {
 				aa[j] = a[j];
 			}
-			for (long j = 1; j <= n - i - 1; j++) {
+			for (integer j = 1; j <= n - i - 1; j++) {
 				b1[j] -= aa[i] * b2[j];
 				b2[j] = b2[j + 1] - aa[i] * b1[j + 1];
 			}
@@ -2151,14 +2153,14 @@ int NUMburg (double x[], long n, double a[], int m, double *xms) {
 	return 1;
 }
 
-void NUMdmatrix_to_dBs (double **m, long rb, long re, long cb, long ce, double ref, double factor, double floor) {
+void NUMdmatrix_to_dBs (double **m, integer rb, integer re, integer cb, integer ce, double ref, double factor, double floor) {
 	double ref_db, factor10 = factor * 10.0;
 	double max = m[rb][cb], min = max;
 
 	Melder_assert (ref > 0 && factor > 0 && rb <= re && cb <= ce);
 
-	for (long i = rb; i <= re; i++) {
-		for (long j = cb; j <= ce; j++) {
+	for (integer i = rb; i <= re; i++) {
+		for (integer j = cb; j <= ce; j++) {
 			if (m[i][j] > max) {
 				max = m[i][j];
 			} else if (m[i][j] < min) {
@@ -2172,8 +2174,8 @@ void NUMdmatrix_to_dBs (double **m, long rb, long re, long cb, long ce, double r
 	}
 	ref_db = factor10 * log10 (ref);
 
-	for (long i = rb; i <= re; i++) {
-		for (long j = cb; j <= ce; j++) {
+	for (integer i = rb; i <= re; i++) {
+		for (integer j = cb; j <= ce; j++) {
 			double mij = floor;
 			if (m[i][j] > 0.0) {
 				mij = factor10 * log10 (m[i][j]) - ref_db;
@@ -2186,19 +2188,19 @@ void NUMdmatrix_to_dBs (double **m, long rb, long re, long cb, long ce, double r
 	}
 }
 
-double **NUMcosinesTable (long first, long last, long npoints) {
+double **NUMcosinesTable (integer first, integer last, integer npoints) {
 	Melder_assert (0 < first && first <= last && npoints > 0);
 	autoNUMmatrix<double> m (first, last, 1, npoints);
-	for (long i = first; i <= last; i++) {
+	for (integer i = first; i <= last; i++) {
 		double f = i * NUMpi / npoints;
-		for (long j = 1; j <= npoints; j++) {
+		for (integer j = 1; j <= npoints; j++) {
 			m[i][j] = cos (f * (j - 0.5));
 		}
 	}
 	return m.transfer();
 }
 
-void NUMspline (double x[], double y[], long n, double yp1, double ypn, double y2[]) {
+void NUMspline (double x[], double y[], integer n, double yp1, double ypn, double y2[]) {
 	autoNUMvector<double> u (1, n - 1);
 
 	if (yp1 > 0.99e30) {
@@ -2208,7 +2210,7 @@ void NUMspline (double x[], double y[], long n, double yp1, double ypn, double y
 		u[1] = (3.0 / (x[2] - x[1])) * ( (y[2] - y[1]) / (x[2] - x[1]) - yp1);
 	}
 
-	for (long i = 2; i <= n - 1; i++) {
+	for (integer i = 2; i <= n - 1; i++) {
 		double sig = (x[i] - x[i - 1]) / (x[i + 1] - x[i - 1]);
 		double p = sig * y2[i - 1] + 2.0;
 		y2[i] = (sig - 1.0) / p;
@@ -2225,15 +2227,15 @@ void NUMspline (double x[], double y[], long n, double yp1, double ypn, double y
 	}
 
 	y2[n] = (un - qn * u[n - 1]) / (qn * y2[n - 1] + 1.0);
-	for (long k = n - 1; k >= 1; k--) {
+	for (integer k = n - 1; k >= 1; k--) {
 		y2[k] = y2[k] * y2[k + 1] + u[k];
 	}
 }
 
-void NUMsplint (double xa[], double ya[], double y2a[], long n, double x, double *y) {
-	long klo = 1, khi = n;
+void NUMsplint (double xa[], double ya[], double y2a[], integer n, double x, double *y) {
+	integer klo = 1, khi = n;
 	while (khi - klo > 1) {
-		long k = (khi + klo) >> 1;
+		integer k = (khi + klo) >> 1;
 		if (xa[k] > x) {
 			khi = k;
 		} else {
@@ -2295,7 +2297,7 @@ int NUMgetOrientationOfPoints (double x1, double y1, double x2, double y2, doubl
 int NUMgetIntersectionsWithRectangle (double x1, double y1, double x2, double y2,
                                       double xmin, double ymin, double xmax, double ymax, double *xi, double *yi) {
 	double x[6], y[6];
-	long ni = 0;
+	integer ni = 0;
 
 	x[1] = x[4] = x[5] = xmin;
 	x[2] = x[3] = xmax;
@@ -2329,7 +2331,7 @@ int NUMgetIntersectionsWithRectangle (double x1, double y1, double x2, double y2
 			To count intersections in a corner only once we have t < 0 instead of t <= 0!
 	*/
 
-	for (long i = 1; i <= 4; i++) {
+	for (integer i = 1; i <= 4; i++) {
 		double denom = (x[i + 1] - x[i]) * (y2 - y1) - (y[i + 1] - y[i]) * (x2 - x1);
 		double s, t, x3, y3;
 		if (denom == 0.0) {
@@ -2530,7 +2532,7 @@ double NUMminimize_brent (double (*f) (double x, void *closure), double a, doubl
 	double x, v, fv, w, fw;
 	const double golden = 1 - NUM_goldenSection;
 	const double sqrt_epsilon = sqrt (NUMfpp -> eps);
-	long itermax = 60;
+	integer itermax = 60;
 
 	Melder_assert (tol > 0 && a < b);
 
@@ -2541,7 +2543,7 @@ double NUMminimize_brent (double (*f) (double x, void *closure), double a, doubl
 	x = v;  w = v;
 	*fx = fv;  fw = fv;
 
-	for (long iter = 1; iter <= itermax; iter++) {
+	for (integer iter = 1; iter <= itermax; iter++) {
 		double range = b - a;
 		double middle_range = (a + b) / 2.0;
 		double tol_act = sqrt_epsilon * fabs (x) + tol / 3.0;
@@ -2640,8 +2642,8 @@ double NUMminimize_brent (double (*f) (double x, void *closure), double a, doubl
 	probs is probability vector, i.e. all 0 <= probs[i] <= 1 and sum(i=1;i=nprobs, probs[i])= 1
 	p is a probability
 */
-long NUMgetIndexFromProbability (double *probs, long nprobs, double p) {
-	long index = 1;
+integer NUMgetIndexFromProbability (double *probs, integer nprobs, double p) {
+	integer index = 1;
 	double psum = probs[index];
 	while (p > psum && index < nprobs) {
 		psum += probs[++index];
@@ -2651,7 +2653,7 @@ long NUMgetIndexFromProbability (double *probs, long nprobs, double p) {
 
 // straight line fitting
 
-void NUMlineFit_theil (double *x, double *y, long numberOfPoints, double *p_m, double *p_intercept, bool incompleteMethod) {
+void NUMlineFit_theil (double *x, double *y, integer numberOfPoints, double *p_m, double *p_intercept, bool incompleteMethod) {
 	try {
 		/* Theil's incomplete method:
 		 * Split (x[i],y[i]) as
@@ -2670,28 +2672,28 @@ void NUMlineFit_theil (double *x, double *y, long numberOfPoints, double *p_m, d
 			m = (y[2] - y[1]) / (x[2] - x[1]);
 			intercept = y[1] - m * x[1];
 		} else {
-			long numberOfCombinations;
+			integer numberOfCombinations;
 			autoNUMvector<double> mbs;
 			if (incompleteMethod) { // incomplete method
 				numberOfCombinations = numberOfPoints / 2;
 				mbs.reset (1, numberOfPoints); //
-				long n2 = numberOfPoints % 2 == 1 ? numberOfCombinations + 1 : numberOfCombinations;
-				for (long i = 1; i <= numberOfCombinations; i++) {
+				integer n2 = numberOfPoints % 2 == 1 ? numberOfCombinations + 1 : numberOfCombinations;
+				for (integer i = 1; i <= numberOfCombinations; i++) {
 					mbs[i] = (y[n2 + i] - y[i]) / (x[n2 + i] - x[i]);
 				}
 			} else { // use all combinations
 				numberOfCombinations = (numberOfPoints - 1) * numberOfPoints / 2;
 				mbs.reset (1, numberOfCombinations);
-				long index = 0;
-				for (long i = 1; i < numberOfPoints; i++) {
-					for (long j = i + 1; j <= numberOfPoints; j++) {
+				integer index = 0;
+				for (integer i = 1; i < numberOfPoints; i++) {
+					for (integer j = i + 1; j <= numberOfPoints; j++) {
 						mbs[++index] = (y[j] - y[i]) / (x[j] - x[i]);
 					}
 				}
 			}
 			NUMsort_d (numberOfCombinations, mbs.peek());
 			m = NUMquantile (numberOfCombinations, mbs.peek(), 0.5);
-			for (long i = 1; i <= numberOfPoints; i++) {
+			for (integer i = 1; i <= numberOfPoints; i++) {
 				mbs[i] = y[i] - m * x[i];
 			}
 			NUMsort_d (numberOfPoints, mbs.peek());
@@ -2708,15 +2710,15 @@ void NUMlineFit_theil (double *x, double *y, long numberOfPoints, double *p_m, d
 	}
 }
 
-void NUMlineFit_LS (double *x, double *y, long numberOfPoints, double *p_m, double *intercept) {
+void NUMlineFit_LS (double *x, double *y, integer numberOfPoints, double *p_m, double *intercept) {
 	double sx = 0.0, sy = 0.0;
-	for (long i = 1; i <= numberOfPoints; i++) {
+	for (integer i = 1; i <= numberOfPoints; i++) {
 		sx += x[i];
 		sy += y[i];
 	}
 	double xmean = sx / numberOfPoints;
 	double st2 = 0.0, m = 0.0;
-	for (long i = 1; i <= numberOfPoints; i++) {
+	for (integer i = 1; i <= numberOfPoints; i++) {
 		double t = x[i] - xmean;
 		st2 += t * t;
 		m += t * y[i];
@@ -2731,7 +2733,7 @@ void NUMlineFit_LS (double *x, double *y, long numberOfPoints, double *p_m, doub
 	}
 }
 
-void NUMlineFit (double *x, double *y, long numberOfPoints, double *m, double *intercept, int method) {
+void NUMlineFit (double *x, double *y, integer numberOfPoints, double *m, double *intercept, int method) {
 	if (method == 1) {
 		NUMlineFit_LS (x, y, numberOfPoints, m, intercept);
 	} else if (method == 3) {
@@ -2743,49 +2745,49 @@ void NUMlineFit (double *x, double *y, long numberOfPoints, double *m, double *i
 
 // IEEE: Programs for digital signal processing section 4.3 LPTRN
 // lpc[1..n] to rc[1..n]
-void NUMlpc_lpc_to_rc (double *lpc, long p, double *rc) {
+void NUMlpc_lpc_to_rc (double *lpc, integer p, double *rc) {
 	autoNUMvector<double> b (1, p);
 	autoNUMvector<double> a (NUMvector_copy<double> (lpc, 1, p), 1);
-	for (long m = p; m > 0; m--) {
+	for (integer m = p; m > 0; m--) {
 		rc[m] = a[m];
 		if (fabs (rc[m]) > 1) {
 			Melder_throw (U"Relection coefficient [", m, U"] larger than 1.");
 		}
-		for (long i = 1; i < m; i++) {
+		for (integer i = 1; i < m; i++) {
 			b[i] = a[i];
 		}
-		for (long i = 1; i < m; i++) {
+		for (integer i = 1; i < m; i++) {
 			a[i] = (b[i] - rc[m] * b[m - i]) / (1.0 - rc[m] * rc[m]);
 		}
 	}
 }
 
-void NUMlpc_rc_to_area2 (double *rc, long n, double *area);
-void NUMlpc_rc_to_area2 (double *rc, long n, double *area) {
+void NUMlpc_rc_to_area2 (double *rc, integer n, double *area);
+void NUMlpc_rc_to_area2 (double *rc, integer n, double *area) {
 	double s = 0.0001; /* 1.0 cm^2 at glottis */
-	for (long i = n; i > 0; i--) {
+	for (integer i = n; i > 0; i--) {
 		s *= (1.0 + rc[i]) / (1.0 - rc[i]);
 		area[i] = s;
 	}
 }
 
-void NUMlpc_area_to_lpc2 (double *area, long n, double *lpc);
-void NUMlpc_area_to_lpc2 (double *area, long n, double *lpc) {
+void NUMlpc_area_to_lpc2 (double *area, integer n, double *lpc);
+void NUMlpc_area_to_lpc2 (double *area, integer n, double *lpc) {
 	// from area to reflection coefficients
 	autoNUMvector<double> rc (1, n);
 	// normalisation: area[n+1] = 0.0001
-	for (long j = n; j > 0; j--) {
+	for (integer j = n; j > 0; j--) {
 		double ar = area[j+1] / area[j];
 		rc[j] = (1 - ar) / (1 + ar);
 	}
 	// LPTRAN works from mouth to lips:
-	for (long j = 1; j <= n; j++) {
+	for (integer j = 1; j <= n; j++) {
 		lpc[j] = rc[n - j + 1];
 	}
-	for (long j = 2; j <= n; j++) {
-		long nh = j / 2;
+	for (integer j = 2; j <= n; j++) {
+		integer nh = j / 2;
 		double q = rc[j];
-		for (long k = 1; k <= nh; k++) {
+		for (integer k = 1; k <= nh; k++) {
 			double at = lpc[k] + q * lpc[j - k];
 			lpc[j - k] += q * lpc[k];
 			lpc[k] = at;
@@ -2793,41 +2795,41 @@ void NUMlpc_area_to_lpc2 (double *area, long n, double *lpc) {
 	}
 }
 
-void NUMlpc_lpc_to_rc2 (double *lpc, long m, double *rc);
-void NUMlpc_lpc_to_rc2 (double *lpc, long m, double *rc) { // klopt nog niet
+void NUMlpc_lpc_to_rc2 (double *lpc, integer m, double *rc);
+void NUMlpc_lpc_to_rc2 (double *lpc, integer m, double *rc) { // klopt nog niet
 	NUMvector_copyElements<double> (lpc, rc, 1, m);
-	for (long j = 2; j <= m; j++) {
-		long jb = m + 1 - j;
-		long mh = (jb + 1) / 2;
+	for (integer j = 2; j <= m; j++) {
+		integer jb = m + 1 - j;
+		integer mh = (jb + 1) / 2;
 		double rct = rc[jb+1];
 		double d = 1.0 - rct * rct;
-		for (long k = 1; k <= mh; k++) {
+		for (integer k = 1; k <= mh; k++) {
 			rc[k] *= (1 - rct) / d;
 		}
 	}
 }
 // area[1] at lips generates n+1 areas from n rc's
-void NUMlpc_rc_to_area (double *rc, long m, double *area) {
+void NUMlpc_rc_to_area (double *rc, integer m, double *area) {
 	area[m+1] = 0.0001; /* 1.0 cm^2 */
-	for (long j = 1; j <= m; j++) {
+	for (integer j = 1; j <= m; j++) {
 		double ar = (1.0 - rc[m+1-j]) / (1.0 + rc[m+1-j]);
 		area[m+1-j] = area[m+2-j] / ar;
 	}
 }
 
 // returns m-1 reflection coefficients from m areas
-void NUMlpc_area_to_rc (double *area, long m, double *rc) {
-	for (long j = 1; j <= m - 1; j++) {
+void NUMlpc_area_to_rc (double *area, integer m, double *rc) {
+	for (integer j = 1; j <= m - 1; j++) {
 		double ar = area[j+1] / area[j];
 		rc[j] = (1.0 - ar) / (1.0 + ar);
 	}
 }
 
-void NUMlpc_rc_to_lpc (double *rc, long m, double *lpc);
-void NUMlpc_rc_to_lpc (double *rc, long m, double *lpc) {
+void NUMlpc_rc_to_lpc (double *rc, integer m, double *lpc);
+void NUMlpc_rc_to_lpc (double *rc, integer m, double *lpc) {
 	NUMvector_copyElements<double> (rc, lpc, 1, m);
-	for (long j = 2; j <= m; j++) {
-		for (long k = 1; k <= j / 2; k++) {
+	for (integer j = 2; j <= m; j++) {
+		for (integer k = 1; k <= j / 2; k++) {
 			double at = lpc[k] + rc[j] * lpc[j - k];
 			lpc[j - k] += rc[j] * lpc[k];
 			lpc[k] = at;
@@ -2835,7 +2837,7 @@ void NUMlpc_rc_to_lpc (double *rc, long m, double *lpc) {
 	}
 }
 
-void NUMlpc_area_to_lpc (double *area, long m, double *lpc) {
+void NUMlpc_area_to_lpc (double *area, integer m, double *lpc) {
 	// from area to reflection coefficients
 	autoNUMvector<double> rc (1, m);
 	// normalisation: area[n+1] = 0.0001
@@ -2843,7 +2845,7 @@ void NUMlpc_area_to_lpc (double *area, long m, double *lpc) {
 	NUMlpc_rc_to_lpc (rc.peek(), m - 1, lpc);
 }
 
-void NUMlpc_lpc_to_area (double *lpc, long m, double *area) {
+void NUMlpc_lpc_to_area (double *lpc, integer m, double *area) {
 	autoNUMvector<double> rc (1, m);
 	NUMlpc_lpc_to_rc (lpc, m, rc.peek());
 	NUMlpc_rc_to_area (rc.peek(), m, area);
@@ -2878,11 +2880,11 @@ inline static double Stirling (double y1)
 
 // djmw 20121211 replaced calls to gsl_rng_uniform with NUMrandomUniform (0,1)
 
-long NUMrandomBinomial (double p, long n) {
+integer NUMrandomBinomial (double p, integer n) {
 	if (p < 0.0 || p > 1.0 || n < 0) {
 		return -100000000;
 	}
-	long ix;                       /* return value */
+	integer ix;                       /* return value */
 	int flipped = 0;
 
 	if (n == 0) {
@@ -2947,7 +2949,7 @@ long NUMrandomBinomial (double p, long n) {
 		/* For n >= SMALL_MEAN, we invoke the BTPE algorithm */
 
 		double ffm = np + p;      /* ffm = n*p+p             */
-		long m = (long) ffm;        /* m = int floor[n*p+p]    */
+		integer m = (integer) ffm;        /* m = int floor[n*p+p]    */
 		double fm = m;            /* fm = double m;          */
 		double xm = fm + 0.5;     /* xm = half integer mean (tip of triangle)  */
 		double npq = np * q;      /* npq = n*p*q            */
@@ -2993,7 +2995,7 @@ TryAgain:
 
 		if (u <= p1) {
 			/* Triangular region */
-			ix = (long) (xm - p1 * v + u);
+			ix = (integer) (xm - p1 * v + u);
 			goto Finish;
 		} else if (u <= p2) {
 			/* Parallelogram region */
@@ -3002,17 +3004,17 @@ TryAgain:
 			if (v > 1.0 || v <= 0.0) {
 				goto TryAgain;
 			}
-			ix = (long) x;
+			ix = (integer) x;
 		} else if (u <= p3) {
 			/* Left tail */
-			ix = (long) (xl + log (v) / lambda_l);
+			ix = (integer) (xl + log (v) / lambda_l);
 			if (ix < 0) {
 				goto TryAgain;
 			}
 			v *= ((u - p2) * lambda_l);
 		} else {
 			/* Right tail */
-			ix = (long) (xr - log (v) / lambda_r);
+			ix = (integer) (xr - log (v) / lambda_r);
 			if (ix > (double) n) {
 				goto TryAgain;
 			}
@@ -3039,7 +3041,7 @@ TryAgain:
 
 		/* More efficient determination of whether v < f(x)/f(M) */
 
-		long k = labs (ix - m);
+		integer k = labs (ix - m);
 
 		if (k <= FAR_FROM_MEAN) {
 			/*
@@ -3052,11 +3054,11 @@ TryAgain:
 			var = v;
 
 			if (m < ix) {
-				for (long i = m + 1; i <= ix; i++) {
+				for (integer i = m + 1; i <= ix; i++) {
 					f *= (g / i - s);
 				}
 			} else if (m > ix) {
-				for (long i = ix + 1; i <= m; i++) {
+				for (integer i = ix + 1; i <= m; i++) {
 					f /= (g / i - s);
 				}
 			}
@@ -3136,7 +3138,7 @@ Finish:
   	return (flipped) ? (n - ix) : ix;
 }
 
-double NUMrandomBinomial_real (double p, long n) {
+double NUMrandomBinomial_real (double p, integer n) {
 	if (p < 0.0 || p > 1.0 || n < 0) {
 		return undefined;
 	} else {
@@ -3159,9 +3161,9 @@ void NUMlngamma_complex (double zr, double zi, double *lnr, double *arg) {
 	}
 }
 
-bool NUMdmatrix_containsUndefinedElements (double **m, long row1, long row2, long col1, long col2) {
-	for (long i = row1; i <= row2; i ++) {
-		for (long j = col1; j <= col2; j ++) {
+bool NUMdmatrix_containsUndefinedElements (double **m, integer row1, integer row2, integer col1, integer col2) {
+	for (integer i = row1; i <= row2; i ++) {
+		for (integer j = col1; j <= col2; j ++) {
 			if (isundef (m [i] [j])) {
 				return true;
 			}
@@ -3170,11 +3172,11 @@ bool NUMdmatrix_containsUndefinedElements (double **m, long row1, long row2, lon
 	return false;
 }
 
-void NUMdmatrix_diagnoseCells (double **m, long rb, long re, long cb, long ce, long maximumNumberOfPositionsToReport) {
-	long numberOfInvalids = 0;
+void NUMdmatrix_diagnoseCells (double **m, integer rb, integer re, integer cb, integer ce, integer maximumNumberOfPositionsToReport) {
+	integer numberOfInvalids = 0;
 	bool firstTime = true;
-	for (long i = rb; i <= re; i++) {
-		for (long j = cb; j <= ce; j++) {
+	for (integer i = rb; i <= re; i++) {
+		for (integer j = cb; j <= ce; j++) {
 			if (! isfinite (m [i][j])) {
 				numberOfInvalids ++;
 				if (firstTime) {
diff --git a/dwsys/NUM2.h b/dwsys/NUM2.h
index 888f2ba..8bc7b87 100644
--- a/dwsys/NUM2.h
+++ b/dwsys/NUM2.h
@@ -49,17 +49,17 @@ real * NUMstring_to_numbers (const char32 *s, integer *numbers_found);
  * 1, 4, 2, 3, 4, 5, 6, 7, 4, 3, 3, 4, 5, 4, 3, 2
  * Overlap is allowed. Ranges can go up and down.
  */
-long *NUMstring_getElementsOfRanges (const char32 *ranges, long maximumElement, long *numberOfElements, long *numberOfMultiples, const char32 *elementType, bool sortedUniques);
+integer *NUMstring_getElementsOfRanges (const char32 *ranges, integer maximumElement, integer *numberOfElements, integer *numberOfMultiples, const char32 *elementType, bool sortedUniques);
 
 char32 * NUMstring_timeNoDot (double time);
 
-int NUMstrings_equal (const char32 **s1, const char32 **s2, long lo, long hi);
+int NUMstrings_equal (const char32 **s1, const char32 **s2, integer lo, integer hi);
 
-void NUMstrings_copyElements (char32 **from, char32**to, long lo, long hi);
+void NUMstrings_copyElements (char32 **from, char32**to, integer lo, integer hi);
 
-void NUMstrings_free (char32 **s, long lo, long hi);
+void NUMstrings_free (char32 **s, integer lo, integer hi);
 
-int NUMstrings_setSequentialNumbering (char32 **s, long lo, long hi, const char32 *precursor, long number, long increment, int asArray);
+int NUMstrings_setSequentialNumbering (char32 **s, integer lo, integer hi, const char32 *precursor, integer number, integer increment, int asArray);
 /*
 	Set s[lo]   = precursor<number>
 	    s[lo+1] = precursor<number+1>
@@ -67,7 +67,7 @@ int NUMstrings_setSequentialNumbering (char32 **s, long lo, long hi, const char3
 		s[hi]   = precursor<number+hi-lo>
 */
 
-char32 **NUMstrings_copy (char32 **from, long lo, long hi);
+char32 **NUMstrings_copy (char32 **from, integer lo, integer hi);
 
 regexp *NUMregexp_compile (const char32 *regexp);
 /* Compiles a regular expression to a datastructure used by the regexp engine */
@@ -80,9 +80,9 @@ char32 *strstr_regexp (const char32 *string, const char32 *search_regexp);
 	no match is found.
 */
 
-char32 **strs_replace (char32 **from, long lo, long hi, const char32 *search,
-	const char32 *replace, int maximumNumberOfReplaces, long *nmatches,
-	long *nstringmatches, int use_regexp);
+char32 **strs_replace (char32 **from, integer lo, integer hi, const char32 *search,
+	const char32 *replace, int maximumNumberOfReplaces, integer *nmatches,
+	integer *nstringmatches, int use_regexp);
 /*
 	Searches and replaces in string array of strings.
 	If use_regexp != 0, 'search' and 'replace' will be interpreted
@@ -97,14 +97,14 @@ char32 **strs_replace (char32 **from, long lo, long hi, const char32 *search,
 */
 
 char32 *str_replace_literal (const char32 *string, const char32 *search,
-	const char32 *replace, long maximumNumberOfReplaces, long *nmatches);
+	const char32 *replace, integer maximumNumberOfReplaces, integer *nmatches);
 /*
 	Search and replace in 'string'.
 	The maximum number of replaces is limited by 'maximumNumberOfReplaces'.
 */
 
 char32 *str_replace_regexp (const char32 *string, regexp *search_compiled,
-	const char32 *replace_regexp, long maximumNumberOfReplaces, long *nmatches);
+	const char32 *replace_regexp, integer maximumNumberOfReplaces, integer *nmatches);
 /*
 	Searches and replaces 'maximumNumberOfReplaces' times in 'string' on
 	the basis of regular expressions (RE).
@@ -117,7 +117,7 @@ char32 *str_replace_regexp (const char32 *string, regexp *search_compiled,
 */
 
 
-void NUMdmatrix_printMatlabForm (double **m, long nr, long nc, const char32 *name);
+void NUMdmatrix_printMatlabForm (double **m, integer nr, integer nc, const char32 *name);
 /*
 	Print a matrix in a form that can be used as input for octave/matlab.
 	                      1 2 3
@@ -129,13 +129,13 @@ void NUMdmatrix_printMatlabForm (double **m, long nr, long nc, const char32 *nam
 	7, 8, 9];
 */
 
-bool NUMdmatrix_containsUndefinedElements (double **m, long row1, long row2, long col1, long col2);
+bool NUMdmatrix_containsUndefinedElements (double **m, integer row1, integer row2, integer col1, integer col2);
 /* true if at least one of the elements is undefined (i.e. infinite or NaN) */
 
-void NUMdmatrix_diagnoseCells (double **m, long rb, long re, long cb, long ce, long maximumNumberOfPositionsToReport);
+void NUMdmatrix_diagnoseCells (double **m, integer rb, integer re, integer cb, integer ce, integer maximumNumberOfPositionsToReport);
 /* which cells are not finite? */
 
-double **NUMdmatrix_transpose (double **m, long nr, long nc);
+double **NUMdmatrix_transpose (double **m, integer nr, integer nc);
 /*
 	Transpose a nr x nc matrix.
 */
@@ -148,10 +148,10 @@ double **NUMdmatrix_transpose (double **m, long nr, long nc);
  *     lo and hi must be valid indices in the array.
 */
 template <class T>
-void NUMvector_extrema (T *v, long lo, long hi, double *p_min, double *p_max) {
+void NUMvector_extrema (T *v, integer lo, integer hi, double *p_min, double *p_max) {
     T min = v[lo];
     T max = min;
-    for (long i = lo + 1; i <= hi; i++)
+    for (integer i = lo + 1; i <= hi; i++)
     {
         if (v[i] < min) min = v[i];
         else if (v[i] > max) max = v[i];
@@ -165,10 +165,10 @@ void NUMvector_extrema (T *v, long lo, long hi, double *p_min, double *p_max) {
 }
 
 template <class T>
-void NUMmatrix_extrema (T **x, long rb, long re, long cb, long ce, double *p_min, double *p_max) {
+void NUMmatrix_extrema (T **x, integer rb, integer re, integer cb, integer ce, double *p_min, double *p_max) {
     T min = x[rb][cb], max = min;
-    for (long i = rb; i <= re; i++) {
-        for (long j = cb; j <= ce; j++) {
+    for (integer i = rb; i <= re; i++) {
+        for (integer j = cb; j <= ce; j++) {
             T t = x[i][j];
             if (t < min) min = t;
             else if (t > max) max = t;
@@ -189,8 +189,8 @@ void NUMmatrix_extrema (T **x, long rb, long re, long cb, long ce, double *p_min
     c[i] = c[i] < min ? min : (c[i] > max ? max : c[i])
 */
 template <class T>
-void NUMvector_clip (T *v, long lo, long hi, double min, double max) {
-    for (long i = lo; i <= hi; i++)
+void NUMvector_clip (T *v, integer lo, integer hi, double min, double max) {
+    for (integer i = lo; i <= hi; i++)
     {
         if (v[i] < min) v[i] = min;
         else if (v[i] > max) v[i] = max;
@@ -198,89 +198,89 @@ void NUMvector_clip (T *v, long lo, long hi, double min, double max) {
 }
 
 template<class T>
-T ** NUMmatrix_transpose (T **m, long nr, long nc) {
+T ** NUMmatrix_transpose (T **m, integer nr, integer nc) {
     autoNUMmatrix<T> to (1, nc, 1, nr);
 
-    for (long i = 1; i <= nr; i++) {
-        for (long j = 1; j <= nc; j++) {
+    for (integer i = 1; i <= nr; i++) {
+        for (integer j = 1; j <= nc; j++) {
             to[j][i] = m[i][j];
         }
     }
     return to.transfer();
 }
 
-double NUMvector_normalize1 (double v[], long n);
+double NUMvector_normalize1 (double v[], integer n);
 
-double NUMvector_normalize2 (double v[], long n);
+double NUMvector_normalize2 (double v[], integer n);
 
-double NUMvector_getNorm1 (const double v[], long n);
+double NUMvector_getNorm1 (const double v[], integer n);
 
-double NUMvector_getNorm2 (const double v[], long n);
+double NUMvector_getNorm2 (const double v[], integer n);
 
-void  NUMcentreRows (double **a, long rb, long re, long cb, long ce);
+void  NUMcentreRows (double **a, integer rb, integer re, integer cb, integer ce);
 /*
 	a[i][j] -= a[i][.]
 */
-void NUMcentreColumns (double **a, long rb, long re, long cb, long ce, double *centres);
+void NUMcentreColumns (double **a, integer rb, integer re, integer cb, integer ce, double *centres);
 /*
 	a[i][j] -= a[.][j]
 	if centres != NULL the means are returned in centres[1..re-rb+1]
 */
 
-void NUMdoubleCentre (double **a, long rb, long re, long cb, long ce);
+void NUMdoubleCentre (double **a, integer rb, integer re, integer cb, integer ce);
 /*
 	Function: Make the average value of each column and each row zero.
 		a[i][j] += - a[i][.] - a[.][j] + a[.][.]
 */
 
-void NUMnormalizeRows (double **a, long nr, long nc, double norm);
+void NUMnormalizeRows (double **a, integer nr, integer nc, double norm);
 
-void NUMnormalizeColumns (double **a, long nr, long nc, double norm);
+void NUMnormalizeColumns (double **a, integer nr, integer nc, double norm);
 /*
 	Scale a[.][j] such that sqrt (Sum(a[i][j]^2, i=1..nPoints)) = norm.
 */
 
-void NUMnormalize (double **a, long nr, long nc, double norm);
+void NUMnormalize (double **a, integer nr, integer nc, double norm);
 /*
 	Scale all elements of the matrix [1..nr][1..nc] such that
 	(sqrt(Sum( a[i][j]^2, i=1..nr, j=1..nc)) becomes equal to norm.
 */
 
-void NUMstandardizeColumns (double **a, long rb, long re, long cb, long ce);
+void NUMstandardizeColumns (double **a, integer rb, integer re, integer cb, integer ce);
 /* a[i][j] = (a[i][j] - average[j]) / sigma[j] */
 
-void NUMstandardizeRows (double **a, long rb, long re, long cb, long ce);
+void NUMstandardizeRows (double **a, integer rb, integer re, integer cb, integer ce);
 /* a[i][j] = (a[i][j] - average[i]) / sigma[i] */
 
-void NUMaverageColumns (double **a, long rb, long re, long cb, long ce);
+void NUMaverageColumns (double **a, integer rb, integer re, integer cb, integer ce);
 /* a[i][j] = average[j]) */
 
-void NUMvector_avevar (double *a, long n, double *average, double *variance);
+void NUMvector_avevar (double *a, integer n, double *average, double *variance);
 
-void NUMcolumn_avevar (double **a, long nr, long nc, long icol, double *average, double *variance);
+void NUMcolumn_avevar (double **a, integer nr, integer nc, integer icol, double *average, double *variance);
 /*
 	Get mean and variance of a column.
 	When average and/or variance are NULL, the corresponding output is
 	NOT given.
  */
 
-void NUMcolumn2_avevar (double **a, long nr, long nc, long icol1, long icol2, double *average1, double *variance1, double *average2, double *variance2, double *covariance);
+void NUMcolumn2_avevar (double **a, integer nr, integer nc, integer icol1, integer icol2, double *average1, double *variance1, double *average2, double *variance2, double *covariance);
 /*
 	Get mean and variance of two columns.
 	When average and/or variance are NULL, the corresponding output is
 	NOT given.
  */
 
-void NUMvector_smoothByMovingAverage (double *xin, long n, long nwindow, double *xout);
+void NUMvector_smoothByMovingAverage (double *xin, integer n, integer nwindow, double *xout);
 
-void NUMcovarianceFromColumnCentredMatrix (double **x, long nrows, long ncols, long ndf, double **covar);
+void NUMcovarianceFromColumnCentredMatrix (double **x, integer nrows, integer ncols, integer ndf, double **covar);
 /*
 	Calculate covariance matrix(ncols x ncols) from data matrix (nrows x ncols);
 	The matrix covar must already have been allocated and centered.
 	covar[i][j] = sum (k=1..nrows, x[i]k]*x[k][j])/(nrows - ndf)
 */
 
-double NUMmultivariateKurtosis (double **x, long nrows, long ncols, int method);
+double NUMmultivariateKurtosis (double **x, integer nrows, integer ncols, int method);
 /*
 	calculate multivariate kurtosis.
 	method = 1 : Schott (2001), J. of Statistical planning and Inference 94, 25-36.
@@ -310,7 +310,7 @@ void NUMstatistics_huber (double *x, integer n, double *location, bool wantlocat
 	If work == NULL, the routine allocates (and destroys) its own memory.
 */
 
-void NUMmonotoneRegression (const double x[], long n, double xs[]);
+void NUMmonotoneRegression (const double x[], integer n, double xs[]);
 /*
 	Find numbers xs[1..n] that have a monotone relationship with
 	the numbers in x[1..n].
@@ -333,8 +333,8 @@ void NUMmonotoneRegression (const double x[], long n, double xs[]);
     It may occur that a_sorted[1] = a_presorted[2] and a_sorted[2] = a_presorted[1]
 */
 template<class T1, class T2>
-void NUMsort2 (long n, T1 *a, T2 *b) {
-    long l, r, j, i, imin;
+void NUMsort2 (integer n, T1 *a, T2 *b) {
+    integer l, r, j, i, imin;
     T1 k, min;
     T2 kb, min2;
     if (n < 2) {
@@ -400,8 +400,8 @@ void NUMsort2 (long n, T1 *a, T2 *b) {
     }
 }
 
-void NUMindexx (const double a[], long n, long indx[]);
-void NUMindexx_s (char32 *a[], long n, long indx[]);
+void NUMindexx (const double a[], integer n, integer indx[]);
+void NUMindexx_s (char32 *a[], integer n, integer indx[]);
 /*
 	Indexes the array a[1..n], i.e., outputs the array indx[1..n] such that
 	a[ indx[i] ] is in ascending order for i=1..n;
@@ -415,12 +415,12 @@ void NUMindexx_s (char32 *a[], long n, long indx[]);
  *  by {1, 3.5, 3.5, 3.5, 3.5, 4}, respectively. *
  */
 template <class T>
-void NUMrank (long n, T *a) {
-    long jt, j = 1;
+void NUMrank (integer n, T *a) {
+    integer jt, j = 1;
     while (j < n) {
         for (jt = j + 1; jt <= n && a[jt] == a[j]; jt++) {}
         T rank = (j + jt - 1) * 0.5;
-        for (long i = j; i <= jt - 1; i++) {
+        for (integer i = j; i <= jt - 1; i++) {
             a[i] = rank;
         }
         j = jt;
@@ -428,9 +428,9 @@ void NUMrank (long n, T *a) {
     if (j == n) a[n] = n;
 }
 
-void NUMrankColumns (double **m, long rb, long re, long cb, long ce);
+void NUMrankColumns (double **m, integer rb, integer re, integer cb, integer ce);
 
-void NUMlocate (double *xx, long n, double x, long *index);
+void NUMlocate (double *xx, integer n, double x, integer *index);
 /*
 	Given an array xx[1..n], and given a value x, returns a value index
 	such that xx[index] < x <=  xx[index+1].
@@ -438,7 +438,7 @@ void NUMlocate (double *xx, long n, double x, long *index);
 	Error: index = 0 or index = n (out of range)
 */
 
-int NUMjacobi (float **a, long n, float d[], float **v, long *nrot);
+int NUMjacobi (float **a, integer n, float d[], float **v, integer *nrot);
 /*
 	This version deviates from the NR version.
 	HERE: v[1..n][1..n] is a matrix whose ROWS
@@ -451,7 +451,7 @@ int NUMjacobi (float **a, long n, float d[], float **v, long *nrot);
 	`nrot' returns the number of Jacobi rotations that were required.
  */
 
-void NUMtred2 (double **a, long n, double d[], double e[]);
+void NUMtred2 (double **a, integer n, double d[], double e[]);
 /*
 	Householder reduction of a real, symmetric matrix a[1..n][1..n]. On output,
 	a is replaced by the orthogonal matrix Q effecting the transformation.
@@ -459,7 +459,7 @@ void NUMtred2 (double **a, long n, double d[], double e[]);
 	the off-diagonal elements, with e[1] = 0.
 */
 
-int NUMtqli (double d[], double e[], long n, double **z);
+int NUMtqli (double d[], double e[], integer n, double **z);
 /*
 	QL algorithm with implicit shifts, to determine the (sorted) eigenvalues
 	and eigenvectors of a real, symmetric, tridiagonal matrix, or of a real,
@@ -477,14 +477,14 @@ int NUMtqli (double d[], double e[], long n, double **z);
 	Returns 0 in case of too many rotations.
 */
 
-int NUMgaussj (double **a, long n, double **b, long m);
+int NUMgaussj (double **a, integer n, double **b, integer m);
 /*
 	Calculate inverse of square matrix a[1..n][1..n] (in-place).
 	Method: Gauss-Jordan elimination with full pivoting.
 	Error message in case of singular matrix.
 */
 
-int NUMsvdcmp (double **a, long m, long n, double w[], double **v);
+int NUMsvdcmp (double **a, integer m, integer n, double w[], double **v);
 /*
 	Given a matrix a[1..m][1..n], this routine computes its singular
 	value decomposition, A = U.W.V'. The matrix U replaces a on output.
@@ -493,7 +493,7 @@ int NUMsvdcmp (double **a, long m, long n, double w[], double **v);
 	Possible errors: no memory or more than 30 iterations.
  */
 
-int NUMsvbksb (double **u, double w[], double **v, long m, long n, double b[], double x[]);
+int NUMsvbksb (double **u, double w[], double **v, integer m, integer n, double b[], double x[]);
 /*
 	Solves A.X=B for a vector X, where A is specified by the arrays
 	u[1..m][1..n], w[1..n], v[1..n][1..n] as returned by NUMsvdcmp.
@@ -503,7 +503,7 @@ int NUMsvbksb (double **u, double w[], double **v, long m, long n, double b[], d
 	Possible errors: no memory.
 */
 
-int NUMludcmp (double **a, long n, long *indx, double *d);
+int NUMludcmp (double **a, integer n, integer *indx, double *d);
 /*	Given a matrix a[1..n][1..n], this routine replaces it by the
 	LU decomposition of a rowwise permutation of itself.
 	a	: matrix [1..n][1..n]
@@ -514,34 +514,34 @@ int NUMludcmp (double **a, long n, long *indx, double *d);
 		even/odd.
 */
 
-int NUMcholeskyDecomposition (double **a, long n, double d[]);
+int NUMcholeskyDecomposition (double **a, integer n, double d[]);
 /*
 	Cholesky decomposition of a symmetric positive definite matrix.
 */
 
-void NUMcholeskySolve (double **a, long n, double d[], double b[], double x[]);
+void NUMcholeskySolve (double **a, integer n, double d[], double b[], double x[]);
 /*
 	Solves A.x=b for x. A[][] and d[] are output from NUMcholeskyDecomposition.
 */
 
-void NUMlowerCholeskyInverse (double **a, long n, double *lnd);
+void NUMlowerCholeskyInverse (double **a, integer n, double *lnd);
 /*
 	Calculates L^-1, where A = L.L' is a symmetric positive definite matrix
 	and ln(determinant). L^-1 in lower, leave upper part intact.
 */
 
-double **NUMinverseFromLowerCholesky (double **m, long n);
+double **NUMinverseFromLowerCholesky (double **m, integer n);
 /*
 	Return the complete matrix inverse (m x m).
 	Input is the lower Cholesky decomposition of the inverse as calculated by NUMlowerCholeskyInverse.
 */
 
-void NUMdeterminant_cholesky (double **a, long n, double *lnd);
+void NUMdeterminant_cholesky (double **a, integer n, double *lnd);
 /*
 	ln(determinant) of a symmetric p.s.d. matrix
 */
 
-double NUMmahalanobisDistance_chi (double **l, double *v, double *m, long nr, long nc);
+double NUMmahalanobisDistance_chi (double **l, double *v, double *m, integer nr, integer nc);
 /*
 	Calculates squared Mahalanobis distance: (v-m)'S^-1(v-m).
 	Input matrix (li) is the inverse L^-1 of the Cholesky decomposition S = L.L'
@@ -551,16 +551,16 @@ double NUMmahalanobisDistance_chi (double **l, double *v, double *m, long nr, lo
 			(L**-1.(x-m))' . (L**-1.(x-m))
 */
 
-double NUMtrace (double **a, long n);
-double NUMtrace2 (double **a1, double **a2, long n);
+double NUMtrace (double **a, integer n);
+double NUMtrace2 (double **a1, double **a2, integer n);
 /*
 	Calculates the trace from the product matrix a1 * a2.
 	a1 and a2 are [1..n][1..n] square matrices.
 */
 
-void eigenSort (double d[], double **v, long n, int sort);
+void eigenSort (double d[], double **v, integer n, int sort);
 
-void NUMeigensystem (double **a, long n, double **evec, double eval[]);
+void NUMeigensystem (double **a, integer n, double **evec, double eval[]);
 /*
 	Determines the eigensystem of a real, symmetric matrix[1..][1..n].
 	Returned are: evec[1..n][1..n] with eigenvectors (columnwise) and
@@ -570,7 +570,7 @@ void NUMeigensystem (double **a, long n, double **evec, double eval[]);
 	Eigenvalues (with corresponding eigenvectors) are sorted in descending order.
 */
 
-void NUMdmatrix_projectRowsOnEigenspace (double **data, long numberOfRows, long from_col, double **eigenvectors, long numberOfEigenvectors, long dimension, double **projection, long to_col);
+void NUMdmatrix_projectRowsOnEigenspace (double **data, integer numberOfRows, integer from_col, double **eigenvectors, integer numberOfEigenvectors, integer dimension, double **projection, integer to_col);
 /* Input:
 	data[numberOfRows, from_col - 1 + my dimension] 
 		contains the 'numberOfRows' vectors to be projected on the eigenspace. 
@@ -583,7 +583,7 @@ void NUMdmatrix_projectRowsOnEigenspace (double **data, long numberOfRows, long
    Project (part of) the vectors in matrix 'data' along the 'numberOfEigenvectors' eigenvectors into the matrix 'projection'.
  */
 
-void NUMdmatrix_projectColumnsOnEigenspace (double **data, long numberOfColumns, double **eigenvectors, long numberOfEigenvectors, long dimension, double **projection);
+void NUMdmatrix_projectColumnsOnEigenspace (double **data, integer numberOfColumns, double **eigenvectors, integer numberOfEigenvectors, integer dimension, double **projection);
 /* Input:
  	data[dimension, numberOfColumns]
  		contains the column vectors to be projected on the eigenspace.
@@ -597,7 +597,7 @@ void NUMdmatrix_projectColumnsOnEigenspace (double **data, long numberOfColumns,
 */
 
 
-void NUMdominantEigenvector (double **mns, long n, double *q, double *lambda, double tolerance);
+void NUMdominantEigenvector (double **mns, integer n, double *q, double *lambda, double tolerance);
 /*
 	Determines the first dominant eigenvector from a GENERAL matrix
 	mns[1..n][1..].
@@ -611,8 +611,8 @@ void NUMdominantEigenvector (double **mns, long n, double *q, double *lambda, do
 	London, (Par. 7.3.1 The Power Method)
 */
 
-void NUMdmatrix_into_principalComponents (double **m, long nrows, long ncols,
-	long numberOfComponents, double **pc);
+void NUMdmatrix_into_principalComponents (double **m, integer nrows, integer ncols,
+	integer numberOfComponents, double **pc);
 /*
 	Precondition:
 		numberOfComponents > 0 && numberOfComponents <= ncols
@@ -636,20 +636,20 @@ void NUMdmatrix_into_principalComponents (double **m, long nrows, long ncols,
 		principal directions.
 */
 
-void NUMprincipalComponents (double **a, long n, long nComponents, double **pc);
+void NUMprincipalComponents (double **a, integer n, integer nComponents, double **pc);
 /*
 	Determines the principal components of a real symmetric matrix
 	a[1..n][1..n] as a pc[1..n][1..nComponents] column matrix.
 */
 
-void NUMpseudoInverse (double **y, long nr, long nc, double **yinv, double tolerance);
+void NUMpseudoInverse (double **y, integer nr, integer nc, double **yinv, double tolerance);
 /*
 	Determines the pseudo-inverse Y^-1 of Y[1..nr][1..nc] via s.v.d.
 	Alternative notation for pseudo-inverse: (Y'.Y)^-1.Y'
 	Returns a [1..nc][1..nr] matrix
 */
 
-long NUMsolveQuadraticEquation (double a, double b, double c, double *x1, double *x2);
+integer NUMsolveQuadraticEquation (double a, double b, double c, double *x1, double *x2);
 /*
 	Finds the real roots of ax^2 + bx + c = 0.
 	The number of real roots is returned and their locations in x1 and x2.
@@ -657,7 +657,7 @@ long NUMsolveQuadraticEquation (double a, double b, double c, double *x1, double
 	If no roots found then x1 and x2 will not be changed.
 */
 
-void NUMsolveEquation (double **a, long nr, long nc, double *b, double tol, double *x);
+void NUMsolveEquation (double **a, integer nr, integer nc, double *b, double tol, double *x);
 /*
 	Solve the equation: a.x = b;
 	a[1..nr][1..nc], b[1..nr] and the unknown x[1..nc]
@@ -665,7 +665,7 @@ void NUMsolveEquation (double **a, long nr, long nc, double *b, double tol, doub
 	Algorithm: s.v.d.
 */
 
-void NUMsolveEquations (double **a, long nr, long nc, double **b, long ncb, double tol, double **x);
+void NUMsolveEquations (double **a, integer nr, integer nc, double **b, integer ncb, double tol, double **x);
 /*
 	Solve the equation: a.x = b;
 	a[1..nr][1..nc], b[1..nr][1..nc2] and the unknown x[1..nc][1..nc2]
@@ -673,8 +673,8 @@ void NUMsolveEquations (double **a, long nr, long nc, double **b, long ncb, doub
 	Algorithm: s.v.d.
 */
 
-void NUMsolveNonNegativeLeastSquaresRegression (double **a, long nr, long nc,
-	double *b, double tol, long itermax, double *x);
+void NUMsolveNonNegativeLeastSquaresRegression (double **a, integer nr, integer nc,
+	double *b, double tol, integer itermax, double *x);
 /*
 	Solve the equation: a.x = b for x under the constraint: all x[i] >= 0;
 	a[1..nr][1..nc], b[1..nr] and x[1..nc].
@@ -683,7 +683,7 @@ void NUMsolveNonNegativeLeastSquaresRegression (double **a, long nr, long nc,
 */
 
 void NUMsolveConstrainedLSQuadraticRegression (double **o, const double y[],
-	long n, double *alpha, double *gamma);
+	integer n, double *alpha, double *gamma);
 /*
 	Solve y[i] = alpha + beta * x[i] + gamma * x[i]^2, with i = 1..n,
 	subject to the constraint beta^2 = 4 * alpha * gamma, for alpha and
@@ -696,7 +696,7 @@ void NUMsolveConstrainedLSQuadraticRegression (double **o, const double y[],
 	Psychometrika 48, 631-638.
 */
 
-void NUMsolveWeaklyConstrainedLinearRegression (double **f, long n, long m, double phi[],
+void NUMsolveWeaklyConstrainedLinearRegression (double **f, integer n, integer m, double phi[],
 	double alpha, double delta, double t[]);
 /*
 	Solve g(t) = ||Ft - phi||^2 + alpha (t't - delta)^2 for t[1..m],
@@ -714,8 +714,8 @@ void NUMsolveWeaklyConstrainedLinearRegression (double **f, long n, long m, doub
 		alpha >= 0
 */
 
-void NUMProcrustes (double **x, double **y, long nPoints,
-	long nDimensions, double **t, double v[], double *s);
+void NUMProcrustes (double **x, double **y, integer nPoints,
+	integer nDimensions, double **t, double v[], double *s);
 /*
 	Given two configurations x and y (nPoints x nDimensions), find the
 	the Procrustes rotation/reflection matrix T, the translation vector v and the scaling
@@ -740,7 +740,7 @@ double NUMridders (double (*f) (double x, void *closure), double xmin, double xm
 		root not bracketed.
 */
 
-void NUMmspline (double knot[], long nKnots, long order, long i, double x,
+void NUMmspline (double knot[], integer nKnots, integer order, integer i, double x,
 	double *y);
 /*
 	Calculates an M-spline for a knot sequence.
@@ -753,7 +753,7 @@ void NUMmspline (double knot[], long nKnots, long order, long i, double x,
 	Error condition: no memory.
 */
 
-void NUMispline (double aknot[], long nKnots, long order, long i, double x,
+void NUMispline (double aknot[], integer nKnots, integer order, integer i, double x,
 	double *y);
 /*
 	Calculates an I-spline for simple knot sequences: only one knot at each
@@ -771,7 +771,7 @@ void NUMispline (double aknot[], long nKnots, long order, long i, double x,
 	Error condition: no memory.
 */
 
-double NUMwilksLambda (double *lambda, long from, long to);
+double NUMwilksLambda (double *lambda, integer from, integer to);
 /*
 	Calculate: Product (i=from..to; 1/(1+lambda[i]))
 	Preconditions: to >= from
@@ -877,7 +877,7 @@ double NUMinvTukeyQ (double p, double cc, double df, double rr);
  *  df = degrees of freedom of error term
  */
 
-double NUMnormalityTest_HenzeZirkler (double **data, long n, long p, double *beta, double *tnb, double *lnmu, double *lnvar);
+double NUMnormalityTest_HenzeZirkler (double **data, integer n, integer p, double *beta, double *tnb, double *lnmu, double *lnvar);
 /*
 	Multivariate normality test of nxp data matrix according to the method described in Henze & Wagner (1997).
 	The test statistic is returned in tnb, together with the lognormal mean 'lnmu' and the lognormal variance 'lnvar'.
@@ -995,14 +995,14 @@ double NUMformantfilter_amplitude (double fc, double bw, double f);
 	Preconditions: f > 0 && bw > 0
 */
 
-int NUMburg (double x[], long n, double a[], int m, double *xms);
+int NUMburg (double x[], integer n, double a[], int m, double *xms);
 /*
 	Calculates linear prediction coefficients according to the algorithm
 	from J.P. Burg as described by N.Anderson in Childers, D. (ed), Modern
 	Spectrum Analysis, IEEE Press, 1978, 252-255.
 */
 
-void NUMdmatrix_to_dBs (double **m, long rb, long re, long cb, long ce,
+void NUMdmatrix_to_dBs (double **m, integer rb, integer re, integer cb, integer ce,
 	double ref, double factor, double floor);
 /*
 	Transforms the values in the matrix m[rb..re][cb..ce] to dB's
@@ -1019,7 +1019,7 @@ void NUMdmatrix_to_dBs (double **m, long rb, long re, long cb, long ce,
 		Matrix elements < 0;
 */
 
-double **NUMcosinesTable (long first, long last, long npoints);
+double **NUMcosinesTable (integer first, integer last, integer npoints);
 /*
 	Generate table with cosines.
 
@@ -1033,7 +1033,7 @@ double **NUMcosinesTable (long first, long last, long npoints);
 
 /******  Interpolation ****/
 
-void NUMspline (double x[], double y[], long n, double yp1, double ypn, double y2[]);
+void NUMspline (double x[], double y[], integer n, double yp1, double ypn, double y2[]);
 /*
 	Given arrays a[1..n] and y[1..n] containing a tabulated function, i.e.,
 	y[i] = f(x[i]), with x[1] < x[2] < ... < x[n], and given values yp1 and
@@ -1046,7 +1046,7 @@ void NUMspline (double x[], double y[], long n, double yp1, double ypn, double y
 	zero second derivative on that boundary.
 */
 
-void NUMsplint (double xa[], double ya[], double y2a[], long n, double x, double *y);
+void NUMsplint (double xa[], double ya[], double y2a[], integer n, double x, double *y);
 /*
 	Given arrays xa[1..n] and ya[1..n] containing a tabulated function,
 	i.e., y[i] = f(x[i]), with x[1] < x[2] < ... < x[n], and given the
@@ -1143,14 +1143,14 @@ double NUMminimize_brent (double (*f) (double x, void *closure), double a, doubl
 
 struct structNUMfft_Table
 {
-  long n;
+  integer n;
   double *trigcache;
-  long *splitcache;
+  integer *splitcache;
 };
 
 typedef struct structNUMfft_Table *NUMfft_Table;
 
-void NUMfft_Table_init (NUMfft_Table table, long n);
+void NUMfft_Table_init (NUMfft_Table table, integer n);
 /*
 	n : data size
 */
@@ -1255,7 +1255,7 @@ void NUMfft_backward (NUMfft_Table table, double *data);
 
 /**** Compatibility with NR fft's */
 
-void NUMforwardRealFastFourierTransform (double  *data, long n);
+void NUMforwardRealFastFourierTransform (double  *data, integer n);
 /*
 	Function:
 		Calculates the Fourier Transform of a set of n real-valued data points.
@@ -1269,7 +1269,7 @@ void NUMforwardRealFastFourierTransform (double  *data, long n);
 		data [2] contains real valued last component (Nyquist frequency)
 		data [3..n] odd index : real part; even index: imaginary part of DFT.
 */
-void NUMreverseRealFastFourierTransform (double  *data, long n);
+void NUMreverseRealFastFourierTransform (double  *data, integer n);
 /*
 	Function:
 		Calculates the inverse transform of a complex array if it is the transform of real data.
@@ -1281,19 +1281,19 @@ void NUMreverseRealFastFourierTransform (double  *data, long n);
 		data [2] contains real valued last component (Nyquist frequency)
 		data [3..n] odd index : real part; even index: imaginary part of DFT.
 */
-void NUMrealft (double *data, long n, int direction);
+void NUMrealft (double *data, integer n, int direction);
 
-long NUMgetIndexFromProbability (double *probs, long nprobs, double p);
+integer NUMgetIndexFromProbability (double *probs, integer nprobs, double p);
 
 // Fit the line y= ax+b
-void NUMlineFit (double *x, double *y, long numberOfPoints, double *m, double *intercept, int method);
+void NUMlineFit (double *x, double *y, integer numberOfPoints, double *m, double *intercept, int method);
 /* method
  * 1 least squares
  * 2 rubust incomplete Theil O(N/2)
  * 3 robust complete Theil (very slow for large N, O(N^2))
  */
 
-void NUMlineFit_theil (double *x, double *y, long numberOfPoints, double *m, double *intercept, bool incompleteMethod);
+void NUMlineFit_theil (double *x, double *y, integer numberOfPoints, double *m, double *intercept, bool incompleteMethod);
 /*
  * Preconditions:
  *		all x[i] must be different, i.e. x[i] != x[j] for all i = 1..(numberOfPoints - 1), j = (i+1) ..numberOfPoints
@@ -1313,7 +1313,7 @@ void NUMlineFit_theil (double *x, double *y, long numberOfPoints, double *m, dou
  */
 
 
-void NUMlineFit_LS (double *x, double *y, long numberOfPoints, double *m, double *intercept);
+void NUMlineFit_LS (double *x, double *y, integer numberOfPoints, double *m, double *intercept);
 
 /* The binomial distribution has the form,
 
@@ -1353,24 +1353,24 @@ void NUMlineFit_LS (double *x, double *y, long numberOfPoints, double *m, double
 
    Additional polishing for GSL coding standards by Brian Gough.  */
 
-long NUMrandomBinomial (double p, long n);
-double NUMrandomBinomial_real (double p, long n);
+integer NUMrandomBinomial (double p, integer n);
+double NUMrandomBinomial_real (double p, integer n);
 
 // IEEE: Programs for digital signal processing section 4.3 LPTRN (modfied)
 
 // lpc[1..n] to rc[1..n]
-void NUMlpc_lpc_to_rc (double *lpc, long p, double *rc);
+void NUMlpc_lpc_to_rc (double *lpc, integer p, double *rc);
 
 // rc[1..n] to area[1..n+1], area[m+1] = 0.0001; (1 cm^2)
-void NUMlpc_rc_to_area (double *rc, long n, double *area);
+void NUMlpc_rc_to_area (double *rc, integer n, double *area);
 
 // area[1..n] to rc[1..n-1] (modification: LPTRN assumes area[n+1])
-void NUMlpc_area_to_rc (double *area, long n, double *rc);
+void NUMlpc_area_to_rc (double *area, integer n, double *rc);
 
 // area[1..n] to lpc[1..n-1]! (modification: lptrn gives lpc[1] = 1 we don't)
-void NUMlpc_area_to_lpc (double *area, long n, double *lpc);
+void NUMlpc_area_to_lpc (double *area, integer n, double *lpc);
 
 // lpc[1..n] to area[1..n+1], area[m+1] = 0.0001; (1 cm^2)
-void NUMlpc_lpc_to_area (double *lpc, long m, double *area);
+void NUMlpc_lpc_to_area (double *lpc, integer m, double *area);
 
 #endif // _NUM2_h_
diff --git a/dwsys/NUMcblas.cpp b/dwsys/NUMcblas.cpp
index b938970..41daa66 100644
--- a/dwsys/NUMcblas.cpp
+++ b/dwsys/NUMcblas.cpp
@@ -24,19 +24,19 @@
 #define MAX(m,n) ((m) > (n) ? (m) : (n))
 #define MIN(m,n) ((m) < (n) ? (m) : (n))
 
-static int dlamc1_ (long *beta, long *t, long *rnd, long *ieee1);
-static int dlamc2_ (long *beta, long *t, long *rnd, double *eps, long *emin, double *rmin, long *emax,
+static int dlamc1_ (integer *beta, integer *t, integer *rnd, integer *ieee1);
+static int dlamc2_ (integer *beta, integer *t, integer *rnd, double *eps, integer *emin, double *rmin, integer *emax,
                     double *rmax);
 static double dlamc3_ (double *, double *);
-static int dlamc4_ (long *emin, double *start, long *base);
-static int dlamc5_ (long *beta, long *p, long *emin, long *ieee, long *emax, double *rmax);
+static int dlamc4_ (integer *emin, double *start, integer *base);
+static int dlamc5_ (integer *beta, integer *p, integer *emin, integer *ieee, integer *emax, double *rmax);
 
-int NUMblas_daxpy (long *n, double *da, double *dx, long *incx, double *dy, long *incy) {
+int NUMblas_daxpy (integer *n, double *da, double *dx, integer *incx, double *dy, integer *incy) {
 	/* System generated locals */
-	long i__1;
+	integer i__1;
 
 	/* Local variables */
-	static long i__, m, ix, iy, mp1;
+	static integer i__, m, ix, iy, mp1;
 
 	--dy;
 	--dx;
@@ -94,12 +94,12 @@ L40:
 	return 0;
 }								/* NUMblas_daxpy */
 
-int NUMblas_dcopy (long *n, double *dx, long *incx, double *dy, long *incy) {
+int NUMblas_dcopy (integer *n, double *dx, integer *incx, double *dy, integer *incy) {
 	/* System generated locals */
-	long i__1;
+	integer i__1;
 
 	/* Local variables */
-	static long i__, m, ix, iy, mp1;
+	static integer i__, m, ix, iy, mp1;
 
 	--dy;
 	--dx;
@@ -157,15 +157,15 @@ L40:
 	return 0;
 }								/* NUMblas_dcopy */
 
-double NUMblas_ddot (long *n, double *dx, long *incx, double *dy, long *incy) {
+double NUMblas_ddot (integer *n, double *dx, integer *incx, double *dy, integer *incy) {
 	/* System generated locals */
-	long i__1;
+	integer i__1;
 	double ret_val;
 
 	/* Local variables */
-	static long i__, m;
+	static integer i__, m;
 	static double dtemp;
-	static long ix, iy, mp1;
+	static integer ix, iy, mp1;
 
 	/* Parameter adjustments */
 	--dy;
@@ -225,17 +225,17 @@ L60:
 	return ret_val;
 }								/* NUMblas_ddot */
 
-int NUMblas_dgemm (const char *transa, const char *transb, long *m, long *n, long *k, double *alpha, double *a, long *lda,
-                   double *b, long *ldb, double *beta, double *c__, long *ldc) {
+int NUMblas_dgemm (const char *transa, const char *transb, integer *m, integer *n, integer *k, double *alpha, double *a, integer *lda,
+                   double *b, integer *ldb, double *beta, double *c__, integer *ldc) {
 	/* System generated locals */
-	long a_dim1, a_offset, b_dim1, b_offset, c_dim1, c_offset, i__1, i__2, i__3;
+	integer a_dim1, a_offset, b_dim1, b_offset, c_dim1, c_offset, i__1, i__2, i__3;
 
 	/* Local variables */
-	static long info;
-	static long nota, notb;
+	static integer info;
+	static integer nota, notb;
 	static double temp;
-	static long i__, j, l, ncola;
-	static long nrowa, nrowb;
+	static integer i__, j, l, ncola;
+	static integer nrowa, nrowb;
 
 #define a_ref(a_1,a_2) a[(a_2)*a_dim1 + a_1]
 #define b_ref(a_1,a_2) b[(a_2)*b_dim1 + a_1]
@@ -438,15 +438,15 @@ int NUMblas_dgemm (const char *transa, const char *transb, long *m, long *n, lon
 #undef b_ref
 #undef a_ref
 
-int NUMblas_dger (long *m, long *n, double *alpha, double *x, long *incx, double *y, long *incy, double *a,
-                  long *lda) {
+int NUMblas_dger (integer *m, integer *n, double *alpha, double *x, integer *incx, double *y, integer *incy, double *a,
+                  integer *lda) {
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2;
+	integer a_dim1, a_offset, i__1, i__2;
 
 	/* Local variables */
-	static long info;
+	static integer info;
 	static double temp;
-	static long i__, j, ix, jy, kx;
+	static integer i__, j, ix, jy, kx;
 
 #define a_ref(a_1,a_2) a[(a_2)*a_dim1 + a_1]
 	/* Test the input parameters. Parameter adjustments */
@@ -524,16 +524,16 @@ int NUMblas_dger (long *m, long *n, double *alpha, double *x, long *incx, double
 
 #undef a_ref
 
-int NUMblas_dgemv (const char *trans, long *m, long *n, double *alpha, double *a, long *lda, double *x, long *incx,
-                   double *beta, double *y, long *incy) {
+int NUMblas_dgemv (const char *trans, integer *m, integer *n, double *alpha, double *a, integer *lda, double *x, integer *incx,
+                   double *beta, double *y, integer *incy) {
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2;
+	integer a_dim1, a_offset, i__1, i__2;
 
 	/* Local variables */
-	static long info;
+	static integer info;
 	static double temp;
-	static long lenx, leny, i__, j;
-	static long ix, iy, jx, jy, kx, ky;
+	static integer lenx, leny, i__, j;
+	static integer ix, iy, jx, jy, kx, ky;
 
 #define a_ref(a_1,a_2) a[(a_2)*a_dim1 + a_1]
 
@@ -698,22 +698,22 @@ int NUMblas_dgemv (const char *trans, long *m, long *n, double *alpha, double *a
 
 double NUMblas_dlamch (const char *cmach) {
 	/* Initialized data */
-	static long first = TRUE;
+	static integer first = TRUE;
 
 	/* System generated locals */
-	long i__1;
+	integer i__1;
 	double ret_val;
 
 	/* Builtin functions */
 	/* Local variables */
 	static double base;
-	static long beta;
+	static integer beta;
 	static double emin, prec, emax;
-	static long imin, imax;
-	static long lrnd;
+	static integer imin, imax;
+	static integer lrnd;
 	static double rmin, rmax, t, rmach;
 	static double smal, sfmin;
-	static long it;
+	static integer it;
 	static double rnd, eps;
 
 	if (first) {
@@ -770,7 +770,7 @@ double NUMblas_dlamch (const char *cmach) {
 	return ret_val;
 }								/* NUMblas_dlamch */
 
-static int dlamc1_ (long *beta, long *t, long *rnd, long *ieee1) {
+static int dlamc1_ (integer *beta, integer *t, integer *rnd, integer *ieee1) {
 	/* -- LAPACK auxiliary routine (version 3.0) -- Univ. of Tennessee, Univ.
 	   of California Berkeley, NAG Ltd., Courant Institute, Argonne National
 	   Lab, and Rice University October 31, 1992
@@ -810,19 +810,19 @@ static int dlamc1_ (long *beta, long *t, long *rnd, long *ieee1) {
 
 	   ===================================================================== */
 	/* Initialized data */
-	static long first = TRUE;
+	static integer first = TRUE;
 
 	/* System generated locals */
 	double d__1, d__2;
 
 	/* Local variables */
-	static long lrnd;
+	static integer lrnd;
 	static double a, b, c, f;
-	static long lbeta;
+	static integer lbeta;
 	static double savec;
-	static long lieee1;
+	static integer lieee1;
 	static double t1, t2;
-	static long lt;
+	static integer lt;
 	static double one, qtr;
 
 	if (first) {
@@ -875,7 +875,7 @@ L20:
 		savec = c;
 		d__1 = -a;
 		c = dlamc3_ (&c, &d__1);
-		lbeta = (long) (c + qtr);
+		lbeta = (integer) (c + qtr);
 
 		/* Now determine whether rounding or chopping occurs, by adding a bit
 		   less than beta/2 and a bit more than beta/2 to a. */
@@ -940,7 +940,7 @@ L30:
 	return 0;
 }								/* dlamc1_ */
 
-static int dlamc2_ (long *beta, long *t, long *rnd, double *eps, long *emin, double *rmin, long *emax,
+static int dlamc2_ (integer *beta, integer *t, integer *rnd, double *eps, integer *emin, double *rmin, integer *emax,
                     double *rmax) {
 	/* -- LAPACK auxiliary routine (version 3.0) -- Univ. of Tennessee, Univ.
 	   of California Berkeley, NAG Ltd., Courant Institute, Argonne National
@@ -986,27 +986,27 @@ static int dlamc2_ (long *beta, long *t, long *rnd, double *eps, long *emin, dou
 	   ===================================================================== */
 	/* Table of constant values */
 	/* Initialized data */
-	static long first = TRUE;
-	static long iwarn = FALSE;
+	static integer first = TRUE;
+	static integer iwarn = FALSE;
 
 	/* System generated locals */
-	long i__1;
+	integer i__1;
 	double d__1, d__2, d__3, d__4, d__5;
 
 	/* Builtin functions */
 	/* Local variables */
-	static long ieee;
+	static integer ieee;
 	static double half;
-	static long lrnd;
+	static integer lrnd;
 	static double leps, zero, a, b, c;
-	static long i, lbeta;
+	static integer i, lbeta;
 	static double rbase;
-	static long lemin, lemax, gnmin;
+	static integer lemin, lemax, gnmin;
 	static double smal;
-	static long gpmin;
+	static integer gpmin;
 	static double third, lrmin, lrmax, sixth;
-	static long lieee1;
-	static long lt, ngnmin, ngpmin;
+	static integer lieee1;
+	static integer lt, ngnmin, ngpmin;
 	static double one, two;
 
 	if (first) {
@@ -1201,7 +1201,7 @@ static double dlamc3_ (double *a, double *b)
 	return ret_val;
 }								/* dlamc3_ */
 
-static int dlamc4_ (long *emin, double *start, long *base) {
+static int dlamc4_ (integer *emin, double *start, integer *base) {
 	/* -- LAPACK auxiliary routine (version 2.0) -- Univ. of Tennessee, Univ.
 	   of California Berkeley, NAG Ltd., Courant Institute, Argonne National
 	   Lab, and Rice University October 31, 1992
@@ -1225,12 +1225,12 @@ static int dlamc4_ (long *emin, double *start, long *base) {
 
 	   ===================================================================== */
 	/* System generated locals */
-	long i__1;
+	integer i__1;
 	double d__1;
 
 	/* Local variables */
 	static double zero, a;
-	static long i;
+	static integer i;
 	static double rbase, b1, b2, c1, c2, d1, d2;
 	static double one;
 
@@ -1278,7 +1278,7 @@ L10:
 	return 0;
 }								/* dlamc4_ */
 
-static int dlamc5_ (long *beta, long *p, long *emin, long *ieee, long *emax, double *rmax) {
+static int dlamc5_ (integer *beta, integer *p, integer *emin, integer *ieee, integer *emax, double *rmax) {
 	/*
 	   First compute LEXP and UEXP, two powers of 2 that bound abs(EMIN). We
 	   then assume that EMAX + abs(EMIN) will sum approximately to the bound
@@ -1288,17 +1288,17 @@ static int dlamc5_ (long *beta, long *p, long *emin, long *ieee, long *emax, dou
 	static double c_b5 = 0.;
 
 	/* System generated locals */
-	long i__1;
+	integer i__1;
 	double d__1;
 
 	/* Local variables */
-	static long lexp;
+	static integer lexp;
 	static double oldy;
-	static long uexp, i;
+	static integer uexp, i;
 	static double y, z;
-	static long nbits;
+	static integer nbits;
 	static double recbas;
-	static long exbits, expsum, try__;
+	static integer exbits, expsum, try__;
 
 	lexp = 1;
 	exbits = 1;
@@ -1388,16 +1388,16 @@ L10:
 	return 0;
 }								/* dlamc5_ */
 
-double NUMblas_dnrm2 (long *n, double *x, long *incx) {
+double NUMblas_dnrm2 (integer *n, double *x, integer *incx) {
 	/* The following loop is equivalent to this call to the LAPACK auxiliary
 	   routine: CALL DLASSQ( N, X, INCX, SCALE, SSQ ) */
 	/* System generated locals */
-	long i__1, i__2;
+	integer i__1, i__2;
 	double ret_val, d__1;
 
 	/* Local variables */
 	static double norm, scale, absxi;
-	static long ix;
+	static integer ix;
 	static double ssq;
 
 	--x;
@@ -1435,14 +1435,14 @@ double NUMblas_dnrm2 (long *n, double *x, long *incx) {
 	return ret_val;
 }								/* NUMblas_dnrm2 */
 
-int NUMblas_drot (long *n, double *dx, long *incx, double *dy, long *incy, double *c__, double *s) {
+int NUMblas_drot (integer *n, double *dx, integer *incx, double *dy, integer *incy, double *c__, double *s) {
 	/* System generated locals */
-	long i__1;
+	integer i__1;
 
 	/* Local variables */
-	static long i__;
+	static integer i__;
 	static double dtemp;
-	static long ix, iy;
+	static integer ix, iy;
 
 	/* applies a plane rotation. jack dongarra, linpack, 3/11/78. modified
 	   12/3/93, array(1) declarations changed to array(*) Parameter
@@ -1488,12 +1488,12 @@ L20:
 	return 0;
 }								/* NUMblas_drot */
 
-int NUMblas_dscal (long *n, double *da, double *dx, long *incx) {
+int NUMblas_dscal (integer *n, double *da, double *dx, integer *incx) {
 	/* System generated locals */
-	long i__1, i__2;
+	integer i__1, i__2;
 
 	/* Local variables */
-	static long i__, m, nincx, mp1;
+	static integer i__, m, nincx, mp1;
 
 	/* Parameter adjustments */
 	--dx;
@@ -1541,14 +1541,14 @@ L40:
 	return 0;
 }								/* dscal_ */
 
-int NUMblas_dswap (long *n, double *dx, long *incx, double *dy, long *incy) {
+int NUMblas_dswap (integer *n, double *dx, integer *incx, double *dy, integer *incy) {
 	/* System generated locals */
-	long i__1;
+	integer i__1;
 
 	/* Local variables */
-	static long i__, m;
+	static integer i__, m;
 	static double dtemp;
-	static long ix, iy, mp1;
+	static integer ix, iy, mp1;
 
 	/* interchanges two vectors. uses unrolled loops for increments equal
 	   one. jack dongarra, linpack, 3/11/78. modified 12/3/93, array(1)
@@ -1615,16 +1615,16 @@ L40:
 	return 0;
 }								/* NUMblas_dswap */
 
-int NUMblas_dsymv (const char *uplo, long *n, double *alpha, double *a, long *lda, double *x, long *incx, double *beta,
-                   double *y, long *incy) {
+int NUMblas_dsymv (const char *uplo, integer *n, double *alpha, double *a, integer *lda, double *x, integer *incx, double *beta,
+                   double *y, integer *incy) {
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2;
+	integer a_dim1, a_offset, i__1, i__2;
 
 	/* Local variables */
-	static long info;
+	static integer info;
 	static double temp1, temp2;
-	static long i__, j;
-	static long ix, iy, jx, jy, kx, ky;
+	static integer i__, j;
+	static integer ix, iy, jx, jy, kx, ky;
 
 #define a_ref(a_1,a_2) a[(a_2)*a_dim1 + a_1]
 
@@ -1791,16 +1791,16 @@ int NUMblas_dsymv (const char *uplo, long *n, double *alpha, double *a, long *ld
 
 #undef a_ref
 
-int NUMblas_dsyr2 (const char *uplo, long *n, double *alpha, double *x, long *incx, double *y, long *incy, double *a,
-                   long *lda) {
+int NUMblas_dsyr2 (const char *uplo, integer *n, double *alpha, double *x, integer *incx, double *y, integer *incy, double *a,
+                   integer *lda) {
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2;
+	integer a_dim1, a_offset, i__1, i__2;
 
 	/* Local variables */
-	static long info;
+	static integer info;
 	static double temp1, temp2;
-	static long i__, j;
-	static long ix, iy, jx, jy, kx, ky;
+	static integer i__, j;
+	static integer ix, iy, jx, jy, kx, ky;
 
 #define a_ref(a_1,a_2) a[(a_2)*a_dim1 + a_1]
 
@@ -1928,17 +1928,17 @@ int NUMblas_dsyr2 (const char *uplo, long *n, double *alpha, double *x, long *in
 
 #undef a_ref
 
-int NUMblas_dsyr2k (const char *uplo, const char *trans, long *n, long *k, double *alpha, double *a, long *lda, double *b,
-                    long *ldb, double *beta, double *c__, long *ldc) {
+int NUMblas_dsyr2k (const char *uplo, const char *trans, integer *n, integer *k, double *alpha, double *a, integer *lda, double *b,
+                    integer *ldb, double *beta, double *c__, integer *ldc) {
 	/* System generated locals */
-	long a_dim1, a_offset, b_dim1, b_offset, c_dim1, c_offset, i__1, i__2, i__3;
+	integer a_dim1, a_offset, b_dim1, b_offset, c_dim1, c_offset, i__1, i__2, i__3;
 
 	/* Local variables */
-	static long info;
+	static integer info;
 	static double temp1, temp2;
-	static long i__, j, l;
-	static long nrowa;
-	static long upper;
+	static integer i__, j, l;
+	static integer nrowa;
+	static integer upper;
 
 #define a_ref(a_1,a_2) a[(a_2)*a_dim1 + a_1]
 #define b_ref(a_1,a_2) b[(a_2)*b_dim1 + a_1]
@@ -2156,19 +2156,19 @@ int NUMblas_dsyr2k (const char *uplo, const char *trans, long *n, long *k, doubl
 #undef b_ref
 #undef a_ref
 
-int NUMblas_dtrmm (const char *side, const char *uplo, const char *transa, const char *diag, long *m, long *n, double *alpha, double *a,
-                   long *lda, double *b, long *ldb) {
+int NUMblas_dtrmm (const char *side, const char *uplo, const char *transa, const char *diag, integer *m, integer *n, double *alpha, double *a,
+                   integer *lda, double *b, integer *ldb) {
 	/* System generated locals */
-	long a_dim1, a_offset, b_dim1, b_offset, i__1, i__2, i__3;
+	integer a_dim1, a_offset, b_dim1, b_offset, i__1, i__2, i__3;
 
 	/* Local variables */
-	static long info;
+	static integer info;
 	static double temp;
-	static long i__, j, k;
-	static long lside;
-	static long nrowa;
-	static long upper;
-	static long nounit;
+	static integer i__, j, k;
+	static integer lside;
+	static integer nrowa;
+	static integer upper;
+	static integer nounit;
 
 #define a_ref(a_1,a_2) a[(a_2)*a_dim1 + a_1]
 #define b_ref(a_1,a_2) b[(a_2)*b_dim1 + a_1]
@@ -2438,16 +2438,16 @@ int NUMblas_dtrmm (const char *side, const char *uplo, const char *transa, const
 #undef b_ref
 #undef a_ref
 
-int NUMblas_dtrmv (const char *uplo, const char *trans, const char *diag, long *n, double *a, long *lda, double *x, long *incx) {
+int NUMblas_dtrmv (const char *uplo, const char *trans, const char *diag, integer *n, double *a, integer *lda, double *x, integer *incx) {
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2;
+	integer a_dim1, a_offset, i__1, i__2;
 
 	/* Local variables */
-	static long info;
+	static integer info;
 	static double temp;
-	static long i__, j;
-	static long ix, jx, kx;
-	static long nounit;
+	static integer i__, j;
+	static integer ix, jx, kx;
+	static integer nounit;
 
 #define a_ref(a_1,a_2) a[(a_2)*a_dim1 + a_1]
 	/* -- Written on 22-October-1986. Jack Dongarra, Argonne National Lab.
@@ -2646,19 +2646,19 @@ int NUMblas_dtrmv (const char *uplo, const char *trans, const char *diag, long *
 
 #undef a_ref
 
-int NUMblas_dtrsm (const char *side, const char *uplo, const char *transa, const char *diag, long *m, long *n,
-                   double *alpha, double *a, long *lda, double *b, long *ldb) {
+int NUMblas_dtrsm (const char *side, const char *uplo, const char *transa, const char *diag, integer *m, integer *n,
+                   double *alpha, double *a, integer *lda, double *b, integer *ldb) {
 	/* System generated locals */
-	long a_dim1, a_offset, b_dim1, b_offset, i__1, i__2, i__3;
+	integer a_dim1, a_offset, b_dim1, b_offset, i__1, i__2, i__3;
 
 	/* Local variables */
-	static long info;
+	static integer info;
 	static double temp;
-	static long i__, j, k;
-	static long lside;
-	static long nrowa;
-	static long upper;
-	static long nounit;
+	static integer i__, j, k;
+	static integer lside;
+	static integer nrowa;
+	static integer upper;
+	static integer nounit;
 
 #define a_ref(a_1,a_2) a[(a_2)*a_dim1 + a_1]
 #define b_ref(a_1,a_2) b[(a_2)*b_dim1 + a_1]
@@ -2953,14 +2953,14 @@ int NUMblas_dtrsm (const char *side, const char *uplo, const char *transa, const
 #undef b_ref
 #undef a_ref
 
-long NUMblas_idamax (long *n, double *dx, long *incx) {
+integer NUMblas_idamax (integer *n, double *dx, integer *incx) {
 	/* System generated locals */
-	long ret_val, i__1;
+	integer ret_val, i__1;
 	double d__1;
 
 	/* Local variables */
 	static double dmax__;
-	static long i__, ix;
+	static integer i__, ix;
 
 	/* finds the index of element having max. absolute value. jack
 	   dongarra, linpack, 3/11/78. modified 3/93 to return if incx .le. 0.
diff --git a/dwsys/NUMcblas.h b/dwsys/NUMcblas.h
index 9f26a27..096bc65 100644
--- a/dwsys/NUMcblas.h
+++ b/dwsys/NUMcblas.h
@@ -25,21 +25,21 @@
 
 #define xerbla_(src,info) Melder_throw (Melder_peek8to32 (src), U": parameter ", *info, U"not correct!")
 
-int NUMblas_daxpy (long *n, double *da, double *dx,	long *incx, double *dy, long *incy);
+int NUMblas_daxpy (integer *n, double *da, double *dx,	integer *incx, double *dy, integer *incy);
 /*     constant times a vector plus a vector.
        uses unrolled loops for increments equal to one. */
 
-int NUMblas_dcopy (long *n, double *dx, long *incx, double *dy, long *incy);
+int NUMblas_dcopy (integer *n, double *dx, integer *incx, double *dy, integer *incy);
 /*     copies a vector, x, to a vector, y.
        uses unrolled loops for increments equal to one.
 */
 
-double NUMblas_ddot (long *n, double *dx, long *incx, double *dy, long *incy);
+double NUMblas_ddot (integer *n, double *dx, integer *incx, double *dy, integer *incy);
 /*     forms the dot product of two vectors.
        uses unrolled loops for increments equal to one. */
 
-int NUMblas_dgemm (const char *transa, const char *transb, long *m, long *n, long *k, double *alpha,
-	double *a, long *lda, double *b, long *ldb, double *beta, double *c, long *ldc);
+int NUMblas_dgemm (const char *transa, const char *transb, integer *m, integer *n, integer *k, double *alpha,
+	double *a, integer *lda, double *b, integer *ldb, double *beta, double *c, integer *ldc);
 /*  Purpose
     =======
     NUMblas_dgemm  performs one of the matrix-matrix operations
@@ -130,8 +130,8 @@ int NUMblas_dgemm (const char *transa, const char *transb, long *m, long *n, lon
        Sven Hammarling, Numerical Algorithms Group Ltd.
 */
 
-int NUMblas_dger (long *m, long *n, double *alpha, double *x, long *incx, double *y,
-	long *incy, double *a, long *lda);
+int NUMblas_dger (integer *m, integer *n, double *alpha, double *x, integer *incx, double *y,
+	integer *incy, double *a, integer *lda);
 /*  Purpose
     =======
     NUMblas_dger   performs the rank 1 operation
@@ -186,8 +186,8 @@ int NUMblas_dger (long *m, long *n, double *alpha, double *x, long *incx, double
        Richard Hanson, Sandia National Labs.
 */
 
-int NUMblas_dgemv (const char *trans, long *m, long *n, double *alpha, double *a, long *lda,
-	double *x, long *incx, double *beta, double *y, long *incy);
+int NUMblas_dgemv (const char *trans, integer *m, integer *n, double *alpha, double *a, integer *lda,
+	double *x, integer *incx, double *beta, double *y, integer *incy);
 /*  Purpose
     =======
     NUMblas_dgemv  performs one of the matrix-vector operations
@@ -295,7 +295,7 @@ double NUMblas_dlamch (const char *cmach);
    =====================================================================
 */
 
-double NUMblas_dnrm2 (long *n, double *x, long *incx);
+double NUMblas_dnrm2 (integer *n, double *x, integer *incx);
 /*
 	NUMblas_dnrm2 returns the euclidean norm of a vector via the function
     name, so that
@@ -306,21 +306,21 @@ double NUMblas_dnrm2 (long *n, double *x, long *incx);
        Parameter adjustments
 */
 
-int NUMblas_drot (long *n, double *dx, long *incx, double *dy, long *incy,
+int NUMblas_drot (integer *n, double *dx, integer *incx, double *dy, integer *incy,
 	double *c__, double *s);
 /*     applies a plane rotation.  */
 
-int NUMblas_dscal (long *n, double *da, double *dx, long *incx);
+int NUMblas_dscal (integer *n, double *da, double *dx, integer *incx);
 /*     scales a vector by a constant.
        uses unrolled loops for increment equal to one.
 */
 
-int NUMblas_dswap (long *n, double *dx, long *incx,	double *dy, long *incy);
+int NUMblas_dswap (integer *n, double *dx, integer *incx,	double *dy, integer *incy);
 /*     interchanges two vectors.
        uses unrolled loops for increments equal one. */
 
-int NUMblas_dsymv (const char *uplo, long *n, double *alpha, double *a, long *lda,
-	double *x, long *incx, double *beta, double *y, long *incy);
+int NUMblas_dsymv (const char *uplo, integer *n, double *alpha, double *a, integer *lda,
+	double *x, integer *incx, double *beta, double *y, integer *incy);
 /*  Purpose
     =======
     NUMblas_dsymv  performs the matrix-vector  operation
@@ -384,8 +384,8 @@ int NUMblas_dsymv (const char *uplo, long *n, double *alpha, double *a, long *ld
              Unchanged on exit.
 */
 
-int NUMblas_dsyr2 (const char *uplo, long *n, double *alpha,	double *x, long *incx,
-	double *y, long *incy, double *a, long *lda);
+int NUMblas_dsyr2 (const char *uplo, integer *n, double *alpha,	double *x, integer *incx,
+	double *y, integer *incy, double *a, integer *lda);
 /*  Purpose
     =======
     NUMblas_dsyr2  performs the symmetric rank 2 operation
@@ -448,8 +448,8 @@ int NUMblas_dsyr2 (const char *uplo, long *n, double *alpha,	double *x, long *in
              Unchanged on exit.
 */
 
-int NUMblas_dsyr2k (const char *uplo, const char *trans, long *n, long *k, double *alpha, double *a,
-	long *lda, double *b, long *ldb, double *beta, double *c, long *ldc);
+int NUMblas_dsyr2k (const char *uplo, const char *trans, integer *n, integer *k, double *alpha, double *a,
+	integer *lda, double *b, integer *ldb, double *beta, double *c, integer *ldc);
 /*  Purpose
     =======
     NUMblas_dsyr2k  performs one of the symmetric rank 2k operations
@@ -544,8 +544,8 @@ int NUMblas_dsyr2k (const char *uplo, const char *trans, long *n, long *k, doubl
 */
 
 int NUMblas_dtrmm (const char *side, const char *uplo, const char *transa, const char *diag,
-	long *m, long *n, double *alpha, double *a, long *lda,
-	double *b, long *ldb);
+	integer *m, integer *n, double *alpha, double *a, integer *lda,
+	double *b, integer *ldb);
 /*  Purpose
     =======
     NUMblas_dtrmm  performs one of the matrix-matrix operations
@@ -625,8 +625,8 @@ int NUMblas_dtrmm (const char *side, const char *uplo, const char *transa, const
     Level 3 Blas routine.
 */
 
-int NUMblas_dtrmv (const char *uplo, const char *trans, const char *diag, long *n,
-	double *a, long *lda, double *x, long *incx);
+int NUMblas_dtrmv (const char *uplo, const char *trans, const char *diag, integer *n,
+	double *a, integer *lda, double *x, integer *incx);
 /*  Purpose
     =======
     NUMblas_dtrmv  performs one of the matrix-vector operations
@@ -688,8 +688,8 @@ int NUMblas_dtrmv (const char *uplo, const char *trans, const char *diag, long *
     Level 2 Blas routine.
 */
 
-int NUMblas_dtrsm (const char *side, const char *uplo, const char *transa, const char *diag, long *m, long *n,
-	double *alpha, double *a, long *lda, double *b, long *ldb);
+int NUMblas_dtrsm (const char *side, const char *uplo, const char *transa, const char *diag, integer *m, integer *n,
+	double *alpha, double *a, integer *lda, double *b, integer *ldb);
 /*  Purpose
     =======
     NUMblas_dtrsm  solves one of the matrix equations
@@ -769,7 +769,7 @@ int NUMblas_dtrsm (const char *side, const char *uplo, const char *transa, const
              Unchanged on exit.
 */
 
-long NUMblas_idamax (long *n, double *dx, long *incx);
+integer NUMblas_idamax (integer *n, double *dx, integer *incx);
 /* finds the index of element having max. absolute value.*/
 
 #endif /* _NUMcblas_h_ */
diff --git a/dwsys/NUMclapack.cpp b/dwsys/NUMclapack.cpp
index e7c76c7..b899301 100644
--- a/dwsys/NUMclapack.cpp
+++ b/dwsys/NUMclapack.cpp
@@ -18,15 +18,15 @@
 
 /* Table of constant values */
 
-static long c__0 = 0;
-static long c__1 = 1;
-static long c_n1 = -1;
-static long c__2 = 2;
-static long c__3 = 3;
-static long c__4 = 4;
-static long c__6 = 6;
-static long c__10 = 10;
-static long c__11 = 11;
+static integer c__0 = 0;
+static integer c__1 = 1;
+static integer c_n1 = -1;
+static integer c__2 = 2;
+static integer c__3 = 3;
+static integer c__4 = 4;
+static integer c__6 = 6;
+static integer c__10 = 10;
+static integer c__11 = 11;
 static double c_b15 = -.125;
 static double c_b49 = 1.;
 static double c_b72 = -1.;
@@ -46,38 +46,38 @@ static double c_b438 = 1.;
 #define u_ref(a_1,a_2) u[(a_2)*u_dim1 + a_1]
 #define vt_ref(a_1,a_2) vt[(a_2)*vt_dim1 + a_1]
 
-int NUMlapack_dbdsqr (const char *uplo, long *n, long *ncvt, long *nru, long *ncc, double *d__, double *e, double *vt,
-                      long *ldvt, double *u, long *ldu, double *c__, long *ldc, double *work, long *info) {
+int NUMlapack_dbdsqr (const char *uplo, integer *n, integer *ncvt, integer *nru, integer *ncc, double *d__, double *e, double *vt,
+                      integer *ldvt, double *u, integer *ldu, double *c__, integer *ldc, double *work, integer *info) {
 	/* System generated locals */
-	long c_dim1, c_offset, u_dim1, u_offset, vt_dim1, vt_offset, i__1, i__2;
+	integer c_dim1, c_offset, u_dim1, u_offset, vt_dim1, vt_offset, i__1, i__2;
 	double d__1, d__2, d__3, d__4;
 
 	/* Local variables */
 	static double abse;
-	static long idir;
+	static integer idir;
 	static double abss;
-	static long oldm;
+	static integer oldm;
 	static double cosl;
-	static long isub, iter;
+	static integer isub, iter;
 	static double unfl, sinl, cosr, smin, smax, sinr;
 	static double f, g, h__;
-	static long i__, j, m;
+	static integer i__, j, m;
 	static double r__;
 	static double oldcs;
-	static long oldll;
+	static integer oldll;
 	static double shift, sigmn, oldsn;
-	static long maxit;
+	static integer maxit;
 	static double sminl, sigmx;
-	static long lower;
+	static integer lower;
 	static double cs;
-	static long ll;
+	static integer ll;
 	static double sn, mu;
 	static double sminoa, thresh;
-	static long rotate;
+	static integer rotate;
 	static double sminlo;
-	static long nm1;
+	static integer nm1;
 	static double tolmul;
-	static long nm12, nm13, lll;
+	static integer nm12, nm13, lll;
 	static double eps, sll, tol;
 
 	/* Parameter adjustments */
@@ -743,16 +743,16 @@ L220:
 #undef u_ref
 
 
-int NUMlapack_dgebd2 (long *m, long *n, double *a, long *lda, double *d__, double *e, double *tauq,
-                      double *taup, double *work, long *info) {
+int NUMlapack_dgebd2 (integer *m, integer *n, double *a, integer *lda, double *d__, double *e, double *tauq,
+                      double *taup, double *work, integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
+	static integer c__1 = 1;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3, i__4;
+	integer a_dim1, a_offset, i__1, i__2, i__3, i__4;
 
 	/* Local variables */
-	static long i__;
+	static integer i__;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -882,16 +882,16 @@ int NUMlapack_dgebd2 (long *m, long *n, double *a, long *lda, double *d__, doubl
 }								/* NUMlapack_dgebd2 */
 
 
-int NUMlapack_dgebak (const char *job, const char *side, long *n, long *ilo, long *ihi, double *scale, long *m,
-                      double *v, long *ldv, long *info) {
+int NUMlapack_dgebak (const char *job, const char *side, integer *n, integer *ilo, integer *ihi, double *scale, integer *m,
+                      double *v, integer *ldv, integer *info) {
 	/* System generated locals */
-	long v_dim1, v_offset, i__1;
+	integer v_dim1, v_offset, i__1;
 
 	/* Local variables */
-	static long i__, k;
+	static integer i__, k;
 	static double s;
 	static int leftv;
-	static long ii;
+	static integer ii;
 	static int rightv;
 
 #define v_ref(a_1,a_2) v[(a_2)*v_dim1 + a_1]
@@ -983,7 +983,7 @@ L30:
 				if (i__ < *ilo) {
 					i__ = *ilo - ii;
 				}
-				k = (long) scale[i__];
+				k = (integer) scale[i__];
 				if (k == i__) {
 					goto L40;
 				}
@@ -1003,7 +1003,7 @@ L40:
 				if (i__ < *ilo) {
 					i__ = *ilo - ii;
 				}
-				k = (long) scale[i__];
+				k = (integer) scale[i__];
 				if (k == i__) {
 					goto L50;
 				}
@@ -1019,23 +1019,23 @@ L50:
 
 #undef v_ref
 
-int NUMlapack_dgebal (const char *job, long *n, double *a, long *lda, long *ilo, long *ihi, double *scale,
-                      long *info) {
+int NUMlapack_dgebal (const char *job, integer *n, double *a, integer *lda, integer *ilo, integer *ihi, double *scale,
+                      integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
+	static integer c__1 = 1;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2;
+	integer a_dim1, a_offset, i__1, i__2;
 	double d__1, d__2;
 
 	/* Local variables */
-	static long iexc;
+	static integer iexc;
 	static double c__, f, g;
-	static long i__, j, k, l, m;
+	static integer i__, j, k, l, m;
 	static double r__, s;
 	static double sfmin1, sfmin2, sfmax1, sfmax2, ca, ra;
 	static int noconv;
-	static long ica, ira;
+	static integer ica, ira;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -1284,27 +1284,27 @@ L210:
 }								/* NUMlapack_dgebal */
 
 
-int NUMlapack_dgebrd (long *m, long *n, double *a, long *lda, double *d__, double *e, double *tauq,
-                      double *taup, double *work, long *lwork, long *info) {
+int NUMlapack_dgebrd (integer *m, integer *n, double *a, integer *lda, double *d__, double *e, double *tauq,
+                      double *taup, double *work, integer *lwork, integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
-	static long c_n1 = -1;
-	static long c__3 = 3;
-	static long c__2 = 2;
+	static integer c__1 = 1;
+	static integer c_n1 = -1;
+	static integer c__3 = 3;
+	static integer c__2 = 2;
 	static double c_b21 = -1.;
 	static double c_b22 = 1.;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3, i__4;
+	integer a_dim1, a_offset, i__1, i__2, i__3, i__4;
 
 	/* Local variables */
-	static long i__, j;
-	static long nbmin, iinfo, minmn;
-	static long nb;
-	static long nx;
+	static integer i__, j;
+	static integer nbmin, iinfo, minmn;
+	static integer nb;
+	static integer nx;
 	static double ws;
-	static long ldwrkx, ldwrky, lwkopt;
-	static long lquery;
+	static integer ldwrkx, ldwrky, lwkopt;
+	static integer lquery;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -1442,24 +1442,24 @@ int NUMlapack_dgebrd (long *m, long *n, double *a, long *lda, double *d__, doubl
 }								/* NUMlapack_dgebrd */
 
 
-int NUMlapack_dgeev (const char *jobvl, const char *jobvr, long *n, double *a, long *lda, double *wr, double *wi,
-                     double *vl, long *ldvl, double *vr, long *ldvr, double *work, long *lwork, long *info) {
+int NUMlapack_dgeev (const char *jobvl, const char *jobvr, integer *n, double *a, integer *lda, double *wr, double *wi,
+                     double *vl, integer *ldvl, double *vr, integer *ldvr, double *work, integer *lwork, integer *info) {
 	/* Table of constant values */
-	static long c__8 = 8;
-	static long c_n1 = -1;
+	static integer c__8 = 8;
+	static integer c_n1 = -1;
 
 	/* System generated locals */
-	long a_dim1, a_offset, vl_dim1, vl_offset, vr_dim1, vr_offset, i__1, i__2, i__3, i__4;
+	integer a_dim1, a_offset, vl_dim1, vl_offset, vr_dim1, vr_offset, i__1, i__2, i__3, i__4;
 	double d__1, d__2;
 
 	/* Local variables */
-	static long ibal;
+	static integer ibal;
 	static char side[1];
-	static long maxb;
+	static integer maxb;
 	static double anrm;
-	static long ierr, itau;
-	static long iwrk, nout;
-	static long i__, k;
+	static integer ierr, itau;
+	static integer iwrk, nout;
+	static integer i__, k;
 	static double r__;
 	static double cs;
 	static int scalea;
@@ -1467,14 +1467,14 @@ int NUMlapack_dgeev (const char *jobvl, const char *jobvr, long *n, double *a, l
 	static double sn;
 	static int select[1];
 	static double bignum;
-	static long minwrk, maxwrk;
+	static integer minwrk, maxwrk;
 	static int wantvl;
 	static double smlnum;
-	static long hswork;
+	static integer hswork;
 	static int lquery, wantvr;
-	static long ihi;
+	static integer ihi;
 	static double scl;
-	static long ilo;
+	static integer ilo;
 	static double dum[1], eps;
 
 #define vl_ref(a_1,a_2) vl[(a_2)*vl_dim1 + a_1]
@@ -1801,16 +1801,16 @@ L50:
 #undef vl_ref
 
 
-int NUMlapack_dgehd2 (long *n, long *ilo, long *ihi, double *a, long *lda, double *tau, double *work,
-                      long *info) {
+int NUMlapack_dgehd2 (integer *n, integer *ilo, integer *ihi, double *a, integer *lda, double *tau, double *work,
+                      integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
+	static integer c__1 = 1;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3;
+	integer a_dim1, a_offset, i__1, i__2, i__3;
 
 	/* Local variables */
-	static long i__;
+	static integer i__;
 	static double aii;
 
 	a_dim1 = *lda;
@@ -1869,31 +1869,31 @@ int NUMlapack_dgehd2 (long *n, long *ilo, long *ihi, double *a, long *lda, doubl
 }								/* NUMlapack_dgehd2 */
 
 
-int NUMlapack_dgehrd (long *n, long *ilo, long *ihi, double *a, long *lda, double *tau, double *work,
-                      long *lwork, long *info) {
+int NUMlapack_dgehrd (integer *n, integer *ilo, integer *ihi, double *a, integer *lda, double *tau, double *work,
+                      integer *lwork, integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
-	static long c_n1 = -1;
-	static long c__3 = 3;
-	static long c__2 = 2;
-	static long c__65 = 65;
+	static integer c__1 = 1;
+	static integer c_n1 = -1;
+	static integer c__3 = 3;
+	static integer c__2 = 2;
+	static integer c__65 = 65;
 	static double c_b25 = -1.;
 	static double c_b26 = 1.;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3, i__4;
+	integer a_dim1, a_offset, i__1, i__2, i__3, i__4;
 
 	/* Local variables */
-	static long i__;
+	static integer i__;
 	static double t[4160] /* was [65][64] */ ;
-	static long nbmin, iinfo;
-	static long ib;
+	static integer nbmin, iinfo;
+	static integer ib;
 	static double ei;
-	static long nb, nh;
-	static long nx;
-	static long ldwork, lwkopt;
+	static integer nb, nh;
+	static integer nx;
+	static integer ldwork, lwkopt;
 	static int lquery;
-	static long iws;
+	static integer iws;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -2042,12 +2042,12 @@ int NUMlapack_dgehrd (long *n, long *ilo, long *ihi, double *a, long *lda, doubl
 	return 0;
 }								/* NUMlapack_dgehrd */
 
-int NUMlapack_dgelq2 (long *m, long *n, double *a, long *lda, double *tau, double *work, long *info) {
+int NUMlapack_dgelq2 (integer *m, integer *n, double *a, integer *lda, double *tau, double *work, integer *info) {
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3;
+	integer a_dim1, a_offset, i__1, i__2, i__3;
 
 	/* Local variables */
-	static long i__, k;
+	static integer i__, k;
 	static double aii;
 
 	a_dim1 = *lda;
@@ -2099,24 +2099,24 @@ int NUMlapack_dgelq2 (long *m, long *n, double *a, long *lda, double *tau, doubl
 	return 0;
 }								/* NUMlapack_dgelq2 */
 
-int NUMlapack_dgelqf (long *m, long *n, double *a, long *lda, double *tau, double *work, long *lwork,
-                      long *info) {
+int NUMlapack_dgelqf (integer *m, integer *n, double *a, integer *lda, double *tau, double *work, integer *lwork,
+                      integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
-	static long c_n1 = -1;
-	static long c__3 = 3;
-	static long c__2 = 2;
+	static integer c__1 = 1;
+	static integer c_n1 = -1;
+	static integer c__3 = 3;
+	static integer c__2 = 2;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3, i__4;
+	integer a_dim1, a_offset, i__1, i__2, i__3, i__4;
 
 	/* Local variables */
-	static long i__, k, nbmin, iinfo;
-	static long ib, nb;
-	static long nx;
-	static long ldwork, lwkopt;
-	static long lquery;
-	static long iws;
+	static integer i__, k, nbmin, iinfo;
+	static integer ib, nb;
+	static integer nx;
+	static integer ldwork, lwkopt;
+	static integer lquery;
+	static integer iws;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -2236,30 +2236,30 @@ int NUMlapack_dgelqf (long *m, long *n, double *a, long *lda, double *tau, doubl
 
 #define b_ref(a_1,a_2) b[(a_2)*b_dim1 + a_1]
 
-int NUMlapack_dgelss (long *m, long *n, long *nrhs, double *a, long *lda, double *b, long *ldb, double *s,
-                      double *rcond, long *rank, double *work, long *lwork, long *info) {
+int NUMlapack_dgelss (integer *m, integer *n, integer *nrhs, double *a, integer *lda, double *b, integer *ldb, double *s,
+                      double *rcond, integer *rank, double *work, integer *lwork, integer *info) {
 	/* System generated locals */
-	long a_dim1, a_offset, b_dim1, b_offset, i__1, i__2, i__3, i__4;
+	integer a_dim1, a_offset, b_dim1, b_offset, i__1, i__2, i__3, i__4;
 	double d__1;
 
 	/* Local variables */
 	static double anrm, bnrm;
-	static long itau;
+	static integer itau;
 	static double vdum[1];
-	static long i__;
-	static long iascl, ibscl;
-	static long chunk;
+	static integer i__;
+	static integer iascl, ibscl;
+	static integer chunk;
 	static double sfmin;
-	static long minmn;
-	static long maxmn, itaup, itauq, mnthr, iwork;
-	static long bl, ie, il;
-	static long mm;
-	static long bdspac;
+	static integer minmn;
+	static integer maxmn, itaup, itauq, mnthr, iwork;
+	static integer bl, ie, il;
+	static integer mm;
+	static integer bdspac;
 	static double bignum;
-	static long ldwork;
-	static long minwrk, maxwrk;
+	static integer ldwork;
+	static integer minwrk, maxwrk;
 	static double smlnum;
-	static long lquery;
+	static integer lquery;
 	static double eps, thr;
 
 	a_dim1 = *lda;
@@ -2843,22 +2843,22 @@ L70:
 
 #undef b_ref
 
-int NUMlapack_dgeqpf (long *m, long *n, double *a, long *lda, long *jpvt, double *tau, double *work, long *info) {
+int NUMlapack_dgeqpf (integer *m, integer *n, double *a, integer *lda, integer *jpvt, double *tau, double *work, integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
+	static integer c__1 = 1;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3;
+	integer a_dim1, a_offset, i__1, i__2, i__3;
 	double d__1, d__2;
 
 	/* Local variables */
 	static double temp;
 	static double temp2;
-	static long i__, j;
-	static long itemp;
-	static long ma, mn;
+	static integer i__, j;
+	static integer itemp;
+	static integer ma, mn;
 	static double aii;
-	static long pvt;
+	static integer pvt;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -3005,15 +3005,15 @@ int NUMlapack_dgeqpf (long *m, long *n, double *a, long *lda, long *jpvt, double
 	return 0;
 }								/* NUMlapack_dgeqpf */
 
-int NUMlapack_dgeqr2 (long *m, long *n, double *a, long *lda, double *tau, double *work, long *info) {
+int NUMlapack_dgeqr2 (integer *m, integer *n, double *a, integer *lda, double *tau, double *work, integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
+	static integer c__1 = 1;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3;
+	integer a_dim1, a_offset, i__1, i__2, i__3;
 
 	/* Local variables */
-	static long i__, k;
+	static integer i__, k;
 	static double aii;
 
 	a_dim1 = *lda;
@@ -3065,24 +3065,24 @@ int NUMlapack_dgeqr2 (long *m, long *n, double *a, long *lda, double *tau, doubl
 	return 0;
 }								/* NUMlapack_dgeqr2 */
 
-int NUMlapack_dgeqrf (long *m, long *n, double *a, long *lda, double *tau, double *work, long *lwork,
-                      long *info) {
+int NUMlapack_dgeqrf (integer *m, integer *n, double *a, integer *lda, double *tau, double *work, integer *lwork,
+                      integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
-	static long c_n1 = -1;
-	static long c__3 = 3;
-	static long c__2 = 2;
+	static integer c__1 = 1;
+	static integer c_n1 = -1;
+	static integer c__3 = 3;
+	static integer c__2 = 2;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3, i__4;
+	integer a_dim1, a_offset, i__1, i__2, i__3, i__4;
 
 	/* Local variables */
-	static long i__, k, nbmin, iinfo;
-	static long ib, nb;
-	static long nx;
-	static long ldwork, lwkopt;
-	static long lquery;
-	static long iws;
+	static integer i__, k, nbmin, iinfo;
+	static integer ib, nb;
+	static integer nx;
+	static integer ldwork, lwkopt;
+	static integer lquery;
+	static integer iws;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -3200,12 +3200,12 @@ int NUMlapack_dgeqrf (long *m, long *n, double *a, long *lda, double *tau, doubl
 	return 0;
 }								/* NUMlapack_dgeqrf */
 
-int NUMlapack_dgerq2 (long *m, long *n, double *a, long *lda, double *tau, double *work, long *info) {
+int NUMlapack_dgerq2 (integer *m, integer *n, double *a, integer *lda, double *tau, double *work, integer *info) {
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2;
+	integer a_dim1, a_offset, i__1, i__2;
 
 	/* Local variables */
-	static long i__, k;
+	static integer i__, k;
 	static double aii;
 
 	a_dim1 = *lda;
@@ -3253,9 +3253,9 @@ int NUMlapack_dgerq2 (long *m, long *n, double *a, long *lda, double *tau, doubl
 	return 0;
 }								/* NUMlapack_dgerq2 */
 
-int NUMlapack_dgesv (long *n, long *nrhs, double *a, long *lda, long *ipiv, double *b, long *ldb, long *info) {
+int NUMlapack_dgesv (integer *n, integer *nrhs, double *a, integer *lda, integer *ipiv, double *b, integer *ldb, integer *info) {
 	/* System generated locals */
-	long a_dim1, a_offset, b_dim1, b_offset, i__1;
+	integer a_dim1, a_offset, b_dim1, b_offset, i__1;
 
 	/* Local variables */
 
@@ -3299,28 +3299,28 @@ int NUMlapack_dgesv (long *n, long *nrhs, double *a, long *lda, long *ipiv, doub
 #define u_ref(a_1,a_2) u[(a_2)*u_dim1 + a_1]
 #define vt_ref(a_1,a_2) vt[(a_2)*vt_dim1 + a_1]
 
-int NUMlapack_dgesvd (const char *jobu, const char *jobvt, long *m, long *n, double *a, long *lda, double *s, double *u,
-                      long *ldu, double *vt, long *ldvt, double *work, long *lwork, long *info) {
+int NUMlapack_dgesvd (const char *jobu, const char *jobvt, integer *m, integer *n, double *a, integer *lda, double *s, double *u,
+                      integer *ldu, double *vt, integer *ldvt, double *work, integer *lwork, integer *info) {
 	/* System generated locals */
 	const char *a__1[2];
-	long a_dim1, a_offset, u_dim1, u_offset, vt_dim1, vt_offset, i__1[2], i__2, i__3, i__4;
+	integer a_dim1, a_offset, u_dim1, u_offset, vt_dim1, vt_offset, i__1[2], i__2, i__3, i__4;
 	char ch__1[2];
 
 	/* Local variables */
-	static long iscl;
+	static integer iscl;
 	static double anrm;
-	static long ierr, itau, ncvt, nrvt, i__;
-	static long chunk, minmn, wrkbl, itaup, itauq, mnthr, iwork;
-	static long wntua, wntva, wntun, wntuo, wntvn, wntvo, wntus, wntvs;
-	static long ie;
-	static long ir, bdspac, iu;
+	static integer ierr, itau, ncvt, nrvt, i__;
+	static integer chunk, minmn, wrkbl, itaup, itauq, mnthr, iwork;
+	static integer wntua, wntva, wntun, wntuo, wntvn, wntvo, wntus, wntvs;
+	static integer ie;
+	static integer ir, bdspac, iu;
 	static double bignum;
-	static long ldwrkr, minwrk, ldwrku, maxwrk;
+	static integer ldwrkr, minwrk, ldwrku, maxwrk;
 	static double smlnum;
-	static long lquery, wntuas, wntvas;
-	static long blk, ncu;
+	static integer lquery, wntuas, wntvas;
+	static integer blk, ncu;
 	static double dum[1], eps;
-	static long nru;
+	static integer nru;
 
 	/* Parameter adjustments */
 	a_dim1 = *lda;
@@ -6835,18 +6835,18 @@ int NUMlapack_dgesvd (const char *jobu, const char *jobvt, long *m, long *n, dou
 #undef vt_ref
 #undef u_ref
 
-int NUMlapack_dgetf2 (long *m, long *n, double *a, long *lda, long *ipiv, long *info) {
+int NUMlapack_dgetf2 (integer *m, integer *n, double *a, integer *lda, integer *ipiv, integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
+	static integer c__1 = 1;
 	static double c_b6 = -1.;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3;
+	integer a_dim1, a_offset, i__1, i__2, i__3;
 	double d__1;
 
 	/* Local variables */
-	static long j;
-	static long jp;
+	static integer j;
+	static integer jp;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -6917,25 +6917,25 @@ int NUMlapack_dgetf2 (long *m, long *n, double *a, long *lda, long *ipiv, long *
 	return 0;
 }								/* NUMlapack_dgetf2 */
 
-int NUMlapack_dgetri (long *n, double *a, long *lda, long *ipiv, double *work, long *lwork, long *info) {
+int NUMlapack_dgetri (integer *n, double *a, integer *lda, integer *ipiv, double *work, integer *lwork, integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
-	static long c_n1 = -1;
-	static long c__2 = 2;
+	static integer c__1 = 1;
+	static integer c_n1 = -1;
+	static integer c__2 = 2;
 	static double c_b20 = -1.;
 	static double c_b22 = 1.;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3;
+	integer a_dim1, a_offset, i__1, i__2, i__3;
 
 	/* Local variables */
-	static long i__, j;
-	static long nbmin;
-	static long jb, nb, jj, jp, nn;
-	static long ldwork;
-	static long lwkopt;
-	static long lquery;
-	static long iws;
+	static integer i__, j;
+	static integer nbmin;
+	static integer jb, nb, jj, jp, nn;
+	static integer ldwork;
+	static integer lwkopt;
+	static integer lquery;
+	static integer iws;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -7072,20 +7072,20 @@ int NUMlapack_dgetri (long *n, double *a, long *lda, long *ipiv, double *work, l
 	return 0;
 }								/* NUMlapack_dgetri */
 
-int NUMlapack_dgetrf (long *m, long *n, double *a, long *lda, long *ipiv, long *info) {
+int NUMlapack_dgetrf (integer *m, integer *n, double *a, integer *lda, integer *ipiv, integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
-	static long c_n1 = -1;
+	static integer c__1 = 1;
+	static integer c_n1 = -1;
 	static double c_b16 = 1.;
 	static double c_b19 = -1.;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3, i__4, i__5;
+	integer a_dim1, a_offset, i__1, i__2, i__3, i__4, i__5;
 
 	/* Local variables */
-	static long i__, j;
-	static long iinfo;
-	static long jb, nb;
+	static integer i__, j;
+	static integer iinfo;
+	static integer jb, nb;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -7186,18 +7186,18 @@ int NUMlapack_dgetrf (long *m, long *n, double *a, long *lda, long *ipiv, long *
 	return 0;
 }								/* NUMlapack_dgetrf */
 
-int NUMlapack_dgetrs (const char *trans, long *n, long *nrhs, double *a, long *lda, long *ipiv, double *b, long *ldb,
-                      long *info) {
+int NUMlapack_dgetrs (const char *trans, integer *n, integer *nrhs, double *a, integer *lda, integer *ipiv, double *b, integer *ldb,
+                      integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
+	static integer c__1 = 1;
 	static double c_b12 = 1.;
-	static long c_n1 = -1;
+	static integer c_n1 = -1;
 
 	/* System generated locals */
-	long a_dim1, a_offset, b_dim1, b_offset, i__1;
+	integer a_dim1, a_offset, b_dim1, b_offset, i__1;
 
 	/* Local variables */
-	static long notran;
+	static integer notran;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -7271,24 +7271,24 @@ int NUMlapack_dgetrs (const char *trans, long *n, long *nrhs, double *a, long *l
 	return 0;
 }								/* NUMlapack_dgetrs */
 
-int NUMlapack_dggsvd (const char *jobu, const char *jobv, const char *jobq, long *m, long *n, long *p, long *k, long *l,
-                      double *a, long *lda, double *b, long *ldb, double *alpha, double *beta, double *u, long *ldu, double *v,
-                      long *ldv, double *q, long *ldq, double *work, long *iwork, long *info) {
+int NUMlapack_dggsvd (const char *jobu, const char *jobv, const char *jobq, integer *m, integer *n, integer *p, integer *k, integer *l,
+                      double *a, integer *lda, double *b, integer *ldb, double *alpha, double *beta, double *u, integer *ldu, double *v,
+                      integer *ldv, double *q, integer *ldq, double *work, integer *iwork, integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
+	static integer c__1 = 1;
 
 	/* System generated locals */
-	long a_dim1, a_offset, b_dim1, b_offset, q_dim1, q_offset, u_dim1, u_offset, v_dim1, v_offset, i__1, i__2;
+	integer a_dim1, a_offset, b_dim1, b_offset, q_dim1, q_offset, u_dim1, u_offset, v_dim1, v_offset, i__1, i__2;
 
 	/* Local variables */
-	static long ibnd;
+	static integer ibnd;
 	static double tola;
-	static long isub;
+	static integer isub;
 	static double tolb, unfl, temp, smax;
-	static long i__, j;
+	static integer i__, j;
 	static double anorm, bnorm;
-	static long wantq, wantu, wantv;
-	static long ncycle;
+	static integer wantq, wantu, wantv;
+	static integer ncycle;
 	static double ulp;
 
 	a_dim1 = *lda;
@@ -7410,22 +7410,22 @@ int NUMlapack_dggsvd (const char *jobu, const char *jobv, const char *jobq, long
 #define u_ref(a_1,a_2) u[(a_2)*u_dim1 + a_1]
 #define v_ref(a_1,a_2) v[(a_2)*v_dim1 + a_1]
 
-int NUMlapack_dggsvp (const char *jobu, const char *jobv, const char *jobq, long *m, long *p, long *n, double *a, long *lda,
-                      double *b, long *ldb, double *tola, double *tolb, long *k, long *l, double *u, long *ldu, double *v,
-                      long *ldv, double *q, long *ldq, long *iwork, double *tau, double *work, long *info) {
+int NUMlapack_dggsvp (const char *jobu, const char *jobv, const char *jobq, integer *m, integer *p, integer *n, double *a, integer *lda,
+                      double *b, integer *ldb, double *tola, double *tolb, integer *k, integer *l, double *u, integer *ldu, double *v,
+                      integer *ldv, double *q, integer *ldq, integer *iwork, double *tau, double *work, integer *info) {
 	/* Table of constant values */
 	static double c_b12 = 0.;
 	static double c_b22 = 1.;
 
 	/* System generated locals */
-	long a_dim1, a_offset, b_dim1, b_offset, q_dim1, q_offset, u_dim1, u_offset, v_dim1, v_offset, i__1, i__2,
+	integer a_dim1, a_offset, b_dim1, b_offset, q_dim1, q_offset, u_dim1, u_offset, v_dim1, v_offset, i__1, i__2,
 	     i__3;
 	double d__1;
 
 	/* Local variables */
-	static long i__, j;
-	static long wantq, wantu, wantv;
-	static long forwrd;
+	static integer i__, j;
+	static integer wantq, wantu, wantv;
+	static integer forwrd;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -7727,44 +7727,44 @@ int NUMlapack_dggsvp (const char *jobu, const char *jobv, const char *jobq, long
 #undef b_ref
 
 
-int NUMlapack_dhseqr (const char *job, const char *compz, long *n, long *ilo, long *ihi, double *h__, long *ldh,
-                      double *wr, double *wi, double *z__, long *ldz, double *work, long *lwork, long *info) {
+int NUMlapack_dhseqr (const char *job, const char *compz, integer *n, integer *ilo, integer *ihi, double *h__, integer *ldh,
+                      double *wr, double *wi, double *z__, integer *ldz, double *work, integer *lwork, integer *info) {
 	/* Table of constant values */
 	static double c_b9 = 0.;
 	static double c_b10 = 1.;
-	static long c__4 = 4;
-	static long c_n1 = -1;
-	static long c__2 = 2;
-	static long c__8 = 8;
-	static long c__15 = 15;
+	static integer c__4 = 4;
+	static integer c_n1 = -1;
+	static integer c__2 = 2;
+	static integer c__8 = 8;
+	static integer c__15 = 15;
 	static int c_false = FALSE;
-	static long c__1 = 1;
+	static integer c__1 = 1;
 
 	/* System generated locals */
 	const char *a__1[2];
-	long h_dim1, h_offset, z_dim1, z_offset, i__1, i__2, i__3[2], i__4, i__5;
+	integer h_dim1, h_offset, z_dim1, z_offset, i__1, i__2, i__3[2], i__4, i__5;
 	double d__1, d__2;
 	char ch__1[2];
 
 	/* Local variables */
-	static long maxb;
+	static integer maxb;
 	static double absw;
-	static long ierr;
+	static integer ierr;
 	static double unfl, temp, ovfl;
-	static long i__, j, k, l;
+	static integer i__, j, k, l;
 	static double s[225] /* was [15][15] */ , v[16];
-	static long itemp;
-	static long i1, i2;
+	static integer itemp;
+	static integer i1, i2;
 	static int initz, wantt, wantz;
-	static long ii, nh;
-	static long nr, ns;
-	static long nv;
+	static integer ii, nh;
+	static integer nr, ns;
+	static integer nv;
 	static double vv[16];
 	static double smlnum;
 	static int lquery;
-	static long itn;
+	static integer itn;
 	static double tau;
-	static long its;
+	static integer its;
 	static double ulp, tst1;
 
 #define h___ref(a_1,a_2) h__[(a_2)*h_dim1 + a_1]
@@ -8176,19 +8176,19 @@ int NUMlapack_dlabad (double *smal, double *large) {
 #define x_ref(a_1,a_2) x[(a_2)*x_dim1 + a_1]
 #define y_ref(a_1,a_2) y[(a_2)*y_dim1 + a_1]
 
-int NUMlapack_dlabrd (long *m, long *n, long *nb, double *a, long *lda, double *d__, double *e, double *tauq,
-                      double *taup, double *x, long *ldx, double *y, long *ldy) {
+int NUMlapack_dlabrd (integer *m, integer *n, integer *nb, double *a, integer *lda, double *d__, double *e, double *tauq,
+                      double *taup, double *x, integer *ldx, double *y, integer *ldy) {
 	/* Table of constant values */
 	static double c_b4 = -1.;
 	static double c_b5 = 1.;
-	static long c__1 = 1;
+	static integer c__1 = 1;
 	static double c_b16 = 0.;
 
 	/* System generated locals */
-	long a_dim1, a_offset, x_dim1, x_offset, y_dim1, y_offset, i__1, i__2, i__3;
+	integer a_dim1, a_offset, x_dim1, x_offset, y_dim1, y_offset, i__1, i__2, i__3;
 
 	/* Local variables */
-	static long i__;
+	static integer i__;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -8413,12 +8413,12 @@ int NUMlapack_dlabrd (long *m, long *n, long *nb, double *a, long *lda, double *
 
 #define b_ref(a_1,a_2) b[(a_2)*b_dim1 + a_1]
 
-int NUMlapack_dlacpy (const char *uplo, long *m, long *n, double *a, long *lda, double *b, long *ldb) {
+int NUMlapack_dlacpy (const char *uplo, integer *m, integer *n, double *a, integer *lda, double *b, integer *ldb) {
 	/* System generated locals */
-	long a_dim1, a_offset, b_dim1, b_offset, i__1, i__2;
+	integer a_dim1, a_offset, b_dim1, b_offset, i__1, i__2;
 
 	/* Local variables */
-	static long i__, j;
+	static integer i__, j;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -8547,7 +8547,7 @@ int NUMlapack_dlaev2 (double *a, double *b, double *c__, double *rt1, double *rt
 
 	/* Local variables */
 	static double acmn, acmx, ab, df, cs, ct, tb, sm, tn, rt, adf, acs;
-	static long sgn1, sgn2;
+	static integer sgn1, sgn2;
 
 	sm = *a + *c__;
 	df = *a - *c__;
@@ -8632,7 +8632,7 @@ int NUMlapack_dlaev2 (double *a, double *b, double *c__, double *rt1, double *rt
 	return 0;
 }								/* NUMlapack_dlaev2 */
 
-int NUMlapack_dlags2 (long *upper, double *a1, double *a2, double *a3, double *b1, double *b2, double *b3,
+int NUMlapack_dlags2 (integer *upper, double *a1, double *a2, double *a3, double *b1, double *b2, double *b3,
                       double *csu, double *snu, double *csv, double *snv, double *csq, double *snq) {
 	/* System generated locals */
 	double d__1;
@@ -8812,30 +8812,30 @@ int NUMlapack_dlags2 (long *upper, double *a1, double *a2, double *a3, double *b
 }								/* NUMlapack_dlags2 */
 
 
-int NUMlapack_dlahqr (int *wantt, int *wantz, long *n, long *ilo, long *ihi, double *h__, long *ldh,
-                      double *wr, double *wi, long *iloz, long *ihiz, double *z__, long *ldz, long *info) {
+int NUMlapack_dlahqr (int *wantt, int *wantz, integer *n, integer *ilo, integer *ihi, double *h__, integer *ldh,
+                      double *wr, double *wi, integer *iloz, integer *ihiz, double *z__, integer *ldz, integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
+	static integer c__1 = 1;
 
 	/* System generated locals */
-	long h_dim1, h_offset, z_dim1, z_offset, i__1, i__2, i__3, i__4;
+	integer h_dim1, h_offset, z_dim1, z_offset, i__1, i__2, i__3, i__4;
 	double d__1, d__2;
 
 	/* Local variables */
 	static double h43h34, disc, unfl, ovfl;
 	static double work[1];
-	static long i__, j, k, l, m;
+	static integer i__, j, k, l, m;
 	static double s, v[3];
-	static long i1, i2;
+	static integer i1, i2;
 	static double t1, t2, t3, v1, v2, v3;
 	static double h00, h10, h11, h12, h21, h22, h33, h44;
-	static long nh;
+	static integer nh;
 	static double cs;
-	static long nr;
+	static integer nr;
 	static double sn;
-	static long nz;
+	static integer nz;
 	static double smlnum, ave, h33s, h44s;
-	static long itn, its;
+	static integer itn, its;
 	static double ulp, sum, tst1;
 
 #define h___ref(a_1,a_2) h__[(a_2)*h_dim1 + a_1]
@@ -9198,20 +9198,20 @@ L150:
 #undef h___ref
 
 
-int NUMlapack_dlahrd (long *n, long *k, long *nb, double *a, long *lda, double *tau, double *t, long *ldt,
-                      double *y, long *ldy) {
+int NUMlapack_dlahrd (integer *n, integer *k, integer *nb, double *a, integer *lda, double *tau, double *t, integer *ldt,
+                      double *y, integer *ldy) {
 	/* Table of constant values */
 	static double c_b4 = -1.;
 	static double c_b5 = 1.;
-	static long c__1 = 1;
+	static integer c__1 = 1;
 	static double c_b38 = 0.;
 
 	/* System generated locals */
-	long a_dim1, a_offset, t_dim1, t_offset, y_dim1, y_offset, i__1, i__2, i__3;
+	integer a_dim1, a_offset, t_dim1, t_offset, y_dim1, y_offset, i__1, i__2, i__3;
 	double d__1;
 
 	/* Local variables */
-	static long i__;
+	static integer i__;
 	static double ei;
 
 #define t_ref(a_1,a_2) t[(a_2)*t_dim1 + a_1]
@@ -9334,25 +9334,25 @@ int NUMlapack_dlahrd (long *n, long *k, long *nb, double *a, long *lda, double *
 #undef t_ref
 
 
-int NUMlapack_dlaln2 (int *ltrans, long *na, long *nw, double *smin, double *ca, double *a, long *lda,
-                      double *d1, double *d2, double *b, long *ldb, double *wr, double *wi, double *x, long *ldx, double *scale,
-                      double *xnorm, long *info) {
+int NUMlapack_dlaln2 (int *ltrans, integer *na, integer *nw, double *smin, double *ca, double *a, integer *lda,
+                      double *d1, double *d2, double *b, integer *ldb, double *wr, double *wi, double *x, integer *ldx, double *scale,
+                      double *xnorm, integer *info) {
 	/* Initialized data */
 	static int zswap[4] = { FALSE, FALSE, TRUE, TRUE };
 	static int rswap[4] = { FALSE, TRUE, FALSE, TRUE };
-	static long ipivot[16] /* was [4][4] */  = { 1, 2, 3, 4, 2, 1, 4, 3, 3, 4, 1, 2,
+	static integer ipivot[16] /* was [4][4] */  = { 1, 2, 3, 4, 2, 1, 4, 3, 3, 4, 1, 2,
 	        4, 3, 2, 1
 	                                           };
 	/* System generated locals */
-	long a_dim1, a_offset, b_dim1, b_offset, x_dim1, x_offset;
+	integer a_dim1, a_offset, b_dim1, b_offset, x_dim1, x_offset;
 	double d__1, d__2, d__3, d__4, d__5, d__6;
 	static double equiv_0[4], equiv_1[4];
 
 	/* Local variables */
 	static double bbnd, cmax, ui11r, ui12s, temp, ur11r, ur12s;
-	static long j;
+	static integer j;
 	static double u22abs;
-	static long icmax;
+	static integer icmax;
 	static double bnorm, cnorm, smini;
 
 #define ci (equiv_0)
@@ -9748,16 +9748,16 @@ int NUMlapack_dlaln2 (int *ltrans, long *na, long *nw, double *smin, double *ca,
 #undef ci
 
 
-double NUMlapack_dlange (const char *norm, long *m, long *n, double *a, long *lda, double *work) {
+double NUMlapack_dlange (const char *norm, integer *m, integer *n, double *a, integer *lda, double *work) {
 	/* Table of constant values */
-	static long c__1 = 1;
+	static integer c__1 = 1;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2;
+	integer a_dim1, a_offset, i__1, i__2;
 	double ret_val, d__1, d__2, d__3;
 
 	/* Local variables */
-	static long i__, j;
+	static integer i__, j;
 	static double scale;
 	static double value;
 	static double sum;
@@ -9847,16 +9847,16 @@ double NUMlapack_dlange (const char *norm, long *m, long *n, double *a, long *ld
 }								/* NUMlapack_dlange */
 
 
-double NUMlapack_dlanhs (const char *norm, long *n, double *a, long *lda, double *work) {
+double NUMlapack_dlanhs (const char *norm, integer *n, double *a, integer *lda, double *work) {
 	/* Table of constant values */
-	static long c__1 = 1;
+	static integer c__1 = 1;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3, i__4;
+	integer a_dim1, a_offset, i__1, i__2, i__3, i__4;
 	double ret_val, d__1, d__2, d__3;
 
 	/* Local variables */
-	static long i__, j;
+	static integer i__, j;
 	static double scale;
 	static double value;
 	static double sum;
@@ -9955,14 +9955,14 @@ double NUMlapack_dlanhs (const char *norm, long *n, double *a, long *lda, double
 }								/* NUMlapack_dlanhs */
 
 
-double NUMlapack_dlanst (const char *norm, long *n, double *d__, double *e) {
+double NUMlapack_dlanst (const char *norm, integer *n, double *d__, double *e) {
 	/* Table of constant values */
-	static long c__1 = 1;
+	static integer c__1 = 1;
 
 	/* System generated locals */
-	long i__1;
+	integer i__1;
 	double ret_val, d__1, d__2, d__3, d__4, d__5;
-	static long i__;
+	static integer i__;
 	static double scale;
 	static double anorm;
 	static double sum;
@@ -10027,17 +10027,17 @@ double NUMlapack_dlanst (const char *norm, long *n, double *d__, double *e) {
 	return ret_val;
 }								/* NUMlapack_dlanst */
 
-double NUMlapack_dlansy (const char *norm, const char *uplo, long *n, double *a, long *lda, double *work) {
+double NUMlapack_dlansy (const char *norm, const char *uplo, integer *n, double *a, integer *lda, double *work) {
 	/* Table of constant values */
-	static long c__1 = 1;
+	static integer c__1 = 1;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2;
+	integer a_dim1, a_offset, i__1, i__2;
 	double ret_val, d__1, d__2, d__3;
 
 	/* Local variables */
 	static double absa;
-	static long i__, j;
+	static integer i__, j;
 	static double scale;
 	static double value;
 	static double sum;
@@ -10307,9 +10307,9 @@ L10:
 }								/* NUMlapack_dlanv2 */
 
 
-int NUMlapack_dlapll (long *n, double *x, long *incx, double *y, long *incy, double *ssmin) {
+int NUMlapack_dlapll (integer *n, double *x, integer *incx, double *y, integer *incy, double *ssmin) {
 	/* System generated locals */
-	long i__1;
+	integer i__1;
 
 	/* Local variables */
 	static double c__;
@@ -10351,13 +10351,13 @@ int NUMlapack_dlapll (long *n, double *x, long *incx, double *y, long *incy, dou
 
 #define x_ref(a_1,a_2) x[(a_2)*x_dim1 + a_1]
 
-int NUMlapack_dlapmt (long *forwrd, long *m, long *n, double *x, long *ldx, long *k) {
+int NUMlapack_dlapmt (integer *forwrd, integer *m, integer *n, double *x, integer *ldx, integer *k) {
 	/* System generated locals */
-	long x_dim1, x_offset, i__1, i__2;
+	integer x_dim1, x_offset, i__1, i__2;
 
 	/* Local variables */
 	static double temp;
-	static long i__, j, ii, in;
+	static integer i__, j, ii, in;
 
 	x_dim1 = *ldx;
 	x_offset = 1 + x_dim1 * 1;
@@ -10481,19 +10481,19 @@ double NUMlapack_dlapy2 (double *x, double *y) {
 #define work_ref(a_1,a_2) work[(a_2)*work_dim1 + a_1]
 #define v_ref(a_1,a_2) v[(a_2)*v_dim1 + a_1]
 
-int NUMlapack_dlarfb (const char *side, const char *trans, const char *direct, const char *storev, long *m, long *n, long *k, double *v,
-                      long *ldv, double *t, long *ldt, double *c__, long *ldc, double *work, long *ldwork) {
+int NUMlapack_dlarfb (const char *side, const char *trans, const char *direct, const char *storev, integer *m, integer *n, integer *k, double *v,
+                      integer *ldv, double *t, integer *ldt, double *c__, integer *ldc, double *work, integer *ldwork) {
 	/* Table of constant values */
-	static long c__1 = 1;
+	static integer c__1 = 1;
 	static double c_b14 = 1.;
 	static double c_b25 = -1.;
 
 	/* System generated locals */
-	long c_dim1, c_offset, t_dim1, t_offset, v_dim1, v_offset;
-	long work_dim1, work_offset, i__1, i__2;
+	integer c_dim1, c_offset, t_dim1, t_offset, v_dim1, v_offset;
+	integer work_dim1, work_offset, i__1, i__2;
 
 	/* Local variables */
-	static long i__, j;
+	static integer i__, j;
 	static char transt[1];
 
 	v_dim1 = *ldv;
@@ -11040,15 +11040,15 @@ int NUMlapack_dlarfb (const char *side, const char *trans, const char *direct, c
 #undef v_ref
 #undef work_ref
 
-int NUMlapack_dlarf (const char *side, long *m, long *n, double *v, long *incv, double *tau, double *c__, long *ldc,
+int NUMlapack_dlarf (const char *side, integer *m, integer *n, double *v, integer *incv, double *tau, double *c__, integer *ldc,
                      double *work) {
 	/* Table of constant values */
 	static double c_b4 = 1.;
 	static double c_b5 = 0.;
-	static long c__1 = 1;
+	static integer c__1 = 1;
 
 	/* System generated locals */
-	long c_dim1, c_offset;
+	integer c_dim1, c_offset;
 	double d__1;
 
 	/* Local variables */
@@ -11094,17 +11094,17 @@ int NUMlapack_dlarf (const char *side, long *m, long *n, double *v, long *incv,
 	return 0;
 }								/* NUMlapack_dlarf */
 
-int NUMlapack_dlarfg (long *n, double *alpha, double *x, long *incx, double *tau) {
+int NUMlapack_dlarfg (integer *n, double *alpha, double *x, integer *incx, double *tau) {
 	/* System generated locals */
-	long i__1;
+	integer i__1;
 	double d__1;
 
 	/* Local variables */
 	static double beta;
-	static long j;
+	static integer j;
 	static double xnorm;
 	static double safmin, rsafmn;
-	static long knt;
+	static integer knt;
 
 	--x;
 
@@ -11179,18 +11179,18 @@ L10:
 #define t_ref(a_1,a_2) t[(a_2)*t_dim1 + a_1]
 #define v_ref(a_1,a_2) v[(a_2)*v_dim1 + a_1]
 
-int NUMlapack_dlarft (const char *direct, const char *storev, long *n, long *k, double *v, long *ldv, double *tau,
-                      double *t, long *ldt) {
+int NUMlapack_dlarft (const char *direct, const char *storev, integer *n, integer *k, double *v, integer *ldv, double *tau,
+                      double *t, integer *ldt) {
 	/* Table of constant values */
-	static long c__1 = 1;
+	static integer c__1 = 1;
 	static double c_b8 = 0.;
 
 	/* System generated locals */
-	long t_dim1, t_offset, v_dim1, v_offset, i__1, i__2, i__3;
+	integer t_dim1, t_offset, v_dim1, v_offset, i__1, i__2, i__3;
 	double d__1;
 
 	/* Local variables */
-	static long i__, j;
+	static integer i__, j;
 	static double vii;
 
 	v_dim1 = *ldv;
@@ -11317,16 +11317,16 @@ int NUMlapack_dlarft (const char *direct, const char *storev, long *n, long *k,
 
 int NUMlapack_dlartg (double *f, double *g, double *cs, double *sn, double *r__) {
 	/* Initialized data */
-	static long first = TRUE;
+	static integer first = TRUE;
 
 	/* System generated locals */
-	long i__1;
+	integer i__1;
 	double d__1, d__2;
 
 	/* Local variables */
-	static long i__;
+	static integer i__;
 	static double scale;
-	static long count;
+	static integer count;
 	static double f1, g1, safmn2, safmx2;
 	static double safmin, eps;
 
@@ -11335,7 +11335,7 @@ int NUMlapack_dlartg (double *f, double *g, double *cs, double *sn, double *r__)
 		safmin = NUMblas_dlamch ("S");
 		eps = NUMblas_dlamch ("E");
 		d__1 = NUMblas_dlamch ("B");
-		i__1 = (long) (log (safmin / eps) / log (NUMblas_dlamch ("B")) / 2.);
+		i__1 = (integer) (log (safmin / eps) / log (NUMblas_dlamch ("B")) / 2.);
 		safmn2 = pow_di (&d__1, &i__1);
 		safmx2 = 1. / safmn2;
 	}
@@ -11419,19 +11419,19 @@ L30:
 	return 0;
 }								/* NUMlapack_dlartg */
 
-int NUMlapack_dlarfx (const char *side, long *m, long *n, double *v, double *tau, double *c__, long *ldc,
+int NUMlapack_dlarfx (const char *side, integer *m, integer *n, double *v, double *tau, double *c__, integer *ldc,
                       double *work) {
 	/* Table of constant values */
 	static double c_b14 = 1.;
-	static long c__1 = 1;
+	static integer c__1 = 1;
 	static double c_b16 = 0.;
 
 	/* System generated locals */
-	long c_dim1, c_offset, i__1;
+	integer c_dim1, c_offset, i__1;
 	double d__1;
 
 	/* Local variables */
-	static long j;
+	static integer j;
 	static double t1, t2, t3, t4, t5, t6, t7, t8, t9, v1, v2, v3, v4, v5, v6, v7, v8, v9, t10, v10, sum;
 
 	--v;
@@ -12140,16 +12140,16 @@ int NUMlapack_dlas2 (double *f, double *g, double *h__, double *ssmin, double *s
 	return 0;
 }								/* NUMlapack_dlas2 */
 
-int NUMlapack_dlascl (const char *type__, long *kl, long *ku, double *cfrom, double *cto, long *m, long *n, double *a,
-                      long *lda, long *info) {
+int NUMlapack_dlascl (const char *type__, integer *kl, integer *ku, double *cfrom, double *cto, integer *m, integer *n, double *a,
+                      integer *lda, integer *info) {
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3, i__4, i__5;
+	integer a_dim1, a_offset, i__1, i__2, i__3, i__4, i__5;
 
 	/* Local variables */
-	static long done;
+	static integer done;
 	static double ctoc;
-	static long i__, j;
-	static long itype, k1, k2, k3, k4;
+	static integer i__, j;
+	static integer itype, k1, k2, k3, k4;
 	static double cfrom1;
 	static double cfromc;
 	static double bignum, smlnum, mul, cto1;
@@ -12367,12 +12367,12 @@ L10:
 	return 0;
 }								/* NUMlapack_dlascl */
 
-int NUMlapack_dlaset (const char *uplo, long *m, long *n, double *alpha, double *beta, double *a, long *lda) {
+int NUMlapack_dlaset (const char *uplo, integer *m, integer *n, double *alpha, double *beta, double *a, integer *lda) {
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3;
+	integer a_dim1, a_offset, i__1, i__2, i__3;
 
 	/* Local variables */
-	static long i__, j;
+	static integer i__, j;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -12437,15 +12437,15 @@ int NUMlapack_dlaset (const char *uplo, long *m, long *n, double *alpha, double
 	return 0;
 }								/* NUMlapack_dlaset */
 
-int NUMlapack_dlasq1 (long *n, double *d__, double *e, double *work, long *info) {
+int NUMlapack_dlasq1 (integer *n, double *d__, double *e, double *work, integer *info) {
 	/* System generated locals */
-	long i__1, i__2;
+	integer i__1, i__2;
 	double d__1, d__2, d__3;
 
 	/* Local variables */
-	static long i__;
+	static integer i__;
 	static double scale;
-	static long iinfo;
+	static integer iinfo;
 	static double sigmn;
 	static double sigmx;
 	static double safmin;
@@ -12542,28 +12542,28 @@ int NUMlapack_dlasq1 (long *n, double *d__, double *e, double *work, long *info)
 
 }								/* NUMlapack_dlasq1 */
 
-int NUMlapack_dlasq2 (long *n, double *z__, long *info) {
+int NUMlapack_dlasq2 (integer *n, double *z__, integer *info) {
 	/* System generated locals */
-	long i__1, i__2, i__3;
+	integer i__1, i__2, i__3;
 	double d__1, d__2;
 
 	/* Local variables */
-	static long ieee;
-	static long nbig;
+	static integer ieee;
+	static integer nbig;
 	static double dmin__, emin, emax;
-	static long ndiv, iter;
+	static integer ndiv, iter;
 	static double qmin, temp, qmax, zmax;
-	static long splt;
+	static integer splt;
 	static double d__, e;
-	static long k;
+	static integer k;
 	static double s, t;
-	static long nfail;
+	static integer nfail;
 	static double desig, trace, sigma;
-	static long iinfo, i0, i4, n0;
-	static long pp, iwhila, iwhilb;
+	static integer iinfo, i0, i4, n0;
+	static integer pp, iwhila, iwhilb;
 	static double oldemn, safmin;
 	static double eps, tol;
-	static long ipn4;
+	static integer ipn4;
 	static double tol2;
 
 	/* Parameter adjustments */
@@ -12963,10 +12963,10 @@ L150:
 	return 0;
 }								/* NUMlapack_dlasq2 */
 
-int NUMlapack_dlasq3 (long *i0, long *n0, double *z__, long *pp, double *dmin__, double *sigma, double *desig,
-                      double *qmax, long *nfail, long *iter, long *ndiv, long *ieee) {
+int NUMlapack_dlasq3 (integer *i0, integer *n0, double *z__, integer *pp, double *dmin__, double *sigma, double *desig,
+                      double *qmax, integer *nfail, integer *iter, integer *ndiv, integer *ieee) {
 	/* Initialized data */
-	static long ttype = 0;
+	static integer ttype = 0;
 	static double dmin1 = 0.;
 	static double dmin2 = 0.;
 	static double dn = 0.;
@@ -12975,15 +12975,15 @@ int NUMlapack_dlasq3 (long *i0, long *n0, double *z__, long *pp, double *dmin__,
 	static double tau = 0.;
 
 	/* System generated locals */
-	long i__1;
+	integer i__1;
 	double d__1, d__2;
 
 	/* Local variables */
 	static double temp, s, t;
-	static long j4;
-	static long nn;
+	static integer j4;
+	static integer nn;
 	static double safmin, eps, tol;
-	static long n0in, ipn4;
+	static integer n0in, ipn4;
 	static double tol2;
 
 	--z__;
@@ -13199,19 +13199,19 @@ L100:
 	return 0;
 }								/* NUMlapack_dlasq3 */
 
-int NUMlapack_dlasq4 (long *i0, long *n0, double *z__, long *pp, long *n0in, double *dmin__, double *dmin1,
-                      double *dmin2, double *dn, double *dn1, double *dn2, double *tau, long *ttype) {
+int NUMlapack_dlasq4 (integer *i0, integer *n0, double *z__, integer *pp, integer *n0in, double *dmin__, double *dmin1,
+                      double *dmin2, double *dn, double *dn1, double *dn2, double *tau, integer *ttype) {
 	/* Initialized data */
 
 	static double g = 0.;
 
 	/* System generated locals */
-	long i__1;
+	integer i__1;
 	double d__1, d__2;
 
 	/* Local variables */
 	static double s, a2, b1, b2;
-	static long i4, nn, np;
+	static integer i4, nn, np;
 	static double gam, gap1, gap2;
 
 	/* Parameter adjustments */
@@ -13504,15 +13504,15 @@ L80:
 	return 0;
 }								/* NUMlapack_dlasq4 */
 
-int NUMlapack_dlasq5 (long *i0, long *n0, double *z__, long *pp, double *tau, double *dmin__, double *dmin1,
-                      double *dmin2, double *dn, double *dnm1, double *dnm2, long *ieee) {
+int NUMlapack_dlasq5 (integer *i0, integer *n0, double *z__, integer *pp, double *tau, double *dmin__, double *dmin1,
+                      double *dmin2, double *dn, double *dnm1, double *dnm2, integer *ieee) {
 	/* System generated locals */
-	long i__1;
+	integer i__1;
 	double d__1, d__2;
 
 	/* Local variables */
 	static double emin, temp, d__;
-	static long j4, j4p2;
+	static integer j4, j4p2;
 
 	--z__;
 
@@ -13650,17 +13650,17 @@ int NUMlapack_dlasq5 (long *i0, long *n0, double *z__, long *pp, double *tau, do
 	return 0;
 }								/* NUMlapack_dlasq5 */
 
-int NUMlapack_dlasq6 (long *i0, long *n0, double *z__, long *pp, double *dmin__, double *dmin1, double *dmin2,
+int NUMlapack_dlasq6 (integer *i0, integer *n0, double *z__, integer *pp, double *dmin__, double *dmin1, double *dmin2,
                       double *dn, double *dnm1, double *dnm2) {
 	/* System generated locals */
-	long i__1;
+	integer i__1;
 	double d__1, d__2;
 
 	/* Local variables */
 	static double emin, temp, d__;
-	static long j4;
+	static integer j4;
 	static double safmin;
-	static long j4p2;
+	static integer j4p2;
 
 	/* Parameter adjustments */
 	--z__;
@@ -13770,15 +13770,15 @@ int NUMlapack_dlasq6 (long *i0, long *n0, double *z__, long *pp, double *dmin__,
 	return 0;
 }								/* NUMlapack_dlasq6 */
 
-int NUMlapack_dlasr (const char *side, const char *pivot, const char *direct, long *m, long *n, double *c__, double *s, double *a,
-                     long *lda) {
+int NUMlapack_dlasr (const char *side, const char *pivot, const char *direct, integer *m, integer *n, double *c__, double *s, double *a,
+                     integer *lda) {
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2;
+	integer a_dim1, a_offset, i__1, i__2;
 
 	/* Local variables */
-	static long info;
+	static integer info;
 	static double temp;
-	static long i__, j;
+	static integer i__, j;
 	static double ctemp, stemp;
 
 	--c__;
@@ -14027,16 +14027,16 @@ int NUMlapack_dlasr (const char *side, const char *pivot, const char *direct, lo
 
 #define stack_ref(a_1,a_2) stack[(a_2)*2 + a_1 - 3]
 
-int NUMlapack_dlasrt (const char *id, long *n, double *d__, long *info) {
+int NUMlapack_dlasrt (const char *id, integer *n, double *d__, integer *info) {
 	/* System generated locals */
-	long i__1, i__2;
+	integer i__1, i__2;
 
 	/* Local variables */
-	static long endd, i__, j;
-	static long stack[64] /* was [2][32] */ ;
+	static integer endd, i__, j;
+	static integer stack[64] /* was [2][32] */ ;
 	static double dmnmx, d1, d2, d3;
-	static long start;
-	static long stkpnt, dir;
+	static integer start;
+	static integer stkpnt, dir;
 	static double tmp;
 
 	--d__;
@@ -14235,14 +14235,14 @@ L110:
 
 #undef stack_ref
 
-int NUMlapack_dlassq (long *n, double *x, long *incx, double *scale, double *sumsq) {
+int NUMlapack_dlassq (integer *n, double *x, integer *incx, double *scale, double *sumsq) {
 	/* System generated locals */
-	long i__1, i__2;
+	integer i__1, i__2;
 	double d__1;
 
 	/* Local variables */
 	static double absxi;
-	static long ix;
+	static integer ix;
 
 	--x;
 
@@ -14280,12 +14280,12 @@ int NUMlapack_dlasv2 (double *f, double *g, double *h__, double *ssmin, double *
 	double d__1;
 
 	/* Local variables */
-	static long pmax;
+	static integer pmax;
 	static double temp;
-	static long swap;
+	static integer swap;
 	static double a, d__, l, m, r__, s, t, tsign, fa, ga, ha;
 	static double ft, gt, ht, mm;
-	static long gasmal;
+	static integer gasmal;
 	static double tt, clt, crt, slt, srt;
 
 	ft = *f;
@@ -14436,13 +14436,13 @@ int NUMlapack_dlasv2 (double *f, double *g, double *h__, double *ssmin, double *
 	return 0;
 }								/* NUMlapack_dlasv2 */
 
-int NUMlapack_dlaswp (long *n, double *a, long *lda, long *k1, long *k2, long *ipiv, long *incx) {
+int NUMlapack_dlaswp (integer *n, double *a, integer *lda, integer *k1, integer *k2, integer *ipiv, integer *incx) {
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3, i__4;
+	integer a_dim1, a_offset, i__1, i__2, i__3, i__4;
 
 	/* Local variables */
 	static double temp;
-	static long i__, j, k, i1, i2, n32, ip, ix, ix0, inc;
+	static integer i__, j, k, i1, i2, n32, ip, ix, ix0, inc;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -14513,21 +14513,21 @@ int NUMlapack_dlaswp (long *n, double *a, long *lda, long *k1, long *k2, long *i
 
 #define w_ref(a_1,a_2) w[(a_2)*w_dim1 + a_1]
 
-int NUMlapack_dlatrd (const char *uplo, long *n, long *nb, double *a, long *lda, double *e, double *tau, double *w,
-                      long *ldw) {
+int NUMlapack_dlatrd (const char *uplo, integer *n, integer *nb, double *a, integer *lda, double *e, double *tau, double *w,
+                      integer *ldw) {
 	/* Table of constant values */
 	static double c_b5 = -1.;
 	static double c_b6 = 1.;
-	static long c__1 = 1;
+	static integer c__1 = 1;
 	static double c_b16 = 0.;
 
 	/* System generated locals */
-	long a_dim1, a_offset, w_dim1, w_offset, i__1, i__2, i__3;
+	integer a_dim1, a_offset, w_dim1, w_offset, i__1, i__2, i__3;
 
 	/* Local variables */
-	static long i__;
+	static integer i__;
 	static double alpha;
-	static long iw;
+	static integer iw;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -14673,17 +14673,17 @@ int NUMlapack_dlatrd (const char *uplo, long *n, long *nb, double *a, long *lda,
 
 #undef w_ref
 
-int NUMlapack_dorg2l (long *m, long *n, long *k, double *a, long *lda, double *tau, double *work, long *info) {
+int NUMlapack_dorg2l (integer *m, integer *n, integer *k, double *a, integer *lda, double *tau, double *work, integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
+	static integer c__1 = 1;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3;
+	integer a_dim1, a_offset, i__1, i__2, i__3;
 	double d__1;
 
 	/* Local variables */
-	static long i__, j, l;
-	static long ii;
+	static integer i__, j, l;
+	static integer ii;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -14754,16 +14754,16 @@ int NUMlapack_dorg2l (long *m, long *n, long *k, double *a, long *lda, double *t
 	return 0;
 }								/* NUMlapack_dorg2l */
 
-int NUMlapack_dorg2r (long *m, long *n, long *k, double *a, long *lda, double *tau, double *work, long *info) {
+int NUMlapack_dorg2r (integer *m, integer *n, integer *k, double *a, integer *lda, double *tau, double *work, integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
+	static integer c__1 = 1;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2;
+	integer a_dim1, a_offset, i__1, i__2;
 	double d__1;
 
 	/* Local variables */
-	static long i__, j, l;
+	static integer i__, j, l;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -14837,22 +14837,22 @@ int NUMlapack_dorg2r (long *m, long *n, long *k, double *a, long *lda, double *t
 	return 0;
 }								/* NUMlapack_dorg2r */
 
-int NUMlapack_dorgbr (const char *vect, long *m, long *n, long *k, double *a, long *lda, double *tau, double *work,
-                      long *lwork, long *info) {
+int NUMlapack_dorgbr (const char *vect, integer *m, integer *n, integer *k, double *a, integer *lda, double *tau, double *work,
+                      integer *lwork, integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
-	static long c_n1 = -1;
+	static integer c__1 = 1;
+	static integer c_n1 = -1;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3;
+	integer a_dim1, a_offset, i__1, i__2, i__3;
 
 	/* Local variables */
-	static long i__, j;
-	static long iinfo;
-	static long wantq;
-	static long nb, mn;
-	static long lwkopt;
-	static long lquery;
+	static integer i__, j;
+	static integer iinfo;
+	static integer wantq;
+	static integer nb, mn;
+	static integer lwkopt;
+	static integer lquery;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -14996,18 +14996,18 @@ int NUMlapack_dorgbr (const char *vect, long *m, long *n, long *k, double *a, lo
 }								/* NUMlapack_dorgbr */
 
 
-int NUMlapack_dorghr (long *n, long *ilo, long *ihi, double *a, long *lda, double *tau, double *work,
-                      long *lwork, long *info) {
+int NUMlapack_dorghr (integer *n, integer *ilo, integer *ihi, double *a, integer *lda, double *tau, double *work,
+                      integer *lwork, integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
-	static long c_n1 = -1;
+	static integer c__1 = 1;
+	static integer c_n1 = -1;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2;
+	integer a_dim1, a_offset, i__1, i__2;
 
 	/* Local variables */
-	static long i__, j, iinfo, nb, nh;
-	static long lwkopt;
+	static integer i__, j, iinfo, nb, nh;
+	static integer lwkopt;
 	static int lquery;
 
 	a_dim1 = *lda;
@@ -15109,13 +15109,13 @@ int NUMlapack_dorghr (long *n, long *ilo, long *ihi, double *a, long *lda, doubl
 }								/* NUMlapack_dorghr */
 
 
-int NUMlapack_dorgl2 (long *m, long *n, long *k, double *a, long *lda, double *tau, double *work, long *info) {
+int NUMlapack_dorgl2 (integer *m, integer *n, integer *k, double *a, integer *lda, double *tau, double *work, integer *info) {
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2;
+	integer a_dim1, a_offset, i__1, i__2;
 	double d__1;
 
 	/* Local variables */
-	static long i__, j, l;
+	static integer i__, j, l;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -15194,24 +15194,24 @@ int NUMlapack_dorgl2 (long *m, long *n, long *k, double *a, long *lda, double *t
 	return 0;
 }								/* NUMlapack_dorgl2 */
 
-int NUMlapack_dorglq (long *m, long *n, long *k, double *a, long *lda, double *tau, double *work, long *lwork,
-                      long *info) {
+int NUMlapack_dorglq (integer *m, integer *n, integer *k, double *a, integer *lda, double *tau, double *work, integer *lwork,
+                      integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
-	static long c_n1 = -1;
-	static long c__3 = 3;
-	static long c__2 = 2;
+	static integer c__1 = 1;
+	static integer c_n1 = -1;
+	static integer c__3 = 3;
+	static integer c__2 = 2;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3;
+	integer a_dim1, a_offset, i__1, i__2, i__3;
 
 	/* Local variables */
-	static long i__, j, l, nbmin, iinfo;
-	static long ib, nb, ki, kk;
-	static long nx;
-	static long ldwork, lwkopt;
-	static long lquery;
-	static long iws;
+	static integer i__, j, l, nbmin, iinfo;
+	static integer ib, nb, ki, kk;
+	static integer nx;
+	static integer ldwork, lwkopt;
+	static integer lquery;
+	static integer iws;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -15364,24 +15364,24 @@ int NUMlapack_dorglq (long *m, long *n, long *k, double *a, long *lda, double *t
 	return 0;
 }								/* NUMlapack_dorglq */
 
-int NUMlapack_dorgql (long *m, long *n, long *k, double *a, long *lda, double *tau, double *work, long *lwork,
-                      long *info) {
+int NUMlapack_dorgql (integer *m, integer *n, integer *k, double *a, integer *lda, double *tau, double *work, integer *lwork,
+                      integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
-	static long c_n1 = -1;
-	static long c__3 = 3;
-	static long c__2 = 2;
+	static integer c__1 = 1;
+	static integer c_n1 = -1;
+	static integer c__3 = 3;
+	static integer c__2 = 2;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3, i__4;
+	integer a_dim1, a_offset, i__1, i__2, i__3, i__4;
 
 	/* Local variables */
-	static long i__, j, l, nbmin, iinfo;
-	static long ib, nb, kk;
-	static long nx;
-	static long ldwork, lwkopt;
-	static long lquery;
-	static long iws;
+	static integer i__, j, l, nbmin, iinfo;
+	static integer ib, nb, kk;
+	static integer nx;
+	static integer ldwork, lwkopt;
+	static integer lquery;
+	static integer iws;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -15533,24 +15533,24 @@ int NUMlapack_dorgql (long *m, long *n, long *k, double *a, long *lda, double *t
 	return 0;
 }								/* NUMlapack_dorgql */
 
-int NUMlapack_dorgqr (long *m, long *n, long *k, double *a, long *lda, double *tau, double *work, long *lwork,
-                      long *info) {
+int NUMlapack_dorgqr (integer *m, integer *n, integer *k, double *a, integer *lda, double *tau, double *work, integer *lwork,
+                      integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
-	static long c_n1 = -1;
-	static long c__3 = 3;
-	static long c__2 = 2;
+	static integer c__1 = 1;
+	static integer c_n1 = -1;
+	static integer c__3 = 3;
+	static integer c__2 = 2;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3;
+	integer a_dim1, a_offset, i__1, i__2, i__3;
 
 	/* Local variables */
-	static long i__, j, l, nbmin, iinfo;
-	static long ib, nb, ki, kk;
-	static long nx;
-	static long ldwork, lwkopt;
-	static long lquery;
-	static long iws;
+	static integer i__, j, l, nbmin, iinfo;
+	static integer ib, nb, ki, kk;
+	static integer nx;
+	static integer ldwork, lwkopt;
+	static integer lquery;
+	static integer iws;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -15704,22 +15704,22 @@ int NUMlapack_dorgqr (long *m, long *n, long *k, double *a, long *lda, double *t
 	return 0;
 }								/* NUMlapack_dorgqr */
 
-int NUMlapack_dorgtr (const char *uplo, long *n, double *a, long *lda, double *tau, double *work, long *lwork,
-                      long *info) {
+int NUMlapack_dorgtr (const char *uplo, integer *n, double *a, integer *lda, double *tau, double *work, integer *lwork,
+                      integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
-	static long c_n1 = -1;
+	static integer c__1 = 1;
+	static integer c_n1 = -1;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3;
+	integer a_dim1, a_offset, i__1, i__2, i__3;
 
 	/* Local variables */
-	static long i__, j;
-	static long iinfo;
-	static long upper;
-	static long nb;
-	static long lwkopt;
-	static long lquery;
+	static integer i__, j;
+	static integer iinfo;
+	static integer upper;
+	static integer nb;
+	static integer lwkopt;
+	static integer lquery;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -15847,19 +15847,19 @@ int NUMlapack_dorgtr (const char *uplo, long *n, double *a, long *lda, double *t
 	return 0;
 }								/* NUMlapack_dorgtr */
 
-int NUMlapack_dorm2r (const char *side, const char *trans, long *m, long *n, long *k, double *a, long *lda, double *tau,
-                      double *c__, long *ldc, double *work, long *info) {
+int NUMlapack_dorm2r (const char *side, const char *trans, integer *m, integer *n, integer *k, double *a, integer *lda, double *tau,
+                      double *c__, integer *ldc, double *work, integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
+	static integer c__1 = 1;
 
 	/* System generated locals */
-	long a_dim1, a_offset, c_dim1, c_offset, i__1, i__2;
+	integer a_dim1, a_offset, c_dim1, c_offset, i__1, i__2;
 
 	/* Local variables */
-	static long left;
-	static long i__;
-	static long i1, i2, i3, ic, jc, mi, ni, nq;
-	static long notran;
+	static integer left;
+	static integer i__;
+	static integer i1, i2, i3, ic, jc, mi, ni, nq;
+	static integer notran;
 	static double aii;
 
 	a_dim1 = *lda;
@@ -15956,26 +15956,26 @@ int NUMlapack_dorm2r (const char *side, const char *trans, long *m, long *n, lon
 	return 0;
 }								/* NUMlapack_dorm2r */
 
-int NUMlapack_dormbr (const char *vect, const char *side, const char *trans, long *m, long *n, long *k, double *a, long *lda,
-                      double *tau, double *c__, long *ldc, double *work, long *lwork, long *info) {
+int NUMlapack_dormbr (const char *vect, const char *side, const char *trans, integer *m, integer *n, integer *k, double *a, integer *lda,
+                      double *tau, double *c__, integer *ldc, double *work, integer *lwork, integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
-	static long c_n1 = -1;
-	static long c__2 = 2;
+	static integer c__1 = 1;
+	static integer c_n1 = -1;
+	static integer c__2 = 2;
 
 	/* System generated locals */
 	const char *a__1[2];
-	long a_dim1, a_offset, c_dim1, c_offset, i__1, i__2, i__3[2];
+	integer a_dim1, a_offset, c_dim1, c_offset, i__1, i__2, i__3[2];
 	char ch__1[2];
 
 	/* Local variables */
-	static long left;
-	static long iinfo, i1, i2, nb, mi, ni, nq, nw;
-	static long notran;
-	static long applyq;
+	static integer left;
+	static integer iinfo, i1, i2, nb, mi, ni, nq, nw;
+	static integer notran;
+	static integer applyq;
 	static char transt[1];
-	static long lwkopt;
-	static long lquery;
+	static integer lwkopt;
+	static integer lquery;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -16151,16 +16151,16 @@ int NUMlapack_dormbr (const char *vect, const char *side, const char *trans, lon
 	return 0;
 }								/* NUMlapack_dormbr */
 
-int NUMlapack_dorml2 (const char *side, const char *trans, long *m, long *n, long *k, double *a, long *lda, double *tau,
-                      double *c__, long *ldc, double *work, long *info) {
+int NUMlapack_dorml2 (const char *side, const char *trans, integer *m, integer *n, integer *k, double *a, integer *lda, double *tau,
+                      double *c__, integer *ldc, double *work, integer *info) {
 	/* System generated locals */
-	long a_dim1, a_offset, c_dim1, c_offset, i__1, i__2;
+	integer a_dim1, a_offset, c_dim1, c_offset, i__1, i__2;
 
 	/* Local variables */
-	static long left;
-	static long i__;
-	static long i1, i2, i3, ic, jc, mi, ni, nq;
-	static long notran;
+	static integer left;
+	static integer i__;
+	static integer i1, i2, i3, ic, jc, mi, ni, nq;
+	static integer notran;
 	static double aii;
 
 	a_dim1 = *lda;
@@ -16258,32 +16258,32 @@ int NUMlapack_dorml2 (const char *side, const char *trans, long *m, long *n, lon
 
 }								/* NUMlapack_dorml2 */
 
-int NUMlapack_dormlq (const char *side, const char *trans, long *m, long *n, long *k, double *a, long *lda, double *tau,
-                      double *c__, long *ldc, double *work, long *lwork, long *info) {
+int NUMlapack_dormlq (const char *side, const char *trans, integer *m, integer *n, integer *k, double *a, integer *lda, double *tau,
+                      double *c__, integer *ldc, double *work, integer *lwork, integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
-	static long c_n1 = -1;
-	static long c__2 = 2;
-	static long c__65 = 65;
+	static integer c__1 = 1;
+	static integer c_n1 = -1;
+	static integer c__2 = 2;
+	static integer c__65 = 65;
 
 	/* System generated locals */
 	char *a__1[2];
-	long a_dim1, a_offset, c_dim1, c_offset, i__1, i__2, i__3[2], i__4, i__5;
+	integer a_dim1, a_offset, c_dim1, c_offset, i__1, i__2, i__3[2], i__4, i__5;
 	char ch__1[2];
 
 	/* Local variables */
-	static long left;
-	static long i__;
+	static integer left;
+	static integer i__;
 	static double t[4160] /* was [65][64] */ ;
-	static long nbmin, iinfo, i1, i2, i3;
-	static long ib, ic, jc, nb, mi, ni;
-	static long nq, nw;
-	static long notran;
-	static long ldwork;
+	static integer nbmin, iinfo, i1, i2, i3;
+	static integer ib, ic, jc, nb, mi, ni;
+	static integer nq, nw;
+	static integer notran;
+	static integer ldwork;
 	static char transt[1];
-	static long lwkopt;
-	static long lquery;
-	static long iws;
+	static integer lwkopt;
+	static integer lquery;
+	static integer iws;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -16445,30 +16445,30 @@ int NUMlapack_dormlq (const char *side, const char *trans, long *m, long *n, lon
 	return 0;
 }								/* NUMlapack_dormlq */
 
-int NUMlapack_dormqr (const char *side, const char *trans, long *m, long *n, long *k, double *a, long *lda, double *tau,
-                      double *c__, long *ldc, double *work, long *lwork, long *info) {
+int NUMlapack_dormqr (const char *side, const char *trans, integer *m, integer *n, integer *k, double *a, integer *lda, double *tau,
+                      double *c__, integer *ldc, double *work, integer *lwork, integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
-	static long c_n1 = -1;
-	static long c__2 = 2;
-	static long c__65 = 65;
+	static integer c__1 = 1;
+	static integer c_n1 = -1;
+	static integer c__2 = 2;
+	static integer c__65 = 65;
 
 	/* System generated locals */
 	char *a__1[2];
-	long a_dim1, a_offset, c_dim1, c_offset, i__1, i__2, i__3[2], i__4, i__5;
+	integer a_dim1, a_offset, c_dim1, c_offset, i__1, i__2, i__3[2], i__4, i__5;
 	char ch__1[2];
 
 	/* Local variables */
-	static long left;
-	static long i__;
+	static integer left;
+	static integer i__;
 	static double t[4160] /* was [65][64] */ ;
-	static long nbmin, iinfo, i1, i2, i3;
-	static long ib, ic, jc, nb, mi, ni;
-	static long nq, nw;
-	static long notran;
-	static long ldwork, lwkopt;
-	static long lquery;
-	static long iws;
+	static integer nbmin, iinfo, i1, i2, i3;
+	static integer ib, ic, jc, nb, mi, ni;
+	static integer nq, nw;
+	static integer notran;
+	static integer ldwork, lwkopt;
+	static integer lquery;
+	static integer iws;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -16625,16 +16625,16 @@ int NUMlapack_dormqr (const char *side, const char *trans, long *m, long *n, lon
 	return 0;
 }								/* NUMlapack_dormqr */
 
-int NUMlapack_dormr2 (const char *side, const char *trans, long *m, long *n, long *k, double *a, long *lda, double *tau,
-                      double *c__, long *ldc, double *work, long *info) {
+int NUMlapack_dormr2 (const char *side, const char *trans, integer *m, integer *n, integer *k, double *a, integer *lda, double *tau,
+                      double *c__, integer *ldc, double *work, integer *info) {
 	/* System generated locals */
-	long a_dim1, a_offset, c_dim1, c_offset, i__1, i__2;
+	integer a_dim1, a_offset, c_dim1, c_offset, i__1, i__2;
 
 	/* Local variables */
-	static long left;
-	static long i__;
-	static long i1, i2, i3, mi, ni, nq;
-	static long notran;
+	static integer left;
+	static integer i__;
+	static integer i1, i2, i3, mi, ni, nq;
+	static integer notran;
 	static double aii;
 
 	a_dim1 = *lda;
@@ -16727,17 +16727,17 @@ int NUMlapack_dormr2 (const char *side, const char *trans, long *m, long *n, lon
 	return 0;
 }								/* NUMlapack_dormr2 */
 
-int NUMlapack_dpotf2 (const char *uplo, long *n, double *a, long *lda, long *info) {
+int NUMlapack_dpotf2 (const char *uplo, integer *n, double *a, integer *lda, integer *info) {
 	/* Table of constant values */
 	static double c_b10 = -1.;
 	static double c_b12 = 1.;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3;
+	integer a_dim1, a_offset, i__1, i__2, i__3;
 	double d__1;
 
 	/* Local variables */
-	static long j;
+	static integer j;
 	static int upper;
 	static double ajj;
 
@@ -16839,9 +16839,9 @@ L40:
 	return 0;
 }				/* NUMlapack_dpotf2_ */
 
-int NUMlapack_drscl (long *n, double *sa, double *sx, long *incx) {
+int NUMlapack_drscl (integer *n, double *sa, double *sx, integer *incx) {
 	static double cden;
-	static long done;
+	static integer done;
 	static double cnum, cden1, cnum1;
 	static double bignum, smlnum, mul;
 
@@ -16901,38 +16901,38 @@ L10:
 
 #define z___ref(a_1,a_2) z__[(a_2)*z_dim1 + a_1]
 
-int NUMlapack_dsteqr (const char *compz, long *n, double *d__, double *e, double *z__, long *ldz, double *work,
-                      long *info) {
+int NUMlapack_dsteqr (const char *compz, integer *n, double *d__, double *e, double *z__, integer *ldz, double *work,
+                      integer *info) {
 	/* Table of constant values */
 	static double c_b9 = 0.;
 	static double c_b10 = 1.;
-	static long c__0 = 0;
-	static long c__1 = 1;
-	static long c__2 = 2;
+	static integer c__0 = 0;
+	static integer c__1 = 1;
+	static integer c__2 = 2;
 
 	/* System generated locals */
-	long z_dim1, z_offset, i__1, i__2;
+	integer z_dim1, z_offset, i__1, i__2;
 	double d__1, d__2;
 
 	/* Local variables */
-	static long lend, jtot;
+	static integer lend, jtot;
 	static double b, c__, f, g;
-	static long i__, j, k, l, m;
+	static integer i__, j, k, l, m;
 	static double p, r__, s;
 	static double anorm;
-	static long l1;
-	static long lendm1, lendp1;
-	static long ii;
-	static long mm, iscale;
+	static integer l1;
+	static integer lendm1, lendp1;
+	static integer ii;
+	static integer mm, iscale;
 	static double safmin;
 	static double safmax;
-	static long lendsv;
+	static integer lendsv;
 	static double ssfmin;
-	static long nmaxit, icompz;
+	static integer nmaxit, icompz;
 	static double ssfmax;
-	static long lm1, mm1, nm1;
+	static integer lm1, mm1, nm1;
 	static double rt1, rt2, eps;
-	static long lsv;
+	static integer lsv;
 	static double tst, eps2;
 
 	--d__;
@@ -17379,32 +17379,32 @@ L190:
 
 #undef z___ref
 
-int NUMlapack_dsterf (long *n, double *d__, double *e, long *info) {
+int NUMlapack_dsterf (integer *n, double *d__, double *e, integer *info) {
 	/* Table of constant values */
-	static long c__0 = 0;
-	static long c__1 = 1;
+	static integer c__0 = 0;
+	static integer c__1 = 1;
 	static double c_b32 = 1.;
 
 	/* System generated locals */
-	long i__1;
+	integer i__1;
 	double d__1, d__2, d__3;
 
 	/* Local variables */
 	static double oldc;
-	static long lend, jtot;
+	static integer lend, jtot;
 	static double c__;
-	static long i__, l, m;
+	static integer i__, l, m;
 	static double p, gamma, r__, s, alpha, sigma, anorm;
-	static long l1;
+	static integer l1;
 	static double bb;
-	static long iscale;
+	static integer iscale;
 	static double oldgam, safmin;
 	static double safmax;
-	static long lendsv;
+	static integer lendsv;
 	static double ssfmin;
-	static long nmaxit;
+	static integer nmaxit;
 	static double ssfmax, rt1, rt2, eps, rte;
-	static long lsv;
+	static integer lsv;
 	static double eps2;
 
 	--e;
@@ -17744,37 +17744,37 @@ L180:
 	return 0;
 }								/* NUMlapack_dsterf */
 
-int NUMlapack_dsyev (const char *jobz, const char *uplo, long *n, double *a, long *lda, double *w, double *work,
-                     long *lwork, long *info) {
+int NUMlapack_dsyev (const char *jobz, const char *uplo, integer *n, double *a, integer *lda, double *w, double *work,
+                     integer *lwork, integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
-	static long c_n1 = -1;
-	static long c__0 = 0;
+	static integer c__1 = 1;
+	static integer c_n1 = -1;
+	static integer c__0 = 0;
 	static double c_b17 = 1.;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2;
+	integer a_dim1, a_offset, i__1, i__2;
 	double d__1;
 
 	/* Local variables */
-	static long inde;
+	static integer inde;
 	static double anrm;
-	static long imax;
+	static integer imax;
 	static double rmin, rmax;
-	static long lopt;
+	static integer lopt;
 	static double sigma;
-	static long iinfo;
-	static long lower, wantz;
-	static long nb;
-	static long iscale;
+	static integer iinfo;
+	static integer lower, wantz;
+	static integer nb;
+	static integer iscale;
 	static double safmin;
 	static double bignum;
-	static long indtau;
-	static long indwrk;
-	static long llwork;
+	static integer indtau;
+	static integer indwrk;
+	static integer llwork;
 	static double smlnum;
-	static long lwkopt;
-	static long lquery;
+	static integer lwkopt;
+	static integer lquery;
 	static double eps;
 
 	a_dim1 = *lda;
@@ -17869,7 +17869,7 @@ int NUMlapack_dsyev (const char *jobz, const char *uplo, long *n, double *a, lon
 	llwork = *lwork - indwrk + 1;
 	NUMlapack_dsytrd (uplo, n, &a[a_offset], lda, &w[1], &work[inde], &work[indtau], &work[indwrk], &llwork,
 	                  &iinfo);
-	lopt = (long) ( (*n << 1) + work[indwrk]);
+	lopt = (integer) ( (*n << 1) + work[indwrk]);
 
 	/* For eigenvalues only, call DSTERF.  For eigenvectors, first call
 	   DORGTR to generate the orthogonal matrix, then call DSTEQR. */
@@ -17900,21 +17900,21 @@ int NUMlapack_dsyev (const char *jobz, const char *uplo, long *n, double *a, lon
 	return 0;
 }								/* NUMlapack_dsyev */
 
-int NUMlapack_dsytd2 (const char *uplo, long *n, double *a, long *lda, double *d__, double *e, double *tau,
-                      long *info) {
+int NUMlapack_dsytd2 (const char *uplo, integer *n, double *a, integer *lda, double *d__, double *e, double *tau,
+                      integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
+	static integer c__1 = 1;
 	static double c_b8 = 0.;
 	static double c_b14 = -1.;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3;
+	integer a_dim1, a_offset, i__1, i__2, i__3;
 
 	/* Local variables */
 	static double taui;
-	static long i__;
+	static integer i__;
 	static double alpha;
-	static long upper;
+	static integer upper;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -18039,27 +18039,27 @@ int NUMlapack_dsytd2 (const char *uplo, long *n, double *a, long *lda, double *d
 	return 0;
 }								/* NUMlapack_dsytd2 */
 
-int NUMlapack_dsytrd (const char *uplo, long *n, double *a, long *lda, double *d__, double *e, double *tau,
-                      double *work, long *lwork, long *info) {
+int NUMlapack_dsytrd (const char *uplo, integer *n, double *a, integer *lda, double *d__, double *e, double *tau,
+                      double *work, integer *lwork, integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
-	static long c_n1 = -1;
-	static long c__3 = 3;
-	static long c__2 = 2;
+	static integer c__1 = 1;
+	static integer c_n1 = -1;
+	static integer c__3 = 3;
+	static integer c__2 = 2;
 	static double c_b22 = -1.;
 	static double c_b23 = 1.;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2, i__3;
+	integer a_dim1, a_offset, i__1, i__2, i__3;
 
 	/* Local variables */
-	static long i__, j;
-	static long nbmin, iinfo;
-	static long upper;
-	static long nb, kk, nx;
-	static long ldwork, lwkopt;
-	static long lquery;
-	static long iws;
+	static integer i__, j;
+	static integer nbmin, iinfo;
+	static integer upper;
+	static integer nb, kk, nx;
+	static integer ldwork, lwkopt;
+	static integer lquery;
+	static integer iws;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -18232,31 +18232,31 @@ int NUMlapack_dsytrd (const char *uplo, long *n, double *a, long *lda, double *d
 #define u_ref(a_1,a_2) u[(a_2)*u_dim1 + a_1]
 #define v_ref(a_1,a_2) v[(a_2)*v_dim1 + a_1]
 
-int NUMlapack_dtgsja (const char *jobu, const char *jobv, const char *jobq, long *m, long *p, long *n, long *k, long *l,
-                      double *a, long *lda, double *b, long *ldb, double *tola, double *tolb, double *alpha, double *beta,
-                      double *u, long *ldu, double *v, long *ldv, double *q, long *ldq, double *work, long *ncycle, long *info) {
+int NUMlapack_dtgsja (const char *jobu, const char *jobv, const char *jobq, integer *m, integer *p, integer *n, integer *k, integer *l,
+                      double *a, integer *lda, double *b, integer *ldb, double *tola, double *tolb, double *alpha, double *beta,
+                      double *u, integer *ldu, double *v, integer *ldv, double *q, integer *ldq, double *work, integer *ncycle, integer *info) {
 	/* Table of constant values */
 	static double c_b13 = 0.;
 	static double c_b14 = 1.;
-	static long c__1 = 1;
+	static integer c__1 = 1;
 	static double c_b43 = -1.;
 
 	/* System generated locals */
-	long a_dim1, a_offset, b_dim1, b_offset, q_dim1, q_offset, u_dim1, u_offset, v_dim1, v_offset, i__1, i__2,
+	integer a_dim1, a_offset, b_dim1, b_offset, q_dim1, q_offset, u_dim1, u_offset, v_dim1, v_offset, i__1, i__2,
 	     i__3, i__4;
 	double d__1;
 
 	/* Local variables */
-	static long i__, j;
+	static integer i__, j;
 	static double gamma;
 	static double a1;
-	static long initq;
+	static integer initq;
 	static double a2, a3, b1;
-	static long initu, initv, wantq, upper;
+	static integer initu, initv, wantq, upper;
 	static double b2, b3;
-	static long wantu, wantv;
+	static integer wantu, wantv;
 	static double error, ssmin;
-	static long kcycle;
+	static integer kcycle;
 	static double csq, csu, csv, snq, rwk, snu, snv;
 
 	a_dim1 = *lda;
@@ -18550,38 +18550,38 @@ L100:
 
 
 
-int NUMlapack_dtrevc (const char *side, const char *howmny, int *select, long *n, double *t, long *ldt, double *vl,
-                      long *ldvl, double *vr, long *ldvr, long *mm, long *m, double *work, long *info) {
+int NUMlapack_dtrevc (const char *side, const char *howmny, int *select, integer *n, double *t, integer *ldt, double *vl,
+                      integer *ldvl, double *vr, integer *ldvr, integer *mm, integer *m, double *work, integer *info) {
 	/* Table of constant values */
 	static int c_false = FALSE;
-	static long c__1 = 1;
+	static integer c__1 = 1;
 	static double c_b22 = 1.;
 	static double c_b25 = 0.;
-	static long c__2 = 2;
+	static integer c__2 = 2;
 	static int c_true = TRUE;
 
 	/* System generated locals */
-	long t_dim1, t_offset, vl_dim1, vl_offset, vr_dim1, vr_offset, i__1, i__2, i__3;
+	integer t_dim1, t_offset, vl_dim1, vl_offset, vr_dim1, vr_offset, i__1, i__2, i__3;
 	double d__1, d__2, d__3, d__4, d__5, d__6;
 
 	/* Local variables */
 	static double beta, emax;
 	static int pair;
 	static int allv;
-	static long ierr;
+	static integer ierr;
 	static double unfl, ovfl, smin;
 	static int over;
 	static double vmax;
-	static long jnxt, i__, j, k;
+	static integer jnxt, i__, j, k;
 	static double scale, x[4] /* was [2][2] */ ;
 	static double remax;
 	static int leftv, bothv;
 	static double vcrit;
 	static int somev;
-	static long j1, j2, n2;
+	static integer j1, j2, n2;
 	static double xnorm;
-	static long ii, ki;
-	static long ip, is;
+	static integer ii, ki;
+	static integer ip, is;
 	static double wi;
 	static double wr;
 	static double bignum;
@@ -19533,17 +19533,17 @@ L250:
 #undef x_ref
 #undef t_ref
 
-int NUMlapack_dtrti2 (const char *uplo, const char *diag, long *n, double *a, long *lda, long *info) {
+int NUMlapack_dtrti2 (const char *uplo, const char *diag, integer *n, double *a, integer *lda, integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
+	static integer c__1 = 1;
 
 	/* System generated locals */
-	long a_dim1, a_offset, i__1, i__2;
+	integer a_dim1, a_offset, i__1, i__2;
 
 	/* Local variables */
-	static long j;
-	static long upper;
-	static long nounit;
+	static integer j;
+	static integer upper;
+	static integer nounit;
 	static double ajj;
 
 	a_dim1 = *lda;
@@ -19618,24 +19618,24 @@ int NUMlapack_dtrti2 (const char *uplo, const char *diag, long *n, double *a, lo
 	return 0;
 }								/* NUMlapack_dtrti2 */
 
-int NUMlapack_dtrtri (const char *uplo, const char *diag, long *n, double *a, long *lda, long *info) {
+int NUMlapack_dtrtri (const char *uplo, const char *diag, integer *n, double *a, integer *lda, integer *info) {
 	/* Table of constant values */
-	static long c__1 = 1;
-	static long c_n1 = -1;
-	static long c__2 = 2;
+	static integer c__1 = 1;
+	static integer c_n1 = -1;
+	static integer c__2 = 2;
 	static double c_b18 = 1.;
 	static double c_b22 = -1.;
 
 	/* System generated locals */
 	char *a__1[2];
-	long a_dim1, a_offset, i__1, i__2[2], i__3, i__4, i__5;
+	integer a_dim1, a_offset, i__1, i__2[2], i__3, i__4, i__5;
 	char ch__1[2];
 
 	/* Local variables */
-	static long j;
-	static long upper;
-	static long jb, nb, nn;
-	static long nounit;
+	static integer j;
+	static integer upper;
+	static integer jb, nb, nn;
+	static integer nounit;
 
 	a_dim1 = *lda;
 	a_offset = 1 + a_dim1 * 1;
@@ -19752,9 +19752,9 @@ int NUMlapack_dtrtri (const char *uplo, const char *diag, long *n, double *a, lo
 	return 0;
 }								/* NUMlapack_dtrtri */
 
-long NUMlapack_ieeeck (long *ispec, float *zero, float *one) {
+integer NUMlapack_ieeeck (integer *ispec, float *zero, float *one) {
 	/* System generated locals */
-	long ret_val;
+	integer ret_val;
 
 	/* Local variables */
 	static float neginf, posinf, negzro, newzro, nan1, nan2, nan3, nan4, nan5, nan6;
@@ -19860,24 +19860,24 @@ long NUMlapack_ieeeck (long *ispec, float *zero, float *one) {
 	return ret_val;
 }								/* NUMlapack_ieeeck */
 
-long NUMlapack_ilaenv (long *ispec, const char *name__, const char *opts, long *n1, long *n2, long *n3, long *n4,
-                       long name_len, long opts_len) {
+integer NUMlapack_ilaenv (integer *ispec, const char *name__, const char *opts, integer *n1, integer *n2, integer *n3, integer *n4,
+                       integer name_len, integer opts_len) {
 	/* Table of constant values */
-	static long c__0 = 0;
+	static integer c__0 = 0;
 	static float c_b162 = 0.f;
 	static float c_b163 = 1.f;
-	static long c__1 = 1;
+	static integer c__1 = 1;
 
 	/* System generated locals */
-	long ret_val;
+	integer ret_val;
 
 	/* Local variables */
-	static long i__;
-	static long cname, sname;
-	static long nbmin;
+	static integer i__;
+	static integer cname, sname;
+	static integer nbmin;
 	static char c1[1], c2[2], c3[3], c4[2];
-	static long ic, nb;
-	static long iz, nx;
+	static integer ic, nb;
+	static integer iz, nx;
 	static char subnam[6];
 
 	(void) opts;
@@ -20291,7 +20291,7 @@ L600:
 
 	/* ISPEC = 6: crossover point for SVD (used by xGELSS and xGESVD) */
 
-	ret_val = (long) ( (float) MIN (*n1, *n2) * 1.6f);
+	ret_val = (integer) ( (float) MIN (*n1, *n2) * 1.6f);
 	return ret_val;
 
 L700:
diff --git a/dwsys/NUMclapack.h b/dwsys/NUMclapack.h
index 8b28216..3a72a84 100644
--- a/dwsys/NUMclapack.h
+++ b/dwsys/NUMclapack.h
@@ -2,7 +2,7 @@
 #define _NUMclapack_h_
  /* NUMclapack.h
  *
- * Copyright (C) 1994-2011 David Weenink
+ * Copyright (C) 1994-2011 David Weenink, 2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -23,6 +23,8 @@
  djmw 20030310 Latest modification
 */
 
+#include "melder.h"   /* for integer */
+
 /*
 	The following routines all use FORTRAN column-major storage of
 	matrices. A consequence is that all matrices must have been allocated
@@ -37,9 +39,9 @@
 
 */
 
-int NUMlapack_dbdsqr(const char *uplo, long *n, long *ncvt, long *nru, long *ncc,
-	double *d, double *e, double *vt, long *ldvt, double *u, long *ldu,
-	double *c, long *ldc, double *work, long *info);
+int NUMlapack_dbdsqr(const char *uplo, integer *n, integer *ncvt, integer *nru, integer *ncc,
+	double *d, double *e, double *vt, integer *ldvt, double *u, integer *ldu,
+	double *c, integer *ldc, double *work, integer *info);
 /*  Purpose
     =======
 
@@ -157,8 +159,8 @@ int NUMlapack_dbdsqr(const char *uplo, long *n, long *ncvt, long *nru, long *ncc
     =====================================================================
 */
 
-int NUMlapack_dgebd2(long *m, long *n, double *a, long *lda, double *d, double *e,
-	double *tauq, double *taup, double *work, long *info);
+int NUMlapack_dgebd2(integer *m, integer *n, double *a, integer *lda, double *d, double *e,
+	double *tauq, double *taup, double *work, integer *info);
 /*
     Purpose
     =======
@@ -274,8 +276,8 @@ int NUMlapack_dgebd2(long *m, long *n, double *a, long *lda, double *d, double *
 
 
 
-int NUMlapack_dgebrd(long *m, long *n, double *a, long *lda, double *d, double *e,
-	double *tauq, double *taup, double *work, long *lwork, long *info);
+int NUMlapack_dgebrd(integer *m, integer *n, double *a, integer *lda, double *d, double *e,
+	double *tauq, double *taup, double *work, integer *lwork, integer *info);
 /*
     Purpose
     =======
@@ -400,8 +402,8 @@ int NUMlapack_dgebrd(long *m, long *n, double *a, long *lda, double *d, double *
     =====================================================================
 */
 
-int NUMlapack_dgebak (const char *job, const char *side, long *n, long *ilo, long *ihi,
-	double *scale, long *m,	double *v, long *ldv, long *info);
+int NUMlapack_dgebak (const char *job, const char *side, integer *n, integer *ilo, integer *ihi,
+	double *scale, integer *m,	double *v, integer *ldv, integer *info);
 /*  -- LAPACK routine (version 3.0) --
        Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
        Courant Institute, Argonne National Lab, and Rice University
@@ -461,8 +463,8 @@ int NUMlapack_dgebak (const char *job, const char *side, long *n, long *ilo, lon
     =====================================================================
 */
 
-int NUMlapack_dgebal (const char *job, long *n, double *a, long *lda, long *ilo,
-	long *ihi, double *scale, long *info);
+int NUMlapack_dgebal (const char *job, integer *n, double *a, integer *lda, integer *ilo,
+	integer *ihi, double *scale, integer *info);
 /*  -- LAPACK routine (version 3.0) --
        Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
        Courant Institute, Argonne National Lab, and Rice University
@@ -558,9 +560,9 @@ int NUMlapack_dgebal (const char *job, long *n, double *a, long *lda, long *ilo,
     =====================================================================
 */
 
-int NUMlapack_dgeev (const char *jobvl, const char *jobvr, long *n, double *a, long *lda,
-	double *wr, double *wi,	double *vl, long *ldvl, double *vr, long *ldvr,
-	double *work, long *lwork, long *info);
+int NUMlapack_dgeev (const char *jobvl, const char *jobvr, integer *n, double *a, integer *lda,
+	double *wr, double *wi,	double *vl, integer *ldvl, double *vr, integer *ldvr,
+	double *work, integer *lwork, integer *info);
 /*  -- LAPACK driver routine (version 3.0) --
        Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
        Courant Institute, Argonne National Lab, and Rice University
@@ -665,8 +667,8 @@ int NUMlapack_dgeev (const char *jobvl, const char *jobvr, long *n, double *a, l
     =====================================================================
 */
 
-int NUMlapack_dgehd2 (long *n, long *ilo, long *ihi, double *a, long *lda,
-	double *tau, double *work, long *info);
+int NUMlapack_dgehd2 (integer *n, integer *ilo, integer *ihi, double *a, integer *lda,
+	double *tau, double *work, integer *info);
 /*  -- LAPACK routine (version 3.0) --
        Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
        Courant Institute, Argonne National Lab, and Rice University
@@ -750,8 +752,8 @@ int NUMlapack_dgehd2 (long *n, long *ilo, long *ihi, double *a, long *lda,
     =====================================================================
 */
 
-int NUMlapack_dgehrd (long *n, long *ilo, long *ihi, double *a, long *lda,
-	double *tau, double *work, long *lwork, long *info);
+int NUMlapack_dgehrd (integer *n, integer *ilo, integer *ihi, double *a, integer *lda,
+	double *tau, double *work, integer *lwork, integer *info);
 /*  -- LAPACK routine (version 3.0) --
        Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
        Courant Institute, Argonne National Lab, and Rice University
@@ -847,7 +849,7 @@ int NUMlapack_dgehrd (long *n, long *ilo, long *ihi, double *a, long *lda,
     =====================================================================
 */
 
-int NUMlapack_dgelq2 (long *m, long *n, double *a, long *lda, double *tau, double *work, long *info);
+int NUMlapack_dgelq2 (integer *m, integer *n, double *a, integer *lda, double *tau, double *work, integer *info);
 /*  Purpose
     =======
 
@@ -902,8 +904,8 @@ int NUMlapack_dgelq2 (long *m, long *n, double *a, long *lda, double *tau, doubl
     =====================================================================
 */
 
-int NUMlapack_dgelqf (long *m, long *n, double *a, long *lda, double *tau,
-	double *work, long *lwork, long *info);
+int NUMlapack_dgelqf (integer *m, integer *n, double *a, integer *lda, double *tau,
+	double *work, integer *lwork, integer *info);
 /*  Purpose
     =======
 
@@ -970,9 +972,9 @@ int NUMlapack_dgelqf (long *m, long *n, double *a, long *lda, double *tau,
 */
 
 
-int NUMlapack_dgelss (long *m, long *n, long *nrhs, double *a, long *lda,
-	double *b, long *ldb, double *s, double *rcond, long *rank, double *work,
-	long *lwork, long *info);
+int NUMlapack_dgelss (integer *m, integer *n, integer *nrhs, double *a, integer *lda,
+	double *b, integer *ldb, double *s, double *rcond, integer *rank, double *work,
+	integer *lwork, integer *info);
 /*  Purpose
     =======
 
@@ -1061,8 +1063,8 @@ int NUMlapack_dgelss (long *m, long *n, long *nrhs, double *a, long *lda,
 */
 
 
-int NUMlapack_dgeqpf (long *m, long *n, double *a, long *lda, long *jpvt,
-	double *tau, double *work, long *info);
+int NUMlapack_dgeqpf (integer *m, integer *n, double *a, integer *lda, integer *jpvt,
+	double *tau, double *work, integer *info);
 /*  Purpose
     =======
 
@@ -1128,8 +1130,8 @@ int NUMlapack_dgeqpf (long *m, long *n, double *a, long *lda, long *jpvt,
     =====================================================================
 */
 
-int NUMlapack_dgeqr2 (long *m, long *n, double *a, long *lda, double *tau,
-	double *work, long *info);
+int NUMlapack_dgeqr2 (integer *m, integer *n, double *a, integer *lda, double *tau,
+	double *work, integer *info);
 /*  Purpose
     =======
 
@@ -1184,8 +1186,8 @@ int NUMlapack_dgeqr2 (long *m, long *n, double *a, long *lda, double *tau,
     =====================================================================
 */
 
-int NUMlapack_dgeqrf(long *m, long *n, double *a, long *lda, double *tau,
-	double *work, long *lwork, long *info);
+int NUMlapack_dgeqrf(integer *m, integer *n, double *a, integer *lda, double *tau,
+	double *work, integer *lwork, integer *info);
 /*  Purpose
     =======
 
@@ -1252,8 +1254,8 @@ int NUMlapack_dgeqrf(long *m, long *n, double *a, long *lda, double *tau,
     =====================================================================
 */
 
-int NUMlapack_dgerq2(long *m, long *n, double *a, long *lda, double *tau,
-	double *work, long *info);
+int NUMlapack_dgerq2(integer *m, integer *n, double *a, integer *lda, double *tau,
+	double *work, integer *info);
 /*  Purpose
     =======
 
@@ -1310,8 +1312,8 @@ int NUMlapack_dgerq2(long *m, long *n, double *a, long *lda, double *tau,
     =====================================================================
 */
 
-int NUMlapack_dgesv (long *n, long *nrhs, double *a, long *lda, long *ipiv,
-	double *b, long *ldb, long *info);
+int NUMlapack_dgesv (integer *n, integer *nrhs, double *a, integer *lda, integer *ipiv,
+	double *b, integer *ldb, integer *info);
 /* 	Purpose
     =======
 
@@ -1366,9 +1368,9 @@ int NUMlapack_dgesv (long *n, long *nrhs, double *a, long *lda, long *ipiv,
 	=====================================================================
 */
 
-int NUMlapack_dgesvd (const char *jobu, const char *jobvt, long *m, long *n, double *a, long *lda,
-	double *s, double *u, long *ldu, double *vt, long *ldvt, double *work,
-	long *lwork, long *info);
+int NUMlapack_dgesvd (const char *jobu, const char *jobvt, integer *m, integer *n, double *a, integer *lda,
+	double *s, double *u, integer *ldu, double *vt, integer *ldvt, double *work,
+	integer *lwork, integer *info);
 /*
     Purpose
     =======
@@ -1489,7 +1491,7 @@ int NUMlapack_dgesvd (const char *jobu, const char *jobvt, long *m, long *n, dou
     =====================================================================
 */
 
-int NUMlapack_dgetf2 (long *m, long *n, double *a, long *lda, long *ipiv, long *info);
+int NUMlapack_dgetf2 (integer *m, integer *n, double *a, integer *lda, integer *ipiv, integer *info);
 /*  Purpose
     =======
 
@@ -1536,8 +1538,8 @@ int NUMlapack_dgetf2 (long *m, long *n, double *a, long *lda, long *ipiv, long *
     =====================================================================
 */
 
-int NUMlapack_dgetri (long *n, double *a, long *lda, long *ipiv, double *work,
-	long *lwork, long *info);
+int NUMlapack_dgetri (integer *n, double *a, integer *lda, integer *ipiv, double *work,
+	integer *lwork, integer *info);
 /* Purpose
     =======
 
@@ -1587,7 +1589,7 @@ int NUMlapack_dgetri (long *n, double *a, long *lda, long *ipiv, double *work,
     =====================================================================
 */
 
-int NUMlapack_dgetrf (long *m, long *n, double *a, long *lda, long *ipiv, long *info);
+int NUMlapack_dgetrf (integer *m, integer *n, double *a, integer *lda, integer *ipiv, integer *info);
 /*  Purpose
     =======
 
@@ -1634,8 +1636,8 @@ int NUMlapack_dgetrf (long *m, long *n, double *a, long *lda, long *ipiv, long *
     =====================================================================
 */
 
-int NUMlapack_dgetrs (const char *trans, long *n, long *nrhs, double *a, long *lda,
-	long *ipiv, double *b, long *ldb, long *info);
+int NUMlapack_dgetrs (const char *trans, integer *n, integer *nrhs, double *a, integer *lda,
+	integer *ipiv, double *b, integer *ldb, integer *info);
 /*  Purpose
     =======
 
@@ -1685,10 +1687,10 @@ int NUMlapack_dgetrs (const char *trans, long *n, long *nrhs, double *a, long *l
     =====================================================================
 */
 
-int NUMlapack_dggsvd (const char *jobu, const char *jobv, const char *jobq, long *m, long *n,
-	long *p, long *k, long *l, double *a, long *lda, double *b, long *ldb,
-	double *alpha, double *beta, double *u, long *ldu, double *v, long *ldv,
-	double *q, long *ldq, double *work, long *iwork, long *info);
+int NUMlapack_dggsvd (const char *jobu, const char *jobv, const char *jobq, integer *m, integer *n,
+	integer *p, integer *k, integer *l, double *a, integer *lda, double *b, integer *ldb,
+	double *alpha, double *beta, double *u, integer *ldu, double *v, integer *ldv,
+	double *q, integer *ldq, double *work, integer *iwork, integer *info);
 /*  Purpose
     =======
 
@@ -1889,10 +1891,10 @@ int NUMlapack_dggsvd (const char *jobu, const char *jobv, const char *jobq, long
     =====================================================================
 */
 
-int NUMlapack_dggsvp (const char *jobu, const char *jobv, const char *jobq, long *m, long *p,
-	long *n, double *a, long *lda, double *b, long *ldb, double *tola,
-	double *tolb, long *k, long *l, double *u, long *ldu, double *v, long *ldv,
-	double *q, long *ldq, long *iwork, double *tau, double *work, long *info);
+int NUMlapack_dggsvp (const char *jobu, const char *jobv, const char *jobq, integer *m, integer *p,
+	integer *n, double *a, integer *lda, double *b, integer *ldb, double *tola,
+	double *tolb, integer *k, integer *l, double *u, integer *ldu, double *v, integer *ldv,
+	double *q, integer *ldq, integer *iwork, double *tau, double *work, integer *info);
 /*  Purpose
     =======
 
@@ -2022,9 +2024,9 @@ int NUMlapack_dggsvp (const char *jobu, const char *jobv, const char *jobq, long
     =====================================================================
 */
 
-int NUMlapack_dhseqr (const char *job, const char *compz, long *n, long *ilo, long *ihi,
-	double *h, long *ldh, double *wr, double *wi, double *z, long *ldz,
-	double *work, long *lwork, long *info);
+int NUMlapack_dhseqr (const char *job, const char *compz, integer *n, integer *ilo, integer *ihi,
+	double *h, integer *ldh, double *wr, double *wi, double *z, integer *ldz,
+	double *work, integer *lwork, integer *info);
 /*  -- LAPACK routine (version 3.0) --
        Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
        Courant Institute, Argonne National Lab, and Rice University
@@ -2164,9 +2166,9 @@ int NUMlapack_dlabad (double *smal, double *large);
        smal and LARGE to avoid overflow and underflow problems.
 */
 
-int NUMlapack_dlabrd (long *m, long *n, long *nb, double *a, long *lda, double *d,
-	double *e, double *tauq, double *taup, double *x, long *ldx, double *y,
-	long *ldy);
+int NUMlapack_dlabrd (integer *m, integer *n, integer *nb, double *a, integer *lda, double *d,
+	double *e, double *tauq, double *taup, double *x, integer *ldx, double *y,
+	integer *ldy);
 /* Purpose
     =======
 
@@ -2289,7 +2291,7 @@ int NUMlapack_dlabrd (long *m, long *n, long *nb, double *a, long *lda, double *
     =====================================================================
 */
 
-int NUMlapack_dlacpy (const char *uplo, long *m, long *n, double *a, long *lda, double *b, long *ldb);
+int NUMlapack_dlacpy (const char *uplo, integer *m, integer *n, double *a, integer *lda, double *b, integer *ldb);
 /*  Purpose
     =======
 
@@ -2465,7 +2467,7 @@ int NUMlapack_dlaev2 (double *a, double *b, double *c, double *rt1, double *rt2,
    =====================================================================
 */
 
-int NUMlapack_dlags2 (long *upper, double *a1, double *a2,	double *a3, double *b1,
+int NUMlapack_dlags2 (integer *upper, double *a1, double *a2,	double *a3, double *b1,
 	double *b2, double *b3, double *csu, double *snu, double *csv, double *snv,
 	double *csq, double *snq);
 /*  Purpose
@@ -2530,9 +2532,9 @@ int NUMlapack_dlags2 (long *upper, double *a1, double *a2,	double *a3, double *b
     =====================================================================
 */
 
-int NUMlapack_dlahqr (int * wantt, int * wantz, long *n, long *ilo,
-	long *ihi, double *h, long *ldh, double *wr, double *wi, long *iloz,
-	long *ihiz, double *z, long *ldz, long *info);
+int NUMlapack_dlahqr (int * wantt, int * wantz, integer *n, integer *ilo,
+	integer *ihi, double *h, integer *ldh, double *wr, double *wi, integer *iloz,
+	integer *ihiz, double *z, integer *ldz, integer *info);
 /*  -- LAPACK auxiliary routine (version 3.0) --
        Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
        Courant Institute, Argonne National Lab, and Rice University
@@ -2624,8 +2626,8 @@ int NUMlapack_dlahqr (int * wantt, int * wantz, long *n, long *ilo,
     =====================================================================
 */
 
-int NUMlapack_dlahrd (long *n, long *k, long *nb, double *a, long *lda,
-	double *tau, double *t, long *ldt, double *y, long *ldy);
+int NUMlapack_dlahrd (integer *n, integer *k, integer *nb, double *a, integer *lda,
+	double *tau, double *t, integer *ldt, double *y, integer *ldy);
 /*  -- LAPACK auxiliary routine (version 3.0) --
        Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
        Courant Institute, Argonne National Lab, and Rice University
@@ -2722,10 +2724,10 @@ int NUMlapack_dlahrd (long *n, long *k, long *nb, double *a, long *lda,
     =====================================================================
 */
 
-int NUMlapack_dlaln2 (int * ltrans, long *na, long *nw, double *smin,
-	double *ca, double *a, long *lda, double *d1, double *d2, double *b,
-	long *ldb, double *wr, double *wi, double *x, long *ldx, double *scale,
-	double *xnorm, long *info);
+int NUMlapack_dlaln2 (int * ltrans, integer *na, integer *nw, double *smin,
+	double *ca, double *a, integer *lda, double *d1, double *d2, double *b,
+	integer *ldb, double *wr, double *wi, double *x, integer *ldx, double *scale,
+	double *xnorm, integer *info);
 /*  -- LAPACK auxiliary routine (version 3.0) --
        Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
        Courant Institute, Argonne National Lab, and Rice University
@@ -2849,7 +2851,7 @@ int NUMlapack_dlaln2 (int * ltrans, long *na, long *nw, double *smin,
    =====================================================================
 */
 
-double NUMlapack_dlange (const char *norm, long *m, long *n, double *a, long *lda, double *work);
+double NUMlapack_dlange (const char *norm, integer *m, integer *n, double *a, integer *lda, double *work);
 /*  Purpose
     =======
 
@@ -2903,7 +2905,7 @@ double NUMlapack_dlange (const char *norm, long *m, long *n, double *a, long *ld
    =====================================================================
 */
 
-double NUMlapack_dlanhs (const char *norm, long *n, double *a, long *lda, double *work);
+double NUMlapack_dlanhs (const char *norm, integer *n, double *a, integer *lda, double *work);
 /*  -- LAPACK auxiliary routine (version 3.0) --
        Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
        Courant Institute, Argonne National Lab, and Rice University
@@ -2961,7 +2963,7 @@ double NUMlapack_dlanhs (const char *norm, long *n, double *a, long *lda, double
    =====================================================================
 */
 
-double NUMlapack_dlanst (const char *norm, long *n, double *d, double *e);
+double NUMlapack_dlanst (const char *norm, integer *n, double *d, double *e);
 /*   Purpose
     =======
 
@@ -3007,8 +3009,8 @@ double NUMlapack_dlanst (const char *norm, long *n, double *d, double *e);
     =====================================================================
 */
 
-double NUMlapack_dlansy (const char *norm, const char *uplo, long *n, double *a,
-	long *lda, double *work);
+double NUMlapack_dlansy (const char *norm, const char *uplo, integer *n, double *a,
+	integer *lda, double *work);
 /*   Purpose
     =======
 
@@ -3125,7 +3127,7 @@ int NUMlapack_dlanv2 (double *a, double *b, double *c, double *d, double *rt1r,
     =====================================================================
 */
 
-int NUMlapack_dlapll(long *n, double *x, long *incx, double *y, long *incy, double *ssmin);
+int NUMlapack_dlapll(integer *n, double *x, integer *incx, double *y, integer *incy, double *ssmin);
 /*  Purpose
     =======
 
@@ -3183,7 +3185,7 @@ double NUMlapack_dlapy2 (double *x, double *y);
     =====================================================================
 */
 
-int NUMlapack_dlapmt (long *forwrd, long *m, long *n,	double *x, long *ldx, long *k);
+int NUMlapack_dlapmt (integer *forwrd, integer *m, integer *n,	double *x, integer *ldx, integer *k);
 /*  Purpose
     =======
 
@@ -3223,8 +3225,8 @@ int NUMlapack_dlapmt (long *forwrd, long *m, long *n,	double *x, long *ldx, long
     =====================================================================
 */
 
-int NUMlapack_dlarf (const char *side, long *m, long *n, double *v, long *incv, double *tau,
-	double *c, long *ldc, double *work);
+int NUMlapack_dlarf (const char *side, integer *m, integer *n, double *v, integer *incv, double *tau,
+	double *c, integer *ldc, double *work);
 /*
     Purpose
     =======
@@ -3279,8 +3281,8 @@ int NUMlapack_dlarf (const char *side, long *m, long *n, double *v, long *incv,
 */
 
 int NUMlapack_dlarfb (const char *side, const char *trans, const char *direct, const char *storev,
-	long *m, long *n, long *k, double *v, long *ldv, double *t, long *ldt,
-	double *c, long *ldc, double *work, long *ldwork);
+	integer *m, integer *n, integer *k, double *v, integer *ldv, double *t, integer *ldt,
+	double *c, integer *ldc, double *work, integer *ldwork);
 /*  Purpose
     =======
 
@@ -3355,7 +3357,7 @@ int NUMlapack_dlarfb (const char *side, const char *trans, const char *direct, c
 
     =====================================================================
 */
-int NUMlapack_dlarfg (long *n, double *alpha, double *x, long *incx, double *tau);
+int NUMlapack_dlarfg (integer *n, double *alpha, double *x, integer *incx, double *tau);
 /*  Purpose
     =======
 
@@ -3403,8 +3405,8 @@ int NUMlapack_dlarfg (long *n, double *alpha, double *x, long *incx, double *tau
     =====================================================================
 */
 
-int NUMlapack_dlarft (const char *direct, const char *storev, long *n, long *k,
-	double *v, long *ldv, double *tau, double *t, long *ldt);
+int NUMlapack_dlarft (const char *direct, const char *storev, integer *n, integer *k,
+	double *v, integer *ldv, double *tau, double *t, integer *ldt);
 /*  Purpose
     =======
 
@@ -3496,8 +3498,8 @@ int NUMlapack_dlarft (const char *direct, const char *storev, long *n, long *k,
     =====================================================================
 */
 
-int NUMlapack_dlarfx (const char *side, long *m, long *n, double *v, double *tau,
-	double *c, long *ldc, double *work);
+int NUMlapack_dlarfx (const char *side, integer *m, integer *n, double *v, double *tau,
+	double *c, integer *ldc, double *work);
 /*  -- LAPACK auxiliary routine (version 3.0) --
        Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
        Courant Institute, Argonne National Lab, and Rice University
@@ -3645,8 +3647,8 @@ int NUMlapack_dlas2 (double *f, double *g, double *h,	double *ssmin, double *ssm
     ====================================================================
 */
 
-int NUMlapack_dlascl (const char *type, long *kl, long *ku, double *cfrom, double *cto,
-	long *m, long *n, double *a, long *lda, long *info);
+int NUMlapack_dlascl (const char *type, integer *kl, integer *ku, double *cfrom, double *cto,
+	integer *m, integer *n, double *a, integer *lda, integer *info);
 /*  Purpose
     =======
 
@@ -3709,8 +3711,8 @@ int NUMlapack_dlascl (const char *type, long *kl, long *ku, double *cfrom, doubl
     =====================================================================
 */
 
-int NUMlapack_dlaset (const char *uplo, long *m, long *n, double *alpha, double *beta,
-	double *a, long *lda);
+int NUMlapack_dlaset (const char *uplo, integer *m, integer *n, double *alpha, double *beta,
+	double *a, integer *lda);
 /*  Purpose
     =======
 
@@ -3755,7 +3757,7 @@ int NUMlapack_dlaset (const char *uplo, long *m, long *n, double *alpha, double
    =====================================================================
 */
 
-int NUMlapack_dlasq1 (long *n, double *d, double *e, double *work, long *info);
+int NUMlapack_dlasq1 (integer *n, double *d, double *e, double *work, integer *info);
 /*  Purpose
     =======
 
@@ -3803,7 +3805,7 @@ int NUMlapack_dlasq1 (long *n, double *d, double *e, double *work, long *info);
     =====================================================================
 */
 
-int NUMlapack_dlasq2 (long *n, double *z, long *info);
+int NUMlapack_dlasq2 (integer *n, double *z, integer *info);
 /*  Purpose
     =======
 
@@ -3859,9 +3861,9 @@ int NUMlapack_dlasq2 (long *n, double *z, long *info);
     =====================================================================
 */
 
-int NUMlapack_dlasq3 (long *i0, long *n0, double *z, long *pp, double *dmin,
-	double *sigma, double *desig, double *qmax, long *nfail, long *iter,
-	long *ndiv,	long *ieee);
+int NUMlapack_dlasq3 (integer *i0, integer *n0, double *z, integer *pp, double *dmin,
+	double *sigma, double *desig, double *qmax, integer *nfail, integer *iter,
+	integer *ndiv,	integer *ieee);
 /*  Purpose
     =======
 
@@ -3914,9 +3916,9 @@ int NUMlapack_dlasq3 (long *i0, long *n0, double *z, long *pp, double *dmin,
     =====================================================================
 */
 
-int NUMlapack_dlasq4 (long *i0, long *n0, double *z, long *pp, long *n0in, double *dmin,
+int NUMlapack_dlasq4 (integer *i0, integer *n0, double *z, integer *pp, integer *n0in, double *dmin,
 	double *dmin1, double *dmin2, double *dn, double *dn1, double *dn2,
-	double *tau, long *ttype);
+	double *tau, integer *ttype);
 /*  Purpose
     =======
 
@@ -3969,8 +3971,8 @@ int NUMlapack_dlasq4 (long *i0, long *n0, double *z, long *pp, long *n0in, doubl
     =====================================================================
 */
 
-int NUMlapack_dlasq5 (long *i0, long *n0, double *z, long *pp, double *tau, double *dmin,
-	double *dmin1, double *dmin2, double *dn, double *dnm1, double *dnm2, long *ieee);
+int NUMlapack_dlasq5 (integer *i0, integer *n0, double *z, integer *pp, double *tau, double *dmin,
+	double *dmin1, double *dmin2, double *dn, double *dnm1, double *dnm2, integer *ieee);
 /*  Purpose
     =======
 
@@ -4020,7 +4022,7 @@ int NUMlapack_dlasq5 (long *i0, long *n0, double *z, long *pp, double *tau, doub
     =====================================================================
 */
 
-int NUMlapack_dlasq6 (long *i0, long *n0, double *z, long *pp, double *dmin,
+int NUMlapack_dlasq6 (integer *i0, integer *n0, double *z, integer *pp, double *dmin,
 	double *dmin1, double *dmin2, double *dn, double *dnm1, double *dnm2);
 /*  Purpose
     =======
@@ -4066,8 +4068,8 @@ int NUMlapack_dlasq6 (long *i0, long *n0, double *z, long *pp, double *dmin,
 */
 
 
-int NUMlapack_dlasr (const char *side, const char *pivot, const char *direct, long *m,
-	 long *n, double *c, double *s, double *a, long *lda);
+int NUMlapack_dlasr (const char *side, const char *pivot, const char *direct, integer *m,
+	 integer *n, double *c, double *s, double *a, integer *lda);
 /*  Purpose
     =======
 
@@ -4161,7 +4163,7 @@ int NUMlapack_dlasr (const char *side, const char *pivot, const char *direct, lo
 
 
 
-int NUMlapack_dlasrt (const char *id, long *n, double *d, long *info);
+int NUMlapack_dlasrt (const char *id, integer *n, double *d, integer *info);
 /*  Purpose
     =======
 
@@ -4194,7 +4196,7 @@ int NUMlapack_dlasrt (const char *id, long *n, double *d, long *info);
     =====================================================================
 */
 
-int NUMlapack_dlassq (long *n, double *x, long *incx, double *scale, double *sumsq);
+int NUMlapack_dlassq (integer *n, double *x, integer *incx, double *scale, double *sumsq);
 /*  Purpose
     =======
 
@@ -4307,8 +4309,8 @@ int NUMlapack_dlasv2 (double *f, double *g, double *h, double *ssmin,
    =====================================================================
 */
 
-int NUMlapack_dlaswp (long *n, double *a, long *lda, long *k1, long *k2,
-	long *ipiv, long *incx);
+int NUMlapack_dlaswp (integer *n, double *a, integer *lda, integer *k1, integer *k2,
+	integer *ipiv, integer *incx);
 /*  Purpose
     =======
 
@@ -4349,8 +4351,8 @@ int NUMlapack_dlaswp (long *n, double *a, long *lda, long *k1, long *k2,
    =====================================================================
 */
 
-int NUMlapack_dlatrd (const char *uplo, long *n, long *nb, double *a, long *lda,
-	double *e, double *tau, double *w, long *ldw);
+int NUMlapack_dlatrd (const char *uplo, integer *n, integer *nb, double *a, integer *lda,
+	double *e, double *tau, double *w, integer *ldw);
 /* Purpose =======
 
 	   NUMlapack_dlatrd reduces NB rows and columns of a real symmetric matrix A to
@@ -4457,8 +4459,8 @@ int NUMlapack_dlatrd (const char *uplo, long *n, long *nb, double *a, long *lda,
 	   =====================================================================
 */
 
-int NUMlapack_dorg2l (long *m, long *n, long *k, double *	a, long *lda, double *tau,
-	double *work, long *info);
+int NUMlapack_dorg2l (integer *m, integer *n, integer *k, double *	a, integer *lda, double *tau,
+	double *work, integer *info);
 /*   Purpose
     =======
 
@@ -4506,8 +4508,8 @@ int NUMlapack_dorg2l (long *m, long *n, long *k, double *	a, long *lda, double *
     =====================================================================
 */
 
-int NUMlapack_dorg2r (long *m, long *n, long *k, double *a, long *lda,
-	double *tau, double *work, long *info);
+int NUMlapack_dorg2r (integer *m, integer *n, integer *k, double *a, integer *lda,
+	double *tau, double *work, integer *info);
 /*  Purpose
     =======
 
@@ -4555,8 +4557,8 @@ int NUMlapack_dorg2r (long *m, long *n, long *k, double *a, long *lda,
     =====================================================================
 */
 
-int NUMlapack_dorgbr (const char *vect, long *m, long *n, long *k, double *a, long *lda,
-	double *tau, double *work, long *lwork, long *info);
+int NUMlapack_dorgbr (const char *vect, integer *m, integer *n, integer *k, double *a, integer *lda,
+	double *tau, double *work, integer *lwork, integer *info);
 /*  Purpose
     =======
 
@@ -4640,8 +4642,8 @@ int NUMlapack_dorgbr (const char *vect, long *m, long *n, long *k, double *a, lo
     =====================================================================
 */
 
-int NUMlapack_dorghr (long *n, long *ilo, long *ihi, double *a, long *lda,
-	double *tau, double *work, long *lwork, long *info);
+int NUMlapack_dorghr (integer *n, integer *ilo, integer *ihi, double *a, integer *lda,
+	double *tau, double *work, integer *lwork, integer *info);
 /*  -- LAPACK routine (version 3.0) --
        Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
        Courant Institute, Argonne National Lab, and Rice University
@@ -4702,8 +4704,8 @@ int NUMlapack_dorghr (long *n, long *ilo, long *ihi, double *a, long *lda,
     =====================================================================
 */
 
-int NUMlapack_dorgl2 (long *m, long *n, long *k, double *a, long *lda, double *tau,
-	double *work, long *info);
+int NUMlapack_dorgl2 (integer *m, integer *n, integer *k, double *a, integer *lda, double *tau,
+	double *work, integer *info);
 /*  Purpose
     =======
 
@@ -4750,8 +4752,8 @@ int NUMlapack_dorgl2 (long *m, long *n, long *k, double *a, long *lda, double *t
     =====================================================================
 */
 
-int NUMlapack_dorglq (long *m, long *n, long *k, double *a, long *lda, double *tau,
-	double *work, long *lwork, long *info);
+int NUMlapack_dorglq (integer *m, integer *n, integer *k, double *a, integer *lda, double *tau,
+	double *work, integer *lwork, integer *info);
 /*  Purpose
     =======
 
@@ -4809,8 +4811,8 @@ int NUMlapack_dorglq (long *m, long *n, long *k, double *a, long *lda, double *t
     =====================================================================
 */
 
-int NUMlapack_dorgql (long *m, long *n, long *k, double *a, long *lda, double *tau,
-	double *work, long *lwork, long *info);
+int NUMlapack_dorgql (integer *m, integer *n, integer *k, double *a, integer *lda, double *tau,
+	double *work, integer *lwork, integer *info);
 /*  Purpose
     =======
 
@@ -4869,8 +4871,8 @@ int NUMlapack_dorgql (long *m, long *n, long *k, double *a, long *lda, double *t
     =====================================================================
 */
 
-int NUMlapack_dorgqr (long *m, long *n, long *k, double *a, long *lda, double *tau,
-	double *work, long *lwork, long *info);
+int NUMlapack_dorgqr (integer *m, integer *n, integer *k, double *a, integer *lda, double *tau,
+	double *work, integer *lwork, integer *info);
 /*  Purpose
     =======
 
@@ -4929,8 +4931,8 @@ int NUMlapack_dorgqr (long *m, long *n, long *k, double *a, long *lda, double *t
     =====================================================================
 */
 
-int NUMlapack_dorgtr (const char *uplo, long *n, double *a, long *lda, double *tau,
-	double *work, long *lwork, long *info);
+int NUMlapack_dorgtr (const char *uplo, integer *n, double *a, integer *lda, double *tau,
+	double *work, integer *lwork, integer *info);
 /*  Purpose
     =======
 
@@ -4986,9 +4988,9 @@ int NUMlapack_dorgtr (const char *uplo, long *n, double *a, long *lda, double *t
     =====================================================================
 */
 
-int NUMlapack_dorm2r (const char *side, const char *trans, long *m, long *n, long *k,
-	double *a, long *lda, double *tau, double *c, long *ldc, double *work,
-	long *info);
+int NUMlapack_dorm2r (const char *side, const char *trans, integer *m, integer *n, integer *k,
+	double *a, integer *lda, double *tau, double *c, integer *ldc, double *work,
+	integer *info);
 /*  Purpose
     =======
 
@@ -5066,9 +5068,9 @@ int NUMlapack_dorm2r (const char *side, const char *trans, long *m, long *n, lon
     =====================================================================
 */
 
-int NUMlapack_dormbr (const char *vect, const char *side, const char *trans, long *m, long *n,
-	long *k, double *a, long *lda, double *tau, double *c, long *ldc,
-	double *work, long *lwork, long *info);
+int NUMlapack_dormbr (const char *vect, const char *side, const char *trans, integer *m, integer *n,
+	integer *k, double *a, integer *lda, double *tau, double *c, integer *ldc,
+	double *work, integer *lwork, integer *info);
 /*  Purpose
     =======
 
@@ -5176,8 +5178,8 @@ int NUMlapack_dormbr (const char *vect, const char *side, const char *trans, lon
     =====================================================================
 */
 
-int NUMlapack_dorml2 (const char *side, const char *trans, long *m, long *n, long *k, double *a,
-	long *lda, double *tau, double *c, long *ldc, double *work, long *info);
+int NUMlapack_dorml2 (const char *side, const char *trans, integer *m, integer *n, integer *k, double *a,
+	integer *lda, double *tau, double *c, integer *ldc, double *work, integer *info);
 /*  Purpose
     =======
 
@@ -5255,9 +5257,9 @@ int NUMlapack_dorml2 (const char *side, const char *trans, long *m, long *n, lon
     =====================================================================
 */
 
-int NUMlapack_dormlq (const char *side, const char *trans, long *m, long *n,
-	long *k, double *a, long *lda, double *tau, double *c,
-	long *ldc, double *work, long *lwork, long *info);
+int NUMlapack_dormlq (const char *side, const char *trans, integer *m, integer *n,
+	integer *k, double *a, integer *lda, double *tau, double *c,
+	integer *ldc, double *work, integer *lwork, integer *info);
 /*  Purpose
     =======
 
@@ -5343,9 +5345,9 @@ int NUMlapack_dormlq (const char *side, const char *trans, long *m, long *n,
     =====================================================================
 */
 
-int NUMlapack_dormqr (const char *side, const char *trans, long *m, long *n, long *k,
-	double *a, long *lda, double *tau, double *c, long *ldc, double *work,
-	long *lwork, long *info);
+int NUMlapack_dormqr (const char *side, const char *trans, integer *m, integer *n, integer *k,
+	double *a, integer *lda, double *tau, double *c, integer *ldc, double *work,
+	integer *lwork, integer *info);
 /*  Purpose
     =======
 
@@ -5431,9 +5433,9 @@ int NUMlapack_dormqr (const char *side, const char *trans, long *m, long *n, lon
     =====================================================================
 */
 
-int NUMlapack_dormr2 (const char *side, const char *trans, long *m, long *n, long *k,
-	double *a, long *lda, double *tau, double *c, long *ldc, double *work,
-	long *info);
+int NUMlapack_dormr2 (const char *side, const char *trans, integer *m, integer *n, integer *k,
+	double *a, integer *lda, double *tau, double *c, integer *ldc, double *work,
+	integer *info);
 /*  Purpose
     =======
 
@@ -5511,7 +5513,7 @@ int NUMlapack_dormr2 (const char *side, const char *trans, long *m, long *n, lon
     =====================================================================
 */
 
-int NUMlapack_dpotf2 (const char *uplo, long *n, double *a, long *lda, long *info);
+int NUMlapack_dpotf2 (const char *uplo, integer *n, double *a, integer *lda, integer *info);
 /*  -- LAPACK routine (version 3.0) --
        Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
        Courant Institute, Argonne National Lab, and Rice University
@@ -5567,7 +5569,7 @@ int NUMlapack_dpotf2 (const char *uplo, long *n, double *a, long *lda, long *inf
 
 */
 
-int NUMlapack_drscl (long *n, double *sa, double *sx,	long *incx);
+int NUMlapack_drscl (integer *n, double *sa, double *sx,	integer *incx);
 /*  Purpose
     =======
 
@@ -5597,8 +5599,8 @@ int NUMlapack_drscl (long *n, double *sa, double *sx,	long *incx);
 */
 
 
-int NUMlapack_dsteqr (const char *compz, long *n, double *d, double *e, double *z, long *ldz,
-	double *work, long *info);
+int NUMlapack_dsteqr (const char *compz, integer *n, double *d, double *e, double *z, integer *ldz,
+	double *work, integer *info);
 /*  Purpose
     =======
 
@@ -5663,7 +5665,7 @@ int NUMlapack_dsteqr (const char *compz, long *n, double *d, double *e, double *
 */
 
 
-int NUMlapack_dsterf (long *n, double *d, double *e, long *info);
+int NUMlapack_dsterf (integer *n, double *d, double *e, integer *info);
 /*  Purpose
     =======
 
@@ -5696,8 +5698,8 @@ int NUMlapack_dsterf (long *n, double *d, double *e, long *info);
 */
 
 
-int NUMlapack_dsyev (const char *jobz, const char *uplo, long *n, double *a,	long *lda,
-	double *w, double *work, long *lwork, long *info);
+int NUMlapack_dsyev (const char *jobz, const char *uplo, integer *n, double *a,	integer *lda,
+	double *w, double *work, integer *lwork, integer *info);
 /* Purpose =======
 
 	NUMlapack_dsyev computes all eigenvalues and, optionally, eigenvectors of a
@@ -5759,8 +5761,8 @@ int NUMlapack_dsyev (const char *jobz, const char *uplo, long *n, double *a,	lon
 */
 
 
-int NUMlapack_dsytd2 (const char *uplo, long *n, double *a, long *lda, double *d,
-	double *e, double *tau, long *info);
+int NUMlapack_dsytd2 (const char *uplo, integer *n, double *a, integer *lda, double *d,
+	double *e, double *tau, integer *info);
 /*  Purpose
     =======
 
@@ -5863,8 +5865,8 @@ int NUMlapack_dsytd2 (const char *uplo, long *n, double *a, long *lda, double *d
     =====================================================================
 */
 
-int NUMlapack_dsytrd (const char *uplo, long *n, double *a, long *lda, double *d,
-	double *e, double *tau, double *work, long *lwork, long *info);
+int NUMlapack_dsytrd (const char *uplo, integer *n, double *a, integer *lda, double *d,
+	double *e, double *tau, double *work, integer *lwork, integer *info);
 /*  Purpose
     =======
 
@@ -5979,11 +5981,11 @@ int NUMlapack_dsytrd (const char *uplo, long *n, double *a, long *lda, double *d
     =====================================================================
 */
 
-int NUMlapack_dtgsja(const char *jobu, const char *jobv, const char *jobq, long *m, long *p,
-	long *n, long *k, long *l, double *a, long *lda, double *b, long *ldb,
+int NUMlapack_dtgsja(const char *jobu, const char *jobv, const char *jobq, integer *m, integer *p,
+	integer *n, integer *k, integer *l, double *a, integer *lda, double *b, integer *ldb,
 	double *tola, double *tolb, double *alpha, double *beta, double *u,
-	long *ldu, double *v, long *ldv, double *q, long *ldq, double *work,
-	long *ncycle, long *info);
+	integer *ldu, double *v, integer *ldv, double *q, integer *ldq, double *work,
+	integer *ncycle, integer *info);
 /*  Purpose
     =======
 
@@ -6224,9 +6226,9 @@ int NUMlapack_dtgsja(const char *jobu, const char *jobv, const char *jobq, long
     =====================================================================
 */
 
-int NUMlapack_dtrevc (const char *side, const char *howmny, int * select, long *n,
-	double *t, long *ldt, double *vl, long *ldvl, double *vr, long *ldvr,
-	long *mm, long *m, double *work, long *info);
+int NUMlapack_dtrevc (const char *side, const char *howmny, int * select, integer *n,
+	double *t, integer *ldt, double *vl, integer *ldvl, double *vr, integer *ldvr,
+	integer *mm, integer *m, double *work, integer *info);
 /*  -- LAPACK routine (version 3.0) --
        Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
        Courant Institute, Argonne National Lab, and Rice University
@@ -6385,7 +6387,7 @@ int NUMlapack_dtrevc (const char *side, const char *howmny, int * select, long *
     =====================================================================
 */
 
-int NUMlapack_dtrti2 (const char *uplo, const char *diag, long *n, double *a, long *lda, long *info);
+int NUMlapack_dtrti2 (const char *uplo, const char *diag, integer *n, double *a, integer *lda, integer *info);
 /*  Purpose
     =======
 
@@ -6434,8 +6436,8 @@ int NUMlapack_dtrti2 (const char *uplo, const char *diag, long *n, double *a, lo
     =====================================================================
 */
 
-int NUMlapack_dtrtri (const char *uplo, const char *diag, long *n, double *
-	a, long *lda, long *info);
+int NUMlapack_dtrtri (const char *uplo, const char *diag, integer *n, double *
+	a, integer *lda, integer *info);
 /*  Purpose
     =======
 
@@ -6483,7 +6485,7 @@ int NUMlapack_dtrtri (const char *uplo, const char *diag, long *n, double *
     =====================================================================
 */
 
-long NUMlapack_ieeeck (long *ispec, float *zero, float *one);
+integer NUMlapack_ieeeck (integer *ispec, float *zero, float *one);
 /*  Purpose
     =======
 
@@ -6515,8 +6517,8 @@ long NUMlapack_ieeeck (long *ispec, float *zero, float *one);
 */
 
 
-long NUMlapack_ilaenv (long *ispec, const char *name, const char *opts, long *n1,
-	long *n2, long *n3, long *n4, long name_len, long opts_len);
+integer NUMlapack_ilaenv (integer *ispec, const char *name, const char *opts, integer *n1,
+	integer *n2, integer *n3, integer *n4, integer name_len, integer opts_len);
 /*  Purpose
     =======
 
diff --git a/dwsys/NUMf2c.cpp b/dwsys/NUMf2c.cpp
index 895f3a7..0ccc76a 100644
--- a/dwsys/NUMf2c.cpp
+++ b/dwsys/NUMf2c.cpp
@@ -2,7 +2,7 @@
 
 #include <ctype.h>
 #include "NUMf2c.h"
-#include "melder.h"
+//#include "melder.h"
 
 double d_sign (double *a, double *b) {
 	double x;
@@ -10,16 +10,16 @@ double d_sign (double *a, double *b) {
 	return (*b >= 0.0 ? x : -x);
 }
 
-long int lsame_ (const char *ca, const char *cb) {
+integer lsame_ (const char *ca, const char *cb) {
 	int a = * (unsigned char *) ca;
 	int b = * (unsigned char *) cb;
 	return tolower (a) == tolower (b);
 }
 
-double pow_di (double *ap, long *bp) {
+double pow_di (double *ap, integer *bp) {
 	double pow, x;
-	long n;
-	unsigned long u;
+	integer n;
+	uinteger u;
 
 	pow = 1;
 	x = *ap;
@@ -44,12 +44,12 @@ double pow_di (double *ap, long *bp) {
 	return (pow);
 }
 
-void s_cat (char *lp, const char *rpp[], long rnp[], long *np, long ll) {
-	long i, nc;
+void s_cat (char *lp, const char *rpp[], integer rnp[], integer *np, integer ll) {
+	integer i, nc;
 	char *rp;
-	long n = *np;
+	integer n = *np;
 #ifndef NO_OVERWRITE
-	long L, m;
+	integer L, m;
 	char *lp0, *lp1;
 
 	lp0 = 0;
@@ -97,7 +97,7 @@ void s_cat (char *lp, const char *rpp[], long rnp[], long *np, long ll) {
 
 
 /* compare two strings */
-long s_cmp (const char *a0, const char *b0, long la, long lb) {
+integer s_cmp (const char *a0, const char *b0, integer la, integer lb) {
 	register unsigned char *a, *aend, *b, *bend;
 	a = (unsigned char *) a0;
 	b = (unsigned char *) b0;
@@ -139,7 +139,7 @@ long s_cmp (const char *a0, const char *b0, long la, long lb) {
 	return (0);
 }
 
-void s_copy (register char *a, register char *b, long la, long lb) {
+void s_copy (register char *a, register char *b, integer la, integer lb) {
 	register char *aend, *bend;
 
 	aend = a + la;
diff --git a/dwsys/NUMf2c.h b/dwsys/NUMf2c.h
index 162cba2..cc0b883 100644
--- a/dwsys/NUMf2c.h
+++ b/dwsys/NUMf2c.h
@@ -3,7 +3,7 @@
  /* NUMf2c.h  --  Standard Fortran to C header file
  *                Auxiliary f2c routines.
  *
- * Copyright (C) 1994-2011 David Weenink
+ * Copyright (C) 1994-2011 David Weenink, 2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,32 +19,29 @@
  * along with this work. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/*
- djmw 20020923 GPL header
- djmw 20110308 Latest modification
-*/
+#include "melder.h"   /* for integer */
 
 double d_sign(double *a, double *b);
 /*
 	returns sign(b)*fabs(a)
 */
 
-long int lsame_(const char *ca, const char *cb);
+integer lsame_(const char *ca, const char *cb);
 /*
     Returns true if ca[0] is the same letter as cb[0] regardless of case.
 */
 
-double pow_di(double *ap, long *bp);
+double pow_di(double *ap, integer *bp);
 
-void s_cat(char *lp, const char *rpp[], long rnp[], long *np, long ll);
+void s_cat(char *lp, const char *rpp[], integer rnp[], integer *np, integer ll);
 /* Unless compiled with -DNO_OVERWRITE, this variant of s_cat allows the
  * target of a concatenation to appear on its right-hand side (contrary
  * to the Fortran 77 Standard, but in accordance with Fortran 90).
  */
 
-long s_cmp(const char *a0, const char *b0, long la, long lb);
+integer s_cmp(const char *a0, const char *b0, integer la, integer lb);
 
-void s_copy(register char *a, register char *b, long la, long lb);
+void s_copy(register char *a, register char *b, integer la, integer lb);
 /* assign strings:  a = b (when no null byte at end of string)*/
 
 #endif /* _NUMf2c_h_ */
diff --git a/dwsys/NUMfft_core.h b/dwsys/NUMfft_core.h
index a546581..68c174c 100644
--- a/dwsys/NUMfft_core.h
+++ b/dwsys/NUMfft_core.h
@@ -11,6 +11,7 @@
   
   djmw 20030630 Adapted for praat (replaced 'int' declarations with 'long').
   djmw 20040511 Made all local variables type double to increase numerical precision.
+  djmw 20171003 Replaced `long` declarations with `integer`).
 
  ********************************************************************/
 
@@ -27,17 +28,19 @@
    original fortran), these routines can work on arbitrary length vectors
    that need not be powers of two in length. */
 
-static void drfti1 (long n, FFT_DATA_TYPE * wa, long *ifac)
+#include "melder.h"   /* for integer */
+
+static void drfti1 (integer n, FFT_DATA_TYPE * wa, integer *ifac)
 {
-	static long ntryh[4] = { 4, 2, 3, 5 };
+	static integer ntryh[4] = { 4, 2, 3, 5 };
 	static double tpi = 6.28318530717958647692528676655900577;
 	double arg, argh, argld, fi;
-	long ntry = 0, i, j = -1;
-	long k1, l1, l2, ib;
-	long ld, ii, ip, is, nq, nr;
-	long ido, ipm, nfm1;
-	long nl = n;
-	long nf = 0;
+	integer ntry = 0, i, j = -1;
+	integer k1, l1, l2, ib;
+	integer ld, ii, ip, is, nq, nr;
+	integer ido, ipm, nfm1;
+	integer nl = n;
+	integer nf = 0;
 
   L101:
 	j++;
@@ -107,7 +110,7 @@ static void drfti1 (long n, FFT_DATA_TYPE * wa, long *ifac)
 	}
 }
 
-static void NUMrffti (long n, FFT_DATA_TYPE * wsave, long *ifac)
+static void NUMrffti (integer n, FFT_DATA_TYPE * wsave, integer *ifac)
 {
 
 	if (n == 1)
@@ -115,19 +118,19 @@ static void NUMrffti (long n, FFT_DATA_TYPE * wsave, long *ifac)
 	drfti1 (n, wsave + n, ifac);
 }
 
-/* void NUMcosqi(long n, FFT_DATA_TYPE *wsave, long *ifac){ static
-   double pih = 1.57079632679489661923132169163975; static long k;
+/* void NUMcosqi(integer n, FFT_DATA_TYPE *wsave, integer *ifac){ static
+   double pih = 1.57079632679489661923132169163975; static integer k;
    static double fk, dt;
 
    dt=pih/n; fk=0.; for(k=0;k<n;k++){ fk+=1.; wsave[k] = cos(fk*dt); }
 
    NUMrffti(n, wsave+n,ifac); } */
 
-static void dradf2 (long ido, long l1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * wa1)
+static void dradf2 (integer ido, integer l1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * wa1)
 {
-	long i, k;
+	integer i, k;
 	double ti2, tr2;
-	long t0, t1, t2, t3, t4, t5, t6;
+	integer t0, t1, t2, t3, t4, t5, t6;
 
 	t1 = 0;
 	t0 = (t2 = l1 * ido);
@@ -186,11 +189,11 @@ static void dradf2 (long ido, long l1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * ch, F
 	}
 }
 
-static void dradf4 (long ido, long l1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * wa1,
+static void dradf4 (integer ido, integer l1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * wa1,
 	FFT_DATA_TYPE * wa2, FFT_DATA_TYPE * wa3)
 {
 	static double hsqt2 = .70710678118654752440084436210485;
-	long i, k, t0, t1, t2, t3, t4, t5, t6;
+	integer i, k, t0, t1, t2, t3, t4, t5, t6;
 	double ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4;
 
 	t0 = l1 * ido;
@@ -291,17 +294,17 @@ static void dradf4 (long ido, long l1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * ch, F
 	}
 }
 
-static void dradfg (long ido, long ip, long l1, long idl1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * c1,
+static void dradfg (integer ido, integer ip, integer l1, integer idl1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * c1,
 	FFT_DATA_TYPE * c2, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * ch2, FFT_DATA_TYPE * wa)
 {
 
 	static double tpi = 6.28318530717958647692528676655900577;
-	long idij, ipph, i, j, k, l, ic, ik, is;
-	long t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10;
+	integer idij, ipph, i, j, k, l, ic, ik, is;
+	integer t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10;
 	double dc2, ai1, ai2, ar1, ar2, ds2;
-	long nbd;
+	integer nbd;
 	double dcp, arg, dsp, ar1h, ar2h;
-	long idp2, ipp2;
+	integer idp2, ipp2;
 
 	arg = tpi / (double) ip;
 	dcp = cos (arg);
@@ -640,11 +643,11 @@ static void dradfg (long ido, long ip, long l1, long idl1, FFT_DATA_TYPE * cc, F
 	}
 }
 
-static void drftf1 (long n, FFT_DATA_TYPE * c, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * wa, long *ifac)
+static void drftf1 (integer n, FFT_DATA_TYPE * c, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * wa, integer *ifac)
 {
-	long i, k1, l1, l2;
-	long na, kh, nf;
-	long ip, iw, ido, idl1, ix2, ix3;
+	integer i, k1, l1, l2;
+	integer na, kh, nf;
+	integer ip, iw, ido, idl1, ix2, ix3;
 
 	nf = ifac[1];
 	na = 1;
@@ -710,9 +713,9 @@ static void drftf1 (long n, FFT_DATA_TYPE * c, FFT_DATA_TYPE * ch, FFT_DATA_TYPE
 		c[i] = ch[i];
 }
 
-static void dradb2 (long ido, long l1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * wa1)
+static void dradb2 (integer ido, integer l1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * wa1)
 {
-	long i, k, t0, t1, t2, t3, t4, t5, t6;
+	integer i, k, t0, t1, t2, t3, t4, t5, t6;
 	double ti2, tr2;
 
 	t0 = l1 * ido;
@@ -770,12 +773,12 @@ static void dradb2 (long ido, long l1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * ch, F
 	}
 }
 
-static void dradb3 (long ido, long l1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * wa1,
+static void dradb3 (integer ido, integer l1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * wa1,
 	FFT_DATA_TYPE * wa2)
 {
 	static double taur = -.5;
 	static double taui = .86602540378443864676372317075293618;
-	long i, k, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10;
+	integer i, k, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10;
 	double ci2, ci3, di2, di3, cr2, cr3, dr2, dr3, ti2, tr2;
 
 	t0 = l1 * ido;
@@ -839,11 +842,11 @@ static void dradb3 (long ido, long l1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * ch, F
 	}
 }
 
-static void dradb4 (long ido, long l1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * wa1,
+static void dradb4 (integer ido, integer l1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * wa1,
 	FFT_DATA_TYPE * wa2, FFT_DATA_TYPE * wa3)
 {
 	static double sqrt2 = 1.4142135623730950488016887242097;
-	long i, k, t0, t1, t2, t3, t4, t5, t6, t7, t8;
+	integer i, k, t0, t1, t2, t3, t4, t5, t6, t7, t8;
 	double ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4;
 
 	t0 = l1 * ido;
@@ -939,15 +942,15 @@ static void dradb4 (long ido, long l1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * ch, F
 	}
 }
 
-static void dradbg (long ido, long ip, long l1, long idl1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * c1,
+static void dradbg (integer ido, integer ip, integer l1, integer idl1, FFT_DATA_TYPE * cc, FFT_DATA_TYPE * c1,
 	FFT_DATA_TYPE * c2, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * ch2, FFT_DATA_TYPE * wa)
 {
 	static double tpi = 6.28318530717958647692528676655900577;
-	long idij, ipph, i, j, k, l, ik, is, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12;
+	integer idij, ipph, i, j, k, l, ik, is, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12;
 	double dc2, ai1, ai2, ar1, ar2, ds2;
-	long nbd;
+	integer nbd;
 	double dcp, arg, dsp, ar1h, ar2h;
-	long ipp2;
+	integer ipp2;
 
 	t10 = ip * ido;
 	t0 = l1 * ido;
@@ -1295,11 +1298,11 @@ static void dradbg (long ido, long ip, long l1, long idl1, FFT_DATA_TYPE * cc, F
 	}
 }
 
-static void drftb1 (long n, FFT_DATA_TYPE * c, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * wa, long *ifac)
+static void drftb1 (integer n, FFT_DATA_TYPE * c, FFT_DATA_TYPE * ch, FFT_DATA_TYPE * wa, integer *ifac)
 {
-	long i, k1, l1, l2;
-	long na;
-	long nf, ip, iw, ix2, ix3, ido, idl1;
+	integer i, k1, l1, l2;
+	integer na;
+	integer nf, ip, iw, ix2, ix3, ido, idl1;
 
 	nf = ifac[1];
 	na = 0;
diff --git a/dwsys/NUMfft_d.cpp b/dwsys/NUMfft_d.cpp
index 469b00a..d09069a 100644
--- a/dwsys/NUMfft_d.cpp
+++ b/dwsys/NUMfft_d.cpp
@@ -1,6 +1,6 @@
 /* NUMfft_d.c
  *
- * Copyright (C) 1997-2011 David Weenink
+ * Copyright (C) 1997-2011 David Weenink, Paul Boersma 2017
  *
  * This code 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 @@
 #define FFT_DATA_TYPE double
 #include "NUMfft_core.h"
 
-void NUMforwardRealFastFourierTransform (double *data, long n) {
+void NUMforwardRealFastFourierTransform (double *data, integer n) {
 	autoNUMfft_Table table;
 	NUMfft_Table_init (& table, n);
 	NUMfft_forward (& table, data);
@@ -35,20 +35,20 @@ void NUMforwardRealFastFourierTransform (double *data, long n) {
 	if (n > 1) {
 		// To be compatible with old behaviour
 		double tmp = data[n];
-		for (long i = n; i > 2; i--) {
+		for (integer i = n; i > 2; i--) {
 			data[i] = data[i - 1];
 		}
 		data[2] = tmp;
 	}
 }
 
-void NUMreverseRealFastFourierTransform (double *data, long n) {
+void NUMreverseRealFastFourierTransform (double *data, integer n) {
 	autoNUMfft_Table table;
 
 	if (n > 1) {
 		// To be compatible with old behaviour
 		double tmp = data[2];
-		for (long i = 2; i < n; i++) {
+		for (integer i = 2; i < n; i++) {
 			data[i] = data[i + 1];
 		}
 		data[n] = tmp;
@@ -72,14 +72,14 @@ void NUMfft_backward (NUMfft_Table me, double *data) {
 	drftb1 (my n, &data[1], my trigcache, my trigcache + my n, my splitcache);
 }
 
-void NUMfft_Table_init (NUMfft_Table me, long n) {
+void NUMfft_Table_init (NUMfft_Table me, integer n) {
 	my n = n;
 	my trigcache = NUMvector <double> (0, 3 * n - 1);
-	my splitcache = NUMvector <long> (0, 31);
+	my splitcache = NUMvector <integer> (0, 31);
 	NUMrffti (n, my trigcache, my splitcache);
 }
 
-void NUMrealft (double *data, long n, int isign) {
+void NUMrealft (double *data, integer n, int isign) {
 	isign == 1 ? NUMforwardRealFastFourierTransform (data, n) :
 	NUMreverseRealFastFourierTransform (data, n);
 }
diff --git a/dwsys/NUMlapack.cpp b/dwsys/NUMlapack.cpp
index a96cab8..acbee3a 100644
--- a/dwsys/NUMlapack.cpp
+++ b/dwsys/NUMlapack.cpp
@@ -31,9 +31,9 @@
 #define SIGN(x,s) ((s) < 0 ? -fabs (x) : fabs(x))
 #define TOVEC(x) (&(x) - 1)
 
-void NUMidentity (double **a, long rb, long re, long cb) {
-	for (long i = rb; i <= re; i++) {
-		for (long j = cb; j <= cb + (re - rb); j++) {
+void NUMidentity (double **a, integer rb, integer re, integer cb) {
+	for (integer i = rb; i <= re; i++) {
+		for (integer j = cb; j <= cb + (re - rb); j++) {
 			a[i][j] = 0;
 		}
 		a[i][i] = 1;
@@ -48,10 +48,10 @@ double NUMpythagoras (double a, double b) {
 		return w;
 	}
 	double t = z / w;
-	return w * sqrt (1 + t * t);
+	return w * sqrt (1.0 + t * t);
 }
 
-double NUMnorm2 (long n, double *x, long incx) {
+double NUMnorm2 (integer n, double *x, integer incx) {
 	if (n < 1 || incx < 1) {
 		return 0;
 	}
@@ -59,13 +59,14 @@ double NUMnorm2 (long n, double *x, long incx) {
 		return fabs (x[1]);
 	}
 
-	double scale = 0, ssq = 1;
-	for (long i = 1; i <= 1 + (n - 1) * incx; i += incx) {
-		if (x[i] != 0) {
+	double scale = 0.0;
+	real80 ssq = 1.0;
+	for (integer i = 1; i <= 1 + (n - 1) * incx; i += incx) {
+		if (x[i] != 0.0) {
 			double absxi = fabs (x[i]);
 			if (scale < absxi) {
 				double tmp = scale / absxi;
-				ssq = 1 + ssq * tmp * tmp;
+				ssq = 1.0 + ssq * tmp * tmp;
 				scale = absxi;
 			} else {
 				double tmp = absxi / scale;
@@ -73,20 +74,21 @@ double NUMnorm2 (long n, double *x, long incx) {
 			}
 		}
 	}
-	return scale * sqrt (ssq);
+	return scale * sqrt ((real) ssq);
 }
 
 
-double NUMfrobeniusnorm (long m, long n, double **x) {
+double NUMfrobeniusnorm (integer m, integer n, double **x) {
 	if (n < 1 || m < 1) {
 		return 0;
 	}
 
-	double scale = 0, ssq = 1;
-	for (long i = 1; i <= m; i++) {
-		for (long j = 1; j <= n; j++) {
-			if (x[i][j] != 0) {
-				double absxi = fabs (x[i][j]);
+	double scale = 0.0;
+	real80 ssq = 1.0;
+	for (integer i = 1; i <= m; i ++) {
+		for (integer j = 1; j <= n; j ++) {
+			if (x [i] [j] != 0.0) {
+				double absxi = fabs (x [i] [j]);
 				if (scale < absxi) {
 					double t = scale / absxi;
 					ssq = 1 + ssq * t * t;
@@ -98,12 +100,12 @@ double NUMfrobeniusnorm (long m, long n, double **x) {
 			}
 		}
 	}
-	return scale * sqrt (ssq);
+	return scale * sqrt ((real) ssq);
 }
 
 
-double NUMdotproduct (long n, double x[], long incx, double y[], long incy) {
-	long ix = 1, iy = 1;
+double NUMdotproduct (integer n, double x[], integer incx, double y[], integer incy) {
+	integer ix = 1, iy = 1;
 	if (n <= 0) {
 		return 0;
 	}
@@ -115,15 +117,15 @@ double NUMdotproduct (long n, double x[], long incx, double y[], long incy) {
 	}
 
 	double dot = 0;
-	for (long i = 1; i <= n; i++, ix += incx, iy += incy) {
+	for (integer i = 1; i <= n; i++, ix += incx, iy += incy) {
 		dot += x[ix] * y[iy];
 	}
 
 	return dot;
 }
 
-void NUMdaxpy (long n, double da, double x[], long incx, double y[], long incy) {
-	long ix = 1, iy = 1;
+void NUMdaxpy (integer n, double da, double x[], integer incx, double y[], integer incy) {
+	integer ix = 1, iy = 1;
 
 	if (n <= 0) {
 		return;
@@ -135,62 +137,62 @@ void NUMdaxpy (long n, double da, double x[], long incx, double y[], long incy)
 		iy = (-n + 1) * incy + 1;
 	}
 
-	for (long i = 1; i <= n; i++, ix += incx, iy += incy) {
+	for (integer i = 1; i <= n; i++, ix += incx, iy += incy) {
 		y[iy] += da * x[ix];
 	}
 }
 
-void NUMvector_scale (long n, double da, double dx[], long incx) {
+void NUMvector_scale (integer n, double da, double dx[], integer incx) {
 	if (n < 1 || incx < 1) {
 		return;
 	}
-	for (long i = 1; i <= n * incx; i += incx) {
+	for (integer i = 1; i <= n * incx; i += incx) {
 		dx[i] *= da;
 	}
 }
 
-void NUMcopyElements (long n, double x[], long incx, double y[], long incy) {
+void NUMcopyElements (integer n, double x[], integer incx, double y[], integer incy) {
 	if (n <= 0) {
 		return;
 	}
 	if (incx == 1 && incy == 1) {
-		for (long i = 1; i <= n; i++) {
+		for (integer i = 1; i <= n; i++) {
 			y[i] = x[i];
 		}
 	} else {
-		long ix = 1, iy = 1;
+		integer ix = 1, iy = 1;
 		if (incx < 0) {
 			ix = (-n + 1) * incx + 1;
 		}
 		if (incy < 0) {
 			iy = (-n + 1) * incy + 1;
 		}
-		for (long i = 1; i <= n; i++, ix += incx, iy += incy) {
+		for (integer i = 1; i <= n; i++, ix += incx, iy += incy) {
 			y[iy] = x[ix];
 		}
 	}
 }
 
-void NUMplaneRotation (long n, double x[], long incx, double y[], long incy,
+void NUMplaneRotation (integer n, double x[], integer incx, double y[], integer incy,
                        double c, double s) {
 	if (n < 1) {
 		return;
 	}
 	if (incx == 1 && incy == 1) {
-		for (long i = 1; i <= n; i++) {
+		for (integer i = 1; i <= n; i++) {
 			double xt = c * x[i] + s * y[i];
 			y[i] = c * y[i] - s * x[i];
 			x[i] = xt;
 		}
 	} else {
-		long ix = 1, iy = 1;
+		integer ix = 1, iy = 1;
 		if (incx < 0) {
 			ix = (-n + 1) * incx + 1;
 		}
 		if (incy < 0) {
 			iy = (-n + 1) * incy + 1;
 		}
-		for (long i = 1; i <= n; i++, ix += incx, iy += incy) {
+		for (integer i = 1; i <= n; i++, ix += incx, iy += incy) {
 			double xt = c * x[ix] + s * y[iy];
 			y[iy] = c * y[iy] - s * x[ix];
 			x[ix] = xt;
@@ -198,29 +200,29 @@ void NUMplaneRotation (long n, double x[], long incx, double y[], long incy,
 	}
 }
 
-void NUMpermuteColumns (int forward, long m, long n, double **x, long *perm) {
+void NUMpermuteColumns (int forward, integer m, integer n, double **x, integer *perm) {
 	if (n <= 1) {
 		return;
 	}
 
-	for (long i = 1; i <= n; i++) {
+	for (integer i = 1; i <= n; i++) {
 		perm[i] = - perm[i];
 	}
 
 	if (forward) {
-		for (long i = 1; i <= n; i++) {
+		for (integer i = 1; i <= n; i++) {
 			if (perm[i] > 0) {
 				continue;
 			}
 
-			long j = i;
+			integer j = i;
 			perm[j] = -perm[j];
-			long in = perm[j];
+			integer in = perm[j];
 			for (;;) {
 				if (perm[in] > 0) {
 					break;
 				}
-				for (long ii = 1; ii <= m; ii++) {
+				for (integer ii = 1; ii <= m; ii++) {
 					double tmp = x[ii][j];
 					x[ii][j] = x[ii][in];
 					x[ii][in] = tmp;
@@ -231,16 +233,16 @@ void NUMpermuteColumns (int forward, long m, long n, double **x, long *perm) {
 			}
 		}
 	} else {
-		for (long i = 1; i <= n; i++) {
+		for (integer i = 1; i <= n; i++) {
 			if (perm[i] > 0) {
 				continue;
 			}
-			long j = perm[i] = - perm[i];
+			integer j = perm[i] = - perm[i];
 			for (;;) {
 				if (j == i) {
 					break;
 				}
-				for (long ii = 1; ii <= m; ii++) {
+				for (integer ii = 1; ii <= m; ii++) {
 					double tmp = x[ii][i];
 					x[ii][i] = x[ii][j];
 					x[ii][j] = tmp;
@@ -252,7 +254,7 @@ void NUMpermuteColumns (int forward, long m, long n, double **x, long *perm) {
 	}
 }
 
-void NUMfindHouseholder (long n, double *alpha, double x[], long incx,
+void NUMfindHouseholder (integer n, double *alpha, double x[], integer incx,
                          double *tau) {
 	double xnorm;
 
@@ -277,7 +279,7 @@ void NUMfindHouseholder (long n, double *alpha, double x[], long incx,
 		// xnorm, beta may be inaccurate; scale x and recompute them
 
 		double rsafmn = 1 / safmin;
-		long knt = 0;
+		integer knt = 0;
 		do {
 			knt++;
 			NUMvector_scale (n - 1, rsafmn, x, incx);
@@ -301,19 +303,19 @@ void NUMfindHouseholder (long n, double *alpha, double x[], long incx,
 		*/
 
 		*alpha = beta;
-		for (long i = 1; i <= knt; i++) {
+		for (integer i = 1; i <= knt; i++) {
 			*alpha *= safmin;
 		}
 	}
 }
 
 void NUMfindGivens (double f, double g, double *cs, double *sn, double *r) {
-	long count;
+	integer count;
 
 	if (! NUMfpp) {
 		NUMmachar ();
 	}
-	double safmn2 = pow (NUMfpp -> base, (long) (log (NUMfpp -> sfmin / NUMfpp -> eps) /
+	double safmn2 = pow (NUMfpp -> base, (integer) (log (NUMfpp -> sfmin / NUMfpp -> eps) /
 	                     log (NUMfpp -> base) / 2.));
 	double safmx2 = 1 / safmn2;
 
@@ -344,7 +346,7 @@ void NUMfindGivens (double f, double g, double *cs, double *sn, double *r) {
 		*r = sqrt (f1 * f1 + g1 * g1);
 		*cs = f1 / *r;
 		*sn = g1 / *r;
-		for (long i = 1; i <= count; i++) {
+		for (integer i = 1; i <= count; i++) {
 			*r *= safmx2;
 		}
 	} else if (scale <= safmn2) {
@@ -359,7 +361,7 @@ void NUMfindGivens (double f, double g, double *cs, double *sn, double *r) {
 		*r = sqrt (f1 * f1 + g1 * g1);
 		*cs = f1 / *r;
 		*sn = g1 / *r;
-		for (long i = 1; i <= count; i++) {
+		for (integer i = 1; i <= count; i++) {
 			*r *= safmn2;
 		}
 	} else {
@@ -375,9 +377,9 @@ void NUMfindGivens (double f, double g, double *cs, double *sn, double *r) {
 	}
 }
 
-void NUMapplyFactoredHouseholder (double **c, long rb, long re, long cb,
-                                  long ce, double v[], long incv, double tau, int side) {
-	long i, j, iv;
+void NUMapplyFactoredHouseholder (double **c, integer rb, integer re, integer cb,
+                                  integer ce, double v[], integer incv, double tau, int side) {
+	integer i, j, iv;
 	double sum;
 
 	Melder_assert ( (re - rb) >= 0 && (ce - cb) >= 0 && incv != 0);
@@ -418,14 +420,14 @@ void NUMapplyFactoredHouseholder (double **c, long rb, long re, long cb,
 	}
 }
 
-void NUMapplyFactoredHouseholders (double **c, long rb, long re, long cb,
-                                   long ce, double **v, long rbv, long rev, long cbv, long cev, long incv,
+void NUMapplyFactoredHouseholders (double **c, integer rb, integer re, integer cb,
+                                   integer ce, double **v, integer rbv, integer rev, integer cbv, integer cev, integer incv,
                                    double tau[], int side, int trans) {
 	int left = side == NUM_LEFT, transpose = trans != NUM_NOTRANSPOSE;
-	long mv = rev - rbv + 1, nv = cev - cbv + 1;
-	long i_begin, i_end, i_inc, numberOfHouseholders, order_v;
-	long m = re - rb + 1, n = ce - cb + 1;
-	long rbc = rb, rec = re, cbc = cb, cec = ce;
+	integer mv = rev - rbv + 1, nv = cev - cbv + 1;
+	integer i_begin, i_end, i_inc, numberOfHouseholders, order_v;
+	integer m = re - rb + 1, n = ce - cb + 1;
+	integer rbc = rb, rec = re, cbc = cb, cec = ce;
 
 	if (incv != 1) {	/* by column (QR) */
 		numberOfHouseholders = mv > nv ? nv : mv - 1;
@@ -449,9 +451,9 @@ void NUMapplyFactoredHouseholders (double **c, long rb, long re, long cb,
 		i_inc = 1;
 	}
 
-	long i = i_begin;
+	integer i = i_begin;
 	while (i != i_end) {
-		double save, *v1; long vr, vc;
+		double save, *v1; integer vr, vc;
 		if (incv == 1) {
 			vr = rev - i + 1;
 			vc = cev - i + 1;
@@ -480,10 +482,10 @@ void NUMapplyFactoredHouseholders (double **c, long rb, long re, long cb,
 	}
 }
 
-void NUMhouseholderQR (double **a, long rb, long re, long cb, long ce,
-                       long lda, double tau[]) {
-	long m = re - rb + 1, n = ce - cb + 1;
-	long numberOfHouseholders = MIN (m, n);
+void NUMhouseholderQR (double **a, integer rb, integer re, integer cb, integer ce,
+                       integer lda, double tau[]) {
+	integer m = re - rb + 1, n = ce - cb + 1;
+	integer numberOfHouseholders = MIN (m, n);
 
 	Melder_assert (numberOfHouseholders > 0);
 
@@ -491,8 +493,8 @@ void NUMhouseholderQR (double **a, long rb, long re, long cb, long ce,
 		tau[m] = 0; numberOfHouseholders--;
 	}
 
-	for (long i = 1; i <= numberOfHouseholders; i++) {
-		long ri = rb + i - 1, ci = cb + i - 1;
+	for (integer i = 1; i <= numberOfHouseholders; i++) {
+		integer ri = rb + i - 1, ci = cb + i - 1;
 
 		// Generate elementary reflector H(i) to annihilate "A(i+1:m,i)"
 
@@ -510,8 +512,8 @@ void NUMhouseholderQR (double **a, long rb, long re, long cb, long ce,
 }
 
 
-void NUMhouseholderQRwithColumnPivoting (long m, long n, double **a, long lda, long pivot[], double tau[]) {
-	long numberOfHouseholders = MIN (m, n);
+void NUMhouseholderQRwithColumnPivoting (integer m, integer n, double **a, integer lda, integer pivot[], double tau[]) {
+	integer numberOfHouseholders = MIN (m, n);
 
 	Melder_assert (numberOfHouseholders > 0);
 
@@ -524,11 +526,11 @@ void NUMhouseholderQRwithColumnPivoting (long m, long n, double **a, long lda, l
 	}
 
 	autoNUMvector<double> colnorm (1, 2 * n);
-	long itmp = 1;
-	for (long i = 1; i <= n; i++) {
+	integer itmp = 1;
+	for (integer i = 1; i <= n; i++) {
 		if (pivot[i] != 0) {
 			if (i != itmp) {
-				for (long j = 1; j <= m; j++) {
+				for (integer j = 1; j <= m; j++) {
 					double tmp = a[j][i];
 					a[j][i] = a[j][itmp];
 					a[j][itmp] = tmp;
@@ -547,7 +549,7 @@ void NUMhouseholderQRwithColumnPivoting (long m, long n, double **a, long lda, l
 	// Compute the QR factorization and update remaining columns
 
 	if (itmp > 0) {
-		long ma = MIN (itmp, m);
+		integer ma = MIN (itmp, m);
 		NUMhouseholderQR (a, 1, m, 1, ma, lda, tau);
 		if (ma < n) NUMapplyFactoredHouseholders (a, 1, m, ma + 1, n, a, 1, m,
 			        1, ma, lda, tau, NUM_LEFT, NUM_TRANSPOSE);
@@ -560,17 +562,17 @@ void NUMhouseholderQRwithColumnPivoting (long m, long n, double **a, long lda, l
 	// Initialize partial column norms. the first n elements of
 	// colnorm store the exact column norms.
 
-	for (long i = itmp + 1; i <= n; i++) {
+	for (integer i = itmp + 1; i <= n; i++) {
 		colnorm[n + i] = colnorm[i] = NUMnorm2 (m - itmp, TOVEC (a[itmp + 1][i]), lda);
 	}
 
 	// Compute factorization
 
-	for (long i = itmp + 1; i <= numberOfHouseholders; i++) {
+	for (integer i = itmp + 1; i <= numberOfHouseholders; i++) {
 		// Determine ith pivot column and swap if necessary
 
-		double max = colnorm[i]; long pvt = i;
-		for (long j = i + 1; j <= n; j++) {
+		double max = colnorm[i]; integer pvt = i;
+		for (integer j = i + 1; j <= n; j++) {
 			if (fabs (colnorm[j]) > max) {
 				max = fabs (colnorm[j]);
 				pvt = j;
@@ -578,7 +580,7 @@ void NUMhouseholderQRwithColumnPivoting (long m, long n, double **a, long lda, l
 		}
 
 		if (pvt != i) {
-			for (long j = 1; j <= m; j++) {
+			for (integer j = 1; j <= m; j++) {
 				double tmp = a[j][i];
 				a[j][i] = a[j][pvt];
 				a[j][pvt] = tmp;
@@ -606,7 +608,7 @@ void NUMhouseholderQRwithColumnPivoting (long m, long n, double **a, long lda, l
 
 		// Update partial column norms.
 
-		for (long j = i + 1; j <= n; j++) {
+		for (integer j = i + 1; j <= n; j++) {
 			if (colnorm[j] == 0) {
 				continue;
 			}
@@ -630,9 +632,9 @@ void NUMhouseholderQRwithColumnPivoting (long m, long n, double **a, long lda, l
 }
 
 
-void NUMhouseholderRQ (double **a, long rb, long re, long cb, long ce, double tau[]) {
-	long m = re - rb + 1, n = ce - cb + 1;
-	long numberOfHouseholders = MIN (m, n);
+void NUMhouseholderRQ (double **a, integer rb, integer re, integer cb, integer ce, double tau[]) {
+	integer m = re - rb + 1, n = ce - cb + 1;
+	integer numberOfHouseholders = MIN (m, n);
 
 	Melder_assert (numberOfHouseholders > 0);
 
@@ -640,10 +642,10 @@ void NUMhouseholderRQ (double **a, long rb, long re, long cb, long ce, double ta
 		tau[n] = 0; numberOfHouseholders--;
 	}
 
-	for (long i = 1; i <= numberOfHouseholders; i++) {
+	for (integer i = 1; i <= numberOfHouseholders; i++) {
 		// Generate elementary reflector H(i) to annihilate "A(m-i+1,1:n-i)"
 
-		long ri = re - i + 1, ci = ce - i + 1, order = n - i + 1;
+		integer ri = re - i + 1, ci = ce - i + 1, order = n - i + 1;
 
 		NUMfindHouseholder (order, &a[ri][ci], a[ri], 1, &tau[i]);
 
@@ -660,7 +662,7 @@ void NUMhouseholderRQ (double **a, long rb, long re, long cb, long ce, double ta
 }
 
 
-void NUMparallelVectors (long n, double x[], long incx, double y[], long incy,
+void NUMparallelVectors (integer n, double x[], integer incx, double y[], integer incy,
                          double *svmin) {
 	double a11, c, svmax, tau;
 
@@ -693,7 +695,7 @@ void NUMsvdcmp22 (double f, double g, double h, double *svmin, double *svmax,
 	double ht = h, ha = fabs (h);
 	double gt = g, ga = fabs (g);
 
-	long pmax = 1;	// pmax: maximum absolute entry of matrix (f=1, g=2, h=3).
+	integer pmax = 1;	// pmax: maximum absolute entry of matrix (f=1, g=2, h=3).
 
 	bool swap = ha > fa;
 	if (swap) {
@@ -996,10 +998,10 @@ void NUMsvcmp22 (double f, double g, double h, double *svmin, double *svmax) {
 
 #define MAXIT 50
 
-void NUMgsvdFromUpperTriangulars (double **a, long m, long n, double **b,
-                                  long p, int product, long k, long l, double tola, double tolb,
-                                  double *alpha, double *beta, double **u, double **v, double **q, long *ncycle) {
-	int upper = 0; long iter, maxmn = MAX (m, n);
+void NUMgsvdFromUpperTriangulars (double **a, integer m, integer n, double **b,
+                                  integer p, int product, integer k, integer l, double tola, double tolb,
+                                  double *alpha, double *beta, double **u, double **v, double **q, integer *ncycle) {
+	int upper = 0; integer iter, maxmn = MAX (m, n);
 	double a1, a2, a3, b1, b2, b3, csq, csu, csv;
 	double snq, snu, snv;
 
@@ -1010,8 +1012,8 @@ void NUMgsvdFromUpperTriangulars (double **a, long m, long n, double **b,
 	for (iter = 1; iter <= MAXIT; iter++) {
 		upper = ! upper;
 
-		for (long i = 1; i <= l - 1; i++) {
-			for (long j = i + 1; j <= l; j++) {
+		for (integer i = 1; i <= l - 1; i++) {
+			for (integer j = i + 1; j <= l; j++) {
 				a1 = a2 = a3 = 0;
 				if (k + i <= m) {
 					a1 = a[k + i][n - l + i];
@@ -1087,9 +1089,9 @@ void NUMgsvdFromUpperTriangulars (double **a, long m, long n, double **b,
 			// Convergence test: test the parallelism of the corresponding rows of A and B.
 
 			double error = 0, svmin;
-			for (long i = 1; i <= MIN (l, m - k); i++) {
-				long jj = n - l + i;
-				for (long j = 1; j <= l - i + 1; j++, jj++) {
+			for (integer i = 1; i <= MIN (l, m - k); i++) {
+				integer jj = n - l + i;
+				for (integer j = 1; j <= l - i + 1; j++, jj++) {
 					work[j] = a[k + i][jj];
 					work[l + j] = b[i][jj];
 				}
@@ -1118,12 +1120,12 @@ void NUMgsvdFromUpperTriangulars (double **a, long m, long n, double **b,
 	// Compute the generalized singular value pairs (alpha, beta), and
 	//  set the triangular matrix R to matrix a.
 
-	for (long i = 1; i <= k; i++) {
+	for (integer i = 1; i <= k; i++) {
 		alpha[i] = 1;
 		beta[i] = 0;
 	}
 
-	for (long i = 1; i <= MIN (l, m - k); i++) {
+	for (integer i = 1; i <= MIN (l, m - k); i++) {
 		a1 = a[k + i][n - l + i];
 		b1 = b[i][n - l + i];
 
@@ -1136,10 +1138,10 @@ void NUMgsvdFromUpperTriangulars (double **a, long m, long n, double **b,
 						V(1:p, i) := - V(1:p, i)
 				*/
 
-				for (long j = n - l + i; j <= n; j++) {
+				for (integer j = n - l + i; j <= n; j++) {
 					b[i][j] = -b[i][j];
 				}
-				if (v) for (long j = 1; j <= p; j++) {
+				if (v) for (integer j = 1; j <= p; j++) {
 						v[j][i] = - v[j][i];
 					}
 			}
@@ -1147,11 +1149,11 @@ void NUMgsvdFromUpperTriangulars (double **a, long m, long n, double **b,
 			NUMfindGivens (fabs (gamma), 1, &beta[k + i], &alpha[k + i], &rwk);
 
 			if (alpha[k + i] >= beta[k + i]) {
-				for (long j = n - l + i; j <= n; j++) {
+				for (integer j = n - l + i; j <= n; j++) {
 					a[k + i][j] /= alpha[k + i];
 				}
 			} else {
-				for (long j = n - l + i; j <= n; j++) {
+				for (integer j = n - l + i; j <= n; j++) {
 					b[i][j] /= beta[k + i];
 					a[k + i][j] = b[i][j];
 				}
@@ -1159,7 +1161,7 @@ void NUMgsvdFromUpperTriangulars (double **a, long m, long n, double **b,
 		} else {
 			alpha[k + i] = 0;
 			beta[k + i] = 1;
-			for (long j = n - l + i; j <= n; j++) {
+			for (integer j = n - l + i; j <= n; j++) {
 				a[k + i][j] = b[i][j];
 			}
 		}
@@ -1167,29 +1169,29 @@ void NUMgsvdFromUpperTriangulars (double **a, long m, long n, double **b,
 
 	// Post-assignment
 
-	for (long i = m + 1; i <= k + l; i++) {
+	for (integer i = m + 1; i <= k + l; i++) {
 		alpha[i] = 0;
 		beta[i] = 1;
 	}
 	if (k + l < n) {
-		for (long i = k + l + 1; i <= n; i++) {
+		for (integer i = k + l + 1; i <= n; i++) {
 			alpha[i] = beta[i] = 0;
 		}
 	}
 }
 
 
-void NUMmatricesToUpperTriangularForms (double **a, long m, long n, double **b,
-                                        long p, double tola, double tolb, long *kk, long *ll, double **u,
+void NUMmatricesToUpperTriangularForms (double **a, integer m, integer n, double **b,
+                                        integer p, double tola, double tolb, integer *kk, integer *ll, double **u,
                                         double **v, double **q) {
 	int forward = 1;
-	long i, j, k = 0, l = 0, lda = n, ldb = n;
+	integer i, j, k = 0, l = 0, lda = n, ldb = n;
 
 	Melder_assert (m > 0 && p > 0 && n > 0);
 
 	*kk = *ll = 0;
 
-	autoNUMvector<long> pivot (1, n);
+	autoNUMvector<integer> pivot (1, n);
 	autoNUMvector<double> tau (1, n);
 
 	if (v) {
@@ -1355,9 +1357,9 @@ void NUMmatricesToUpperTriangularForms (double **a, long m, long n, double **b,
 }
 
 
-void NUMgsvdcmp (double **a, long m, long n, double **b, long p, int productsvd,
-                 long *k, long *l, double *alpha, double *beta, double **u, double **v, double **q, int invertR) {
-	long ncycle;
+void NUMgsvdcmp (double **a, integer m, integer n, double **b, integer p, int productsvd,
+                 integer *k, integer *l, double *alpha, double *beta, double **u, double **v, double **q, int invertR) {
+	integer ncycle;
 
 	Melder_assert (m > 0 && n > 0 && p > 0);
 
@@ -1386,7 +1388,7 @@ void NUMgsvdcmp (double **a, long m, long n, double **b, long p, int productsvd,
 	                             tolb, alpha, beta, u, v, q, &ncycle);
 
 	if (q && invertR) {
-		long i, j, ki, nr = *k + *l;
+		integer i, j, ki, nr = *k + *l;
 		int upper, unitDiagonal;
 
 		autoNUMmatrix<double> r (1, nr, 1, nr);
@@ -1460,8 +1462,8 @@ void NUMgsvdcmp (double **a, long m, long n, double **b, long p, int productsvd,
 	}
 }
 
-void NUMtriangularInverse (int upper, int unitDiagonal, long n, double **a) {
-	long j, i, k;
+void NUMtriangularInverse (int upper, int unitDiagonal, integer n, double **a) {
+	integer j, i, k;
 	double ajj, tmp;
 
 	Melder_assert (n > 0);
@@ -1527,7 +1529,7 @@ void NUMtriangularInverse (int upper, int unitDiagonal, long n, double **a) {
 
 void NUMeigencmp22 (double a, double b, double c, double *rt1, double *rt2,
                     double *cs1, double *sn1) {
-	long sgn1, sgn2;
+	integer sgn1, sgn2;
 	double ab, acmn, acmx, acs, adf, cs, ct, df, rt, sm, tb, tn;
 
 	sm = a + c;
diff --git a/dwsys/NUMlapack.h b/dwsys/NUMlapack.h
index 62d8898..22183ee 100644
--- a/dwsys/NUMlapack.h
+++ b/dwsys/NUMlapack.h
@@ -117,7 +117,7 @@ We have changed the following things:
 	dggsvp	NUMmatricesToUpperTriangularForms
 */
 
-void NUMidentity (double **a, long rb, long re, long cb);
+void NUMidentity (double **a, integer rb, integer re, integer cb);
 /*
 	Set a[rb:re, cb:cb+re-rb] to identity matrix.
 */
@@ -128,45 +128,45 @@ double NUMpythagoras (double a, double b);
 	overflow.
 */
 
-double NUMnorm2 (long n, double *x, long incx);
+double NUMnorm2 (integer n, double *x, integer incx);
 /*
 	Returns the euclidean norm of a vector so that
 
 	NUMvector_norm2 := sqrt (x'*x)
 */
 
-double NUMfrobeniusnorm (long m, long n, double **x);
+double NUMfrobeniusnorm (integer m, integer n, double **x);
 /*
 	Returns frobenius norm of matrix sqrt (sum (i=1:m, j=1:n, x[i][j]^2))
 */
 
-double NUMdotproduct (long n, double x[], long incx, double y[], long incy);
+double NUMdotproduct (integer n, double x[], integer incx, double y[], integer incy);
 /*
 	Returns the dot product of two vectors.
 */
 
-void NUMcopyElements (long n, double x[], long incx, double y[], long incy);
+void NUMcopyElements (integer n, double x[], integer incx, double y[], integer incy);
 /*
 	Copies a vector, x, to a vector, y.
 */
 
 
-void NUMdaxpy (long n, double da, double x[], long incx, double y[], long incy);
+void NUMdaxpy (integer n, double da, double x[], integer incx, double y[], integer incy);
 /*
 	Constant times a vector plus a vector y[] += da*x[].
 */
 
-void NUMvector_scale (long n, double da, double dx[], long incx);
+void NUMvector_scale (integer n, double da, double dx[], integer incx);
 /*
 	Scales a vector by a constant.
 */
 
-void NUMplaneRotation (long n, double x[], long incx, double y[], long incy, double c, double s);
+void NUMplaneRotation (integer n, double x[], integer incx, double y[], integer incy, double c, double s);
 /*
 	Rotates vector's x and y.
 */
 
-void NUMpermuteColumns (int forward, long m, long n, double **x, long *perm);
+void NUMpermuteColumns (int forward, integer m, integer n, double **x, integer *perm);
 /*
 	Rearranges the columns of the m by n matrix X as specified
 	by the permutation perm[1], perm[2], ..., perm[n] of the integers 1, ..., n.
@@ -194,7 +194,7 @@ void NUMpermuteColumns (int forward, long m, long n, double **x, long *perm);
 	perm	the permutation vector [1..n].
 */
 
-void NUMfindHouseholder (long n, double *alpha, double x[], long incx, double *tau);
+void NUMfindHouseholder (integer n, double *alpha, double x[], integer incx, double *tau);
 /*
 	Find a real elementary reflector H of order n, such that
 
@@ -260,7 +260,7 @@ void NUMfindGivens (double f, double g, double *cs, double *sn, double *r);
 	r       the nonzero component of the rotated vector.
 */
 
-void NUMapplyFactoredHouseholder (double **c, long rb, long re, long cb, long ce, double v[], long incv,
+void NUMapplyFactoredHouseholder (double **c, integer rb, integer re, integer cb, integer ce, double v[], integer incv,
 	double tau, int side);
 /*
 	Applies a real elementary reflector H to the (rb:re, cb:ce) part of a real matrix
@@ -301,8 +301,8 @@ void NUMapplyFactoredHouseholder (double **c, long rb, long re, long cb, long ce
 
 
 
-void NUMapplyFactoredHouseholders (double **c, long rb, long re, long cb, long ce, double **v,
-	long rbv, long rev, long cbv, long cev, long incv, double tau[], int side, int trans);
+void NUMapplyFactoredHouseholders (double **c, integer rb, integer re, integer cb, integer ce, double **v,
+	integer rbv, integer rev, integer cbv, integer cev, integer incv, double tau[], int side, int trans);
 /*
 	Overwrites the general real m by n matrix C with
 
@@ -394,7 +394,7 @@ void NUMeigencmp22 (double a, double b, double c, double *rt1, double *rt2,
 */
 
 
-void NUMhouseholderQR (double **a, long rb, long re, long cb, long ce, long ncol, double tau[]);
+void NUMhouseholderQR (double **a, integer rb, integer re, integer cb, integer ce, integer ncol, double tau[]);
 /*
 	Computes a QR factorization of a real (sub) matrix (rb:re, cb:ce) of A (:, :lda)
 	A = Q * R.
@@ -436,7 +436,7 @@ void NUMhouseholderQR (double **a, long rb, long re, long cb, long ce, long ncol
 */
 
 
-void NUMhouseholderQRwithColumnPivoting (long m, long n, double **a, long ncol, long *pivot, double tau[]);
+void NUMhouseholderQRwithColumnPivoting (integer m, integer n, double **a, integer ncol, integer *pivot, double tau[]);
 /*
 	Computes a QR factorization with column pivoting of a
 	real m-by-n matrix A: A*P = Q*R.
@@ -486,7 +486,7 @@ void NUMhouseholderQRwithColumnPivoting (long m, long n, double **a, long ncol,
 */
 
 
-void NUMhouseholderRQ (double **a, long rb, long re, long cb, long ce, double tau[]);
+void NUMhouseholderRQ (double **a, integer rb, integer re, integer cb, integer ce, double tau[]);
 /*
 	Computes an RQ factorization of a real m by n matrix A: A = R * Q.
 
@@ -528,7 +528,7 @@ void NUMhouseholderRQ (double **a, long rb, long re, long cb, long ce, double ta
 */
 
 
-void NUMparallelVectors (long n, double x[], long incx, double y[], long incy, double *svmin);
+void NUMparallelVectors (integer n, double x[], integer incx, double y[], integer incy, double *svmin);
 /*
 	Given two column vectors x and y, let
 
@@ -708,9 +708,9 @@ void NUMsvcmp22 (double f, double g, double h, double *svmin, double *svmax );
 */
 
 
-void NUMgsvdFromUpperTriangulars (double **a, long m, long n, double **b, long p,
-	int product, long k, long l, double tola, double tolb, double *alpha, double *beta,
-	double **u, double **v, double **q, long *ncycle);
+void NUMgsvdFromUpperTriangulars (double **a, integer m, integer n, double **b, integer p,
+	int product, integer k, integer l, double tola, double tolb, double *alpha, double *beta,
+	double **u, double **v, double **q, integer *ncycle);
 /*
 	Computes the generalized singular value decomposition (gsvd)
 	of two real upper triangular (or trapezoidal) matrices A and B.
@@ -886,8 +886,8 @@ void NUMgsvdFromUpperTriangulars (double **a, long m, long n, double **b, long p
 */
 
 
-void NUMmatricesToUpperTriangularForms (double **a, long m, long n, double **b, long p,
-	double tola, double tolb, long *kk, long *ll, double **u, double **v, double **q);
+void NUMmatricesToUpperTriangularForms (double **a, integer m, integer n, double **b, integer p,
+	double tola, double tolb, integer *kk, integer *ll, double **u, double **v, double **q);
 /*
 	Computes orthogonal matrices U, V and Q such that
 
@@ -961,7 +961,7 @@ void NUMmatricesToUpperTriangularForms (double **a, long m, long n, double **b,
 */
 
 
-void NUMgsvdcmp (double **a, long m, long n, double **b, long p, int product, long *k, long *l,
+void NUMgsvdcmp (double **a, integer m, integer n, double **b, integer p, int product, integer *k, integer *l,
 	double *alpha, double *beta, double **u, double **v, double **q, int invertR);
 /*
 	Computes the generalized singular value decomposition (gsvd)
@@ -1105,7 +1105,7 @@ void NUMgsvdcmp (double **a, long m, long n, double **b, long p, int product, lo
 			errors of the decomposition.
 */
 
-void NUMtriangularInverse (int upper, int unitDiagonal, long n, double **a);
+void NUMtriangularInverse (int upper, int unitDiagonal, integer n, double **a);
 /*
 	Computes inverse of triangular matrix.
 
diff --git a/dwsys/NUMsort2.cpp b/dwsys/NUMsort2.cpp
index ea1c20d..f883a2e 100644
--- a/dwsys/NUMsort2.cpp
+++ b/dwsys/NUMsort2.cpp
@@ -35,16 +35,16 @@
 	    Floyd's optimization (page 642) is used.
 */
 
-void NUMrankColumns (double **m, long rb, long re, long cb, long ce) {
-	long nr = re - rb + 1;
-	autoNUMvector<double> v (1, nr);
-	autoNUMvector<long> index (1, nr);
+void NUMrankColumns (double **m, integer rb, integer re, integer cb, integer ce) {
+	integer nr = re - rb + 1;
+	autoNUMvector <double> v (1, nr);
+	autoNUMvector <integer> index (1, nr);
 
-	for (long j = cb; j <= ce; j++) {
-		for (long i = 1; i <= nr; i++) {
+	for (integer j = cb; j <= ce; j++) {
+		for (integer i = 1; i <= nr; i++) {
 			v[i] = m[rb + i - 1][j];
 		}
-		for (long i = 1; i <= nr; i++) {
+		for (integer i = 1; i <= nr; i++) {
 			index[i] = i;
 		}
 		NUMsort2 (nr, v.peek(), index.peek());
@@ -204,19 +204,19 @@ void NUMindexx (const T a[], long n, long index[], int (*compare) (void *, void
 
 #define COMPARELT(x,y) ((x) < (y))
 
-void NUMindexx (const double a[], long n, long index[])
+void NUMindexx (const double a[], integer n, integer index[])
 MACRO_NUMindex (double)
 
 #undef COMPARELT
 #define COMPARELT(x,y) (Melder_cmp (x,y) <  0)
-void NUMindexx_s (char32 **a, long n, long index[])
+void NUMindexx_s (char32 **a, integer n, integer index[])
 MACRO_NUMindex (char32 *)
 
 #undef COMPARELT
 #undef MACRO_INDEXX
 
 template <class T>
-void NUMsort1 (long n, T a[]) {
+void NUMsort1 (integer n, T a[]) {
 /*
 	Knuth's heapsort algorithm (vol. 3, page 145),
 	modified with Floyd's optimization (vol. 3, page 642).
diff --git a/dwsys/NUMstring.cpp b/dwsys/NUMstring.cpp
index 2245895..4f8b224 100644
--- a/dwsys/NUMstring.cpp
+++ b/dwsys/NUMstring.cpp
@@ -69,8 +69,8 @@ real *NUMstring_to_numbers (const char32 *s, integer *p_numbers_found) {
 	return numbers.transfer();
 }
 
-void NUMstrings_copyElements (char32 **from, char32 **to, long lo, long hi) {
-	for (long i = lo; i <= hi; i++) {
+void NUMstrings_copyElements (char32 **from, char32 **to, integer lo, integer hi) {
+	for (integer i = lo; i <= hi; i ++) {
 		Melder_free (to [i]);
 		if (from [i]) {
 			to [i] = Melder_dup (from [i]);
@@ -78,17 +78,17 @@ void NUMstrings_copyElements (char32 **from, char32 **to, long lo, long hi) {
 	}
 }
 
-void NUMstrings_free (char32 **s, long lo, long hi) {
+void NUMstrings_free (char32 **s, integer lo, integer hi) {
 	if (! s) {
 		return;
 	}
-	for (long i = lo; i <= hi; i++) {
+	for (integer i = lo; i <= hi; i ++) {
 		Melder_free (s [i]);
 	}
 	NUMvector_free <char32 *> (s, lo);
 }
 
-char32 **NUMstrings_copy (char32 **from, long lo, long hi) {
+char32 **NUMstrings_copy (char32 **from, integer lo, integer hi) {
 	autoNUMvector <char32 *> to (lo, hi);
 	NUMstrings_copyElements (from, to.peek(), lo, hi);
 	return to.transfer();
@@ -101,14 +101,14 @@ static char32 *appendNumberToString (const char32 *s, long number, int asArray)
 		Melder_cat (s, U"(", number, U")"));
 }
 
-int NUMstrings_setSequentialNumbering (char32 **s, long lo, long hi, const char32 *pre, long number, long increment, int asArray) {
-	for (long i = lo; i <= hi; i++, number += increment) {
+int NUMstrings_setSequentialNumbering (char32 **s, integer lo, integer hi, const char32 *pre, integer number, integer increment, int asArray) {
+	for (integer i = lo; i <= hi; i ++, number += increment) {
 		char32 *newc = appendNumberToString (pre, number, asArray);
 		if (newc == NULL) {
 			return 0;
 		}
-		Melder_free (s[i]);
-		s[i] = newc;
+		Melder_free (s [i]);
+		s [i] = newc;
 	}
 	return 1;
 }
@@ -141,7 +141,7 @@ char32 *strstr_regexp (const char32 *string, const char32 *search_regexp) {
 }
 
 char32 *str_replace_literal (const char32 *string, const char32 *search, const char32 *replace,
-                              long maximumNumberOfReplaces, long *nmatches) {
+                              integer maximumNumberOfReplaces, integer *nmatches) {
 	if (string == 0 || search == 0 || replace == 0) {
 		return NULL;
 	}
@@ -228,7 +228,7 @@ char32 *str_replace_literal (const char32 *string, const char32 *search, const c
 }
 
 char32 *str_replace_regexp (const char32 *string, regexp *compiledSearchRE,
-                             const char32 *replaceRE, long maximumNumberOfReplaces, long *nmatches) {
+                             const char32 *replaceRE, integer maximumNumberOfReplaces, integer *nmatches) {
 	int buf_nchar = 0;				/* # characters in 'buf' */
 	int gap_copied = 0;
 	int nchar, reverse = 0;
@@ -335,15 +335,15 @@ char32 *str_replace_regexp (const char32 *string, regexp *compiledSearchRE,
 	return buf.transfer();
 }
 
-static char32 **strs_replace_literal (char32 **from, long lo, long hi, const char32 *search,
-	const char32 *replace, int maximumNumberOfReplaces, long *p_nmatches, long *p_nstringmatches) {
+static char32 **strs_replace_literal (char32 **from, integer lo, integer hi, const char32 *search,
+	const char32 *replace, int maximumNumberOfReplaces, integer *p_nmatches, integer *p_nstringmatches) {
 	if (search == NULL || replace == NULL) {
 		return NULL;
 	}
 	autostring32vector result (lo, hi);
 
-	long nmatches_sub = 0, nmatches = 0, nstringmatches = 0;
-	for (long i = lo; i <= hi; i ++) {
+	integer nmatches_sub = 0, nmatches = 0, nstringmatches = 0;
+	for (integer i = lo; i <= hi; i ++) {
 		const char32 *string = ( from [i] ? from [i] : U"" );   // treat null as an empty string
 
 		result [i] = str_replace_literal (string, search, replace, maximumNumberOfReplaces, & nmatches_sub);
@@ -361,24 +361,24 @@ static char32 **strs_replace_literal (char32 **from, long lo, long hi, const cha
 	return result.transfer();
 }
 
-static char32 **strs_replace_regexp (char32 **from, long lo, long hi, const char32 *searchRE,
-	const char32 *replaceRE, int maximumNumberOfReplaces, long *p_nmatches, long *p_nstringmatches) {
+static char32 **strs_replace_regexp (char32 **from, integer lo, integer hi, const char32 *searchRE,
+	const char32 *replaceRE, int maximumNumberOfReplaces, integer *p_nmatches, integer *p_nstringmatches) {
 	if (searchRE == NULL || replaceRE == NULL) {
 		return NULL;
 	}
 	autostring32vector result;
 
-	long nmatches_sub = 0;
+	integer nmatches_sub = 0;
 
 	regexp *compiledRE = CompileRE_throwable (searchRE, 0);
 
 	result.reset (lo, hi);
 
-	long nmatches = 0, nstringmatches = 0;
-	for (long i = lo; i <= hi; i++) {
+	integer nmatches = 0, nstringmatches = 0;
+	for (integer i = lo; i <= hi; i ++) {
 		const char32 *string = ( from [i] ? from [i] : U"" );   // treat null as an empty string
 
-		result [i] = str_replace_regexp (string, compiledRE, replaceRE, maximumNumberOfReplaces, &nmatches_sub);
+		result [i] = str_replace_regexp (string, compiledRE, replaceRE, maximumNumberOfReplaces, & nmatches_sub);
 		if (nmatches_sub > 0) {
 			nmatches += nmatches_sub;
 			nstringmatches ++;
@@ -393,7 +393,7 @@ static char32 **strs_replace_regexp (char32 **from, long lo, long hi, const char
 	return result.transfer();
 }
 
-char32 **strs_replace (char32 **from, long lo, long hi, const char32 *search, const char32 *replace, int maximumNumberOfReplaces, long *nmatches, long *nstringmatches, int use_regexp) {
+char32 **strs_replace (char32 **from, integer lo, integer hi, const char32 *search, const char32 *replace, int maximumNumberOfReplaces, integer *nmatches, integer *nstringmatches, int use_regexp) {
 	return use_regexp ? strs_replace_regexp (from, lo, hi, search, replace, maximumNumberOfReplaces, nmatches, nstringmatches) :
 		strs_replace_literal (from, lo, hi, search, replace, maximumNumberOfReplaces, nmatches, nstringmatches);
 }
@@ -404,11 +404,11 @@ char32 **strs_replace (char32 **from, long lo, long hi, const char32 *search, co
  * 1, 4, 2, 3, 4, 5, 6, 7, 4, 3, 3, 4, 5, 4, 3, 2
  * Overlap is allowed. Ranges can go up and down.
  */
-static long *getElementsOfRanges (const char32 *ranges, long maximumElement, long *numberOfElements, const char32 *elementType) {
+static integer *getElementsOfRanges (const char32 *ranges, integer maximumElement, integer *numberOfElements, const char32 *elementType) {
 	/*
 	 * Count the elements.
 	 */
-	long previousElement = 0;
+	integer previousElement = 0;
 	*numberOfElements = 0;
 	const char32 *p = & ranges [0];
 	for (;;) {
@@ -450,7 +450,7 @@ static long *getElementsOfRanges (const char32 *ranges, long maximumElement, lon
 	/*
 	 * Create room for the elements.
 	 */
-	autoNUMvector <long> elements (1, *numberOfElements);
+	autoNUMvector <integer> elements (1, *numberOfElements);
 	/*
 	 * Store the elements.
 	 */
@@ -484,17 +484,17 @@ static long *getElementsOfRanges (const char32 *ranges, long maximumElement, lon
 	return elements.transfer();
 }
 
-static void NUMlvector_getUniqueNumbers (long *numbers, long *p_numberOfElements, long *p_numberOfMultiples) {
+static void NUMlvector_getUniqueNumbers (integer *numbers, integer *p_numberOfElements, integer *p_numberOfMultiples) {
 	Melder_assert (p_numberOfElements);
-	autoNUMvector<long> sorted (NUMvector_copy<long> (numbers, 1, *p_numberOfElements), 1);
-	NUMsort_l (*p_numberOfElements, sorted.peek());
-	long numberOfMultiples = 0;
+	autoNUMvector< integer> sorted (NUMvector_copy <integer> (numbers, 1, *p_numberOfElements), 1);
+	NUMsort_integer (*p_numberOfElements, sorted.peek());
+	integer numberOfMultiples = 0;
 	
 	numbers [1] = sorted [1];
 	long numberOfUniques = 1;
-	for (long i = 2; i <= *p_numberOfElements; i++) {
-		if (sorted[i] != sorted[i - 1]) {
-			numbers [++numberOfUniques] = sorted[i];
+	for (integer i = 2; i <= *p_numberOfElements; i ++) {
+		if (sorted [i] != sorted [i - 1]) {
+			numbers [++numberOfUniques] = sorted [i];
 		} else {
 			numberOfMultiples ++;
 		}
@@ -505,8 +505,8 @@ static void NUMlvector_getUniqueNumbers (long *numbers, long *p_numberOfElements
 	}
 }
 
-long *NUMstring_getElementsOfRanges (const char32 *ranges, long maximumElement, long *numberOfElements, long *numberOfMultiples, const char32 *elementType, bool sortedUniques) {
-	autoNUMvector<long> elements (getElementsOfRanges (ranges, maximumElement, numberOfElements, elementType), 1);
+integer *NUMstring_getElementsOfRanges (const char32 *ranges, integer maximumElement, integer *numberOfElements, integer *numberOfMultiples, const char32 *elementType, bool sortedUniques) {
+	autoNUMvector <integer> elements (getElementsOfRanges (ranges, maximumElement, numberOfElements, elementType), 1);
 	if (sortedUniques) {
 		NUMlvector_getUniqueNumbers (elements.peek(), numberOfElements, numberOfMultiples);
 	}
diff --git a/dwsys/Permutation.cpp b/dwsys/Permutation.cpp
index 0387265..bf951b0 100644
--- a/dwsys/Permutation.cpp
+++ b/dwsys/Permutation.cpp
@@ -63,7 +63,7 @@ static long Permutation_checkRange (Permutation me, long *from, long *to) {
 
 void Permutation_checkInvariant (Permutation me) {
 	autoPermutation thee = Data_copy (me);
-	NUMsort_l (thy numberOfElements, thy p);
+	NUMsort_integer (thy numberOfElements, thy p);
 	for (long i = 1; i <= my numberOfElements; i++) {
 		if (thy p[i] != i) {
 			Melder_throw (me, U":not a valid permutation.");
@@ -81,13 +81,13 @@ void structPermutation :: v_readText (MelderReadText text, int /*formatVersion*/
 	if (numberOfElements < 1) {
 		Melder_throw (U"Found a negative mumber of elements during reading.");
 	}
-	p = NUMvector_readText_i32 (1, numberOfElements, text, "p");
+	p = NUMvector_readText_integer (1, numberOfElements, text, "p");
 	Permutation_checkInvariant (this);
 }
 
 void Permutation_init (Permutation me, long numberOfElements) {
 	my numberOfElements = numberOfElements;
-	my p = NUMvector<long> (1, numberOfElements);
+	my p = NUMvector<integer> (1, numberOfElements);
 	Permutation_sort (me);
 }
 
@@ -371,7 +371,7 @@ autoPermutation Permutation_reverse (Permutation me, long from, long to) {
 */
 void Permutation_next_inline (Permutation me) {
 	long size = my numberOfElements;
-	long *p = & my p[1];
+	integer *p = & my p[1];
 
 	if (size < 2) {
 		Melder_throw (U"Only one element.");
@@ -409,7 +409,7 @@ void Permutation_next_inline (Permutation me) {
 */
 void Permutation_previous_inline (Permutation me) {
 	long size = my numberOfElements;
-	long *p = & my p[1];
+	integer *p = & my p[1];
 
 	if (size < 2) {
 		Melder_throw (U"Only one element.");
diff --git a/dwsys/Permutation_def.h b/dwsys/Permutation_def.h
index bd6cf1d..d712fbf 100644
--- a/dwsys/Permutation_def.h
+++ b/dwsys/Permutation_def.h
@@ -20,8 +20,8 @@
 #define ooSTRUCT Permutation
 oo_DEFINE_CLASS (Permutation, Daata)
 
-	oo_LONG (numberOfElements)
-	oo_LONG_VECTOR (p, numberOfElements)
+	oo_INTEGER (numberOfElements)
+	oo_INTEGER_VECTOR (p, numberOfElements)
 			
 	#if oo_DECLARING
 		void v_info ()
diff --git a/dwsys/SVD.cpp b/dwsys/SVD.cpp
index ffafc48..0aa6961 100644
--- a/dwsys/SVD.cpp
+++ b/dwsys/SVD.cpp
@@ -204,7 +204,7 @@ static void NUMtranspose_d (double **m, long n) {
 void SVD_compute (SVD me) {
 	try {
 		char jobu = 'S', jobvt = 'O';
-		long m, lda, ldu, ldvt, info, lwork = -1;
+		integer m, lda, ldu, ldvt, info, lwork = -1;
 		double wt[2];
 		int transpose = my numberOfRows < my numberOfColumns;
 
@@ -214,7 +214,7 @@ void SVD_compute (SVD me) {
 		}
 
 		lda = ldu = ldvt = m = my numberOfColumns;
-		long n = my numberOfRows;
+		integer n = my numberOfRows;
 
 		(void) NUMlapack_dgesvd (&jobu, &jobvt, &m, &n, &my u[1][1], &lda, &my d[1], &my v[1][1], &ldu, nullptr, &ldvt, wt, &lwork, &info);
 
@@ -289,19 +289,19 @@ void SVD_solve (SVD me, double b[], double x[]) {
 
 void SVD_sort (SVD me) {
 	try {
-		long mn_min = MIN (my numberOfRows, my numberOfColumns);
+		integer mn_min = MIN (my numberOfRows, my numberOfColumns);
 		autoSVD thee = Data_copy (me);
-		autoNUMvector<long> index (1, mn_min);
+		autoNUMvector<integer> index (1, mn_min);
 
 		NUMindexx (my d, mn_min, index.peek());
 
-		for (long j = 1; j <= mn_min; j++) {
-			long from = index[mn_min - j + 1];
+		for (integer j = 1; j <= mn_min; j++) {
+			integer from = index[mn_min - j + 1];
 			my d[j] = thy d[from];
-			for (long i = 1; i <= my numberOfRows; i++) {
+			for (integer i = 1; i <= my numberOfRows; i++) {
 				my u[i][j] = thy u[i][from];
 			}
-			for (long i = 1; i <= my numberOfColumns; i++) {
+			for (integer i = 1; i <= my numberOfColumns; i++) {
 				my v[i][j] = thy v[i][from];
 			}
 		}
@@ -400,8 +400,8 @@ autoGSVD GSVD_create (long numberOfColumns) {
 
 autoGSVD GSVD_create_d (double **m1, long numberOfRows1, long numberOfColumns, double **m2, long numberOfRows2) {
 	try {
-		long m = numberOfRows1, n = numberOfColumns, p = numberOfRows2;
-		long lwork = MAX (MAX (3 * n, m), p) + n;
+		integer m = numberOfRows1, n = numberOfColumns, p = numberOfRows2;
+		integer lwork = MAX (MAX (3 * n, m), p) + n;
 
 		// Store the matrices a and b as column major!
 		autoNUMmatrix<double> a (NUMmatrix_transpose (m1, m, n), 1, 1);
@@ -410,11 +410,11 @@ autoGSVD GSVD_create_d (double **m1, long numberOfRows1, long numberOfColumns, d
 		autoNUMvector<double> alpha (1, n);
 		autoNUMvector<double> beta (1, n);
 		autoNUMvector<double> work (1, lwork);
-		autoNUMvector<long> iwork (1, n);
+		autoNUMvector<integer> iwork (1, n);
 
 
 		char jobu1 = 'N', jobu2 = 'N', jobq = 'Q';
-		long k, l, info;
+		integer k, l, info;
 		NUMlapack_dggsvd (&jobu1, &jobu2, &jobq, &m, &n, &p, &k, &l,
 		    &a[1][1], &m, &b[1][1], &p, &alpha[1], &beta[1], nullptr, &m,
 		    nullptr, &p, &q[1][1], &n, &work[1], &iwork[1], &info);
@@ -423,18 +423,18 @@ autoGSVD GSVD_create_d (double **m1, long numberOfRows1, long numberOfColumns, d
 		}
 
 
-		long kl = k + l;
+		integer kl = k + l;
 		autoGSVD me = GSVD_create (kl);
 
-		for (long i = 1; i <= kl; i++) {
+		for (integer i = 1; i <= kl; i++) {
 			my d1[i] = alpha[i];
 			my d2[i] = beta[i];
 		}
 
 		// Transpose q
 
-		for (long i = 1; i <= n; i++) {
-			for (long j = i + 1; j <= n; j++) {
+		for (integer i = 1; i <= n; i++) {
+			for (integer j = i + 1; j <= n; j++) {
 				my q[i][j] = q[j][i];
 				my q[j][i] = q[i][j];
 			}
@@ -444,8 +444,8 @@ autoGSVD GSVD_create_d (double **m1, long numberOfRows1, long numberOfColumns, d
 		// Get R from a(1:k+l,n-k-l+1:n)
 
 		double *pr = &a[1][1];
-		for (long i = 1; i <= kl; i++) {
-			for (long j = i; j <= kl; j++) {
+		for (integer i = 1; i <= kl; i++) {
+			for (integer j = i; j <= kl; j++) {
 				my r[i][j] = pr[i - 1 + (n - kl + j - 1) * m]; /* from col-major */
 			}
 		}
diff --git a/dwsys/SVD_def.h b/dwsys/SVD_def.h
index 1f9a8b6..25322e1 100644
--- a/dwsys/SVD_def.h
+++ b/dwsys/SVD_def.h
@@ -20,8 +20,8 @@
 oo_DEFINE_CLASS (SVD, Daata)
 
 	oo_DOUBLE (tolerance)
-	oo_LONG (numberOfRows)
-	oo_LONG (numberOfColumns)
+	oo_INTEGER (numberOfRows)
+	oo_INTEGER (numberOfColumns)
 	oo_DOUBLE_MATRIX (u, numberOfRows, (numberOfColumns < numberOfRows ? numberOfColumns : numberOfRows))
 	oo_DOUBLE_MATRIX (v, numberOfColumns, (numberOfColumns < numberOfRows ? numberOfColumns : numberOfRows))
 	oo_DOUBLE_VECTOR (d, (numberOfColumns < numberOfRows ? numberOfColumns : numberOfRows))
@@ -39,7 +39,7 @@ oo_END_CLASS (SVD)
 oo_DEFINE_CLASS (GSVD, Daata)
 
 	oo_DOUBLE (tolerance)
-	oo_LONG (numberOfColumns)
+	oo_INTEGER (numberOfColumns)
 	oo_DOUBLE_MATRIX ( q, numberOfColumns, numberOfColumns)
 	oo_DOUBLE_MATRIX ( r, numberOfColumns, numberOfColumns)
 	oo_DOUBLE_VECTOR (d1, numberOfColumns)
diff --git a/dwsys/SimpleVector_def.h b/dwsys/SimpleVector_def.h
index 4f24125..8f18392 100644
--- a/dwsys/SimpleVector_def.h
+++ b/dwsys/SimpleVector_def.h
@@ -23,8 +23,8 @@
 #define ooSTRUCT DoubleVector
 oo_DEFINE_CLASS (DoubleVector, Daata)
 
-	oo_LONG (min)
-	oo_LONG (max)
+	oo_INTEGER (min)
+	oo_INTEGER (max)
 	oo_DOUBLE_VECTOR_FROM (v, min, max)
 	
 oo_END_CLASS (DoubleVector)	
@@ -33,8 +33,8 @@ oo_END_CLASS (DoubleVector)
 #define ooSTRUCT ComplexVector
 oo_DEFINE_CLASS (ComplexVector, Daata)
 
-	oo_LONG (min)
-	oo_LONG (max)
+	oo_INTEGER (min)
+	oo_INTEGER (max)
 	oo_DCOMPLEX_VECTOR_FROM (v, min, max)
 	
 oo_END_CLASS (ComplexVector)	
diff --git a/dwtools/ActivationList.cpp b/dwtools/ActivationList.cpp
index 23bca63..90548e1 100644
--- a/dwtools/ActivationList.cpp
+++ b/dwtools/ActivationList.cpp
@@ -1,6 +1,6 @@
 /* ActivationList.cpp
  *
- * Copyright (C) 1993-2012, 2015 David Weenink
+ * Copyright (C) 1993-2012,2015 David Weenink
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,21 +16,14 @@
  * along with this work. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/*
- djmw 20020315 GPL header
- djmw 20041203 Added _Activation_checkElements.
- djmw 20080122 float -> double
- djmw 20110304 Thing_new
- */
-
 #include "ActivationList.h"
 
 Thing_implement (ActivationList, Matrix, 2);
 
 int _ActivationList_checkElements (ActivationList me) {
-	for (long i = 1; i <= my ny; i++) {
-		for (long j = 1; j <= my nx; j++) {
-			if (my z[i][j] < 0.0 || my z[i][j] > 1) {
+	for (integer i = 1; i <= my ny; i ++) {
+		for (integer j = 1; j <= my nx; j ++) {
+			if (my z[i][j] < 0.0 || my z [i] [j] > 1.0) {
 				return 0;
 			}
 		}
@@ -38,11 +31,11 @@ int _ActivationList_checkElements (ActivationList me) {
 	return 1;
 }
 
-void ActivationList_init (ActivationList me, long ny, long nx) {
+void ActivationList_init (ActivationList me, integer ny, integer nx) {
 	Matrix_init (me, 1.0, nx, nx, 1.0, 1.0, 1.0, ny, ny, 1.0, 1.0);
 }
 
-autoActivationList ActivationList_create (long ny, long nx) {
+autoActivationList ActivationList_create (integer ny, integer nx) {
 	try {
 		autoActivationList me = Thing_new (ActivationList);
 		ActivationList_init (me.get(), ny, nx);
diff --git a/dwtools/ActivationList.h b/dwtools/ActivationList.h
index 5415663..dd51d69 100644
--- a/dwtools/ActivationList.h
+++ b/dwtools/ActivationList.h
@@ -1,8 +1,8 @@
 #ifndef _ActivationList_h_
 #define _ActivationList_h_
-/* Activation.h
+/* ActivationList.h
  * 
- * Copyright (C) 1993-2011, 2015-2016 David Weenink
+ * Copyright (C) 1993-2011,2015,2016 David Weenink, Paul Boersma 2017
  * 
  * This program is free oftware; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,33 +18,28 @@
  * along with this work. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/*
- djmw 20020315 GPL header.
- djmw 20110505 Latest modification.
- */
-
 #include "Matrix.h"
 
 Thing_define (ActivationList, Matrix) {
 };
 
 /* Attributes:
-   xmin				:1
-   xmax				:#units
-   nx				:#units
-   dx				:1
-   x1				:1
-   ymin				:1
-   ymax				:#patterns
-   ny				:#patterns
-   dy				:1
-   y1				:1
-   z[iy][ix]		:the activities
+   xmin         : 1
+   xmax         : number of units
+   nx           : number of units
+   dx           : 1
+   x1           : 1
+   ymin         : 1
+   ymax         : number of patterns
+   ny           : number of patterns
+   dy           : 1
+   y1           : 1
+   z [iy] [ix]  : the activities
 */
 
-void ActivationList_init (ActivationList me, long ny, long nx);
+void ActivationList_init (ActivationList me, integer ny, integer nx);
 
-autoActivationList ActivationList_create (long ny, long nx);
+autoActivationList ActivationList_create (integer ny, integer nx);
 
 autoActivationList Matrix_to_ActivationList (Matrix me);
 
@@ -53,4 +48,5 @@ autoMatrix ActivationList_to_Matrix (ActivationList me);
 int _ActivationList_checkElements (ActivationList me);
 /* Return 1 if all elements are in interval [0,1] else 0. */
 
-#endif /* _ActivationList_h_ */
+/* End of file ActivationList.h */
+#endif
diff --git a/dwtools/AffineTransform_def.h b/dwtools/AffineTransform_def.h
index c8b3d3c..60c7ef0 100644
--- a/dwtools/AffineTransform_def.h
+++ b/dwtools/AffineTransform_def.h
@@ -20,7 +20,7 @@
 #define ooSTRUCT AffineTransform
 oo_DEFINE_CLASS (AffineTransform, Daata)
 
-	oo_LONG (n)
+	oo_INTEGER (n)
 	oo_DOUBLE_VECTOR (t, n)
 	oo_DOUBLE_MATRIX (r, n, n)
 
diff --git a/dwtools/CCA_def.h b/dwtools/CCA_def.h
index 0ad2748..d6eb127 100644
--- a/dwtools/CCA_def.h
+++ b/dwtools/CCA_def.h
@@ -28,8 +28,8 @@
 #define ooSTRUCT CCA
 oo_DEFINE_CLASS (CCA, Daata)
 
-	oo_LONG (numberOfCoefficients)
-	oo_LONG (numberOfObservations)
+	oo_INTEGER (numberOfCoefficients)
+	oo_INTEGER (numberOfObservations)
 	oo_AUTO_OBJECT (Strings, 0, yLabels)
 	oo_AUTO_OBJECT (Strings, 0, xLabels)
 	oo_AUTO_OBJECT(Eigen, 0, y)
diff --git a/dwtools/CC_def.h b/dwtools/CC_def.h
index e48dd2f..33d5478 100644
--- a/dwtools/CC_def.h
+++ b/dwtools/CC_def.h
@@ -20,7 +20,7 @@
 #define ooSTRUCT CC_Frame
 oo_DEFINE_STRUCT (CC_Frame)
 
-	oo_LONG (numberOfCoefficients)
+	oo_INTEGER (numberOfCoefficients)
 	#if oo_READING_BINARY
 		if (formatVersion == 0)
 		{
@@ -47,7 +47,7 @@ oo_DEFINE_CLASS (CC, Sampled)
 	oo_DOUBLE (fmin)
 	oo_DOUBLE (fmax)
 	// c[0]..c[maximumNumberOfCoefficients] ; needed for inverse transform
-	oo_LONG (maximumNumberOfCoefficients)
+	oo_INTEGER (maximumNumberOfCoefficients)
 	oo_STRUCT_VECTOR (CC_Frame, frame, nx)
 
 	#if oo_DECLARING
diff --git a/dwtools/CategoriesEditor.cpp b/dwtools/CategoriesEditor.cpp
index eb0216e..fc672a6 100644
--- a/dwtools/CategoriesEditor.cpp
+++ b/dwtools/CategoriesEditor.cpp
@@ -52,10 +52,10 @@ static void menu_cb_help (CategoriesEditor /* me */, EDITOR_ARGS_DIRECT) {
 /* Preconditions: */
 /*	1 <= (position[i], newpos) <= size; */
 /*	newpos <= position[1] || newpos >= position[npos] */
-static void Ordered_moveItems (Ordered me, long position [], long npos, long newpos) {
-	long pos, min = position [1], max = position [1];
+static void Ordered_moveItems (Ordered me, integer position [], integer npos, integer newpos) {
+	integer pos, min = position [1], max = position [1];
 
-	for (long i = 2; i <= npos; i ++) {
+	for (integer i = 2; i <= npos; i ++) {
 		if (position [i] > max) {
 			max = position [i];
 		} else if (position [i] < min) {
@@ -70,7 +70,7 @@ static void Ordered_moveItems (Ordered me, long position [], long npos, long new
 	/*
 		Move some data from `me` into `tmp`, in a different order.
 	*/
-	for (long i = 1; i <= npos; i ++) {
+	for (integer i = 1; i <= npos; i ++) {
 		tmp [i] = (Daata) my at [position [i]];   // dangle
 		my at [position [i]] = nullptr;   // undangle
 	}
@@ -79,7 +79,7 @@ static void Ordered_moveItems (Ordered me, long position [], long npos, long new
 
 	if (newpos <= min) {
 		pos = max;
-		for (long i = max; i >= newpos; i --) {
+		for (integer i = max; i >= newpos; i --) {
 			if (my at [i]) {
 				my at [pos --] = my at [i];
 			}
@@ -87,7 +87,7 @@ static void Ordered_moveItems (Ordered me, long position [], long npos, long new
 		pos = newpos;
 	} else {
 		pos = min;
-		for (long i = min; i <= newpos; i ++) {
+		for (integer i = min; i <= newpos; i ++) {
 			if (my at [i]) {
 				my at [pos ++] = my at [i];
 			}
@@ -97,13 +97,13 @@ static void Ordered_moveItems (Ordered me, long position [], long npos, long new
 
 	// fill the 'hole'
 
-	for (long i = 1; i <= npos; i ++) {
+	for (integer i = 1; i <= npos; i ++) {
 		my at [pos ++] = tmp [i];
 	}
 }
 
 /*
-static void OrderedOfString_replaceItemPos (Collection me, autoSimpleString data, long pos) {
+static void OrderedOfString_replaceItemPos (Collection me, autoSimpleString data, integer pos) {
 	if (pos < 1 || pos > my size) {
 		return;
 	}
@@ -112,7 +112,7 @@ static void OrderedOfString_replaceItemPos (Collection me, autoSimpleString data
 */
 
 /* Remove the item at position 'from' and insert it at position 'to'. */
-static void Ordered_moveItem (Ordered me, long from, long to) {
+static void Ordered_moveItem (Ordered me, integer from, integer to) {
 	if (from < 1 || from > my size) {
 		from = my size;
 	}
@@ -124,11 +124,11 @@ static void Ordered_moveItem (Ordered me, long from, long to) {
 	}
 	Daata tmp = my at [from];
 	if (from > to) {
-		for (long i = from; i > to; i --) {
+		for (integer i = from; i > to; i --) {
 			my at [i] = my at [i - 1];
 		}
 	} else {
-		for (long i = from; i < to; i ++) {
+		for (integer i = from; i < to; i ++) {
 			my at [i] = my at [i + 1];
 		}
 	}
@@ -139,8 +139,8 @@ static void Ordered_moveItem (Ordered me, long from, long to) {
 
 static void notifyNumberOfSelected (CategoriesEditor me) {
 	autoMelderString tmp;
-	long posCount;
-	autoNUMvector<long> posList (GuiList_getSelectedPositions (my list, & posCount), 1);  // waste
+	integer posCount;
+	autoNUMvector <integer> posList (GuiList_getSelectedPositions (my list, & posCount), 1);  // waste
 	if (posCount > 0) {
 		MelderString_append (&tmp, posCount, U" selection", (posCount > 1 ? U"s." : U"."));
 	}
@@ -176,13 +176,13 @@ static void updateUndoAndRedoMenuItems (CategoriesEditor me)
 
 static void updateWidgets (CategoriesEditor me) {   // all buttons except undo & redo
 	Categories data = (Categories) my data;
-	long size = data->size;
+	integer size = data->size;
 	bool insert = false, insertAtEnd = true, replace = false, remove = false;
 	bool moveUp = false, moveDown = false;
-	long posCount;
-	autoNUMvector<long> posList (GuiList_getSelectedPositions (my list, & posCount), 1);
+	integer posCount;
+	autoNUMvector <integer> posList (GuiList_getSelectedPositions (my list, & posCount), 1);
 	if (posList.peek()) {
-		long firstPos = posList[1], lastPos = posList[posCount];
+		integer firstPos = posList[1], lastPos = posList[posCount];
 		bool contiguous = ( lastPos - firstPos + 1 == posCount );
 		moveUp = contiguous && firstPos > 1;
 		moveDown = contiguous && lastPos < size;
@@ -211,9 +211,9 @@ static void updateWidgets (CategoriesEditor me) {   // all buttons except undo &
 	notifyNumberOfSelected (me);
 }
 
-static void update (CategoriesEditor me, long from, long to, const long *select, long nSelect) {
+static void update (CategoriesEditor me, integer from, integer to, const integer *select, integer nSelect) {
 	Categories data = (Categories) my data;
-	long size = data->size;
+	integer size = data->size;
 
 	if (size == 0) {
 		autoSimpleString str = SimpleString_create (CategoriesEditor_EMPTYLABEL);
@@ -231,32 +231,32 @@ static void update (CategoriesEditor me, long from, long to, const long *select,
 		to = size;
 	}
 	if (from > to) {
-		long ti = from; from = to; to = ti;
+		integer ti = from; from = to; to = ti;
 	}
 
 	// Begin optimization: add the items from a table instead of separately.
 	try {
 		autostring32vector table (from, to);
-		long itemCount = GuiList_getNumberOfItems (my list);
-		for (long i = from; i <= to; i++) {
+		integer itemCount = GuiList_getNumberOfItems (my list);
+		for (integer i = from; i <= to; i++) {
 			char wcindex[20];
 			snprintf (wcindex,20, "%5ld ", i);
 			table[i] = Melder_dup_f (Melder_cat (Melder_peek8to32 (wcindex), OrderedOfString_itemAtIndex_c ((OrderedOfString) my data, i)));
 		}
 		if (itemCount > size) { // some items have been removed from Categories?
-			for (long j = itemCount; j > size; j --) {
+			for (integer j = itemCount; j > size; j --) {
 				GuiList_deleteItem (my list, j);
 			}
 			itemCount = size;
 		}
 		if (to > itemCount) {
-			for (long j = 1; j <= to - itemCount; j ++) {
+			for (integer j = 1; j <= to - itemCount; j ++) {
 				GuiList_insertItem (my list, table [itemCount + j], 0);
 			}
 		}
 		if (from <= itemCount) {
-			long n = (to < itemCount ? to : itemCount);
-			for (long j = from; j <= n; j++) {
+			integer n = (to < itemCount ? to : itemCount);
+			for (integer j = from; j <= n; j++) {
 				GuiList_replaceItem (my list, table[j], j);
 			}
 		}
@@ -277,7 +277,7 @@ static void update (CategoriesEditor me, long from, long to, const long *select,
 	} else if (nSelect > 0) {
 		// Select but postpone highlighting
 
-		for (long i = 1; i <= nSelect; i++) {
+		for (integer i = 1; i <= nSelect; i++) {
 			GuiList_selectItem (my list, select[i] > size ? size : select[i]);
 		}
 	}
@@ -285,8 +285,8 @@ static void update (CategoriesEditor me, long from, long to, const long *select,
 	// VIEWPORT
 
 	{
-		long top = GuiList_getTopPosition (my list), bottom = GuiList_getBottomPosition (my list);
-		long visible = bottom - top + 1;
+		integer top = GuiList_getTopPosition (my list), bottom = GuiList_getBottomPosition (my list);
+		integer visible = bottom - top + 1;
 		if (nSelect == 0) {
 			top = my position - visible / 2;
 		} else if (select[nSelect] < top) {
@@ -296,7 +296,7 @@ static void update (CategoriesEditor me, long from, long to, const long *select,
 			// selection below visible area
 			top = select[nSelect] - visible + 1;
 		} else {
-			long deltaTopPos = -1, nUpdate = to - from + 1;
+			integer deltaTopPos = -1, nUpdate = to - from + 1;
 			if ( (from == select[1] && to == select[nSelect]) || // Replace
 			        (nUpdate > 2 && nSelect == 1) /* Inserts */) {
 				deltaTopPos = 0;
@@ -319,8 +319,8 @@ static void update (CategoriesEditor me, long from, long to, const long *select,
 
 Thing_define (CategoriesEditorCommand, Command) {
 	autoCategories categories;
-	long *selection;
-	long nSelected, newPos;
+	integer *selection;
+	integer nSelected, newPos;
 
 	void v_destroy () noexcept
 		override;
@@ -334,12 +334,12 @@ void structCategoriesEditorCommand :: v_destroy () noexcept {
 }
 
 static void CategoriesEditorCommand_init (CategoriesEditorCommand me, const char32 *name, Thing boss,
-        Command_Callback execute, Command_Callback undo, int /*nCategories*/, int nSelected) {
+        Command_Callback execute, Command_Callback undo, integer /*nCategories*/, integer nSelected) {
 
 	my nSelected = nSelected;
 	Command_init (me, name, boss, execute, undo);
 	my categories = Categories_create();
-	my selection = NUMvector<long> (1, nSelected);
+	my selection = NUMvector <integer> (1, nSelected);
 }
 
 #pragma mark Insert
@@ -392,7 +392,7 @@ static int CategoriesEditorRemove_execute (CategoriesEditorRemove me) {
 	CategoriesEditor editor = static_cast<CategoriesEditor> (my boss);
 	Categories categories = static_cast<Categories> (editor -> data);
 
-	for (long i = my nSelected; i >= 1; i--) {
+	for (integer i = my nSelected; i >= 1; i--) {
 		autoSimpleString item = Data_copy (categories->at [my selection [i]]);   // FIXME this copy can probably be replaced with a move
 		my categories -> addItemAtPosition_move (item.move(), 1);
 		categories -> removeItem (my selection [i]);
@@ -405,7 +405,7 @@ static int CategoriesEditorRemove_undo (CategoriesEditorRemove me) {
 	CategoriesEditor editor = (CategoriesEditor) my boss;
 	Categories categories = (Categories) editor -> data;
 
-	for (long i = 1; i <= my nSelected; i ++) {
+	for (integer i = 1; i <= my nSelected; i ++) {
 		autoSimpleString item = Data_copy (my categories->at [i]);
 		categories -> addItemAtPosition_move (item.move(), my selection [i]);
 	}
@@ -413,12 +413,12 @@ static int CategoriesEditorRemove_undo (CategoriesEditorRemove me) {
 	return 1;
 }
 
-static autoCategoriesEditorRemove CategoriesEditorRemove_create (Thing boss, long *posList, long posCount) {
+static autoCategoriesEditorRemove CategoriesEditorRemove_create (Thing boss, integer *posList, integer posCount) {
 	try {
 		autoCategoriesEditorRemove me = Thing_new (CategoriesEditorRemove);
 		CategoriesEditorCommand_init (me.get(), U"Remove", boss, CategoriesEditorRemove_execute,
 		                              CategoriesEditorRemove_undo, posCount, posCount);
-		for (long i = 1; i <= posCount; i ++) {
+		for (integer i = 1; i <= posCount; i ++) {
 			my selection [i] = posList [i];
 		}
 		return me;
@@ -438,7 +438,7 @@ static int CategoriesEditorReplace_execute (CategoriesEditorReplace me) {
 	CategoriesEditor editor = static_cast<CategoriesEditor> (my boss);
 	Categories categories = static_cast<Categories> (editor -> data);
 
-	for (long i = my nSelected; i >= 1; i --) {
+	for (integer i = my nSelected; i >= 1; i --) {
 		autoSimpleString str = Data_copy (my categories->at [1]);
 		my categories -> addItemAtPosition_move (autoSimpleString (categories->at [my selection [i]]), 2);   // YUCK
 		categories->at [my selection [i]] = str.releaseToAmbiguousOwner();
@@ -451,7 +451,7 @@ static int CategoriesEditorReplace_undo (CategoriesEditorReplace me) {
 	CategoriesEditor editor = static_cast<CategoriesEditor> (my boss);
 	Categories categories = static_cast<Categories> (editor -> data);
 
-	for (long i = 1; i <= my nSelected; i ++) {
+	for (integer i = 1; i <= my nSelected; i ++) {
 		autoSimpleString str = Data_copy (my categories->at [i + 1]);
 		categories -> replaceItem_move (str.move(), my selection [i]);
 	}
@@ -459,12 +459,12 @@ static int CategoriesEditorReplace_undo (CategoriesEditorReplace me) {
 	return 1;
 }
 
-static autoCategoriesEditorReplace CategoriesEditorReplace_create (Thing boss, autoSimpleString str, long *posList, long posCount) {
+static autoCategoriesEditorReplace CategoriesEditorReplace_create (Thing boss, autoSimpleString str, integer *posList, integer posCount) {
 	try {
 		autoCategoriesEditorReplace me = Thing_new (CategoriesEditorReplace);
 		CategoriesEditorCommand_init (me.get(), U"Replace", boss, CategoriesEditorReplace_execute,
 		                              CategoriesEditorReplace_undo, posCount + 1, posCount);
-		for (long i = 1; i <= posCount; i ++) {
+		for (integer i = 1; i <= posCount; i ++) {
 			my selection [i] = posList [i];
 		}
 		my categories -> addItem_move (str.move());
@@ -486,8 +486,8 @@ static int CategoriesEditorMoveUp_execute (CategoriesEditorMoveUp me) {
 	Categories categories = static_cast<Categories> (editor -> data);
 
 	Ordered_moveItems ((Ordered) categories, my selection, my nSelected, my newPos);   // FIXME cast
-	autoNUMvector<long> selection (1, my nSelected);
-	for (long i = 1; i <= my nSelected; i ++) {
+	autoNUMvector<integer> selection (1, my nSelected);
+	for (integer i = 1; i <= my nSelected; i ++) {
 		selection[i] = my newPos + i - 1;
 	}
 	update (editor, my newPos, my selection[my nSelected], selection.peek(), my nSelected);
@@ -498,19 +498,19 @@ static int CategoriesEditorMoveUp_undo (CategoriesEditorMoveUp me) {
 	CategoriesEditor editor = static_cast<CategoriesEditor> (my boss);
 	Categories categories = static_cast<Categories> (editor -> data);
 
-	for (long i = 1; i <= my nSelected; i ++) {
+	for (integer i = 1; i <= my nSelected; i ++) {
 		Ordered_moveItem ((Ordered) categories, my newPos, my selection [my nSelected]);   // FIXME cast
 	}
 	update (editor, my newPos, my selection[my nSelected], my selection, my nSelected);
 	return 1;
 }
 
-static autoCategoriesEditorMoveUp CategoriesEditorMoveUp_create (Thing boss, long *posList, long posCount, long newPos) {
+static autoCategoriesEditorMoveUp CategoriesEditorMoveUp_create (Thing boss, integer *posList, integer posCount, integer newPos) {
 
 	try {
 		autoCategoriesEditorMoveUp me = Thing_new (CategoriesEditorMoveUp);
 		CategoriesEditorCommand_init (me.get(), U"Move up", boss, CategoriesEditorMoveUp_execute, CategoriesEditorMoveUp_undo, 0, posCount);
-		for (long i = 1; i <= posCount; i ++) {
+		for (integer i = 1; i <= posCount; i ++) {
 			my selection [i] = posList [i];
 		}
 		my newPos = newPos;
@@ -532,8 +532,8 @@ static int CategoriesEditorMoveDown_execute (CategoriesEditorMoveDown me) {
 	Categories categories = static_cast<Categories> (editor -> data);
 
 	Ordered_moveItems ((Ordered) categories, my selection, my nSelected, my newPos);   // FIXME cast
-	autoNUMvector<long> selection (1, my nSelected);
-	for (long i = 1; i <= my nSelected; i++) {
+	autoNUMvector<integer> selection (1, my nSelected);
+	for (integer i = 1; i <= my nSelected; i++) {
 		selection[i] = my newPos - my nSelected + i;
 	}
 	update (editor, my selection[1], my newPos, selection.peek(), my nSelected);
@@ -544,20 +544,20 @@ static int CategoriesEditorMoveDown_undo (CategoriesEditorMoveDown me) {
 	CategoriesEditor editor = static_cast<CategoriesEditor> (my boss);
 	Categories categories = static_cast<Categories> (editor -> data);
 
-	for (long i = 1; i <= my nSelected; i ++) {
+	for (integer i = 1; i <= my nSelected; i ++) {
 		Ordered_moveItem ((Ordered) categories, my newPos, my selection [1]); // TODO 1 or i ??     // FIXME cast
 	}
-	long from = my selection[1];
+	integer from = my selection[1];
 	update (editor, ( from > 1 ? from -- : from ), my newPos, my selection, my nSelected);
 	return 1;
 }
 
-static autoCategoriesEditorMoveDown CategoriesEditorMoveDown_create (Thing boss, long *posList,
-        long posCount, long newPos) {
+static autoCategoriesEditorMoveDown CategoriesEditorMoveDown_create (Thing boss, integer *posList,
+        integer posCount, integer newPos) {
 	try {
 		autoCategoriesEditorMoveDown me = Thing_new (CategoriesEditorMoveDown);
 		CategoriesEditorCommand_init (me.get(), U"Move down", boss, CategoriesEditorMoveDown_execute, CategoriesEditorMoveDown_undo, 0, posCount);
-		for (long i = 1; i <= posCount; i++) {
+		for (integer i = 1; i <= posCount; i++) {
 			my selection[i] = posList[i];
 		}
 		my newPos = newPos;
@@ -570,8 +570,8 @@ static autoCategoriesEditorMoveDown CategoriesEditorMoveDown_create (Thing boss,
 #pragma mark - Callbacks
 
 static void gui_button_cb_remove (CategoriesEditor me, GuiButtonEvent /* event */) {
-	long posCount;
-	autoNUMvector<long> posList (GuiList_getSelectedPositions (my list, & posCount), 1);
+	integer posCount;
+	autoNUMvector <integer> posList (GuiList_getSelectedPositions (my list, & posCount), 1);
 	if (posList.peek()) {
 		autoCategoriesEditorRemove command = CategoriesEditorRemove_create (me, posList.peek(), posCount);
 		if (! Command_do (command.get())) {
@@ -608,8 +608,8 @@ static void gui_button_cb_insertAtEnd (CategoriesEditor me, GuiButtonEvent /* ev
 }
 
 static void gui_button_cb_replace (CategoriesEditor me, GuiButtonEvent /* event */) {
-	long posCount;
-	autoNUMvector<long> posList (GuiList_getSelectedPositions (my list, & posCount), 1);
+	integer posCount;
+	autoNUMvector <integer> posList (GuiList_getSelectedPositions (my list, & posCount), 1);
 	if (posCount > 0) {
 		autostring32 text = GuiText_getString (my text);
 		if (str32len (text.peek()) != 0) {
@@ -626,8 +626,8 @@ static void gui_button_cb_replace (CategoriesEditor me, GuiButtonEvent /* event
 
 /* Precondition: contiguous selection */
 static void gui_button_cb_moveUp (CategoriesEditor me, GuiButtonEvent /* event */) {
-	long posCount;
-	autoNUMvector<long> posList (GuiList_getSelectedPositions (my list, & posCount), 1);
+	integer posCount;
+	autoNUMvector <integer> posList (GuiList_getSelectedPositions (my list, & posCount), 1);
 	if (posCount > 0) {
 		autoCategoriesEditorMoveUp command = CategoriesEditorMoveUp_create (me, posList.peek(), posCount, posList[1] - 1);
 		Command_do (command.get());
@@ -640,8 +640,8 @@ static void gui_button_cb_moveUp (CategoriesEditor me, GuiButtonEvent /* event *
 
 /* Precondition: contiguous selection */
 static void gui_button_cb_moveDown (CategoriesEditor me, GuiButtonEvent /* event */) {
-	long posCount;
-	autoNUMvector<long> posList (GuiList_getSelectedPositions (my list, & posCount), 1);
+	integer posCount;
+	autoNUMvector <integer> posList (GuiList_getSelectedPositions (my list, & posCount), 1);
 	if (posCount > 0) {
 		autoCategoriesEditorMoveDown command = CategoriesEditorMoveDown_create (me, posList.peek(), posCount, posList[posCount] + 1);
 		Command_do (command.get());
@@ -661,8 +661,8 @@ static void gui_list_cb_doubleClick (CategoriesEditor me, GuiList_DoubleClickEve
 
 	//  `my position` should just have been updated by the selectionChanged callback.
 
-	long posCount;
-	autoNUMvector<long> posList (GuiList_getSelectedPositions (my list, & posCount), 1);
+	integer posCount;
+	autoNUMvector <integer> posList (GuiList_getSelectedPositions (my list, & posCount), 1);
 	if (posCount == 1   // often or even usually true when double-clicking?
 	    && posList [1] == my position)   // should be true, but we don't crash if it's false
 	{
diff --git a/dwtools/Configuration_def.h b/dwtools/Configuration_def.h
index 8da8a71..22cc8ba 100644
--- a/dwtools/Configuration_def.h
+++ b/dwtools/Configuration_def.h
@@ -20,7 +20,7 @@
 #define ooSTRUCT Configuration
 oo_DEFINE_CLASS (Configuration, TableOfReal)
 
-	oo_LONG (metric)
+	oo_INTEGER (metric)
 	oo_DOUBLE_VECTOR (w, numberOfColumns)
 
 	#if oo_DECLARING
diff --git a/dwtools/Confusion.cpp b/dwtools/Confusion.cpp
index 98ed521..c8e53dc 100644
--- a/dwtools/Confusion.cpp
+++ b/dwtools/Confusion.cpp
@@ -426,7 +426,7 @@ static void create_index (char32 **s, long sb, long se, char32 **ref, long rb, l
 autoConfusion Confusion_condense (Confusion me, const char32 *search, const char32 *replace,
 	long maximumNumberOfReplaces, int use_regexp) {
 	try {
-		long nmatches, nstringmatches;
+		integer nmatches, nstringmatches;
 
 		if (my rowLabels == 0 || my columnLabels == 0) {
 			Melder_throw (U"No row or column labels.");
diff --git a/dwtools/DTW_def.h b/dwtools/DTW_def.h
index 4414ce9..a4024a0 100644
--- a/dwtools/DTW_def.h
+++ b/dwtools/DTW_def.h
@@ -24,16 +24,16 @@
 
 #define ooSTRUCT DTW_Path
 oo_DEFINE_STRUCT (DTW_Path)
-	oo_LONG (x)
-	oo_LONG (y)
+	oo_INTEGER (x)
+	oo_INTEGER (y)
 oo_END_STRUCT (DTW_Path) 
 #undef ooSTRUCT
 
 #define ooSTRUCT DTW_Path_Query
 oo_DEFINE_STRUCT (DTW_Path_Query)
-	oo_LONG (nx)
-	oo_LONG (ny)
-	oo_LONG (nxy)
+	oo_INTEGER (nx)
+	oo_INTEGER (ny)
+	oo_INTEGER (nxy)
 	oo_AUTO_OBJECT (RealTier, 0, yfromx)
 	oo_AUTO_OBJECT (RealTier, 0, xfromy)
 oo_END_STRUCT (DTW_Path_Query) 
@@ -42,7 +42,7 @@ oo_END_STRUCT (DTW_Path_Query)
 #define ooSTRUCT DTW
 oo_DEFINE_CLASS (DTW, Matrix)
 	oo_DOUBLE (weightedDistance)
-	oo_LONG (pathLength)
+	oo_INTEGER (pathLength)
 	oo_STRUCT_VECTOR (DTW_Path, path, pathLength)
 	#if ! oo_READING && ! oo_WRITING
 		oo_DOUBLE (wx)
diff --git a/dwtools/DataModeler.cpp b/dwtools/DataModeler.cpp
index cc36ef9..6ef5852 100644
--- a/dwtools/DataModeler.cpp
+++ b/dwtools/DataModeler.cpp
@@ -527,7 +527,7 @@ static void DataModeler_drawBasisFunction_inside (DataModeler me, Graphics g, do
 	}
 }
 
-static long DataModeler_drawingSpecifiers_x (DataModeler me, double *xmin, double *xmax, long *ixmin, long *ixmax) {
+static integer DataModeler_drawingSpecifiers_x (DataModeler me, double *xmin, double *xmax, integer *ixmin, integer *ixmax) {
 	if (*xmax <= *xmin) {
 		*xmin = my xmin; *xmax = my xmax;
 	}
@@ -546,8 +546,8 @@ static long DataModeler_drawingSpecifiers_x (DataModeler me, double *xmin, doubl
 }
 
 void DataModeler_drawOutliersMarked_inside (DataModeler me, Graphics g, double xmin, double xmax, double ymin, double ymax, double numberOfSigmas, int useSigmaY, char32 *mark, int marksFontSize, double horizontalOffset_mm) {
-	long ixmin, ixmax;
-	if (DataModeler_drawingSpecifiers_x (me, &xmin, &xmax, &ixmin, &ixmax) < 1) return;
+	integer ixmin, ixmax;
+	if (DataModeler_drawingSpecifiers_x (me, & xmin, & xmax, & ixmin, & ixmax) < 1) return;
 	autoNUMvector<double> zscores (1, my numberOfDataPoints);
 	DataModeler_getZScores (me, useSigmaY, zscores.peek());
 	double horizontalOffset_wc = Graphics_dxMMtoWC (g, horizontalOffset_mm);
@@ -556,9 +556,9 @@ void DataModeler_drawOutliersMarked_inside (DataModeler me, Graphics g, double x
 	Graphics_setFontSize (g, marksFontSize);
 	Graphics_setTextAlignment (g, Graphics_CENTRE, Graphics_HALF);
 	int currentFontSize = Graphics_inqFontSize (g);
-	for (long idata = 1; idata <= my numberOfDataPoints; idata++) {
-		if (my dataPointStatus[idata] != DataModeler_DATA_INVALID) {
-			double x = my x[idata], y = my y[idata];
+	for (long idata = 1; idata <= my numberOfDataPoints; idata ++) {
+		if (my dataPointStatus [idata] != DataModeler_DATA_INVALID) {
+			double x = my x [idata], y = my y [idata];
 			if (x >= xmin && x <= xmax && y >= ymin && y <= ymax) {
 				if (fabs (zscores[idata]) > numberOfSigmas) {
 					Graphics_text (g, x + horizontalOffset_wc, y, mark);
@@ -1001,13 +1001,12 @@ double DataModeler_getResidualSumOfSquares (DataModeler me, long *numberOfDataPo
 }
 
 void DataModeler_reportChiSquared (DataModeler me, int weighDataType) {
-	int useSigmaY = weighDataType - 1;
 	MelderInfo_writeLine (U"Chi squared test:");
-	MelderInfo_writeLine (useSigmaY == DataModeler_DATA_WEIGH_EQUAL ? U"Standard deviation is estimated from the data." :
-		useSigmaY == DataModeler_DATA_WEIGH_SIGMA ? U"Sigmas are used as estimate for local standard deviations." : 
-		useSigmaY == DataModeler_DATA_WEIGH_RELATIVE ? U"1/Q's are used as estimate for local standard deviations." :
+	MelderInfo_writeLine (weighDataType == DataModeler_DATA_WEIGH_EQUAL ? U"Standard deviation is estimated from the data." :
+		weighDataType == DataModeler_DATA_WEIGH_SIGMA ? U"Sigmas are used as estimate for local standard deviations." :
+		weighDataType == DataModeler_DATA_WEIGH_RELATIVE ? U"1/Q's are used as estimate for local standard deviations." :
 		U"Sqrt sigmas are used as estimate for local standard deviations.");
-	double ndf, probability, chisq = DataModeler_getChiSquaredQ (me, useSigmaY, &probability, &ndf);
+	double ndf, probability, chisq = DataModeler_getChiSquaredQ (me, weighDataType, &probability, &ndf);
 	MelderInfo_writeLine (U"Chi squared = ", chisq);
 	MelderInfo_writeLine (U"Probability = ", probability);
 	MelderInfo_writeLine (U"Number of degrees of freedom = ", ndf);	
@@ -1166,7 +1165,7 @@ void FormantModeler_drawBasisFunction (FormantModeler me, Graphics g, double tmi
 	}
 }
 
-static long FormantModeler_drawingSpecifiers_x (FormantModeler me, double *xmin, double *xmax, long *ixmin, long *ixmax) {
+static integer FormantModeler_drawingSpecifiers_x (FormantModeler me, double *xmin, double *xmax, integer *ixmin, integer *ixmax) {
 	Melder_assert (my trackmodelers.size > 0);
 	DataModeler fm = my trackmodelers.at [1];
 	return DataModeler_drawingSpecifiers_x (fm, xmin, xmax, ixmin, ixmax);
@@ -1247,8 +1246,8 @@ void FormantModeler_drawVariancesOfShiftedTracks (FormantModeler me, Graphics g,
 	double ymin, double ymax, int shiftDirection, long fromFormant, long toFormant, bool garnish)
 {
 	try {
-		long ixmin, ixmax;
-		if (FormantModeler_drawingSpecifiers_x (me, &xmin, &xmax, &ixmin, &ixmax) < 1) {
+		integer ixmin, ixmax;
+		if (FormantModeler_drawingSpecifiers_x (me, & xmin, & xmax, & ixmin, & ixmax) < 1) {
 			Melder_throw (me, U" not enough data points in drawing range.");
 		}
 		long numberOfDataPoints = FormantModeler_getNumberOfDataPoints (me);
@@ -1290,10 +1289,9 @@ void FormantModeler_drawVariancesOfShiftedTracks (FormantModeler me, Graphics g,
 	}
 }
 
-
 void FormantModeler_drawCumulativeChiScores (FormantModeler me, Graphics g, double xmin, double xmax, double ymin, double ymax, int useSigmaY, int garnish) {
 	try {
-		long ixmin, ixmax;
+		integer ixmin, ixmax;
 		if (FormantModeler_drawingSpecifiers_x (me, & xmin, & xmax, & ixmin, & ixmax) < 1) {
 			Melder_throw (me, U" not enough data points in drawing range.");
 		}
@@ -1892,24 +1890,22 @@ double FormantModeler_getFormantsConstraintsFactor (FormantModeler me, double mi
 	return minF1Factor * maxF1Factor * minF2Factor * maxF2Factor * minF3Factor;
 }
 
-
 void FormantModeler_reportChiSquared (FormantModeler me, int weighDataType) {
 	long numberOfFormants = my trackmodelers.size;
-	int useSigmaY = weighDataType - 1;
 	double chisq = 0, ndf = 0, probability;
 	MelderInfo_writeLine (U"Chi squared tests for individual models of each of ", numberOfFormants, U" formant track:");
-	MelderInfo_writeLine (useSigmaY == DataModeler_DATA_WEIGH_EQUAL ? U"Standard deviation is estimated from the data." :
-		useSigmaY == DataModeler_DATA_WEIGH_SIGMA ? U"\tBandwidths are used as estimate for local standard deviations." : 
-		useSigmaY == DataModeler_DATA_WEIGH_RELATIVE ? U"\t1/Q's are used as estimate for local standard deviations." :
+	MelderInfo_writeLine (weighDataType == DataModeler_DATA_WEIGH_EQUAL ? U"Standard deviation is estimated from the data." :
+		weighDataType == DataModeler_DATA_WEIGH_SIGMA ? U"\tBandwidths are used as estimate for local standard deviations." :
+		weighDataType == DataModeler_DATA_WEIGH_RELATIVE ? U"\t1/Q's are used as estimate for local standard deviations." :
 		U"\tSqrt bandwidths are used as estimate for local standard deviations.");
 	for (long iformant = 1; iformant <= numberOfFormants; iformant ++) {
-		chisq = FormantModeler_getChiSquaredQ (me, iformant, iformant, useSigmaY, &probability, &ndf);
+		chisq = FormantModeler_getChiSquaredQ (me, iformant, iformant, weighDataType, & probability, & ndf);
 		MelderInfo_writeLine (U"Formant track ", iformant, U":");
 		MelderInfo_writeLine (U"\tChi squared (F", iformant, U") = ", chisq);
 		MelderInfo_writeLine (U"\tProbability (F", iformant, U") = ", probability);
 		MelderInfo_writeLine (U"\tNumber of degrees of freedom (F", iformant, U") = ", ndf);
 	}
-	chisq = FormantModeler_getChiSquaredQ (me, 1, numberOfFormants, useSigmaY, & probability, & ndf);
+	chisq = FormantModeler_getChiSquaredQ (me, 1, numberOfFormants, weighDataType, & probability, & ndf);
 	MelderInfo_writeLine (U"Chi squared test for the complete model with ", numberOfFormants, U" formants:");
 	MelderInfo_writeLine (U"\tChi squared = ", chisq);
 	MelderInfo_writeLine (U"\tProbability = ", probability);
diff --git a/dwtools/DataModeler_def.h b/dwtools/DataModeler_def.h
index b7a66cc..6a7d0f6 100644
--- a/dwtools/DataModeler_def.h
+++ b/dwtools/DataModeler_def.h
@@ -21,8 +21,8 @@
 oo_DEFINE_CLASS (DataModeler, Function)
 
 	oo_INT (type)	// polynomial, legendre ...
-	oo_LONG (numberOfDataPoints)
-	oo_LONG (numberOfParameters)
+	oo_INTEGER (numberOfDataPoints)
+	oo_INTEGER (numberOfParameters)
 	oo_DOUBLE_VECTOR (x, numberOfDataPoints)
 	oo_DOUBLE_VECTOR (y, numberOfDataPoints)
 	oo_DOUBLE_VECTOR (sigmaY, numberOfDataPoints)
diff --git a/dwtools/Discriminant_def.h b/dwtools/Discriminant_def.h
index 8e2161a..133bccf 100644
--- a/dwtools/Discriminant_def.h
+++ b/dwtools/Discriminant_def.h
@@ -26,14 +26,14 @@ oo_DEFINE_CLASS (Discriminant, Daata)
 	#if oo_READING
 		if (formatVersion < 1) {
 			eigen = Thing_new (Eigen);
-			oo_LONG (eigen -> numberOfEigenvalues)
-			oo_LONG (eigen -> dimension)
+			oo_INTEGER (eigen -> numberOfEigenvalues)
+			oo_INTEGER (eigen -> dimension)
 			oo_DOUBLE_VECTOR (eigen -> eigenvalues, eigen -> numberOfEigenvalues)
 			oo_DOUBLE_MATRIX (eigen -> eigenvectors, eigen -> numberOfEigenvalues, eigen -> dimension)
 		}
 	#endif
 	
-	oo_LONG (numberOfGroups)
+	oo_INTEGER (numberOfGroups)
 	oo_AUTO_OBJECT (SSCPList, 0, groups)
 	oo_AUTO_OBJECT (SSCP, 0, total)
 	oo_DOUBLE_VECTOR (aprioriProbabilities, numberOfGroups)
diff --git a/dwtools/EEG_extensions.cpp b/dwtools/EEG_extensions.cpp
index 5991ed5..fac1b7b 100644
--- a/dwtools/EEG_extensions.cpp
+++ b/dwtools/EEG_extensions.cpp
@@ -1,6 +1,6 @@
 /* EEG_extensions.cpp
  *
- * Copyright (C) 2012-2017 David Weenink, 2015 Paul Boersma
+ * Copyright (C) 2012-2017 David Weenink, 2015,2017 Paul Boersma
  *
  * This code 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 @@ static autoEEG EEG_copyWithoutSound (EEG me) {
 		thy numberOfChannels = my numberOfChannels;
 		thy textgrid = Data_copy (my textgrid.get());
 		autostring32vector channelNames (1, my numberOfChannels);
-		for (long i = 1; i <= my numberOfChannels; i++) {
+		for (integer i = 1; i <= my numberOfChannels; i++) {
 			channelNames[i] = Melder_dup (my channelNames[i]);
 		}
 		thy channelNames = channelNames.transfer();
@@ -42,11 +42,11 @@ static autoEEG EEG_copyWithoutSound (EEG me) {
 	}
 }
 
-static long *EEG_channelNames_to_channelNumbers (EEG me, char32 **channelNames, long numberOfChannelNames) {
+static integer *EEG_channelNames_to_channelNumbers (EEG me, char32 **channelNames, integer numberOfChannelNames) {
 	try {
-		autoNUMvector<long> channelNumbers (1, numberOfChannelNames);
-		for (long i = 1; i <= numberOfChannelNames; i++) {
-			for (long j = 1; j <= my numberOfChannels; j++) {
+		autoNUMvector<integer> channelNumbers (1, numberOfChannelNames);
+		for (integer i = 1; i <= numberOfChannelNames; i++) {
+			for (integer j = 1; j <= my numberOfChannels; j++) {
 				if (Melder_equ (channelNames[i], my channelNames[j])) {
 					channelNumbers[i] = j;
 				}
@@ -61,22 +61,22 @@ static long *EEG_channelNames_to_channelNumbers (EEG me, char32 **channelNames,
 	}
 }
 
-static void EEG_setChannelNames_selected (EEG me, const char32 *precursor, long *channelNumbers, long numberOfChannels) {
+static void EEG_setChannelNames_selected (EEG me, const char32 *precursor, integer *channelNumbers, integer numberOfChannels) {
 	autoMelderString name;
 	const char32 *zero = U"0";
-	for (long i = 1; i <= numberOfChannels; i++) {
+	for (integer i = 1; i <= numberOfChannels; i ++) {
 		MelderString_copy (&name, precursor);
 		if (my numberOfChannels > 100) {
 			if (i < 10) {
-				MelderString_append (&name, zero);
+				MelderString_append (& name, zero);
 			}
 			if (i < 100) {
-				MelderString_append (&name, zero);
+				MelderString_append (& name, zero);
 			}
 		} else if (i < 10) {
-			MelderString_append (&name, zero);
+			MelderString_append (& name, zero);
 		}
-		MelderString_append (&name, i);
+		MelderString_append (& name, i);
 		EEG_setChannelName (me, channelNumbers[i], name.string);
 	}
 }
@@ -96,13 +96,13 @@ autoCrossCorrelationTable EEG_to_CrossCorrelationTable (EEG me, double startTime
 			endTime = my xmax;
 		}
 		autoEEG thee = EEG_extractPart (me, startTime, endTime, true);
-		long numberOfChannels;
-		autoNUMvector <long> channels (NUMstring_getElementsOfRanges (channelRanges, thy numberOfChannels, & numberOfChannels, nullptr, U"channel", true), 1);
+		integer numberOfChannels;
+		autoNUMvector <integer> channels (NUMstring_getElementsOfRanges (channelRanges, thy numberOfChannels, & numberOfChannels, nullptr, U"channel", true), 1);
 		autoSound soundPart = Sound_copyChannelRanges (thy sound.get(), channelRanges);
 		autoCrossCorrelationTable him = Sound_to_CrossCorrelationTable (soundPart.get(), startTime, endTime, lagStep);
 		// assign channel names
-		for (long i = 1; i <= numberOfChannels; i++) {
-			long ichannel = channels[i];
+		for (integer i = 1; i <= numberOfChannels; i++) {
+			integer ichannel = channels[i];
 			char32 *label = my channelNames[ichannel];
 			TableOfReal_setRowLabel (him.get(), i, label);
 			TableOfReal_setColumnLabel (him.get(), i, label);
@@ -126,7 +126,7 @@ autoCovariance EEG_to_Covariance (EEG me, double startTime, double endTime, cons
 	}
 }
 
-autoCrossCorrelationTableList EEG_to_CrossCorrelationTableList (EEG me, double startTime, double endTime, double lagStep, long ncovars, const char32 *channelRanges) {
+autoCrossCorrelationTableList EEG_to_CrossCorrelationTableList (EEG me, double startTime, double endTime, double lagStep, integer ncovars, const char32 *channelRanges) {
 	try {
 		// autowindow
 		if (startTime == endTime) {
@@ -140,8 +140,8 @@ autoCrossCorrelationTableList EEG_to_CrossCorrelationTableList (EEG me, double s
 			endTime = my xmax;
 		}
 		autoEEG thee = EEG_extractPart (me, startTime, endTime, true);
-		long numberOfChannels;
-		autoNUMvector <long> channels (NUMstring_getElementsOfRanges (channelRanges, thy numberOfChannels, & numberOfChannels, nullptr, U"channel", true), 1);
+		integer numberOfChannels;
+		autoNUMvector <integer> channels (NUMstring_getElementsOfRanges (channelRanges, thy numberOfChannels, & numberOfChannels, nullptr, U"channel", true), 1);
 		autoSound soundPart = Sound_copyChannelRanges (thy sound.get(), channelRanges);
 		autoCrossCorrelationTableList him = Sound_to_CrossCorrelationTableList (soundPart.get(), startTime, endTime, lagStep, ncovars);
 		return him;
@@ -166,19 +166,19 @@ autoPCA EEG_to_PCA (EEG me, double startTime, double endTime, const char32 *chan
 	}
 }
 
-autoEEG EEG_and_PCA_to_EEG_whiten (EEG me, PCA thee, long numberOfComponents) {
+autoEEG EEG_and_PCA_to_EEG_whiten (EEG me, PCA thee, integer numberOfComponents) {
 	try {
 		if (numberOfComponents <= 0 || numberOfComponents > thy numberOfEigenvalues) {
 			numberOfComponents = thy numberOfEigenvalues;
 		}
 		numberOfComponents = ( numberOfComponents > my numberOfChannels ? my numberOfChannels : numberOfComponents );
 
-		autoNUMvector<long> channelNumbers (EEG_channelNames_to_channelNumbers (me, thy labels, thy dimension), 1);
+		autoNUMvector <integer> channelNumbers (EEG_channelNames_to_channelNumbers (me, thy labels, thy dimension), 1);
 
 		autoEEG him = Data_copy (me);
 		autoSound white = Sound_and_PCA_whitenSelectedChannels (my sound.get(), thee, numberOfComponents, channelNumbers.peek(), thy dimension);
-		for (long i = 1; i <= thy dimension; i++) {
-			long ichannel = channelNumbers[i];
+		for (integer i = 1; i <= thy dimension; i++) {
+			integer ichannel = channelNumbers[i];
 			NUMvector_copyElements<double> (white -> z[i], his sound -> z[ichannel], 1, his sound -> nx);
 		}
 		EEG_setChannelNames_selected (him.get(), U"wh", channelNumbers.peek(), thy dimension);
@@ -188,18 +188,18 @@ autoEEG EEG_and_PCA_to_EEG_whiten (EEG me, PCA thee, long numberOfComponents) {
 	}
 }
 
-autoEEG EEG_and_PCA_to_EEG_principalComponents (EEG me, PCA thee, long numberOfComponents) {
+autoEEG EEG_and_PCA_to_EEG_principalComponents (EEG me, PCA thee, integer numberOfComponents) {
 	try {
 		if (numberOfComponents <= 0 || numberOfComponents > thy numberOfEigenvalues) {
 			numberOfComponents = thy numberOfEigenvalues;
 		}
 		numberOfComponents = numberOfComponents > my numberOfChannels ? my numberOfChannels : numberOfComponents;
 
-		autoNUMvector<long> channelNumbers (EEG_channelNames_to_channelNumbers (me, thy labels, thy dimension), 1);
+		autoNUMvector <integer> channelNumbers (EEG_channelNames_to_channelNumbers (me, thy labels, thy dimension), 1);
 		autoEEG him = Data_copy (me);
 		autoSound pc = Sound_and_PCA_to_Sound_pc_selectedChannels (my sound.get(), thee, numberOfComponents, channelNumbers.peek(), thy dimension);
-		for (long i = 1; i <= thy dimension; i ++) {
-			long ichannel = channelNumbers[i];
+		for (integer i = 1; i <= thy dimension; i ++) {
+			integer ichannel = channelNumbers[i];
 			NUMvector_copyElements<double> (pc -> z[i], his sound -> z[ichannel], 1, his sound -> nx);
 		}
 		EEG_setChannelNames_selected (him.get(), U"pc", channelNumbers.peek(), thy dimension);
@@ -209,7 +209,7 @@ autoEEG EEG_and_PCA_to_EEG_principalComponents (EEG me, PCA thee, long numberOfC
 	}
 }
 
-autoEEG EEG_to_EEG_bss (EEG me, double startTime, double endTime, long ncovars, double lagStep, const char32 *channelRanges, int whiteningMethod, int diagonalizerMethod, long maxNumberOfIterations, double tol) {
+autoEEG EEG_to_EEG_bss (EEG me, double startTime, double endTime, integer ncovars, double lagStep, const char32 *channelRanges, int whiteningMethod, int diagonalizerMethod, integer maxNumberOfIterations, double tol) {
 	try {
 		// autowindow
 		if (startTime == endTime) {
@@ -222,8 +222,8 @@ autoEEG EEG_to_EEG_bss (EEG me, double startTime, double endTime, long ncovars,
 		if (endTime > my xmax) {
 			endTime = my xmax;
 		}
-		long numberOfChannels;
-		autoNUMvector <long> channelNumbers (NUMstring_getElementsOfRanges (channelRanges, my numberOfChannels, & numberOfChannels, nullptr, U"channel", true), 1);
+		integer numberOfChannels;
+		autoNUMvector <integer> channelNumbers (NUMstring_getElementsOfRanges (channelRanges, my numberOfChannels, & numberOfChannels, nullptr, U"channel", true), 1);
 		autoEEG thee = EEG_extractPart (me, startTime, endTime, true);
 		if (whiteningMethod != 0) {
 			bool fromCorrelation = ( whiteningMethod == 2 );
@@ -249,22 +249,22 @@ autoEEG EEG_to_EEG_bss (EEG me, double startTime, double endTime, long ncovars,
 
 autoSound EEG_to_Sound_modulated (EEG me, double baseFrequency, double channelBandwidth, const char32 *channelRanges) {
 	try {
-		long numberOfChannels;
-		autoNUMvector <long> channelNumbers (NUMstring_getElementsOfRanges (channelRanges, my numberOfChannels, & numberOfChannels, nullptr, U"channel", true), 1);
+		integer numberOfChannels;
+		autoNUMvector <integer> channelNumbers (NUMstring_getElementsOfRanges (channelRanges, my numberOfChannels, & numberOfChannels, nullptr, U"channel", true), 1);
 		double maxFreq = baseFrequency + my numberOfChannels * channelBandwidth;
 		double samplingFrequency = 2 * maxFreq;
 		samplingFrequency = samplingFrequency < 44100 ? 44100 : samplingFrequency;
 		autoSound thee = Sound_createSimple (1, my xmax - my xmin, samplingFrequency);
-		for (long i = 1; i <= numberOfChannels; i++) {
-			long ichannel = channelNumbers[i];
+		for (integer i = 1; i <= numberOfChannels; i++) {
+			integer ichannel = channelNumbers[i];
 			double fbase = baseFrequency;// + (ichannel - 1) * channelBandwidth;
 			autoSound si = Sound_extractChannel (my sound.get(), ichannel);
 			autoSpectrum spi = Sound_to_Spectrum (si.get(), 1);
 			Spectrum_passHannBand (spi.get(), 0.5, channelBandwidth - 0.5, 0.5);
 			autoSpectrum spi_shifted = Spectrum_shiftFrequencies (spi.get(), fbase, samplingFrequency / 2.0, 30);
 			autoSound resampled = Spectrum_to_Sound (spi_shifted.get());
-			long nx = resampled -> nx < thy nx ? resampled -> nx : thy nx;
-			for (long j = 1; j <= nx; j++) {
+			integer nx = resampled -> nx < thy nx ? resampled -> nx : thy nx;
+			for (integer j = 1; j <= nx; j++) {
 				thy z[1][j] += resampled -> z[1][j];
 			}
 		}
@@ -275,7 +275,7 @@ autoSound EEG_to_Sound_modulated (EEG me, double baseFrequency, double channelBa
 	}
 }
 
-autoSound EEG_to_Sound_frequencyShifted (EEG me, long channel, double frequencyShift, double samplingFrequency, double maxAmp) {
+autoSound EEG_to_Sound_frequencyShifted (EEG me, integer channel, double frequencyShift, double samplingFrequency, double maxAmp) {
 	try {
 		autoSound si = Sound_extractChannel (my sound.get(), channel);
 		autoSpectrum spi = Sound_to_Spectrum (si.get(), 1);
diff --git a/dwtools/EEG_extensions.h b/dwtools/EEG_extensions.h
index c75f1e5..6c257dd 100644
--- a/dwtools/EEG_extensions.h
+++ b/dwtools/EEG_extensions.h
@@ -25,17 +25,17 @@ autoCrossCorrelationTable EEG_to_CrossCorrelationTable (EEG me, double startTime
 
 autoCovariance EEG_to_Covariance (EEG me, double startTime, double endTime, const char32 *channelRanges);
 
-autoCrossCorrelationTableList EEG_to_CrossCorrelationTableList (EEG me, double startTime, double endTime, double lagTime, long ncovars, const char32 *channelRanges);
+autoCrossCorrelationTableList EEG_to_CrossCorrelationTableList (EEG me, double startTime, double endTime, double lagTime, integer ncovars, const char32 *channelRanges);
 
 autoPCA EEG_to_PCA (EEG me, double startTime, double endTime, const char32 *channelRanges, int fromCorrelation);
 
-autoEEG EEG_and_PCA_to_EEG_whiten (EEG me, PCA thee, long numberOfComponents);
+autoEEG EEG_and_PCA_to_EEG_whiten (EEG me, PCA thee, integer numberOfComponents);
 
-autoEEG EEG_and_PCA_to_EEG_principalComponents (EEG me, PCA thee, long numberOfComponents);
+autoEEG EEG_and_PCA_to_EEG_principalComponents (EEG me, PCA thee, integer numberOfComponents);
 
-autoEEG EEG_to_EEG_bss (EEG me, double startTime, double endTime, long ncovars, double lagTime, const char32 *channelRanges, int whiteningMethod, int diagonalizerMethod, long maxNumberOfIterations, double tol);
+autoEEG EEG_to_EEG_bss (EEG me, double startTime, double endTime, integer ncovars, double lagTime, const char32 *channelRanges, int whiteningMethod, int diagonalizerMethod, integer maxNumberOfIterations, double tol);
 
-autoSound EEG_to_Sound_frequencyShifted (EEG me, long channel, double frequencyShift, double samplingFrequency, double maxAmp);
+autoSound EEG_to_Sound_frequencyShifted (EEG me, integer channel, double frequencyShift, double samplingFrequency, double maxAmp);
 
 autoSound EEG_to_Sound_modulated (EEG me, double baseFrequency, double channelBandWidth, const char32 *channelRanges);
 
diff --git a/dwtools/EditDistanceTable_def.h b/dwtools/EditDistanceTable_def.h
index e3005c3..0e20468 100644
--- a/dwtools/EditDistanceTable_def.h
+++ b/dwtools/EditDistanceTable_def.h
@@ -22,15 +22,15 @@
 
 #define ooSTRUCT PairOfInteger
 oo_DEFINE_STRUCT (PairOfInteger)
-	oo_LONG (x)
-	oo_LONG (y)
+	oo_INTEGER (x)
+	oo_INTEGER (y)
 oo_END_STRUCT (PairOfInteger)
 #undef ooSTRUCT
 
 #define ooSTRUCT WarpingPath
 oo_DEFINE_CLASS (WarpingPath, Daata)
-	oo_LONG (_capacity)
-	oo_LONG (pathLength)
+	oo_INTEGER (_capacity)
+	oo_INTEGER (pathLength)
 	oo_STRUCT_VECTOR (PairOfInteger, path, pathLength)
 oo_END_CLASS (WarpingPath)
 #undef ooSTRUCT
diff --git a/dwtools/Eigen_and_Matrix.cpp b/dwtools/Eigen_and_Matrix.cpp
index dea02bd..6187e11 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, 2015-2016 David Weenink, 2015 Paul Boersma
+ * Copyright (C) 1993-2011, 2015-2016 David Weenink, 2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@
 #include "NUM2.h"
 
 
-autoMatrix Eigen_extractEigenvector (Eigen me, long index, long numberOfRows, long numberOfColumns) {
+autoMatrix Eigen_extractEigenvector (Eigen me, integer index, integer numberOfRows, integer numberOfColumns) {
 	try {
 		if (numberOfRows == 0 && numberOfColumns == 0) {
 			numberOfRows = 1; numberOfColumns = my dimension;
@@ -37,9 +37,9 @@ autoMatrix Eigen_extractEigenvector (Eigen me, long index, long numberOfRows, lo
 			numberOfColumns = lround (ceil ((double) my dimension / numberOfRows));
 		}
 		autoMatrix thee = Matrix_createSimple (numberOfRows, numberOfColumns);
-		long i = 1;
-		for (long irow = 1; irow <= numberOfRows; irow++) {
-			for (long icol = 1; icol <= numberOfColumns; icol++) {
+		integer i = 1;
+		for (integer irow = 1; irow <= numberOfRows; irow++) {
+			for (integer icol = 1; icol <= numberOfColumns; icol++) {
 				thy z [irow] [icol] = i <= my dimension ? my eigenvectors [index] [i++] : 0.0;
 			}
 		}
@@ -49,7 +49,7 @@ autoMatrix Eigen_extractEigenvector (Eigen me, long index, long numberOfRows, lo
 	}
 }
 
-autoMatrix Eigen_and_Matrix_to_Matrix_projectRows (Eigen me, Matrix thee, long numberOfDimensionsToKeep) {
+autoMatrix Eigen_and_Matrix_to_Matrix_projectRows (Eigen me, Matrix thee, integer numberOfDimensionsToKeep) {
 	try {
 		if (numberOfDimensionsToKeep <= 0 || numberOfDimensionsToKeep > my numberOfEigenvalues) {
 			numberOfDimensionsToKeep = my numberOfEigenvalues;
@@ -67,7 +67,7 @@ autoMatrix Eigen_and_Matrix_to_Matrix_projectRows (Eigen me, Matrix thee, long n
 	}
 }
 
-autoMatrix Eigen_and_Matrix_to_Matrix_projectColumns (Eigen me, Matrix thee, long numberOfDimensionsToKeep) {
+autoMatrix Eigen_and_Matrix_to_Matrix_projectColumns (Eigen me, Matrix thee, integer numberOfDimensionsToKeep) {
 	try {
 		if (numberOfDimensionsToKeep <= 0 || numberOfDimensionsToKeep > my numberOfEigenvalues) {
 			numberOfDimensionsToKeep = my numberOfEigenvalues;
diff --git a/dwtools/Eigen_and_Matrix.h b/dwtools/Eigen_and_Matrix.h
index 8261b3b..137c270 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,2015-2016 David Weenink
+ * Copyright (C) 1993-2011,2015-2016 David Weenink, 2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,27 +19,21 @@
  * along with this work. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/*
- djmw 20020327
- djmw 20020813 GPL header
- djmw 20110307 Latest modification
-*/
-
 #include "Eigen.h"
 #include "Matrix.h"
 
-autoMatrix Eigen_extractEigenvector (Eigen me, long index, long numberOfRows, long numberOfColumns);
+autoMatrix Eigen_extractEigenvector (Eigen me, integer index, integer numberOfRows, integer numberOfColumns);
 /* Extract eigenvector as a (reshaped) matrix */
 
-autoMatrix Eigen_and_Matrix_to_Matrix_projectRows (Eigen me, Matrix thee, long numberOfDimensionsToKeep);
+autoMatrix Eigen_and_Matrix_to_Matrix_projectRows (Eigen me, Matrix thee, integer numberOfDimensionsToKeep);
 /*
 	Purpose: project the rows of the matrix (thee) on the eigenspace (me). 
 */
 
-autoMatrix Eigen_and_Matrix_to_Matrix_projectColumns (Eigen me, Matrix thee, long numberOfDimensionsToKeep);
+autoMatrix Eigen_and_Matrix_to_Matrix_projectColumns (Eigen me, Matrix thee, integer numberOfDimensionsToKeep);
 /*
-	Purpose: project the columnss of the matrix (thee) on the eigenspace (me). 
+	Purpose: project the columns of the matrix (thee) on the eigenspace (me).
 */
 
-
-#endif /* _Eigen_and_Matrix_h_ */
+/* End of file Eigen_and_Matrix.h */
+#endif
diff --git a/dwtools/GaussianMixture_def.h b/dwtools/GaussianMixture_def.h
index 82341c9..3a510ff 100644
--- a/dwtools/GaussianMixture_def.h
+++ b/dwtools/GaussianMixture_def.h
@@ -19,8 +19,8 @@
 #define ooSTRUCT GaussianMixture
 oo_DEFINE_CLASS (GaussianMixture, Daata)
 
-	oo_LONG (numberOfComponents)
-	oo_LONG (dimension)
+	oo_INTEGER (numberOfComponents)
+	oo_INTEGER (dimension)
 	oo_DOUBLE_VECTOR (mixingProbabilities, numberOfComponents)
 	oo_AUTO_OBJECT (CovarianceList, 0, covariances)
 
diff --git a/dwtools/HMM.cpp b/dwtools/HMM.cpp
index 2818ffa..dafd1b1 100644
--- a/dwtools/HMM.cpp
+++ b/dwtools/HMM.cpp
@@ -64,49 +64,49 @@ Thing_implement (HMMStateSequence, Strings, 0);
 
 // 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);
-autoHMMObservation HMMObservation_create (const char32 *label, long numberOfComponents, long dimension, long storage);
+autoHMMObservation HMMObservation_create (const char32 *label, integer numberOfComponents, integer dimension, integer storage);
 
-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);
+integer HMM_and_HMMObservationSequence_getLongestSequence (HMM me, HMMObservationSequence thee, integer symbolNumber);
+integer StringsIndex_getLongestSequence (StringsIndex me, integer index, integer *pos);
+integer Strings_getLongestSequence (Strings me, char32 *string, integer *pos);
 autoHMMState HMMState_create (const char32 *label);
 
-autoHMMBaumWelch HMMBaumWelch_create (long nstates, long nsymbols, long capacity);
+autoHMMBaumWelch HMMBaumWelch_create (integer nstates, integer nsymbols, integer capacity);
 void HMMBaumWelch_getGamma (HMMBaumWelch me);
-autoHMMBaumWelch HMM_forward (HMM me, long *obs, long nt);
+autoHMMBaumWelch HMM_forward (HMM me, integer *obs, integer nt);
 void HMMBaumWelch_reInit (HMMBaumWelch me);
-void HMM_and_HMMBaumWelch_getXi (HMM me, HMMBaumWelch thee, long *obs);
+void HMM_and_HMMBaumWelch_getXi (HMM me, HMMBaumWelch thee, integer *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);
+void HMM_and_HMMBaumWelch_addEstimate (HMM me, HMMBaumWelch thee, integer *obs);
+void HMM_and_HMMBaumWelch_forward (HMM me, HMMBaumWelch thee, integer *obs);
+void HMM_and_HMMBaumWelch_backward (HMM me, HMMBaumWelch thee, integer *obs);
+void HMM_and_HMMViterbi_decode (HMM me, HMMViterbi thee, integer *obs);
+double HMM_getProbabilityOfObservations (HMM me, integer *obs, integer numberOfTimes);
 autoTableOfReal StringsIndex_to_TableOfReal_transitions (StringsIndex me, int probabilities);
 autoStringsIndex HMM_and_HMMStateSequence_to_StringsIndex (HMM me, HMMStateSequence thee);
 
 
-autoHMMViterbi HMMViterbi_create (long nstates, long ntimes);
-autoHMMViterbi HMM_to_HMMViterbi (HMM me, long *obs, long ntimes);
+autoHMMViterbi HMMViterbi_create (integer nstates, integer ntimes);
+autoHMMViterbi HMM_to_HMMViterbi (HMM me, integer *obs, integer ntimes);
 
 // evaluate the numbers given to probabilities
-static double *NUMwstring_to_probs (char32 *s, long nwanted) {
+static double *NUMwstring_to_probs (char32 *s, integer nwanted) {
 	integer numbers_found;
 	autoNUMvector<double> numbers (NUMstring_to_numbers (s, & numbers_found), 1);
 	if (numbers_found != nwanted) {
 		Melder_throw (U"You supplied ", numbers_found, U", while ", nwanted, U" numbers needed.");
 	}
-	double sum = 0;
-	for (long i = 1; i <= numbers_found; i++) {
+	real80 sum = 0.0;
+	for (integer i = 1; i <= numbers_found; i++) {
 		if (numbers[i] < 0) {
 			Melder_throw (U"Numbers have to be positive.");
 		}
 		sum += numbers [i];
 	}
-	if (sum <= 0) {
+	if (sum <= 0.0) {
 		Melder_throw (U"All probabilities cannot be zero.");
 	}
-	for (long i = 1; i <= numbers_found; i ++) {
+	for (integer i = 1; i <= numbers_found; i ++) {
 		numbers [i] /= sum;
 	}
 	return numbers.transfer();
@@ -116,7 +116,7 @@ int NUMget_line_intersection_with_circle (double xc, double yc, double r, double
 	double ca = a * a + 1.0, bmyc = (b - yc);
 	double cb = 2.0 * (a * bmyc - xc);
 	double cc = bmyc * bmyc + xc * xc - r * r;
-	long nroots = NUMsolveQuadraticEquation (ca, cb, cc, x1, x2);
+	integer nroots = NUMsolveQuadraticEquation (ca, cb, cc, x1, x2);
 	if (nroots == 1) {
 		*y1 = a * *x1 + b;
 		*x2 = *x1;
@@ -133,7 +133,7 @@ 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) {
+static double HMM_and_HMM_getCrossEntropy_asym (HMM me, HMM thee, integer observationLength) {
 	autoHMMObservationSequence os = HMM_to_HMMObservationSequence (thee, 0, observationLength);
 	double ce = HMM_and_HMMObservationSequence_getCrossEntropy (me, os.get());
 	if (isundef (ce)) {
@@ -148,12 +148,12 @@ static double HMM_and_HMM_getCrossEntropy_asym (HMM me, HMM thee, long observati
 
 /**************** HMMObservation ******************************/
 
-static void HMMObservation_init (HMMObservation me, const char32 *label, long numberOfComponents, long dimension, long storage) {
+static void HMMObservation_init (HMMObservation me, const char32 *label, integer numberOfComponents, integer dimension, integer storage) {
 	my label = Melder_dup (label);
 	my gm = GaussianMixture_create (numberOfComponents, dimension, storage);
 }
 
-autoHMMObservation HMMObservation_create (const char32 *label, long numberOfComponents, long dimension, long storage) {
+autoHMMObservation HMMObservation_create (const char32 *label, integer numberOfComponents, integer dimension, integer storage) {
 	try {
 		autoHMMObservation me = Thing_new (HMMObservation);
 		HMMObservation_init (me.get(), label, numberOfComponents, dimension, storage);
@@ -163,14 +163,14 @@ autoHMMObservation HMMObservation_create (const char32 *label, long numberOfComp
 	}
 }
 
-long Strings_getLongestSequence (Strings me, char32 *string, long *pos) {
-	long length = 0, longest = 0, lpos = 0;
-	for (long i = 1; i <= my numberOfStrings; i++) {
-		if (Melder_equ (my strings[i], string)) {
+integer Strings_getLongestSequence (Strings me, char32 *string, integer *pos) {
+	integer length = 0, longest = 0, lpos = 0;
+	for (integer i = 1; i <= my numberOfStrings; i ++) {
+		if (Melder_equ (my strings [i], string)) {
 			if (length == 0) {
 				lpos = i;
 			}
-			length++;
+			length ++;
 		} else {
 			if (length > 0) {
 				if (length > longest) {
@@ -183,14 +183,14 @@ long Strings_getLongestSequence (Strings me, char32 *string, long *pos) {
 	return length;
 }
 
-long StringsIndex_getLongestSequence (StringsIndex me, long index, long *pos) {
-	long length = 0, longest = 0, lpos = 0;
-	for (long i = 1; i <= my numberOfItems; i++) {
-		if (my classIndex[i] == index) {
+integer StringsIndex_getLongestSequence (StringsIndex me, integer index, integer *pos) {
+	integer length = 0, longest = 0, lpos = 0;
+	for (integer i = 1; i <= my numberOfItems; i ++) {
+		if (my classIndex [i] == index) {
 			if (length == 0) {
 				lpos = i;
 			}
-			length++;
+			length ++;
 		} else {
 			if (length > 0) {
 				if (length > longest) {
@@ -227,7 +227,7 @@ void HMMState_setLabel (HMMState me, char32 *label) {
 /**************** HMMBaumWelch ******************************/
 
 void structHMMBaumWelch :: v_destroy () noexcept {
-	for (long it = 1; it <= capacity; it ++) {
+	for (integer it = 1; it <= capacity; it ++) {
 		NUMmatrix_free (xi[it], 1, 1);
 	}
 	NUMvector_free (xi, 1);
@@ -241,7 +241,7 @@ void structHMMBaumWelch :: v_destroy () noexcept {
 	NUMmatrix_free (bik_denom, 1, 1);
 }
 
-autoHMMBaumWelch HMMBaumWelch_create (long nstates, long nsymbols, long capacity) {
+autoHMMBaumWelch HMMBaumWelch_create (integer nstates, integer nsymbols, integer capacity) {
 	try {
 		autoHMMBaumWelch me = Thing_new (HMMBaumWelch);
 		my numberOfTimes = my capacity = capacity;
@@ -256,7 +256,7 @@ autoHMMBaumWelch HMMBaumWelch_create (long nstates, long nsymbols, long capacity
 		my bik_num = NUMmatrix<double> (1, nstates, 1, nsymbols);
 		my bik_denom = NUMmatrix<double> (1, nstates, 1, nsymbols);
 		my gamma = NUMmatrix<double> (1, nstates, 1, capacity);
-		for (long it = 1; it <= capacity; it++) {
+		for (integer it = 1; it <= capacity; it ++) {
 			my xi[it] = NUMmatrix<double> (1, nstates, 1, nstates);
 		}
 		return me;
@@ -266,14 +266,14 @@ autoHMMBaumWelch HMMBaumWelch_create (long nstates, long nsymbols, long capacity
 }
 
 void HMMBaumWelch_getGamma (HMMBaumWelch me) {
-	for (long it = 1; it <= my numberOfTimes; it ++) {
+	for (integer it = 1; it <= my numberOfTimes; it ++) {
 		double sum = 0.0;
-		for (long is = 1; is <= my numberOfStates; is ++) {
+		for (integer is = 1; is <= my numberOfStates; is ++) {
 			my gamma [is] [it] = my alpha [is] [it] * my beta [is] [it];
 			sum += my gamma [is] [it];
 		}
 
-		for (long is = 1; is <= my numberOfStates; is ++) {
+		for (integer is = 1; is <= my numberOfStates; is ++) {
 			my gamma [is] [it] /= sum;
 		}
 	}
@@ -281,14 +281,14 @@ void HMMBaumWelch_getGamma (HMMBaumWelch me) {
 
 /**************** HMMViterbi ******************************/
 
-autoHMMViterbi HMMViterbi_create (long nstates, long ntimes) {
+autoHMMViterbi HMMViterbi_create (integer nstates, integer ntimes) {
 	try {
 		autoHMMViterbi me = Thing_new (HMMViterbi);
 		my numberOfTimes = ntimes;
 		my numberOfStates = nstates;
-		my viterbi = NUMmatrix<double> (1, nstates, 1, ntimes);
-		my bp = NUMmatrix<long> (1, nstates, 1 , ntimes);
-		my path = NUMvector<long> (1, ntimes);
+		my viterbi = NUMmatrix <double> (1, nstates, 1, ntimes);
+		my bp = NUMmatrix <integer> (1, nstates, 1 , ntimes);
+		my path = NUMvector <integer> (1, ntimes);
 		return me;
 	} catch (MelderError) {
 		Melder_throw (U"HMMViterbi not created.");
@@ -297,7 +297,7 @@ autoHMMViterbi HMMViterbi_create (long nstates, long ntimes) {
 
 /******************* HMMObservationSequence & HMMStateSequence ***/
 
-autoHMMObservationSequence HMMObservationSequence_create (long numberOfItems, long dataLength) {
+autoHMMObservationSequence HMMObservationSequence_create (integer numberOfItems, integer dataLength) {
 	try {
 		autoHMMObservationSequence me = Thing_new (HMMObservationSequence);
 		Table_initWithoutColumnNames (me.get(), numberOfItems, dataLength + 1);
@@ -307,20 +307,20 @@ autoHMMObservationSequence HMMObservationSequence_create (long numberOfItems, lo
 	}
 }
 
-long HMMObservationSequence_getNumberOfObservations (HMMObservationSequence me) {
+integer HMMObservationSequence_getNumberOfObservations (HMMObservationSequence me) {
 	return my rows.size;
 }
 
-void HMMObservationSequence_removeObservation (HMMObservationSequence me, long index) {
+void HMMObservationSequence_removeObservation (HMMObservationSequence me, integer index) {
 	Table_removeRow ( (Table) me, index);
 }
 
 autoStrings HMMObservationSequence_to_Strings (HMMObservationSequence me) {
 	try {
-		long numberOfStrings = my rows.size;
+		integer numberOfStrings = my rows.size;
 		autoStrings thee = Thing_new (Strings);
 		thy strings = NUMvector<char32 *> (1, numberOfStrings);
-		for (long i = 1; i <= numberOfStrings; i++) {
+		for (integer i = 1; i <= numberOfStrings; i++) {
 			thy strings[i] = Melder_dup_f (Table_getStringValue_Assert ( (Table) me, i, 1));
 			(thy numberOfStrings) ++;
 		}
@@ -333,7 +333,7 @@ autoStrings HMMObservationSequence_to_Strings (HMMObservationSequence me) {
 autoHMMObservationSequence Strings_to_HMMObservationSequence (Strings me) {
 	try {
 		autoHMMObservationSequence thee = HMMObservationSequence_create (my numberOfStrings, 0);
-		for (long i = 1; i <= my numberOfStrings; i++) {
+		for (integer i = 1; i <= my numberOfStrings; i++) {
 			Table_setStringValue ( (Table) thee.get(), i, 1, my strings[i]);
 		}
 		return thee;
@@ -352,16 +352,16 @@ autoStringsIndex HMMObservationSequence_to_StringsIndex (HMMObservationSequence
 	}
 }
 
-long HMM_and_HMMObservationSequence_getLongestSequence (HMM me, HMMObservationSequence thee, long symbolNumber) {
+integer HMM_and_HMMObservationSequence_getLongestSequence (HMM me, HMMObservationSequence thee, integer symbolNumber) {
 	autoStringsIndex si = HMM_and_HMMObservationSequence_to_StringsIndex (me, thee);
 	// TODO
 	(void) symbolNumber;
 	return 1;
 }
 
-long HMMObservationSequenceBag_getLongestSequence (HMMObservationSequenceBag me) {
-	long longest = 0;
-	for (long i = 1; i <= my size; i ++) {
+integer HMMObservationSequenceBag_getLongestSequence (HMMObservationSequenceBag me) {
+	integer longest = 0;
+	for (integer i = 1; i <= my size; i ++) {
 		HMMObservationSequence thee = my at [i];
 		if (thy rows.size > longest) {
 			longest = thy rows.size;
@@ -370,7 +370,7 @@ long HMMObservationSequenceBag_getLongestSequence (HMMObservationSequenceBag me)
 	return longest;
 }
 
-autoHMMStateSequence HMMStateSequence_create (long numberOfItems) {
+autoHMMStateSequence HMMStateSequence_create (integer numberOfItems) {
 	try {
 		autoHMMStateSequence me = Thing_new (HMMStateSequence);
 		my strings = NUMvector<char32 *> (1, numberOfItems);
@@ -396,18 +396,18 @@ autoStrings HMMStateSequence_to_Strings (HMMStateSequence me) {
 void structHMM :: v_info () {
 	structDaata :: v_info ();
 	MelderInfo_writeLine (U"Number of states: ", numberOfStates);
-	for (long i = 1; i <= numberOfStates; i ++) {
+	for (integer i = 1; i <= numberOfStates; i ++) {
 		HMMState hmms = our states->at [i];
 		MelderInfo_writeLine (U"  ", hmms -> label);
 	}
 	MelderInfo_writeLine (U"Number of symbols: ", numberOfObservationSymbols);
-	for (long i = 1; i <= numberOfObservationSymbols; i ++) {
+	for (integer i = 1; i <= numberOfObservationSymbols; i ++) {
 		HMMObservation hmms = our observationSymbols->at [i];
 		MelderInfo_writeLine (U"  ", hmms -> label);
 	}
 }
 
-static void HMM_init (HMM me, long numberOfStates, long numberOfObservationSymbols, int leftToRight) {
+static void HMM_init (HMM me, integer numberOfStates, integer numberOfObservationSymbols, int leftToRight) {
 	my numberOfStates = numberOfStates;
 	my numberOfObservationSymbols = numberOfObservationSymbols;
 	my componentStorage = 1;
@@ -418,7 +418,7 @@ static void HMM_init (HMM me, long numberOfStates, long numberOfObservationSymbo
 	my emissionProbs = NUMmatrix<double> (1, numberOfStates, 1, numberOfObservationSymbols);
 }
 
-autoHMM HMM_create (int leftToRight, long numberOfStates, long numberOfObservationSymbols) {
+autoHMM HMM_create (int leftToRight, integer numberOfStates, integer numberOfObservationSymbols) {
 	try {
 		autoHMM me = Thing_new (HMM);
 		HMM_init (me.get(), numberOfStates, numberOfObservationSymbols, leftToRight);
@@ -434,13 +434,13 @@ autoHMM HMM_create (int leftToRight, long numberOfStates, long numberOfObservati
 }
 
 void HMM_setDefaultStates (HMM me) {
-	for (long i = 1; i <= my numberOfStates; i++) {
+	for (integer i = 1; i <= my numberOfStates; i++) {
 		autoHMMState hmms = HMMState_create (Melder_cat (U"S", i));
 		HMM_addState_move (me, hmms.move());
 	}
 }
 
-autoHMM HMM_createFullContinuousModel (int leftToRight, long numberOfStates, long numberOfObservationSymbols, long numberOfFeatureStreams, long *dimensionOfStream, long *numberOfGaussiansforStream) {
+autoHMM HMM_createFullContinuousModel (int leftToRight, integer numberOfStates, integer numberOfObservationSymbols, integer numberOfFeatureStreams, integer *dimensionOfStream, integer *numberOfGaussiansforStream) {
 	(void) leftToRight;
 	(void) numberOfStates;
 	(void) numberOfObservationSymbols;
@@ -450,18 +450,18 @@ autoHMM HMM_createFullContinuousModel (int leftToRight, long numberOfStates, lon
 	return autoHMM();
 }
 
-autoHMM HMM_createContinuousModel (int leftToRight, long numberOfStates, long numberOfObservationSymbols, long numberOfMixtureComponentsPerSymbol, long componentDimension, long componentStorage) {
+autoHMM HMM_createContinuousModel (int leftToRight, integer numberOfStates, integer numberOfObservationSymbols, integer numberOfMixtureComponentsPerSymbol, integer componentDimension, integer componentStorage) {
 	try {
 		autoHMM me = Thing_new (HMM);
 		HMM_init (me.get(), numberOfStates, numberOfObservationSymbols, leftToRight);
 		my numberOfMixtureComponents = numberOfMixtureComponentsPerSymbol;
 		my componentDimension = componentDimension;
 		my componentStorage = componentStorage;
-		for (long i = 1; i <= numberOfStates; i++) {
+		for (integer i = 1; i <= numberOfStates; i++) {
 			autoHMMState state = HMMState_create (Melder_cat (U"S", i));
 			HMM_addState_move (me.get(), state.move());
 		}
-		for (long j = 1; j <= numberOfObservationSymbols; j++) {
+		for (integer j = 1; j <= numberOfObservationSymbols; j++) {
 			autoHMMObservation obs = HMMObservation_create (Melder_cat (U"s", j), numberOfMixtureComponentsPerSymbol, componentDimension, componentStorage);
 			HMM_addObservation_move (me.get(), obs.move());
 		}
@@ -481,8 +481,8 @@ autoHMM HMM_createSimple (int leftToRight, const char32 *states_string, const ch
 		autoHMM me = Thing_new (HMM);
 		const char32 *states = states_string;
 		const char32 *symbols = symbols_string;
-		long numberOfStates = Melder_countTokens (states_string);
-		long numberOfObservationSymbols = Melder_countTokens (symbols_string);
+		integer numberOfStates = Melder_countTokens (states_string);
+		integer numberOfObservationSymbols = Melder_countTokens (symbols_string);
 
 		if (numberOfStates == 0 and numberOfObservationSymbols == 0) {
 			Melder_throw (U"No states and no symbols given.");
@@ -520,16 +520,16 @@ 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 ++) {
+	for (integer i = 1; i <= my numberOfObservationSymbols; i ++) {
 		autoHMMObservation hmms = HMMObservation_create (Melder_cat (def, i), 0, 0, 0);
 		HMM_addObservation_move (me, hmms.move());
 	}
 }
 
 void HMM_setDefaultTransitionProbs (HMM me) {
-	for (long i = 1; i <= my numberOfStates; i ++) {
+	for (integer i = 1; i <= my numberOfStates; i ++) {
 		double p = ( my leftToRight ? 1.0 / (my numberOfStates - i + 1.0) : 1.0 / my numberOfStates );
-		for (long j = 1; j <= my numberOfStates; j++) {
+		for (integer j = 1; j <= my numberOfStates; j++) {
 			my transitionProbs [i] [j] = ( my leftToRight && j < i ? 0.0 : p );
 		}
 	}
@@ -540,24 +540,24 @@ void HMM_setDefaultTransitionProbs (HMM me) {
 
 void HMM_setDefaultStartProbs (HMM me) {
 	double p = 1.0 / my numberOfStates;
-	for (long j = 1; j <= my numberOfStates; j ++) {
+	for (integer j = 1; j <= my numberOfStates; j ++) {
 		my transitionProbs [0] [j] = p;
 	}
 }
 
 void HMM_setDefaultEmissionProbs (HMM me) {
 	double p = 1.0 / my numberOfObservationSymbols;
-	for (long i = 1; i <= my numberOfStates; i++)
-		for (long j = 1; j <= my numberOfObservationSymbols; j ++) {
+	for (integer i = 1; i <= my numberOfStates; i++)
+		for (integer j = 1; j <= my numberOfObservationSymbols; j ++) {
 			my emissionProbs [i] [j] = my notHidden ? ( i == j ? 1.0 : 0.0 ) : p;
 		}
 }
 
 void HMM_setDefaultMixingProbabilities (HMM me) {
 	double mp = 1.0 / my numberOfMixtureComponents;
-	for (long is = 1; is <= my numberOfObservationSymbols; is ++) {
+	for (integer is = 1; is <= my numberOfObservationSymbols; is ++) {
 		HMMObservation hmmo = my observationSymbols->at [is];
-		for (long im = 1; im <= my numberOfMixtureComponents; im ++) {
+		for (integer im = 1; im <= my numberOfMixtureComponents; im ++) {
 			hmmo -> gm -> mixingProbabilities [im] = mp;
 		}
 	}
@@ -566,7 +566,7 @@ void HMM_setDefaultMixingProbabilities (HMM me) {
 void HMM_setStartProbabilities (HMM me, char32 *probs) {
 	try {
 		autoNUMvector<double> p (NUMwstring_to_probs (probs, my numberOfStates), 1);
-		for (long i = 1; i <= my numberOfStates; i++) {
+		for (integer i = 1; i <= my numberOfStates; i++) {
 			my transitionProbs[0][i] = p[i];
 		}
 	} catch (MelderError) {
@@ -574,13 +574,13 @@ void HMM_setStartProbabilities (HMM me, char32 *probs) {
 	}
 }
 
-void HMM_setTransitionProbabilities (HMM me, long state_number, char32 *state_probs) {
+void HMM_setTransitionProbabilities (HMM me, integer state_number, char32 *state_probs) {
 	try {
 		if (state_number > my states->size) {
 			Melder_throw (U"State number too large.");
 		}
 		autoNUMvector<double> p (NUMwstring_to_probs (state_probs, my numberOfStates), 1);
-		for (long i = 1; i <= my numberOfStates + 1; i ++) {
+		for (integer i = 1; i <= my numberOfStates + 1; i ++) {
 			my transitionProbs [state_number] [i] = p [i];
 		}
 	} catch (MelderError) {
@@ -588,7 +588,7 @@ void HMM_setTransitionProbabilities (HMM me, long state_number, char32 *state_pr
 	}
 }
 
-void HMM_setEmissionProbabilities (HMM me, long state_number, char32 *emission_probs) {
+void HMM_setEmissionProbabilities (HMM me, integer state_number, char32 *emission_probs) {
 	try {
 		if (state_number > my states->size) {
 			Melder_throw (U"State number too large.");
@@ -597,7 +597,7 @@ void HMM_setEmissionProbabilities (HMM me, long state_number, char32 *emission_p
 			Melder_throw (U"The emission probs of this model are fixed.");
 		}
 		autoNUMvector<double> p (NUMwstring_to_probs (emission_probs, my numberOfObservationSymbols), 1);
-		for (long i = 1; i <= my numberOfObservationSymbols; i++) {
+		for (integer i = 1; i <= my numberOfObservationSymbols; i++) {
 			my emissionProbs [state_number] [i] = p [i];
 		}
 	} catch (MelderError) {
@@ -607,7 +607,7 @@ void HMM_setEmissionProbabilities (HMM me, long state_number, char32 *emission_p
 }
 
 void HMM_addObservation_move (HMM me, autoHMMObservation thee) {
-	long ns = my observationSymbols->size + 1;
+	integer ns = my observationSymbols->size + 1;
 	if (ns > my numberOfObservationSymbols) {
 		Melder_throw (U"Observation list is full.");
 	}
@@ -615,7 +615,7 @@ void HMM_addObservation_move (HMM me, autoHMMObservation thee) {
 }
 
 void HMM_addState_move (HMM me, autoHMMState thee) {
-	long ns = my states->size + 1;
+	integer ns = my states->size + 1;
 	if (ns > my numberOfStates) {
 		Melder_throw (U"States list is full.");
 	}
@@ -625,17 +625,17 @@ void HMM_addState_move (HMM me, autoHMMState thee) {
 autoTableOfReal HMM_extractTransitionProbabilities (HMM me) {
 	try {
 		autoTableOfReal thee = TableOfReal_create (my numberOfStates + 1, my numberOfStates + 1);
-		for (long is = 1; is <= my numberOfStates; is ++) {
+		for (integer is = 1; is <= my numberOfStates; is ++) {
 			HMMState hmms = my states->at [is];
 			TableOfReal_setRowLabel (thee.get(), is + 1, hmms -> label);
 			TableOfReal_setColumnLabel (thee.get(), is, hmms -> label);
-			for (long js = 1; js <= my numberOfStates; js ++) {
+			for (integer js = 1; js <= my numberOfStates; js ++) {
 				thy data [is + 1] [js] = my transitionProbs [is] [js];
 			}
 		}
 		TableOfReal_setRowLabel (thee.get(), 1, U"START");
 		TableOfReal_setColumnLabel (thee.get(), my numberOfStates + 1, U"END");
-		for (long is = 1; is <= my numberOfStates; is ++) {
+		for (integer is = 1; is <= my numberOfStates; is ++) {
 			thy data [1] [is] = my transitionProbs [0] [is];
 			thy data [is + 1] [my numberOfStates + 1] = my transitionProbs [is] [my numberOfStates + 1];
 		}
@@ -648,14 +648,14 @@ autoTableOfReal HMM_extractTransitionProbabilities (HMM me) {
 autoTableOfReal HMM_extractEmissionProbabilities (HMM me) {
 	try {
 		autoTableOfReal thee = TableOfReal_create (my numberOfStates, my numberOfObservationSymbols);
-		for (long js = 1; js <= my numberOfObservationSymbols; js ++) {
+		for (integer js = 1; js <= my numberOfObservationSymbols; js ++) {
 			HMMObservation hmms = my observationSymbols->at [js];
 			TableOfReal_setColumnLabel (thee.get(), js, hmms -> label);
 		}
-		for (long is = 1; is <= my numberOfStates; is ++) {
+		for (integer is = 1; is <= my numberOfStates; is ++) {
 			HMMState hmms = my states->at [is];
 			TableOfReal_setRowLabel (thee.get(), is, hmms -> label);
-			for (long js = 1; js <= my numberOfObservationSymbols; js ++) {
+			for (integer js = 1; js <= my numberOfObservationSymbols; js ++) {
 				thy data [is] [js] = my emissionProbs [is] [js];
 			}
 		}
@@ -665,21 +665,21 @@ autoTableOfReal HMM_extractEmissionProbabilities (HMM me) {
 	};
 }
 
-double HMM_getExpectedValueOfDurationInState (HMM me, long istate) {
+double HMM_getExpectedValueOfDurationInState (HMM me, integer istate) {
 	if (istate < 0 || istate > my numberOfStates) {
 		return undefined;
 	}
 	return 1.0 / (1.0 - my transitionProbs [istate] [istate]);
 }
 
-double HMM_getProbabilityOfStayingInState (HMM me, long istate, long numberOfTimeUnits) {
+double HMM_getProbabilityOfStayingInState (HMM me, integer istate, integer numberOfTimeUnits) {
 	if (istate < 0 || istate > my numberOfStates) {
 		return undefined;
 	}
 	return pow (my transitionProbs [istate] [istate], numberOfTimeUnits - 1.0) * (1.0 - my transitionProbs[istate][istate]);
 }
 
-double HMM_and_HMM_getCrossEntropy (HMM me, HMM thee, long observationLength, int symmetric) {
+double HMM_and_HMM_getCrossEntropy (HMM me, HMM thee, integer observationLength, int symmetric) {
 	double ce1 = HMM_and_HMM_getCrossEntropy_asym (me, thee, observationLength);
 	if (! symmetric || isundef (ce1)) {
 		return ce1;
@@ -715,7 +715,7 @@ void HMM_draw (HMM me, Graphics g, int garnish) {
 	// heuristic: all states on a circle until we have a better graph drawing algorithm.
 	xs[1] = ys[1] = 0;
 	if (my numberOfStates > 1) {
-		for (long is = 1; is <= my numberOfStates; is++) {
+		for (integer is = 1; is <= my numberOfStates; is++) {
 			double alpha = - NUMpi + NUMpi * 2.0 * (is - 1) / my numberOfStates;
 			xs[is] = r * cos (alpha); ys[is] = r * sin (alpha);
 		}
@@ -727,7 +727,7 @@ void HMM_draw (HMM me, Graphics g, int garnish) {
 	int fontSize = Graphics_inqFontSize (g);
 	const char32 *widest_label = U"";
 	double max_width = 0.0;
-	for (long is = 1; is <= my numberOfStates; is ++) {
+	for (integer is = 1; is <= my numberOfStates; is ++) {
 		HMMState hmms = my states->at [is];
 		double w = ( hmms -> label == nullptr ? 0.0 : Graphics_textWidth (g, hmms -> label) );
 		if (w > max_width) {
@@ -743,7 +743,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 ++) {
+	for (integer is = 1; is <= my numberOfStates; is ++) {
 		HMMState hmms = my states->at [is];
 		Graphics_circle (g, xs [is], ys [is], rstate);
 		Graphics_text (g, xs [is], ys [is], hmms -> label);
@@ -753,9 +753,9 @@ void HMM_draw (HMM me, Graphics g, int garnish) {
 	// 1 -> 2 / 2-> : increase / decrease angle between 1 and 2 with pi /10
 	// use cos(a+b) and cos(a -b) rules
 	double cosb = cos (NUMpi / 10.0), sinb = sin (NUMpi / 10.0);
-	for (long is = 1; is <= my numberOfStates; is ++) {
+	for (integer is = 1; is <= my numberOfStates; is ++) {
 		double x1 = xs [is], y1 = ys [is];
-		for (long js = 1; js <= my numberOfStates; js ++) {
+		for (integer js = 1; js <= my numberOfStates; js ++) {
 			if (my transitionProbs [is] [js] > 0.0 && is != js) {
 				double x2 = xs [js], y2 = ys [js];
 				double dx = x2 - x1, dy = y2 - y1, h = sqrt (dx * dx + dy * dy), cosa = dx / h, sina = dy / h;
@@ -778,13 +778,13 @@ void HMM_unExpandPCA (HMM me) {
 	if (my componentDimension <= 0) {
 		return;    // nothing to do
 	}
-	for (long is = 1; is <= my numberOfObservationSymbols; is ++) {
+	for (integer is = 1; is <= my numberOfObservationSymbols; is ++) {
 		HMMObservation s = my observationSymbols->at [is];
 		GaussianMixture_unExpandPCA (s -> gm.get());
 	}
 }
 
-autoHMMObservationSequence HMM_to_HMMObservationSequence (HMM me, long startState, long numberOfItems) {
+autoHMMObservationSequence HMM_to_HMMObservationSequence (HMM me, integer startState, integer numberOfItems) {
 	try {
 		autoHMMObservationSequence thee = HMMObservationSequence_create (numberOfItems, my componentDimension);
 		autoNUMvector<double> obs;
@@ -793,17 +793,17 @@ autoHMMObservationSequence HMM_to_HMMObservationSequence (HMM me, long startStat
 			obs.reset (1, my componentDimension);
 			buf.reset (1, my componentDimension);
 		}
-		long istate = startState == 0 ? NUMgetIndexFromProbability (my transitionProbs[0], my numberOfStates, NUMrandomUniform (0.0, 1.0)) : startState;
-		for (long i = 1; i <= numberOfItems; i++) {
+		integer istate = startState == 0 ? NUMgetIndexFromProbability (my transitionProbs[0], my numberOfStates, NUMrandomUniform (0.0, 1.0)) : startState;
+		for (integer i = 1; i <= numberOfItems; i++) {
 			// Emit a symbol from istate
 
-			long isymbol = NUMgetIndexFromProbability (my emissionProbs[istate], my numberOfObservationSymbols, NUMrandomUniform (0.0, 1.0));
+			integer isymbol = NUMgetIndexFromProbability (my emissionProbs[istate], my numberOfObservationSymbols, NUMrandomUniform (0.0, 1.0));
 			HMMObservation s = my observationSymbols->at [isymbol];
 
 			if (my componentDimension > 0) {
 				char32 *name;
 				GaussianMixture_generateOneVector (s -> gm.get(), obs.peek(), &name, buf.peek());
-				for (long j = 1; j <= my componentDimension; j++) {
+				for (integer j = 1; j <= my componentDimension; j++) {
 					Table_setNumericValue ( (Table) thee.get(), i, 1 + j, obs[j]);
 				}
 			}
@@ -814,7 +814,7 @@ autoHMMObservationSequence HMM_to_HMMObservationSequence (HMM me, long startStat
 
 			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 --) {
+				for (integer j = numberOfItems; j > i; j --) {
 					HMMObservationSequence_removeObservation (thee.get(), j);
 				}
 				break;
@@ -828,7 +828,7 @@ autoHMMObservationSequence HMM_to_HMMObservationSequence (HMM me, long startStat
 	}
 }
 
-autoHMMBaumWelch HMM_forward (HMM me, long *obs, long nt) {
+autoHMMBaumWelch HMM_forward (HMM me, integer *obs, integer nt) {
 	try {
 		autoHMMBaumWelch thee = HMMBaumWelch_create (my numberOfStates, my numberOfObservationSymbols, nt);
 		HMM_and_HMMBaumWelch_forward (me, thee.get(), obs);
@@ -838,7 +838,7 @@ autoHMMBaumWelch HMM_forward (HMM me, long *obs, long nt) {
 	}
 }
 
-autoHMMViterbi HMM_to_HMMViterbi (HMM me, long *obs, long ntimes) {
+autoHMMViterbi HMM_to_HMMViterbi (HMM me, integer *obs, integer ntimes) {
 	try {
 		autoHMMViterbi thee = HMMViterbi_create (my numberOfStates, ntimes);
 		HMM_and_HMMViterbi_decode (me, thee.get(), obs);
@@ -850,7 +850,7 @@ autoHMMViterbi HMM_to_HMMViterbi (HMM me, long *obs, long ntimes) {
 
 void HMMBaumWelch_reInit (HMMBaumWelch me) {
 	my totalNumberOfSequences = 0;
-	my lnProb = 0;
+	my lnProb = 0.0;
 
 	/*
 		The _num and _denum matrices are asigned as += in the iteration loop and therefore need to be zeroed
@@ -858,16 +858,16 @@ void HMMBaumWelch_reInit (HMMBaumWelch me) {
 		The elements of alpha, beta, scale, gamma & xi are always calculated directly and need not be
 		initialised.
 	*/
-	for (long is = 0; is <= my numberOfStates; is++) {
-		for (long js = 1; js <= my numberOfStates + 1; js++) {
-			my aij_num[is][js] = 0.0;
-			my aij_denom[is][js] = 0.0;
+	for (integer is = 0; is <= my numberOfStates; is ++) {
+		for (integer js = 1; js <= my numberOfStates + 1; js ++) {
+			my aij_num [is] [js] = 0.0;
+			my aij_denom [is] [js] = 0.0;
 		}
 	}
-	for (long is = 1; is <= my numberOfStates; is++) {
-		for (long js = 1; js <= my numberOfSymbols; js++) {
-			my bik_num[is][js] = 0.0;
-			my bik_denom[is][js] = 0.0;
+	for (integer is = 1; is <= my numberOfStates; is ++) {
+		for (integer js = 1; js <= my numberOfSymbols; js ++) {
+			my bik_num [is] [js] = 0.0;
+			my bik_denom [is] [js] = 0.0;
 		}
 	}
 }
@@ -875,38 +875,39 @@ void HMMBaumWelch_reInit (HMMBaumWelch me) {
 void HMM_and_HMMObservationSequenceBag_learn (HMM me, HMMObservationSequenceBag thee, double delta_lnp, double minProb, int info) {
 	try {
 		// act as if all observation sequences are in memory
-		long capacity = HMMObservationSequenceBag_getLongestSequence (thee);
+		integer capacity = HMMObservationSequenceBag_getLongestSequence (thee);
 		autoHMMBaumWelch bw = HMMBaumWelch_create (my numberOfStates, my numberOfObservationSymbols, capacity);
 		bw -> minProb = minProb;
 		if (info) {
 			MelderInfo_open (); 
 		}
-		long iter = 0; double lnp;
+		integer iter = 0;
+		double lnp;
 		do {
 			lnp = bw -> lnProb;
 			HMMBaumWelch_reInit (bw.get());
-			for (long ios = 1; ios <= thy size; ios ++) {
+			for (integer ios = 1; ios <= thy size; ios ++) {
 				HMMObservationSequence hmm_os = thy at [ios];
 				autoStringsIndex si = HMM_and_HMMObservationSequence_to_StringsIndex (me, hmm_os); // TODO outside the loop or more efficiently
-				long *obs = si -> classIndex, nobs = si -> numberOfItems; // convenience
+				integer *obs = si -> classIndex, nobs = si -> numberOfItems; // convenience
 
 				// Interpretation of unknowns: end of sequence
 
-				long istart = 1, iend = nobs;
+				integer istart = 1, iend = nobs;
 				while (istart <= nobs) {
-					while (istart <= nobs && obs[istart] == 0) {
-						istart++;
+					while (istart <= nobs && obs [istart] == 0) {
+						istart ++;
 					};
 					if (istart > nobs) {
 						break;
 					}
 					iend = istart + 1;
-					while (iend <= nobs && obs[iend] != 0) {
-						iend++;
+					while (iend <= nobs && obs [iend] != 0) {
+						iend ++;
 					}
 					iend --;
 					bw -> numberOfTimes = iend - istart + 1;
-					(bw -> totalNumberOfSequences) ++;
+					bw -> totalNumberOfSequences ++;
 					HMM_and_HMMBaumWelch_forward (me, bw.get(), obs + istart - 1); // get new alphas
 					HMM_and_HMMBaumWelch_backward (me, bw.get(), obs + istart - 1); // get new betas
 					HMMBaumWelch_getGamma (bw.get());
@@ -916,7 +917,7 @@ void HMM_and_HMMObservationSequenceBag_learn (HMM me, HMMObservationSequenceBag
 				}
 			}
 			// we have processed all observation sequences, now it is time to estimate new probabilities.
-			iter++;
+			iter ++;
 			HMM_and_HMMBaumWelch_reestimate (me, bw.get());
 			if (info) { 
 				MelderInfo_writeLine (U"Iteration: ", iter, U" ln(prob): ", bw -> lnProb); 
@@ -937,7 +938,7 @@ void HMM_and_HMMObservationSequenceBag_learn (HMM me, HMMObservationSequenceBag
 
 // xc1 < xc2
 void HMM_and_HMMStateSequence_drawTrellis (HMM me, HMMStateSequence thee, Graphics g, int connect, int garnish) {
-	long numberOfTimes = thy numberOfStrings;
+	integer numberOfTimes = thy numberOfStrings;
 	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;
 
@@ -946,12 +947,12 @@ void HMM_and_HMMStateSequence_drawTrellis (HMM me, HMMStateSequence thee, Graphi
 
 	double r = 0.2 / (numberOfTimes > my numberOfStates ? numberOfTimes : my numberOfStates);
 
-	for (long it = 1; it <= numberOfTimes; it++) {
-		for (long js = 1; js <= my numberOfStates; js++) {
+	for (integer it = 1; it <= numberOfTimes; it++) {
+		for (integer js = 1; js <= my numberOfStates; js++) {
 			double xc = it, yc = js, x2 = it, y2 = js;
 			Graphics_circle (g, xc, yc, r);
 			if (it > 1) {
-				for (long is = 1; is <= my numberOfStates; is++) {
+				for (integer is = 1; is <= my numberOfStates; is++) {
 					bool indexedConnection = si -> classIndex[it - 1] == is && si -> classIndex[it] == js;
 					Graphics_setLineWidth (g, indexedConnection ? 2.0 : 1.0);
 					Graphics_setLineType (g, indexedConnection ? Graphics_DRAWN : Graphics_DOTTED);
@@ -973,7 +974,7 @@ void HMM_and_HMMStateSequence_drawTrellis (HMM me, HMMStateSequence thee, Graphi
 	Graphics_setLineType (g, Graphics_DRAWN);
 	if (garnish) {
 		Graphics_drawInnerBox (g);
-		for (long js = 1; js <= my numberOfStates; js ++) {
+		for (integer js = 1; js <= my numberOfStates; js ++) {
 			HMMState hmms = my states->at [js];
 			Graphics_markLeft (g, js, false, false, false, hmms -> label);
 		}
@@ -986,13 +987,13 @@ void HMM_drawBackwardProbabilitiesIllustration (Graphics g, bool garnish) {
 	double xmin = 0.0, xmax = 1.0, ymin = 0.0, ymax = 1.0;
 	Graphics_setWindow (g, xmin, xmax, ymin, ymax);
 	double xleft  = 0.1, xright = 0.9, r = 0.03;
-	long np = 6;
+	integer np = 6;
 	double dy = (1.0 - 0.3) / (np - 1);
 	double x0 = xleft, y0 = 0.5;
 	Graphics_setWindow (g, xmin, xmax, ymin, ymax);
 	Graphics_circle (g, x0, y0, r);
 	double x = xright, y = 0.9;
-	for (long i = 1; i <= np; i++) {
+	for (integer i = 1; i <= np; i++) {
 		if (i < 4 or i == np) {
 			Graphics_circle (g, x, y, r);
 			double xx = x0 - x, yy = y - y0;
@@ -1045,13 +1046,13 @@ void HMM_drawForwardProbabilitiesIllustration (Graphics g, bool garnish) {
 	double xmin = 0.0, xmax = 1.0, ymin = 0.0, ymax = 1.0;
 	Graphics_setWindow (g, xmin, xmax, ymin, ymax);
 	double xleft = 0.1, xright = 0.9, r = 0.03;
-	long np = 6;
+	integer np = 6;
 	double dy = (1.0 - 0.3) / (np - 1);
 	double x0 = xright, y0 = 0.5;
 	Graphics_setWindow (g, xmin, xmax, ymin, ymax);
 	Graphics_circle (g, x0, y0, r);
 	double x = xleft, y = 0.9;
-	for (long i = 1; i <= np; i++) {
+	for (integer i = 1; i <= np; i++) {
 		if (i < 4 or i == np) {
 			Graphics_circle (g, x, y, r);
 			double xx = x0 - x, yy = y - y0;
@@ -1136,27 +1137,27 @@ void HMM_drawForwardAndBackwardProbabilitiesIllustration (Graphics g, bool garni
 	}
 }
 
-void HMM_and_HMMBaumWelch_getXi (HMM me, HMMBaumWelch thee, long *obs) {
+void HMM_and_HMMBaumWelch_getXi (HMM me, HMMBaumWelch thee, integer *obs) {
 
-	for (long it = 1; it <= thy numberOfTimes - 1; it++) {
+	for (integer it = 1; it <= thy numberOfTimes - 1; it ++) {
 		double sum = 0.0;
-		for (long is = 1; is <= thy numberOfStates; is++) {
-			for (long js = 1; js <= thy numberOfStates; js++) {
+		for (integer is = 1; is <= thy numberOfStates; is ++) {
+			for (integer js = 1; js <= thy numberOfStates; js ++) {
 				thy xi[it][is][js] = thy alpha[is][it] * thy beta[js][it + 1] *
 					my transitionProbs[is][js] * my emissionProbs[js][ obs[it + 1] ];
 				sum += thy xi[it][is][js];
 			}
 		}
-		for (long is = 1; is <= my numberOfStates; is++) {
-			for (long js = 1; js <= my numberOfStates; js++) {
+		for (integer is = 1; is <= my numberOfStates; is ++) {
+			for (integer js = 1; js <= my numberOfStates; js ++) {
 				thy xi[it][is][js] /= sum;
 			}
 		}
 	}
 }
 
-void HMM_and_HMMBaumWelch_addEstimate (HMM me, HMMBaumWelch thee, long *obs) {
-	for (long is = 1; is <= my numberOfStates; is ++) {
+void HMM_and_HMMBaumWelch_addEstimate (HMM me, HMMBaumWelch thee, integer *obs) {
+	for (integer is = 1; is <= my numberOfStates; is ++) {
 		// only for valid start states with p > 0
 		if (my transitionProbs [0] [is] > 0.0) {
 			thy aij_num [0] [is] += thy gamma [is] [1];
@@ -1164,15 +1165,15 @@ void HMM_and_HMMBaumWelch_addEstimate (HMM me, HMMBaumWelch thee, long *obs) {
 		}
 	}
 
-	for (long is = 1; is <= my numberOfStates; is ++) {
+	for (integer is = 1; is <= my numberOfStates; is ++) {
 		double gammasum = 0.0;
-		for (long it = 1; it <= thy numberOfTimes - 1; it ++) {
+		for (integer it = 1; it <= thy numberOfTimes - 1; it ++) {
 			gammasum += thy gamma [is] [it];
 		}
 
-		for (long js = 1; js <= my numberOfStates; js ++) {
+		for (integer js = 1; js <= my numberOfStates; js ++) {
 			double xisum = 0.0;
-			for (long it = 1; it <= thy numberOfTimes - 1; it ++) {
+			for (integer it = 1; it <= thy numberOfTimes - 1; it ++) {
 				xisum += thy xi [it] [is] [js];
 			}
 			// zero probs signal invalid connections, don't reestimate
@@ -1188,9 +1189,9 @@ void HMM_and_HMMBaumWelch_addEstimate (HMM me, HMMBaumWelch thee, long *obs) {
 		*/
 		if (! my notHidden) {
 			gammasum += thy gamma [is] [thy numberOfTimes];   // now sum all, add last term
-			for (long k = 1; k <= my numberOfObservationSymbols; k ++) {
+			for (integer k = 1; k <= my numberOfObservationSymbols; k ++) {
 				double gammasum_k = 0.0;
-				for (long it = 1; it <= thy numberOfTimes; it ++) {
+				for (integer it = 1; it <= thy numberOfTimes; it ++) {
 					if (obs [it] == k) {
 						gammasum_k += thy gamma [is] [it];
 					}
@@ -1218,7 +1219,7 @@ void HMM_and_HMMBaumWelch_reestimate (HMM me, HMMBaumWelch thee) {
 
 		What to do with the P_k (see Rabiner formulas 109-110)?
 	*/
-	for (long is = 1; is <= my numberOfStates; is ++) {
+	for (integer is = 1; is <= my numberOfStates; is ++) {
 		/*
 			If we have not enough observation sequences it can happen that some probabilities
 			become zero. This means that for some future observation sequences the probability evaluation
@@ -1230,14 +1231,14 @@ void HMM_and_HMMBaumWelch_reestimate (HMM me, HMMBaumWelch thee) {
 			p = thy aij_num [0] [is] / thy aij_denom [0] [is];
 			my transitionProbs [0] [is] = p > 0.0 ? p : thy minProb;
 		}
-		for (long js = 1; js <= my numberOfStates; js ++) {
+		for (integer js = 1; js <= my numberOfStates; js ++) {
 			if (my transitionProbs [is] [js] > 0.0) {
 				p = thy aij_num [is] [js] / thy aij_denom [is] [js];
 				my transitionProbs [is] [js] = p > 0.0 ? p : thy minProb;
 			}
 		}
 		if (! my notHidden) {
-			for (long k = 1; k <= my numberOfObservationSymbols; k ++) {
+			for (integer k = 1; k <= my numberOfObservationSymbols; k ++) {
 				if (my emissionProbs [is] [k] > 0.0) {
 					p = thy bik_num [is] [k] / thy bik_denom [is] [k];
 					my emissionProbs [is] [k] = p > 0.0 ? p : thy minProb;
@@ -1251,22 +1252,22 @@ void HMM_and_HMMBaumWelch_reestimate (HMM me, HMMBaumWelch thee) {
 	}
 }
 
-void HMM_and_HMMBaumWelch_forward (HMM me, HMMBaumWelch thee, long *obs) {
+void HMM_and_HMMBaumWelch_forward (HMM me, HMMBaumWelch thee, integer *obs) {
 	// initialise at t = 1 & scale
 	thy scale [1] = 0.0;
-	for (long js = 1; js <= my numberOfStates; js ++) {
+	for (integer js = 1; js <= my numberOfStates; js ++) {
 		thy alpha [js] [1] = my transitionProbs [0] [js] * my emissionProbs [js] [obs [1]];
 		thy scale [1] += thy alpha [js] [1];
 	}
-	for (long js = 1; js <= my numberOfStates; js ++) {
+	for (integer js = 1; js <= my numberOfStates; js ++) {
 		thy alpha [js] [1] /= thy scale [1];
 	}
 	// recursion
-	for (long it = 2; it <= thy numberOfTimes; it ++) {
+	for (integer it = 2; it <= thy numberOfTimes; it ++) {
 		thy scale [it] = 0.0;
-		for (long js = 1; js <= my numberOfStates; js ++) {
+		for (integer js = 1; js <= my numberOfStates; js ++) {
 			double sum = 0.0;
-			for (long is = 1; is <= my numberOfStates; is ++) {
+			for (integer is = 1; is <= my numberOfStates; is ++) {
 				sum += thy alpha [is] [it - 1] * my transitionProbs [is] [js];
 			}
 
@@ -1274,24 +1275,24 @@ void HMM_and_HMMBaumWelch_forward (HMM me, HMMBaumWelch thee, long *obs) {
 			thy scale [it] += thy alpha [js] [it];
 		}
 
-		for (long js = 1; js <= my numberOfStates; js ++) {
+		for (integer js = 1; js <= my numberOfStates; js ++) {
 			thy alpha [js] [it] /= thy scale [it];
 		}
 	}
 
-	for (long it = 1; it <= thy numberOfTimes; it ++) {
+	for (integer it = 1; it <= thy numberOfTimes; it ++) {
 		thy lnProb += log (thy scale [it]);
 	}
 }
 
-void HMM_and_HMMBaumWelch_backward (HMM me, HMMBaumWelch thee, long *obs) {
-	for (long is = 1; is <= my numberOfStates; is ++) {
+void HMM_and_HMMBaumWelch_backward (HMM me, HMMBaumWelch thee, integer *obs) {
+	for (integer is = 1; is <= my numberOfStates; is ++) {
 		thy beta [is] [thy numberOfTimes] = 1.0 / thy scale [thy numberOfTimes];
 	}
-	for (long it = thy numberOfTimes - 1; it >= 1; it --) {
-		for (long is = 1; is <= my numberOfStates; is ++) {
-			double sum = 0.0;
-			for (long js = 1; js <= my numberOfStates; js ++) {
+	for (integer it = thy numberOfTimes - 1; it >= 1; it --) {
+		for (integer is = 1; is <= my numberOfStates; is ++) {
+			real80 sum = 0.0;
+			for (integer js = 1; js <= my numberOfStates; js ++) {
 				sum += thy beta [js] [it + 1] * my transitionProbs [is] [js] * my emissionProbs [js] [obs [it + 1]];
 			}
 			thy beta [is] [it] = sum / thy scale [it];
@@ -1302,57 +1303,57 @@ void HMM_and_HMMBaumWelch_backward (HMM me, HMMBaumWelch thee, long *obs) {
 /*************************** HMM decoding ***********************************/
 
 // precondition: valid symbols, i.e. 1 <= o[i] <= my numberOfSymbols for i=1..nt
-void HMM_and_HMMViterbi_decode (HMM me, HMMViterbi thee, long *obs) {
-	long ntimes = thy numberOfTimes;
+void HMM_and_HMMViterbi_decode (HMM me, HMMViterbi thee, integer *obs) {
+	integer ntimes = thy numberOfTimes;
 	// initialisation
-	for (long is = 1; is <= my numberOfStates; is++) {
-		thy viterbi[is][1] = my transitionProbs[0][is] * my emissionProbs[is][ obs[1] ];
-		thy bp[is][1] = 0;
+	for (integer is = 1; is <= my numberOfStates; is ++) {
+		thy viterbi [is] [1] = my transitionProbs [0] [is] * my emissionProbs [is] [obs [1]];
+		thy bp [is] [1] = 0;
 	}
 	// recursion
-	for (long it = 2; it <= ntimes; it++) {
-		for (long is = 1; is <= my numberOfStates; is++) {
+	for (integer it = 2; it <= ntimes; it ++) {
+		for (integer is = 1; is <= my numberOfStates; is ++) {
 			// all transitions isp -> is from previous time to current
 			double max_score = -1; // any negative number is ok
-			for (long isp = 1; isp <= my numberOfStates; isp++) {
-				double score = thy viterbi[isp][it - 1] * my transitionProbs[isp][is]; // * my emissionProbs[is][ obs[it] ]
+			for (integer isp = 1; isp <= my numberOfStates; isp ++) {
+				double score = thy viterbi [isp] [it - 1] * my transitionProbs [isp] [is]; // * my emissionProbs [is] [obs [it]]
 				if (score > max_score) {
 					max_score = score;
-					thy bp[is][it] = isp;
+					thy bp [is] [it] = isp;
 				}
 			}
 			thy viterbi[is][it] = max_score * my emissionProbs[is][ obs[it] ];
 		}
 	}
 	// path starts at state with best end probability
-	thy path[ntimes] = 1;
-	thy prob = thy viterbi[1][ntimes];
-	for (long is = 2; is <= my numberOfStates; is++) {
-		if (thy viterbi[is][ntimes] > thy prob) {
-			thy prob = thy viterbi[ thy path[ntimes] = is ][ntimes];
+	thy path [ntimes] = 1;
+	thy prob = thy viterbi [1] [ntimes];
+	for (integer is = 2; is <= my numberOfStates; is ++) {
+		if (thy viterbi [is] [ntimes] > thy prob) {
+			thy prob = thy viterbi [thy path [ntimes] = is] [ntimes];
 		}
 	}
 	// trace back and get path
-	for (long it = ntimes; it > 1; it--) {
-		thy path[it - 1] = thy bp[ thy path[it] ][it];
+	for (integer it = ntimes; it > 1; it --) {
+		thy path [it - 1] = thy bp [thy path [it]] [it];
 	}
 }
 
 autoHMMStateSequence HMM_and_HMMObservationSequence_to_HMMStateSequence (HMM me, HMMObservationSequence thee) {
 	try {
 		autoStringsIndex si = HMM_and_HMMObservationSequence_to_StringsIndex (me, thee);
-		long *obs = si -> classIndex; // convenience
-		long numberOfUnknowns = StringsIndex_countItems (si.get(), 0);
+		integer *obs = si -> classIndex; // convenience
+		integer numberOfUnknowns = StringsIndex_countItems (si.get(), 0);
 
 		if (numberOfUnknowns > 0) {
 			Melder_throw (U"Unknown observation symbol(s) (# = ", numberOfUnknowns, U").");
 		}
 
-		long numberOfTimes = thy rows.size;
+		integer numberOfTimes = thy rows.size;
 		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 ++) {
+		for (integer it = 1; it <= numberOfTimes; it ++) {
 			HMMState hmms = my states->at [v -> path [it]];
 			his strings [it] = Melder_dup (hmms -> label);
 			his numberOfStrings ++;
@@ -1365,8 +1366,8 @@ autoHMMStateSequence HMM_and_HMMObservationSequence_to_HMMStateSequence (HMM me,
 
 double HMM_and_HMMStateSequence_getProbability (HMM me, HMMStateSequence thee) {
 	autoStringsIndex si = HMM_and_HMMStateSequence_to_StringsIndex (me, thee);
-	long numberOfUnknowns = StringsIndex_countItems (si.get(), 0);
-	long *index = si -> classIndex;
+	integer numberOfUnknowns = StringsIndex_countItems (si.get(), 0);
+	integer *index = si -> classIndex;
 
 	if (index == 0) {
 		return undefined;
@@ -1380,13 +1381,13 @@ double HMM_and_HMMStateSequence_getProbability (HMM me, HMMStateSequence thee) {
 		Melder_throw (U"You cannot start with this state.");
 	}
 	double lnp = log (p0);
-	for (long it = 2; it <= thy numberOfStrings; it ++) {
+	for (integer it = 2; it <= thy numberOfStrings; it ++) {
 		lnp += log (my transitionProbs [index [it - 1]] [index [it]]);
 	}
 	return lnp;
 }
 
-double HMM_getProbabilityAtTimeBeingInState (HMM me, long itime, long istate) {
+double HMM_getProbabilityAtTimeBeingInState (HMM me, integer itime, integer istate) {
 	if (istate < 1 || istate > my numberOfStates) {
 		return undefined;
 	}
@@ -1395,35 +1396,35 @@ double HMM_getProbabilityAtTimeBeingInState (HMM me, long itime, long istate) {
 	autoNUMvector<double> alpha_t (1, my numberOfStates);
 	autoNUMvector<double> alpha_tm1 (1, my numberOfStates);
 
-	for (long js = 1; js <= my numberOfStates; js ++) {
+	for (integer js = 1; js <= my numberOfStates; js ++) {
 		alpha_t [js] = my transitionProbs [0] [js];
 		scale [1] += alpha_t [js];
 	}
-	for (long js = 1; js <= my numberOfStates; js ++) {
+	for (integer js = 1; js <= my numberOfStates; js ++) {
 		alpha_t [js] /= scale [1];
 	}
 	// recursion
-	for (long it = 2; it <= itime; it ++) {
-		for (long js = 1; js <= my numberOfStates; js ++) {
+	for (integer it = 2; it <= itime; it ++) {
+		for (integer js = 1; js <= my numberOfStates; js ++) {
 			alpha_tm1 [js] = alpha_t [js];
 		}
 
-		for (long js = 1; js <= my numberOfStates; js ++) {
-			double sum = 0.0;
-			for (long is = 1; is <= my numberOfStates; is ++) {
+		for (integer js = 1; js <= my numberOfStates; js ++) {
+			real80 sum = 0.0;
+			for (integer is = 1; is <= my numberOfStates; is ++) {
 				sum += alpha_tm1 [is] * my transitionProbs [is] [js];
 			}
 			alpha_t [js] = sum;
 			scale [it] += alpha_t [js];
 		}
 
-		for (long js = 1; js <= my numberOfStates; js ++) {
+		for (integer js = 1; js <= my numberOfStates; js ++) {
 			alpha_t [js] /= scale [it];
 		}
 	}
 
-	double lnp = 0.0;
-	for (long it = 1; it <= itime; it ++) {
+	real80 lnp = 0.0;
+	for (integer it = 1; it <= itime; it ++) {
 		lnp += log (scale [it]);
 	}
 
@@ -1431,7 +1432,7 @@ double HMM_getProbabilityAtTimeBeingInState (HMM me, long itime, long istate) {
 	return lnp;
 }
 
-double HMM_getProbabilityAtTimeBeingInStateEmittingSymbol (HMM me, long itime, long istate, long isymbol) {
+double HMM_getProbabilityAtTimeBeingInStateEmittingSymbol (HMM me, integer itime, integer istate, integer isymbol) {
 	// for a notHidden model emissionProbs may be zero!
 	if (isymbol < 1 || isymbol > my numberOfObservationSymbols || my emissionProbs[istate][isymbol] == 0) {
 		return undefined;
@@ -1440,57 +1441,56 @@ double HMM_getProbabilityAtTimeBeingInStateEmittingSymbol (HMM me, long itime, l
 	return ( isundef (lnp) ? undefined : lnp + log (my emissionProbs [istate] [isymbol]) );
 }
 
-double HMM_getProbabilityOfObservations (HMM me, long *obs, long numberOfTimes) {
-	autoNUMvector<double> scale (1, numberOfTimes);
-	autoNUMvector<double> alpha_t (1, my numberOfStates);
-	autoNUMvector<double> alpha_tm1 (1, my numberOfStates);
+double HMM_getProbabilityOfObservations (HMM me, integer *obs, integer numberOfTimes) {
+	autoNUMvector <double> scale (1, numberOfTimes);
+	autoNUMvector <double> alpha_t (1, my numberOfStates);
+	autoNUMvector <double> alpha_tm1 (1, my numberOfStates);
 
 	// initialise
-	for (long js = 1; js <= my numberOfStates; js++) {
-		alpha_t[js] = my transitionProbs[0][js] * my emissionProbs[js][ obs[1] ];
-		scale[1] += alpha_t[js];
+	for (integer js = 1; js <= my numberOfStates; js ++) {
+		alpha_t [js] = my transitionProbs [0] [js] * my emissionProbs [js] [obs [1]];
+		scale [1] += alpha_t [js];
 	}
-	if (scale[1] == 0) {
+	if (scale [1] == 0.0) {
 		Melder_throw (U"The observation sequence starts with a symbol which state has starting probability zero.");
 	}
-	for (long js = 1; js <= my numberOfStates; js++) {
-		alpha_t[js] /= scale[1];
+	for (integer js = 1; js <= my numberOfStates; js ++) {
+		alpha_t [js] /= scale [1];
 	}
 
 	// recursion
-	for (long it = 2; it <= numberOfTimes; it++) {
-		for (long js = 1; js <= my numberOfStates; js++) {
-			alpha_tm1[js] = alpha_t[js];
+	for (integer it = 2; it <= numberOfTimes; it ++) {
+		for (integer js = 1; js <= my numberOfStates; js ++) {
+			alpha_tm1 [js] = alpha_t [js];
 		}
 
-		for (long js = 1; js <= my numberOfStates; js++) {
-			double sum = 0.0;
-			for (long is = 1; is <= my numberOfStates; is++) {
-				sum += alpha_tm1[is] * my transitionProbs[is][js];
+		for (integer js = 1; js <= my numberOfStates; js ++) {
+			real80 sum = 0.0;
+			for (integer is = 1; is <= my numberOfStates; is ++) {
+				sum += alpha_tm1 [is] * my transitionProbs [is] [js];
 			}
-
-			alpha_t[js] = sum * my emissionProbs[js][ obs[it] ];
-			scale[it] += alpha_t[js];
+			alpha_t [js] = sum * my emissionProbs [js] [obs [it]];
+			scale [it] += alpha_t [js];
 		}
-		if (scale[it] <= 0) {
+		if (scale [it] <= 0.0) {
 			return -INFINITY;
 		}
-		for (long js = 1; js <= my numberOfStates; js++) {
-			alpha_t[js] /= scale[it];
+		for (integer js = 1; js <= my numberOfStates; js ++) {
+			alpha_t [js] /= scale [it];
 		}
 	}
 
-	double lnp = 0;
-	for (long it = 1; it <= numberOfTimes; it++) {
-		lnp += log (scale[it]);
+	double lnp = 0.0;
+	for (integer it = 1; it <= numberOfTimes; it ++) {
+		lnp += log (scale [it]);
 	}
 	return lnp;
 }
 
 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.get(), 0);
+	integer *index = si -> classIndex;
+	integer numberOfUnknowns = StringsIndex_countItems (si.get(), 0);
 	if (numberOfUnknowns > 0) {
 		Melder_throw (U"Unknown observations (# = ", numberOfUnknowns, U").");
 	}
@@ -1508,19 +1508,19 @@ double HMM_and_HMMObservationSequence_getPerplexity (HMM me, HMMObservationSeque
 	return isundef (ce) ? undefined : pow (2.0, ce);
 }
 
-autoHMM HMM_createFromHMMObservationSequence (HMMObservationSequence me, long numberOfStates, int leftToRight) {
+autoHMM HMM_createFromHMMObservationSequence (HMMObservationSequence me, integer numberOfStates, int leftToRight) {
 	try {
 		autoHMM thee = Thing_new (HMM);
 		autoStrings s = HMMObservationSequence_to_Strings (me);
 		autoDistributions d = Strings_to_Distributions (s.get());
 
-		long numberOfObservationSymbols = d -> numberOfRows;
+		integer numberOfObservationSymbols = d -> numberOfRows;
 		thy notHidden = numberOfStates < 1;
 		numberOfStates = numberOfStates > 0 ? numberOfStates : numberOfObservationSymbols;
 
 		HMM_init (thee.get(), numberOfStates, numberOfObservationSymbols, leftToRight);
 
-		for (long i = 1; i <= numberOfObservationSymbols; i++) {
+		for (integer i = 1; i <= numberOfObservationSymbols; i++) {
 			const char32 *label = d -> rowLabels[i];
 			autoHMMObservation hmmo = HMMObservation_create (label, 0, 0, 0);
 			HMM_addObservation_move (thee.get(), hmmo.move());
@@ -1555,7 +1555,7 @@ autoStringsIndex HMM_and_HMMObservationSequence_to_StringsIndex (HMM me, HMMObse
 	try {
 		autoStrings classes = Thing_new (Strings);
 		classes -> strings = NUMvector<char32 *> (1, my numberOfObservationSymbols);
-		for (long is = 1; is <= my numberOfObservationSymbols; is ++) {
+		for (integer is = 1; is <= my numberOfObservationSymbols; is ++) {
 			HMMObservation hmmo = my observationSymbols->at [is];
 			classes -> strings [is] = Melder_dup (hmmo -> label);
 			classes -> numberOfStrings ++;
@@ -1572,7 +1572,7 @@ autoStringsIndex HMM_and_HMMStateSequence_to_StringsIndex (HMM me, HMMStateSeque
 	try {
 		autoStrings classes = Thing_new (Strings);
 		classes -> strings = NUMvector<char32 *> (1, my numberOfObservationSymbols);
-		for (long is = 1; is <= my numberOfStates; is ++) {
+		for (integer is = 1; is <= my numberOfStates; is ++) {
 			HMMState hmms = my states->at [is];
 			classes -> strings [is] = Melder_dup (hmms -> label);
 			classes -> numberOfStrings ++;
@@ -1607,27 +1607,27 @@ autoTableOfReal HMM_and_HMMStateSequence_to_TableOfReal_transitions (HMM me, HMM
 
 autoTableOfReal StringsIndex_to_TableOfReal_transitions (StringsIndex me, int probabilities) {
 	try {
-		long numberOfTypes = my classes->size;
+		integer numberOfTypes = my classes->size;
 
 		autoTableOfReal thee = TableOfReal_create (numberOfTypes + 1, numberOfTypes + 1);
-		for (long i = 1; i <= numberOfTypes; i ++) {
+		for (integer i = 1; i <= numberOfTypes; i ++) {
 			SimpleString s = (SimpleString) my classes->at [i];
 			TableOfReal_setRowLabel (thee.get(), i, s -> string);
 			TableOfReal_setColumnLabel (thee.get(), i, s -> string);
 		}
-		for (long i = 2; i <= my numberOfItems; i ++) {
+		for (integer i = 2; i <= my numberOfItems; i ++) {
 			if (my classIndex [i - 1] > 0 && my classIndex [i] > 0) { // a zero is a restart!
 				thy data [my classIndex [i-1]] [my classIndex [i]] ++;
 			}
 		}
-		double sum = 0.0;
-		for (long i = 1; i <= numberOfTypes; i ++) {
+		real80 sum = 0.0;
+		for (integer i = 1; i <= numberOfTypes; i ++) {
 			double rowSum = 0.0, colSum = 0.0;
-			for (long j = 1; j <= numberOfTypes; j ++) {
+			for (integer j = 1; j <= numberOfTypes; j ++) {
 				rowSum += thy data [i] [j];
 			}
 			thy data [i] [numberOfTypes + 1] = rowSum;
-			for (long j = 1; j <= numberOfTypes; j ++) {
+			for (integer j = 1; j <= numberOfTypes; j ++) {
 				colSum += thy data [j] [i];
 			}
 			thy data[numberOfTypes + 1][i] = colSum;
@@ -1635,14 +1635,14 @@ autoTableOfReal StringsIndex_to_TableOfReal_transitions (StringsIndex me, int pr
 		}
 		thy data [numberOfTypes + 1] [numberOfTypes + 1] = sum;
 		if (probabilities && sum > 0) {
-			for (long i = 1; i <= numberOfTypes; i ++) {
+			for (integer i = 1; i <= numberOfTypes; i ++) {
 				if (thy data [i] [numberOfTypes + 1] > 0.0) {
-					for (long j = 1; j <= numberOfTypes; j++) {
+					for (integer j = 1; j <= numberOfTypes; j++) {
 						thy data [i] [j] /= thy data [i] [numberOfTypes + 1];
 					}
 				}
 			}
-			for (long i = 1; i <= numberOfTypes; i ++) {
+			for (integer i = 1; i <= numberOfTypes; i ++) {
 				thy data [i] [numberOfTypes + 1] /= sum;
 				thy data [numberOfTypes + 1] [i] /= sum;
 			}
diff --git a/dwtools/HMM.h b/dwtools/HMM.h
index e9d89d8..bf2000d 100644
--- a/dwtools/HMM.h
+++ b/dwtools/HMM.h
@@ -43,11 +43,11 @@ Collection_define (HMMObservationList, OrderedOf, HMMObservation) {
 /********** class HMMBaumWelch **********/
 
 Thing_define (HMMBaumWelch, Daata) {
-	long capacity;
-	long numberOfTimes;
-	long totalNumberOfSequences;
-	long numberOfStates;
-	long numberOfSymbols;
+	integer capacity;
+	integer numberOfTimes;
+	integer totalNumberOfSequences;
+	integer numberOfStates;
+	integer numberOfSymbols;
 	double lnProb;
 	double minProb;
 	double **alpha;
@@ -72,9 +72,9 @@ Thing_define (HMMObservationSequence, Table) {
 Collection_define (HMMObservationSequenceBag, CollectionOf, HMMObservationSequence) {
 };
 
-autoHMMObservationSequence HMMObservationSequence_create (long numberOfItems, long dataLength);
+autoHMMObservationSequence HMMObservationSequence_create (integer numberOfItems, integer dataLength);
 
-void HMMObservationSequence_removeObservation (HMMObservationSequence me, long index);
+void HMMObservationSequence_removeObservation (HMMObservationSequence me, integer index);
 
 autoStrings HMMObservationSequence_to_Strings (HMMObservationSequence me);
 
@@ -88,32 +88,32 @@ autoTableOfReal HMMObservationSequence_to_TableOfReal_transitions (HMMObservatio
 
 autoTableOfReal HMM_and_HMMObservationSequence_to_TableOfReal_transitions (HMM me, HMMObservationSequence thee, int probabilities);
 
-long HMMObservationSequence_getNumberOfObservations (HMMObservationSequence me);
+integer HMMObservationSequence_getNumberOfObservations (HMMObservationSequence me);
 
-long HMMObservationSequenceBag_getLongestSequence (HMMObservationSequenceBag me);
+integer HMMObservationSequenceBag_getLongestSequence (HMMObservationSequenceBag me);
 
 autoTableOfReal HMMStateSequence_to_TableOfReal_transitions (HMMStateSequence me);
 
 autoTableOfReal HMM_and_HMMStateSequence_to_TableOfReal_transitions (HMM me, HMMStateSequence thee, int probabilities);
 
-autoHMMStateSequence HMMStateSequence_create (long numberOfItems);
+autoHMMStateSequence HMMStateSequence_create (integer numberOfItems);
 
 autoStrings HMMStateSequence_to_Strings (HMMStateSequence me);
 
 void HMMState_setLabel (HMMState me, char32 *label);
 
 
-autoHMM HMM_create (int leftToRight, long numberOfStates, long numberOfObservationSymbols);
+autoHMM HMM_create (int leftToRight, integer numberOfStates, integer numberOfObservationSymbols);
 
 autoHMM HMM_createSimple (int leftToRight, const char32 *states_string, const char32 *symbols_string);
 
-autoHMM HMM_createContinuousModel (int leftToRight, long numberOfStates, long numberOfObservationSymbols,
-	long numberOfMixtureComponentsPerSymbol, long componentDimension, long componentStorage);
+autoHMM HMM_createContinuousModel (int leftToRight, integer numberOfStates, integer numberOfObservationSymbols,
+	integer numberOfMixtureComponentsPerSymbol, integer componentDimension, integer componentStorage);
 
-autoHMM HMM_createFullContinuousModel (int leftToRight, long numberOfStates, long numberOfObservationSymbols,
-	long numberOfFeatureStreams, long *dimensionOfStream, long *numberOfGaussiansforStream);
+autoHMM HMM_createFullContinuousModel (int leftToRight, integer numberOfStates, integer numberOfObservationSymbols,
+	integer numberOfFeatureStreams, integer *dimensionOfStream, integer *numberOfGaussiansforStream);
 
-autoHMM HMM_createFromHMMObservationSequence (HMMObservationSequence me, long numberOfStates, int leftToRight);
+autoHMM HMM_createFromHMMObservationSequence (HMMObservationSequence me, integer numberOfStates, int leftToRight);
 
 void HMM_draw (HMM me, Graphics g, int garnish);
 
@@ -147,22 +147,22 @@ void HMM_unExpandPCA (HMM me);
 /*
 	Set the probabilities. A probability zero value indicates that this p cannot be changed during training/learning.
 */
-void HMM_setTransitionProbabilities (HMM me, long state_number, char32 *state_probs);
+void HMM_setTransitionProbabilities (HMM me, integer state_number, char32 *state_probs);
 
-void HMM_setEmissionProbabilities (HMM me, long state_number, char32 *emission_probs);
+void HMM_setEmissionProbabilities (HMM me, integer state_number, char32 *emission_probs);
 
 void HMM_setStartProbabilities (HMM me, char32 *probs);
 
 
-double HMM_getProbabilityAtTimeBeingInState (HMM me, long itime, long istate);
+double HMM_getProbabilityAtTimeBeingInState (HMM me, integer itime, integer istate);
 
-double HMM_getProbabilityAtTimeBeingInStateEmittingSymbol (HMM me, long itime, long istate, long isymbol);
+double HMM_getProbabilityAtTimeBeingInStateEmittingSymbol (HMM me, integer itime, integer istate, integer isymbol);
 
-double HMM_getExpectedValueOfDurationInState (HMM me, long istate);
+double HMM_getExpectedValueOfDurationInState (HMM me, integer istate);
 
-double HMM_getProbabilityOfStayingInState (HMM me, long istate, long numberOfTimeUnits);
+double HMM_getProbabilityOfStayingInState (HMM me, integer istate, integer numberOfTimeUnits);
 
-double HMM_and_HMM_getCrossEntropy (HMM me, HMM thee, long observationLength, int symmetric);
+double HMM_and_HMM_getCrossEntropy (HMM me, HMM thee, integer observationLength, int symmetric);
 
 double HMM_and_HMM_and_HMMObservationSequence_getCrossEntropy (HMM me, HMM thee, HMMObservationSequence him);
 
@@ -172,7 +172,7 @@ autoTableOfReal HMM_extractEmissionProbabilities (HMM me);
 
 /* HMM & HMMObservationSequence ****/
 
-autoHMMObservationSequence HMM_to_HMMObservationSequence (HMM me, long initialState, long numberOfItems);
+autoHMMObservationSequence HMM_to_HMMObservationSequence (HMM me, integer initialState, integer numberOfItems);
 
 autoHMMStateSequence HMM_and_HMMObservationSequence_to_HMMStateSequence (HMM me, HMMObservationSequence thee);
 
diff --git a/dwtools/HMM_def.h b/dwtools/HMM_def.h
index 8b187f0..fba2d3d 100644
--- a/dwtools/HMM_def.h
+++ b/dwtools/HMM_def.h
@@ -41,10 +41,10 @@ oo_DEFINE_CLASS (HMM, Daata)
 
 	oo_INT (notHidden) // to model a Markov model instead of HMM
 	oo_INT (leftToRight)
-	oo_LONG (numberOfStates)
-	oo_LONG (numberOfObservationSymbols)
-	oo_LONG (numberOfMixtureComponents)
-	oo_LONG (componentDimension)
+	oo_INTEGER (numberOfStates)
+	oo_INTEGER (numberOfObservationSymbols)
+	oo_INTEGER (numberOfMixtureComponents)
+	oo_INTEGER (componentDimension)
 	oo_INT (componentStorage)
 	oo_DOUBLE_MATRIX_FROM (transitionProbs, 0, numberOfStates, 1, numberOfStates + 1) // row 0: initial probabilities
 	oo_DOUBLE_MATRIX (emissionProbs, numberOfStates, numberOfObservationSymbols)
@@ -63,12 +63,12 @@ oo_END_CLASS (HMM)
 #define ooSTRUCT HMMViterbi
 oo_DEFINE_CLASS (HMMViterbi, Daata)
 
-	oo_LONG (numberOfTimes)
-	oo_LONG (numberOfStates)
+	oo_INTEGER (numberOfTimes)
+	oo_INTEGER (numberOfStates)
 	oo_DOUBLE (prob)
 	oo_DOUBLE_MATRIX (viterbi, numberOfStates, numberOfTimes)
-	oo_LONG_MATRIX (bp, numberOfStates, numberOfTimes)
-	oo_LONG_VECTOR (path, numberOfTimes)
+	oo_INTEGER_MATRIX (bp, numberOfStates, numberOfTimes)
+	oo_INTEGER_VECTOR (path, numberOfTimes)
 
 oo_END_CLASS (HMMViterbi)
 #undef ooSTRUCT
diff --git a/dwtools/KlattGrid.cpp b/dwtools/KlattGrid.cpp
index ad5bcb9..49fa8d1 100644
--- a/dwtools/KlattGrid.cpp
+++ b/dwtools/KlattGrid.cpp
@@ -272,7 +272,7 @@ static bool FormantGrid_Intensities_isFormantDefined (FormantGrid me, OrderedOf<
 	return exists;
 }
 
-static void check_formants (long numberOfFormants, long *ifb, long *ife) {
+static void check_formants (integer numberOfFormants, integer *ifb, integer *ife) {
 	if (numberOfFormants <= 0 || *ifb > numberOfFormants || *ife < *ifb || *ife < 1) {
 		*ife = 0;  // overrules everything *ifb value is a don't care now
 		return;
@@ -1560,11 +1560,11 @@ static autoSound Sound_VocalTractGrid_CouplingGrid_filter_cascade (Sound me, Voc
 		long numberOfTrachealAntiFormants = tracheal_antiformants -> formants.size;
 		long numberOfNasalFormants = nasal_formants -> formants.size;
 		long numberOfNasalAntiFormants = nasal_antiformants -> formants.size;
-		check_formants (numberOfFormants, & (pv -> startOralFormant), & (pv -> endOralFormant));
-		check_formants (numberOfNasalFormants, & (pv -> startNasalFormant), & (pv -> endNasalFormant));
-		check_formants (numberOfTrachealFormants, & (pc -> startTrachealFormant), & (pc -> endTrachealFormant));
-		check_formants (numberOfNasalAntiFormants, & (pv -> startNasalAntiFormant), & (pv -> endNasalAntiFormant));
-		check_formants (numberOfTrachealAntiFormants, & (pc -> startTrachealAntiFormant), & (pc -> endTrachealAntiFormant));
+		check_formants (numberOfFormants, & pv -> startOralFormant, & pv -> endOralFormant);
+		check_formants (numberOfNasalFormants, & pv -> startNasalFormant, & pv -> endNasalFormant);
+		check_formants (numberOfTrachealFormants, & pc -> startTrachealFormant, & pc -> endTrachealFormant);
+		check_formants (numberOfNasalAntiFormants, & pv -> startNasalAntiFormant, & pv -> endNasalAntiFormant);
+		check_formants (numberOfTrachealAntiFormants, & pc -> startTrachealAntiFormant, & pc -> endTrachealAntiFormant);
 
 		autoSound him = Data_copy (me);
 
diff --git a/dwtools/KlattGridEditors.h b/dwtools/KlattGridEditors.h
index fb1620d..7c1f092 100644
--- a/dwtools/KlattGridEditors.h
+++ b/dwtools/KlattGridEditors.h
@@ -2,7 +2,7 @@
 #define _KlattGridEditors_h_
 /* KlattGridEditors.h
  *
- * Copyright (C) 2009-2011 David Weenink
+ * Copyright (C) 2009-2011 David Weenink, 2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -44,8 +44,6 @@ Thing_define (KlattGrid_OpenPhaseTierEditor, KlattGrid_RealTierEditor) {
 		override { return 1.0; }
 	const char32 * v_quantityText ()
 		override { return U"Open phase (0..1)"; }
-	const char32 * v_quantityKey ()
-		override { return U"Open phase"; }
 	const char32 * v_rightTickUnits ()
 		override { return U""; }
 	double v_defaultYmin ()
@@ -62,10 +60,6 @@ Thing_define (KlattGrid_OpenPhaseTierEditor, KlattGrid_RealTierEditor) {
 		override { return U"Minimum (0..1)"; }
 	const char32 * v_ymaxText ()
 		override { return U"Maximum (0..1)"; }
-	const char32 * v_yminKey ()
-		override { return U"Minimum"; }
-	const char32 * v_ymaxKey ()
-		override { return U"Maximum"; }
 };
 
 autoKlattGrid_OpenPhaseTierEditor KlattGrid_OpenPhaseTierEditor_create (const char32 *title, KlattGrid klattgrid);
@@ -78,8 +72,6 @@ Thing_define (KlattGrid_CollisionPhaseTierEditor, KlattGrid_RealTierEditor) {
 		override { return 1.0; }
 	const char32 * v_quantityText ()
 		override { return U"Collision phase (0..1)"; }
-	const char32 * v_quantityKey ()
-		override { return U"Collision phase"; }
 	const char32 * v_rightTickUnits ()
 		override { return U""; }
 	double v_defaultYmin ()
@@ -96,10 +88,6 @@ Thing_define (KlattGrid_CollisionPhaseTierEditor, KlattGrid_RealTierEditor) {
 		override { return U"Minimum (0..1)"; }
 	const char32 * v_ymaxText ()
 		override { return U"Maximum (0..1)"; }
-	const char32 * v_yminKey ()
-		override { return U"Minimum"; }
-	const char32 * v_ymaxKey ()
-		override { return U"Maximum"; }
 };
 
 autoKlattGrid_CollisionPhaseTierEditor KlattGrid_CollisionPhaseTierEditor_create (const char32 *title, KlattGrid klattgrid);
@@ -110,8 +98,6 @@ Thing_define (KlattGrid_Power1TierEditor, KlattGrid_RealTierEditor) {
 		override { return 0.0; }
 	const char32 * v_quantityText ()
 		override { return U"Power1"; }
-	const char32 * v_quantityKey ()
-		override { return U"Power1"; }
 	const char32 * v_rightTickUnits ()
 		override { return U""; }
 	double v_defaultYmin ()
@@ -128,10 +114,6 @@ Thing_define (KlattGrid_Power1TierEditor, KlattGrid_RealTierEditor) {
 		override { return U"Minimum"; }
 	const char32 * v_ymaxText ()
 		override { return U"Maximum"; }
-	const char32 * v_yminKey ()
-		override { return U"Minimum"; }
-	const char32 * v_ymaxKey ()
-		override { return U"Maximum"; }
 };
 
 autoKlattGrid_Power1TierEditor KlattGrid_Power1TierEditor_create (const char32 *title, KlattGrid klattgrid);
@@ -142,8 +124,6 @@ Thing_define (KlattGrid_Power2TierEditor, KlattGrid_RealTierEditor) {
 		override { return 0.0; }
 	const char32 * v_quantityText ()
 		override { return U"Power2"; }
-	const char32 * v_quantityKey ()
-		override { return U"Power2"; }
 	const char32 * v_rightTickUnits ()
 		override { return U""; }
 	double v_defaultYmin ()
@@ -160,10 +140,6 @@ Thing_define (KlattGrid_Power2TierEditor, KlattGrid_RealTierEditor) {
 		override { return U"Minimum"; }
 	const char32 * v_ymaxText ()
 		override { return U"Maximum"; }
-	const char32 * v_yminKey ()
-		override { return U"Minimum"; }
-	const char32 * v_ymaxKey ()
-		override { return U"Maximum"; }
 };
 
 autoKlattGrid_Power2TierEditor KlattGrid_Power2TierEditor_create (const char32 *title, KlattGrid klattgrid);
@@ -176,8 +152,6 @@ Thing_define (KlattGrid_DoublePulsingTierEditor, KlattGrid_RealTierEditor) {
 		override { return 1.0; }
 	const char32 * v_quantityText ()
 		override { return U"Double pulsing (0..1)"; }
-	const char32 * v_quantityKey ()
-		override { return U"Double pulsing"; }
 	const char32 * v_rightTickUnits ()
 		override { return U""; }
 	double v_defaultYmin ()
@@ -194,10 +168,6 @@ Thing_define (KlattGrid_DoublePulsingTierEditor, KlattGrid_RealTierEditor) {
 		override { return U"Minimum (0..1)"; }
 	const char32 * v_ymaxText ()
 		override { return U"Maximum (0..1)"; }
-	const char32 * v_yminKey ()
-		override { return U"Minimum"; }
-	const char32 * v_ymaxKey ()
-		override { return U"Maximum"; }
 };
 
 autoKlattGrid_DoublePulsingTierEditor KlattGrid_DoublePulsingTierEditor_create (const char32 *title, KlattGrid klattgrid);
@@ -210,8 +180,6 @@ Thing_define (KlattGrid_PitchTierEditor, KlattGrid_RealTierEditor) {
 		override { return 0.0; }
 	const char32 * v_quantityText ()
 		override { return U"Frequency (Hz)"; }
-	const char32 * v_quantityKey ()
-		override { return U"Frequency"; }
 	const char32 * v_rightTickUnits ()
 		override { return U" Hz"; }
 	double v_defaultYmin ()
@@ -228,10 +196,6 @@ Thing_define (KlattGrid_PitchTierEditor, KlattGrid_RealTierEditor) {
 		override { return U"Minimum frequency (Hz)"; }
 	const char32 * v_ymaxText ()
 		override { return U"Maximum frequency (Hz)"; }
-	const char32 * v_yminKey ()
-		override { return U"Minimum frequency"; }
-	const char32 * v_ymaxKey ()
-		override { return U"Maximum frequency"; }
 };
 
 autoKlattGrid_PitchTierEditor KlattGrid_PitchTierEditor_create (const char32 *title, KlattGrid klattgrid);
@@ -244,8 +208,6 @@ Thing_define (KlattGrid_FlutterTierEditor, KlattGrid_RealTierEditor) {
 		override { return 1.0; }
 	const char32 * v_quantityText ()
 		override { return U"Flutter (0..1)"; }
-	const char32 * v_quantityKey ()
-		override { return U"Flutter"; }
 	const char32 * v_rightTickUnits ()
 		override { return U""; }
 	double v_defaultYmin ()
@@ -262,10 +224,6 @@ Thing_define (KlattGrid_FlutterTierEditor, KlattGrid_RealTierEditor) {
 		override { return U"Minimum (0..1)"; }
 	const char32 * v_ymaxText ()
 		override { return U"Maximum (0..1)"; }
-	const char32 * v_yminKey ()
-		override { return U"Minimum"; }
-	const char32 * v_ymaxKey ()
-		override { return U"Maximum"; }
 };
 
 autoKlattGrid_FlutterTierEditor KlattGrid_FlutterTierEditor_create (const char32 *title, KlattGrid klattgrid);
@@ -276,8 +234,6 @@ Thing_define (KlattGrid_IntensityTierEditor, KlattGrid_RealTierEditor) {
 		override;
 	const char32 * v_quantityText ()
 		override { return U"Intensity (dB)"; }
-	const char32 * v_quantityKey ()
-		override { return U"Intensity"; }
 	const char32 * v_rightTickUnits ()
 		override { return U" dB"; }
 	double v_defaultYmin ()
@@ -294,10 +250,6 @@ Thing_define (KlattGrid_IntensityTierEditor, KlattGrid_RealTierEditor) {
 		override { return U"Minimum intensity (dB)"; }
 	const char32 * v_ymaxText ()
 		override { return U"Maximum intensity (dB)"; }
-	const char32 * v_yminKey ()
-		override { return U"Minimum intensity"; }
-	const char32 * v_ymaxKey ()
-		override { return U"Maximum intensity"; }
 };
 
 void KlattGrid_IntensityTierEditor_init (KlattGrid_IntensityTierEditor me, const char32 *title, KlattGrid klattgrid, RealTier tier);
@@ -306,8 +258,6 @@ void KlattGrid_IntensityTierEditor_init (KlattGrid_IntensityTierEditor me, const
 Thing_define (KlattGrid_DecibelTierEditor, KlattGrid_IntensityTierEditor) {
 	const char32 * v_quantityText ()
 		override { return U"Amplitude (dB)"; }
-	const char32 * v_quantityKey ()
-		override { return U"Amplitude"; }
 	const char32 * v_rightTickUnits ()
 		override { return U" dB"; }
 	double v_defaultYmin ()
@@ -324,10 +274,6 @@ Thing_define (KlattGrid_DecibelTierEditor, KlattGrid_IntensityTierEditor) {
 		override { return U"Minimum amplitude (dB)"; }
 	const char32 * v_ymaxText ()
 		override { return U"Maximum amplitude (dB)"; }
-	const char32 * v_yminKey ()
-		override { return U"Minimum amplitude"; }
-	const char32 * v_ymaxKey ()
-		override { return U"Maximum amplitude"; }
 };
 
 autoKlattGrid_DecibelTierEditor KlattGrid_DecibelTierEditor_create (const char32 *title, KlattGrid klattgrid, RealTier data);
diff --git a/dwtools/KlattGrid_def.h b/dwtools/KlattGrid_def.h
index 9c9e5bd..3a7ff5c 100644
--- a/dwtools/KlattGrid_def.h
+++ b/dwtools/KlattGrid_def.h
@@ -96,12 +96,12 @@ oo_END_CLASS (PhonationGrid)
 oo_DEFINE_CLASS (VocalTractGridPlayOptions, Daata)
 
 	oo_INT (filterModel)
-	oo_LONG (startOralFormant)
-	oo_LONG (endOralFormant)
-	oo_LONG (startNasalFormant)
-	oo_LONG (endNasalFormant)
-	oo_LONG (startNasalAntiFormant)
-	oo_LONG (endNasalAntiFormant)
+	oo_INTEGER (startOralFormant)
+	oo_INTEGER (endOralFormant)
+	oo_INTEGER (startNasalFormant)
+	oo_INTEGER (endNasalFormant)
+	oo_INTEGER (startNasalAntiFormant)
+	oo_INTEGER (endNasalAntiFormant)
 
 oo_END_CLASS (VocalTractGridPlayOptions)
 #undef ooSTRUCT
@@ -138,14 +138,14 @@ oo_END_CLASS (VocalTractGrid)
 #define ooSTRUCT CouplingGridPlayOptions
 oo_DEFINE_CLASS (CouplingGridPlayOptions, Daata)
 
-	oo_LONG (startTrachealFormant)
-	oo_LONG (endTrachealFormant)
-	oo_LONG (startTrachealAntiFormant)
-	oo_LONG (endTrachealAntiFormant)
-	oo_LONG (startDeltaFormant)
-	oo_LONG (endDeltaFormant)
-	oo_LONG (startDeltaBandwidth)
-	oo_LONG (endDeltaBandwidth)
+	oo_INTEGER (startTrachealFormant)
+	oo_INTEGER (endTrachealFormant)
+	oo_INTEGER (startTrachealAntiFormant)
+	oo_INTEGER (endTrachealAntiFormant)
+	oo_INTEGER (startDeltaFormant)
+	oo_INTEGER (endDeltaFormant)
+	oo_INTEGER (startDeltaBandwidth)
+	oo_INTEGER (endDeltaBandwidth)
 	oo_INT (openglottis)
 	oo_DOUBLE (fadeFraction)
 
@@ -184,8 +184,8 @@ oo_END_CLASS (CouplingGrid)
 #define ooSTRUCT FricationGridPlayOptions
 oo_DEFINE_CLASS (FricationGridPlayOptions, Daata)
 
-	oo_LONG (startFricationFormant)
-	oo_LONG (endFricationFormant)
+	oo_INTEGER (startFricationFormant)
+	oo_INTEGER (endFricationFormant)
 	oo_INT (bypass)
 
 oo_END_CLASS (FricationGridPlayOptions)
diff --git a/dwtools/LongSound_extensions.cpp b/dwtools/LongSound_extensions.cpp
index d644e00..2b8813c 100644
--- a/dwtools/LongSound_extensions.cpp
+++ b/dwtools/LongSound_extensions.cpp
@@ -197,8 +197,7 @@ void LongSounds_appendToExistingSoundFile (OrderedOf<structSampled>* me, MelderF
 		autofile f = Melder_fopen (file, "r+b");
 		file -> filePointer = f; // essential !!
 		double sampleRate_d;
-		long startOfData;
-		integer numberOfSamples;
+		integer startOfData, numberOfSamples;
 		int numberOfChannels, encoding;
 		int audioFileType = MelderFile_checkSoundFile (file, & numberOfChannels, & encoding, & sampleRate_d, & startOfData, & numberOfSamples);
 
diff --git a/dwtools/MDS.cpp b/dwtools/MDS.cpp
index 1f0691e..c9250d2 100644
--- a/dwtools/MDS.cpp
+++ b/dwtools/MDS.cpp
@@ -65,46 +65,43 @@ Thing_implement (Similarity, Proximity, 0);
 
 /********************** NUMERICAL STUFF **************************************/
 
-static void NUMdmatrix_into_vector (double **m, double *v, long r1, long r2, long c1, long c2) {
-	long k = 1;
-
-	for (long i = r1; i <= r2; i++) {
-		for (long j = c1; j <= c2; j++) {
-			v[k++] = m[i][j];
+static void NUMdmatrix_into_vector (double **m, double *v, integer r1, integer r2, integer c1, integer c2) {
+	integer k = 1;
+	for (integer i = r1; i <= r2; i ++) {
+		for (integer j = c1; j <= c2; j ++) {
+			v [k ++] = m [i] [j];
 		}
 	}
 }
 
-static void NUMdvector_into_matrix (const double *v, double **m, long r1, long r2, long c1, long c2) {
-	long k = 1;
-
-	for (long i = r1; i <= r2; i++) {
-		for (long j = c1; j <= c2; j++) {
-			m[i][j] = v[k++];
+static void NUMdvector_into_matrix (const double *v, double **m, integer r1, integer r2, integer c1, integer c2) {
+	integer k = 1;
+	for (integer i = r1; i <= r2; i ++) {
+		for (integer j = c1; j <= c2; j ++) {
+			m [i] [j] = v [k ++];
 		}
 	}
 }
 
-static void NUMdmatrix_normalizeRows (double **m, long nr, long nc) {
-	for (long i = 1; i <= nr; i++) {
-		double rowSum = 0.0;
-		for (long j = 1; j <= nc; j++) {
-			rowSum += m[i][j];
+static void NUMdmatrix_normalizeRows (double **m, integer nr, integer nc) {
+	for (integer i = 1; i <= nr; i ++) {
+		real80 rowSum = 0.0;
+		for (integer j = 1; j <= nc; j ++) {
+			rowSum += m [i] [j];
 		}
-
 		if (rowSum != 0.0) {
-			for (long j = 1; j <= nc; j++) {
-				m[i][j] /= rowSum;
+			for (integer j = 1; j <= nc; j ++) {
+				m [i] [j] /= rowSum;
 			}
 		}
 	}
 }
 
-static long NUMdmatrix_countZeros (double **m, long nr, long nc) {
-	long nZeros = 0;
+static integer NUMdmatrix_countZeros (double **m, integer nr, integer nc) {
+	integer nZeros = 0;
 
-	for (long i = 1; i <= nr; i++) {
-		for (long j = 1; j <= nc; j++) {
+	for (integer i = 1; i <= nr; i++) {
+		for (integer j = 1; j <= nc; j++) {
 			if (m[i][j] == 0) {
 				nZeros++;
 			}
@@ -113,46 +110,46 @@ static long NUMdmatrix_countZeros (double **m, long nr, long nc) {
 	return nZeros;
 }
 
-static void NUMsort3 (double *data, long *iPoint, long *jPoint, long ifrom, long ito, int ascending) {
+static void NUMsort3 (double *data, integer *iPoint, integer *jPoint, integer ifrom, integer ito, int ascending) {
 	if (ifrom > ito || ifrom < 1) {
 		Melder_throw (U"invalid range.");
 	}
-	long n = ito - ifrom + 1;
+	integer n = ito - ifrom + 1;
 	if (n == 1) {
 		return;
 	}
-	autoNUMvector<long> indx (ifrom, ito);
+	autoNUMvector<integer> indx (ifrom, ito);
 	autoNUMvector<double> atmp (ifrom, ito);
-	autoNUMvector<long> itmp (ifrom, ito);
+	autoNUMvector<integer> itmp (ifrom, ito);
 	//NUMindexx (data + ifrom - 1, n, indx + ifrom - 1);
-	NUMindexx (&data [ifrom - 1], n, &indx [ifrom - 1]);
+	NUMindexx (& data [ifrom - 1], n, & indx [ifrom - 1]);
 	if (! ascending) {
-		for (long j = ifrom; j <= ifrom + n / 2; j ++) {
-			long tmp = indx [j];
+		for (integer j = ifrom; j <= ifrom + n / 2; j ++) {
+			integer tmp = indx [j];
 			indx [j] = indx [ito - j + ifrom];
 			indx [ito - j + ifrom] = tmp;
 		}
 	}
-	for (long j = ifrom; j <= ito; j++) {
-		indx[j] += ifrom - 1;
+	for (integer j = ifrom; j <= ito; j ++) {
+		indx [j] += ifrom - 1;
 	}
-	for (long j = ifrom; j <= ito; j++) {
-		atmp[j] = data[j];
+	for (integer j = ifrom; j <= ito; j ++) {
+		atmp [j] = data [j];
 	}
-	for (long j = ifrom; j <= ito; j++) {
-		data[j] = atmp[indx[j]];
+	for (integer j = ifrom; j <= ito; j ++) {
+		data [j] = atmp [indx [j]];
 	}
-	for (long j = ifrom; j <= ito; j++) {
-		itmp[j] = iPoint[j];
+	for (integer j = ifrom; j <= ito; j ++) {
+		itmp [j] = iPoint [j];
 	}
-	for (long j = ifrom; j <= ito; j++) {
-		iPoint[j] = itmp[indx[j]];
+	for (integer j = ifrom; j <= ito; j ++) {
+		iPoint [j] = itmp [indx [j]];
 	}
-	for (long j = ifrom; j <= ito; j++) {
+	for (integer j = ifrom; j <= ito; j ++) {
 		itmp[j] = jPoint[j];
 	}
-	for (long j = ifrom; j <= ito; j++) {
-		jPoint[j] = itmp[indx[j]];
+	for (integer j = ifrom; j <= ito; j ++) {
+		jPoint [j] = itmp [indx [j]];
 	}
 }
 
@@ -161,7 +158,7 @@ static void NUMsort3 (double *data, long *iPoint, long *jPoint, long ifrom, long
 autoDistanceList ConfigurationList_to_DistanceList (ConfigurationList me) {
 	try {
 		autoDistanceList thee = DistanceList_create ();
-		for (long i = 1; i <= my size; i ++) {
+		for (integer i = 1; i <= my size; i ++) {
 			Configuration conf = my at [i];
 			autoDistance d = Configuration_to_Distance (conf);
 			Thing_setName (d.get(), Thing_getName (conf));
@@ -199,13 +196,13 @@ autoSimilarity DistanceList_to_Similarity_cc (DistanceList me, Weight w) {
 
 		autoSimilarity thee = Similarity_create (my size);
 
-		for (long i = 1; i <= my size; i ++) {
+		for (integer i = 1; i <= my size; i ++) {
 			Distance di = my at [i];
 			const char32 *name = Thing_getName (di);
 			TableOfReal_setRowLabel (thee.get(), i, name);
 			TableOfReal_setColumnLabel (thee.get(), i, name);
 			thy data[i][i] = 1;
-			for (long j = i + 1; j <= my size; j ++) {
+			for (integer j = i + 1; j <= my size; j ++) {
 				Distance dj = my at [j];
 				thy data [i] [j] = thy data [j] [i] = Distance_Weight_congruenceCoefficient (di, dj, w);
 			}
@@ -226,9 +223,9 @@ autoDistance structTransformator :: v_transform (MDSVec vec, Distance dist, Weig
 
 		// Absolute scaling
 
-		for (long i = 1; i <= vec -> nProximities; i++) {
-			long ii = vec -> iPoint[i];
-			long jj = vec -> jPoint[i];
+		for (integer i = 1; i <= vec -> nProximities; i++) {
+			integer ii = vec -> iPoint[i];
+			integer jj = vec -> jPoint[i];
 			thy data[ii][jj] = thy data[jj][ii] = vec -> proximity[i];
 		}
 		return thee;
@@ -237,12 +234,12 @@ autoDistance structTransformator :: v_transform (MDSVec vec, Distance dist, Weig
 	}
 }
 
-void Transformator_init (Transformator me, long numberOfPoints) {
+void Transformator_init (Transformator me, integer numberOfPoints) {
 	my numberOfPoints = numberOfPoints;
 	my normalization = 1;
 }
 
-autoTransformator Transformator_create (long numberOfPoints) {
+autoTransformator Transformator_create (integer numberOfPoints) {
 	try {
 		autoTransformator me = Thing_new (Transformator);
 		Transformator_init (me.get(), numberOfPoints);
@@ -273,9 +270,9 @@ autoDistance structRatioTransformator :: v_transform (MDSVec vec, Distance d, We
 	// Determine ratio (eq. 9.4)
 
 	double etaSq = 0.0, rho = 0.0;
-	for (long i = 1; i <= vec -> nProximities; i ++) {
-		long ii = vec -> iPoint [i];
-		long jj = vec -> jPoint [i];
+	for (integer i = 1; i <= vec -> nProximities; i ++) {
+		integer ii = vec -> iPoint [i];
+		integer jj = vec -> jPoint [i];
 		double delta_ij = vec -> proximity[i], d_ij = d -> data [ii] [jj];
 		double tmp = w -> data [ii] [jj] * delta_ij * delta_ij;
 		etaSq += tmp;
@@ -288,9 +285,9 @@ autoDistance structRatioTransformator :: v_transform (MDSVec vec, Distance d, We
 		Melder_throw (U"Eta squared is zero.");
 	}
 	our ratio = rho / etaSq;
-	for (long i = 1; i <= vec -> nProximities; i ++) {
-		long ii = vec -> iPoint [i];
-		long jj = vec -> jPoint [i];
+	for (integer i = 1; i <= vec -> nProximities; i ++) {
+		integer ii = vec -> iPoint [i];
+		integer jj = vec -> jPoint [i];
 		thy data [ii] [jj] = thy data [jj] [ii] = our ratio * vec -> proximity [i];
 	}
 
@@ -300,7 +297,7 @@ autoDistance structRatioTransformator :: v_transform (MDSVec vec, Distance d, We
 	return thee;
 }
 
-autoRatioTransformator RatioTransformator_create (long numberOfPoints) {
+autoRatioTransformator RatioTransformator_create (integer numberOfPoints) {
 	try {
 		autoRatioTransformator me = Thing_new (RatioTransformator);
 		Transformator_init (me.get(), numberOfPoints);
@@ -322,7 +319,7 @@ autoDistance structMonotoneTransformator :: v_transform (MDSVec vec, Distance d,
 	}
 }
 
-autoMonotoneTransformator MonotoneTransformator_create (long numberOfPoints) {
+autoMonotoneTransformator MonotoneTransformator_create (integer numberOfPoints) {
 	try {
 		autoMonotoneTransformator me = Thing_new (MonotoneTransformator);
 		Transformator_init (me.get(), numberOfPoints);
@@ -346,15 +343,15 @@ void structISplineTransformator :: v_destroy () noexcept {
 
 autoDistance structISplineTransformator :: v_transform (MDSVec vec, Distance dist, Weight w) {
 	double tol = 1e-6;
-	long itermax = 20, nx = vec -> nProximities;
-	long nKnots = numberOfInteriorKnots + order + order + 2;
+	integer itermax = 20, nx = vec -> nProximities;
+	integer nKnots = numberOfInteriorKnots + order + order + 2;
 
 	autoDistance thee = Distance_create (dist -> numberOfRows);
 	TableOfReal_copyLabels (dist, thee.get(), 1, -1);
 
 	autoNUMvector<double> d (1, nx);
 
-	for (long i = 1; i <= nx; i++) {
+	for (integer i = 1; i <= nx; i++) {
 		d[i] = dist -> data[vec -> iPoint[i]][vec -> jPoint[i]];
 	}
 
@@ -363,21 +360,21 @@ autoDistance structISplineTransformator :: v_transform (MDSVec vec, Distance dis
 		Guarantee that for each proximity x[i]: knot[j] <= x[i] < knot[j+1]
 	*/
 
-	for (long i = 1; i <= order + 1; i++) {
+	for (integer i = 1; i <= order + 1; i++) {
 		knot [i] = vec -> proximity [1];
 		knot [nKnots - i + 1] = vec -> proximity [nx] * 1.000001;
 	}
-	for (long i = 1; i <= numberOfInteriorKnots; i++) {
+	for (integer i = 1; i <= numberOfInteriorKnots; i++) {
 		double fraction = (double) i / (numberOfInteriorKnots + 1);
 		knot [order + 1 + i] = NUMquantile (nx, vec -> proximity, fraction);
 	}
 
 	// Calculate data matrix m.
 
-	for (long i = 1; i <= nx; i++) {
+	for (integer i = 1; i <= nx; i++) {
 		double y, x = vec -> proximity [i];
 		m[i][1] = 1.0;
-		for (long j = 2; j <= numberOfParameters; j++) {
+		for (integer j = 2; j <= numberOfParameters; j++) {
 			try {
 				NUMispline (knot, nKnots, order, j - 1, x, & y);
 			} catch (MelderError) {
@@ -389,12 +386,12 @@ autoDistance structISplineTransformator :: v_transform (MDSVec vec, Distance dis
 
 	NUMsolveNonNegativeLeastSquaresRegression (m, nx, numberOfParameters, d.peek(), tol, itermax, b);
 
-	for (long i = 1; i <= nx; i++) {
-		long ii = vec->iPoint[i];
-		long jj = vec->jPoint[i];
+	for (integer i = 1; i <= nx; i++) {
+		integer ii = vec->iPoint[i];
+		integer jj = vec->jPoint[i];
 		double r = 0.0;
 
-		for (long j = 1; j <= numberOfParameters; j++) {
+		for (integer j = 1; j <= numberOfParameters; j++) {
 			r += m[i][j] * b[j];
 		}
 		thy data[ii][jj] = thy data[jj][ii] = r;
@@ -406,10 +403,10 @@ autoDistance structISplineTransformator :: v_transform (MDSVec vec, Distance dis
 	return thee;
 }
 
-autoISplineTransformator ISplineTransformator_create (long numberOfPoints, long numberOfInteriorKnots, long order) {
+autoISplineTransformator ISplineTransformator_create (integer numberOfPoints, integer numberOfInteriorKnots, integer order) {
 	try {
 		autoISplineTransformator me = Thing_new (ISplineTransformator);
-		long nData = (numberOfPoints - 1) * numberOfPoints / 2;
+		integer nData = (numberOfPoints - 1) * numberOfPoints / 2;
 
 		Transformator_init (me.get(), numberOfPoints);
 
@@ -419,13 +416,13 @@ autoISplineTransformator ISplineTransformator_create (long numberOfPoints, long
 		*/
 
 		my numberOfParameters = numberOfInteriorKnots + order + 1;
-		long numberOfKnots = numberOfInteriorKnots + order + order + 2;
+		integer numberOfKnots = numberOfInteriorKnots + order + order + 2;
 
 		my b = NUMvector<double> (1, my numberOfParameters);
 		my knot = NUMvector<double> (1, numberOfKnots);
 		my m = NUMmatrix<double> (1, nData, 1, my numberOfParameters);
 
-		for (long i = 1; i <= my numberOfParameters; i++) {
+		for (integer i = 1; i <= my numberOfParameters; i++) {
 			my b[i] = NUMrandomUniform (0.0, 1.0);
 		}
 
@@ -439,10 +436,10 @@ autoISplineTransformator ISplineTransformator_create (long numberOfPoints, long
 
 /***************** CONTINGENCYTABLE **************************************/
 
-autoConfiguration ContingencyTable_to_Configuration_ca (ContingencyTable me, long numberOfDimensions, int scaling) {
+autoConfiguration ContingencyTable_to_Configuration_ca (ContingencyTable me, integer numberOfDimensions, int scaling) {
 	try {
-		long nr = my numberOfRows, nc = my numberOfColumns;
-		long dimmin = nr < nc ? nr : nc;
+		integer nr = my numberOfRows, nc = my numberOfColumns;
+		integer dimmin = nr < nc ? nr : nc;
 
 		autoNUMmatrix<double> h (NUMmatrix_copy (my data, 1, nr, 1, nc), 1, 1);
 		autoNUMvector<double> rowsum (1, nr);
@@ -460,20 +457,20 @@ autoConfiguration ContingencyTable_to_Configuration_ca (ContingencyTable me, lon
 		//		Chapter 8, Multidimensional scaling and Correspondence Analysis.
 		// Get row and column marginals
 
-		double sum = 0.0;
-		for (long i = 1; i <= nr; i++) {
-			for (long j = 1; j <= nc; j++) {
-				rowsum[i] += my data[i][j];
-				colsum[j] += my data[i][j];
+		real80 sum = 0.0;
+		for (integer i = 1; i <= nr; i ++) {
+			for (integer j = 1; j <= nc; j ++) {
+				rowsum [i] += my data [i] [j];
+				colsum [j] += my data [i] [j];
 			}
-			if (rowsum[i] <= 0.0) {
+			if (rowsum [i] <= 0.0) {
 				Melder_throw (U"Empty row: ", i, U".");
 			}
-			sum += rowsum[i];
+			sum += rowsum [i];
 		}
 
-		for (long j = 1; j <= nc; j++) {
-			if (colsum[j] <= 0.0) {
+		for (integer j = 1; j <= nc; j ++) {
+			if (colsum [j] <= 0.0) {
 				Melder_throw (U"Empty column: ", j, U".");
 			}
 		}
@@ -481,10 +478,10 @@ autoConfiguration ContingencyTable_to_Configuration_ca (ContingencyTable me, lon
 		// Remove trivial singular vectors (Eq. 8.24),
 		// construct Dr^(-1/2) H Dc^(-1/2) - Dr^(1/2) uu' Dc^(1/2) / N
 
-		for (long i = 1; i <= nr; i++) {
-			for (long j = 1; j <= nc; j++) {
-				double rc = sqrt (rowsum[i] * colsum[j]);
-				h[i][j] = h[i][j] / rc - rc / sum;
+		for (integer i = 1; i <= nr; i ++) {
+			for (integer j = 1; j <= nc; j ++) {
+				double rc = sqrt (rowsum [i] * colsum [j]);
+				h [i] [j] = h [i] [j] / rc - rc / (real) sum;
 			}
 		}
 
@@ -495,7 +492,7 @@ autoConfiguration ContingencyTable_to_Configuration_ca (ContingencyTable me, lon
 
 		// Scale row vectors and column vectors to configuration.
 
-		for (long j = 1; j <= numberOfDimensions; j++) {
+		for (integer j = 1; j <= numberOfDimensions; j ++) {
 			double rootsum = sqrt (sum), xfactor, yfactor, lambda = svd -> d[j];
 			if (scaling == 1) {
 
@@ -517,17 +514,17 @@ autoConfiguration ContingencyTable_to_Configuration_ca (ContingencyTable me, lon
 			} else {
 				break;
 			}
-			for (long i = 1; i <= nr; i++) {
-				thy data[i][j] = svd -> u[i][j] * xfactor / sqrt (rowsum[i]);
+			for (integer i = 1; i <= nr; i ++) {
+				thy data [i] [j] = svd -> u [i] [j] * xfactor / sqrt (rowsum [i]);
 			}
-			for (long i = 1; i <= nc; i++) {
-				thy data[nr + i][j] = svd -> v[i][j] * yfactor / sqrt (colsum[i]);
+			for (integer i = 1; i <= nc; i ++) {
+				thy data [nr + i] [j] = svd -> v [i] [j] * yfactor / sqrt (colsum [i]);
 			}
 		}
 
 		TableOfReal_setSequentialColumnLabels (thee.get(), 0, 0, nullptr, 1, 1);
 		NUMstrings_copyElements (my rowLabels, thy rowLabels, 1, nr);
-		for (long i = 1; i <= nc; i++) {
+		for (integer i = 1; i <= nc; i ++) {
 			if (my columnLabels[i]) {
 				TableOfReal_setRowLabel (thee.get(), nr + i, my columnLabels[i]);
 			}
@@ -617,19 +614,19 @@ autoScalarProduct TableOfReal_to_ScalarProduct (TableOfReal me) {
 
 /**************** Covariance & Correlation to Configuration *****************/
 
-autoConfiguration SSCP_to_Configuration (SSCP me, long numberOfDimensions) {
+autoConfiguration SSCP_to_Configuration (SSCP me, integer numberOfDimensions) {
 	try {
 		autoConfiguration thee = Configuration_create (my numberOfRows, numberOfDimensions);
 		autoPCA a = SSCP_to_PCA (me);
 		TableOfReal_setSequentialColumnLabels (thee.get(), 0, 0, nullptr, 1, 1);
 
-		for (long i = 1; i <= my numberOfRows; i++) {
-			for (long j = 1; j <= numberOfDimensions; j++) {
-				double s = 0.0;
-				for (long k = 1; k <= my numberOfRows; k++) {
-					s += my data[k][i] * a -> eigenvectors[k][j];
+		for (integer i = 1; i <= my numberOfRows; i++) {
+			for (integer j = 1; j <= numberOfDimensions; j ++) {
+				real80 s = 0.0;
+				for (integer k = 1; k <= my numberOfRows; k ++) {
+					s += my data [k] [i] * a -> eigenvectors [k] [j];
 				}
-				thy data[i][j] = s;
+				thy data [i] [j] = (real) s;
 			}
 		}
 		return thee;
@@ -638,23 +635,23 @@ autoConfiguration SSCP_to_Configuration (SSCP me, long numberOfDimensions) {
 	}
 }
 
-autoConfiguration Covariance_to_Configuration (Covariance me, long numberOfDimensions) {
+autoConfiguration Covariance_to_Configuration (Covariance me, integer numberOfDimensions) {
 	return SSCP_to_Configuration (me, numberOfDimensions);
 }
 
-autoConfiguration Correlation_to_Configuration (Correlation me, long numberOfDimensions) {
+autoConfiguration Correlation_to_Configuration (Correlation me, integer numberOfDimensions) {
 	return SSCP_to_Configuration (me, numberOfDimensions);
 }
 
 /**************************** Weight *****************************************/
 
-autoWeight Weight_create (long numberOfPoints) {
+autoWeight Weight_create (integer numberOfPoints) {
 	try {
 		autoWeight me = Thing_new (Weight);
 		TableOfReal_init (me.get(), numberOfPoints, numberOfPoints);
-		for (long i = 1; i <= numberOfPoints; i++) {
-			for (long j = 1; j <= numberOfPoints; j++) {
-				my data[i][j] = 1.0;
+		for (integer i = 1; i <= numberOfPoints; i ++) {
+			for (integer j = 1; j <= numberOfPoints; j ++) {
+				my data [i] [j] = 1.0;
 			}
 		}
 		return me;
@@ -666,7 +663,7 @@ autoWeight Weight_create (long numberOfPoints) {
 
 /**************** Salience *****************************************/
 
-autoSalience Salience_create (long numberOfSources, long numberOfDimensions) {
+autoSalience Salience_create (integer numberOfSources, integer numberOfDimensions) {
 	try {
 		autoSalience me = Thing_new (Salience);
 		TableOfReal_init (me.get(), numberOfSources, numberOfDimensions);
@@ -677,15 +674,15 @@ autoSalience Salience_create (long numberOfSources, long numberOfDimensions) {
 	}
 }
 
-long Salience_correctNegatives (Salience me) {
+integer Salience_correctNegatives (Salience me) {
 	/*
 		The weights might be negative.
 		We correct this by simply making them positive.
 	*/
 
-	long nNegatives = 0;
-	for (long i = 1; i <= my numberOfRows; i++) {
-		for (long j = 1; j <= my numberOfColumns; j++) {
+	integer nNegatives = 0;
+	for (integer i = 1; i <= my numberOfRows; i ++) {
+		for (integer j = 1; j <= my numberOfColumns; j ++) {
 			if (my data[i][j] < 0.0) {
 				nNegatives++;
 				my data[i][j] = - my data[i][j];
@@ -696,26 +693,26 @@ long Salience_correctNegatives (Salience me) {
 }
 
 void Salience_setDefaults (Salience me) {
-	for (long i = 1; i <= my numberOfRows; i++) {
-		for (long j = 1; j <= my numberOfColumns; j++) {
+	for (integer i = 1; i <= my numberOfRows; i++) {
+		for (integer j = 1; j <= my numberOfColumns; j++) {
 			my data[i][j] = 1.0 / sqrt (my numberOfColumns);
 		}
 	}
-	for (long j = 1; j <= my numberOfColumns; j++) {
+	for (integer j = 1; j <= my numberOfColumns; j++) {
 		TableOfReal_setColumnLabel (me, j, Melder_cat (U"dimension ", j));
 	}
 }
 
-void Salience_draw (Salience me, Graphics g, int ix, int iy, int garnish) {
-	long nc2, nc1 = ix < iy ? (nc2 = iy, ix) : (nc2 = ix, iy);
+void Salience_draw (Salience me, Graphics g, int ix, int iy, bool garnish) {
+	integer nc2, nc1 = ix < iy ? (nc2 = iy, ix) : (nc2 = ix, iy);
 	double xmin = 0.0, xmax = 1.0, ymin = 0.0, ymax = 1.0, wmax = 1.0;
 
 	if (ix < 1 || ix > my numberOfColumns || iy < 1 || iy > my numberOfColumns) {
 		return;
 	}
 
-	for (long i = 1; i <= my numberOfRows; i++) {
-		for (long j = nc1; j <= nc2; j++) {
+	for (integer i = 1; i <= my numberOfRows; i++) {
+		for (integer j = nc1; j <= nc2; j++) {
 			if (my data[i][j] > wmax) {
 				wmax = my data[i][j];
 			}
@@ -726,7 +723,7 @@ void Salience_draw (Salience me, Graphics g, int ix, int iy, int garnish) {
 	Graphics_setWindow (g, xmin, xmax, ymin, ymax);
 	Graphics_setTextAlignment (g, Graphics_CENTRE, Graphics_HALF);
 
-	for (long i = 1; i <= my numberOfRows; i++) {
+	for (integer i = 1; i <= my numberOfRows; i++) {
 		if (my rowLabels[i]) {
 			Graphics_text (g, my data[i][ix], my data[i][iy], my rowLabels[i]);
 		}
@@ -752,19 +749,19 @@ void Salience_draw (Salience me, Graphics g, int ix, int iy, int garnish) {
 
 void structMDSVec :: v_destroy () noexcept {
 	NUMvector_free<double> (proximity, 1);
-	NUMvector_free<long> (iPoint, 1);
-	NUMvector_free<long> (jPoint, 1);
+	NUMvector_free<integer> (iPoint, 1);
+	NUMvector_free<integer> (jPoint, 1);
 	MDSVec_Parent :: v_destroy ();
 }
 
-autoMDSVec MDSVec_create (long nPoints) {
+autoMDSVec MDSVec_create (integer nPoints) {
 	try {
 		autoMDSVec me = Thing_new (MDSVec);
 		my nPoints = nPoints;
 		my nProximities = nPoints * (nPoints - 1) / 2;
 		my proximity = NUMvector<double> (1, my nProximities);
-		my iPoint = NUMvector<long> (1, my nProximities);
-		my jPoint = NUMvector<long> (1, my nProximities);
+		my iPoint = NUMvector<integer> (1, my nProximities);
+		my jPoint = NUMvector<integer> (1, my nProximities);
 		return me;
 	} catch (MelderError) {
 		Melder_throw (U"MDSVec not created.");
@@ -775,15 +772,15 @@ autoMDSVec Dissimilarity_to_MDSVec (Dissimilarity me) {
 	try {
 		autoMDSVec thee = MDSVec_create (my numberOfRows);
 
-		long k = 0;
-		for (long i = 1; i <= my numberOfRows - 1; i++) {
-			for (long j = i + 1; j <= my numberOfColumns; j++) {
-				double f = (my data[i][j] + my data[j][i]) / 2;
+		integer k = 0;
+		for (integer i = 1; i <= my numberOfRows - 1; i ++) {
+			for (integer j = i + 1; j <= my numberOfColumns; j ++) {
+				double f = 0.5 * (my data [i] [j] + my data [j] [i]);
 				if (f > 0.0) {
-					k++;
-					thy proximity[k] = f;
-					thy iPoint[k] = i;
-					thy jPoint[k] = j;
+					k ++;
+					thy proximity [k] = f;
+					thy iPoint [k] = i;
+					thy jPoint [k] = j;
 				}
 			}
 		}
@@ -800,7 +797,7 @@ autoMDSVec Dissimilarity_to_MDSVec (Dissimilarity me) {
 autoMDSVecList DissimilarityList_to_MDSVecList (DissimilarityList me) {
 	try {
 		autoMDSVecList thee = MDSVecList_create ();
-		for (long i = 1; i <= my size; i ++) {
+		for (integer i = 1; i <= my size; i ++) {
 			autoMDSVec him = Dissimilarity_to_MDSVec (my at [i]);
 			Thing_setName (him.get(), Thing_getName (my at [i]));
 			thy addItem_move (him.move());
@@ -830,7 +827,7 @@ autoConfusion ConfusionList_sum (ConfusionList me) {
 
 /*****************  SCALARPRODUCT ***************************************/
 
-autoScalarProduct ScalarProduct_create (long numberOfPoints) {
+autoScalarProduct ScalarProduct_create (integer numberOfPoints) {
 	try {
 		autoScalarProduct me = Thing_new (ScalarProduct);
 		TableOfReal_init (me.get(), numberOfPoints, numberOfPoints);
@@ -846,7 +843,7 @@ autoScalarProduct ScalarProduct_create (long numberOfPoints) {
 
 /******************  DISSIMILARITY **********************************/
 
-autoDissimilarity Dissimilarity_create (long numberOfPoints) {
+autoDissimilarity Dissimilarity_create (integer numberOfPoints) {
 	try {
 		autoDissimilarity me = Thing_new (Dissimilarity);
 		Proximity_init (me.get(), numberOfPoints);
@@ -857,24 +854,24 @@ autoDissimilarity Dissimilarity_create (long numberOfPoints) {
 }
 
 static double Dissimilarity_getAverage (Dissimilarity me) {
-	double sum = 0.0;
-	long numberOfPositives = 0;
-	for (long i = 1; i <= my numberOfRows - 1; i++) {
-		for (long j = i + 1; j <= my numberOfRows; j++) {
-			double proximity = (my data[i][j] + my data[j][i]) / 2.0;
+	real80 sum = 0.0;
+	integer numberOfPositives = 0;
+	for (integer i = 1; i <= my numberOfRows - 1; i ++) {
+		for (integer j = i + 1; j <= my numberOfRows; j ++) {
+			double proximity = 0.5 * (my data [i] [j] + my data [j] [i]);
 			if (proximity > 0.0) {
-				numberOfPositives++;
+				numberOfPositives ++;
 				sum += proximity;
 			}
 		}
 	}
-	return ( numberOfPositives > 0 ? sum /= numberOfPositives : undefined );
+	return numberOfPositives > 0 ? (real) sum / numberOfPositives : undefined;
 }
 
 double Dissimilarity_getAdditiveConstant (Dissimilarity me) {
 	double additiveConstant = undefined;
 	try {
-		long nPoints = my numberOfRows, nPoints2 = 2 * nPoints;
+		integer nPoints = my numberOfRows, nPoints2 = 2 * nPoints;
 
 		// Return c = average dissimilarity in case of failure
 
@@ -894,8 +891,8 @@ double Dissimilarity_getAdditiveConstant (Dissimilarity me) {
 
 		// The matrices D & D1/2 with distances (squared and linear)
 
-		for (long i = 1; i <= nPoints - 1; i++) {
-			for (long j = i + 1; j <= nPoints; j++) {
+		for (integer i = 1; i <= nPoints - 1; i++) {
+			for (integer j = i + 1; j <= nPoints; j++) {
 				double proximity = (my data[i][j] + my data[j][i]) / 2.0;
 				wdsqrt[i][j] = - proximity / 2.0;
 				wd[i][j] = - proximity * proximity / 2.0;
@@ -907,8 +904,8 @@ double Dissimilarity_getAdditiveConstant (Dissimilarity me) {
 
 		// Calculate the B matrix according to eq. 6
 
-		for (long i = 1; i <= nPoints; i++) {
-			for (long j = 1; j <= nPoints; j++) {
+		for (integer i = 1; i <= nPoints; i++) {
+			for (integer j = 1; j <= nPoints; j++) {
 				b[i][nPoints + j] = 2.0 * wd[i][j];
 				b[nPoints + i][nPoints + j] = -4.0 * wdsqrt[i][j];
 				b[nPoints + i][i] = -1.0;
@@ -934,7 +931,7 @@ double Dissimilarity_getAdditiveConstant (Dissimilarity me) {
 
 /*************  SIMILARITY *****************************************/
 
-autoSimilarity Similarity_create (long numberOfPoints) {
+autoSimilarity Similarity_create (integer numberOfPoints) {
 	try {
 		autoSimilarity me = Thing_new (Similarity);
 		Proximity_init (me.get(), numberOfPoints);
@@ -950,7 +947,7 @@ autoSimilarity Confusion_to_Similarity (Confusion me, bool normalize, int symmet
 			Melder_throw (U"Confusion must be a square table.");
 		}
 
-		long nxy = my numberOfColumns;
+		integer nxy = my numberOfColumns;
 		autoSimilarity thee = Similarity_create (nxy);
 
 		TableOfReal_copyLabels (me, thee.get(), 1, 1);
@@ -964,17 +961,17 @@ autoSimilarity Confusion_to_Similarity (Confusion me, bool normalize, int symmet
 			return thee;
 		}
 		if (symmetrizeMethod == 2) { // Average data
-			for (long i = 1; i <= nxy - 1; i++) {
-				for (long j = i + 1; j <= nxy; j++) {
+			for (integer i = 1; i <= nxy - 1; i++) {
+				for (integer j = i + 1; j <= nxy; j++) {
 					thy data[i][j] = thy data[j][i] = (thy data[i][j] + thy data[j][i]) / 2;
 				}
 			}
 		} else if (symmetrizeMethod == 3) { // Method Houtgast.
 			autoNUMmatrix<double> p (NUMmatrix_copy (thy data, 1, nxy, 1, nxy), 1, 1);
-			for (long i = 1; i <= nxy; i++) {
-				for (long j = i; j <= nxy; j++) {
+			for (integer i = 1; i <= nxy; i++) {
+				for (integer j = i; j <= nxy; j++) {
 					double tmp = 0;
-					for (long k = 1; k <= nxy; k++) {
+					for (integer k = 1; k <= nxy; k++) {
 						tmp += p[i][k] < p[j][k] ? p[i][k] : p[j][k];
 					}
 					thy data[j][i] = thy data[i][j] = tmp;
@@ -989,14 +986,14 @@ autoSimilarity Confusion_to_Similarity (Confusion me, bool normalize, int symmet
 
 autoDissimilarity Similarity_to_Dissimilarity (Similarity me, double maximumDissimilarity) {
 	try {
-		long nxy = my numberOfColumns;
+		integer nxy = my numberOfColumns;
 		double max = 0;
 		autoDissimilarity thee = Dissimilarity_create (nxy);
 		TableOfReal_copyLabels (me, thee.get(), 1, 1);
 		NUMmatrix_copyElements (my data, thy data, 1, my numberOfRows, 1, my numberOfColumns);
 
-		for (long i = 1; i <= nxy; i++) {
-			for (long j = 1; j <= nxy; j++) {
+		for (integer i = 1; i <= nxy; i++) {
+			for (integer j = 1; j <= nxy; j++) {
 				if (thy data[i][j] > max) {
 					max = thy data[i][j];
 				}
@@ -1010,8 +1007,8 @@ autoDissimilarity Similarity_to_Dissimilarity (Similarity me, double maximumDiss
 		if (maximumDissimilarity < max) Melder_warning
 			(U"Your maximumDissimilarity is smaller than the maximum similarity. Some data may be lost.");
 
-		for (long i = 1; i <= nxy; i++) {
-			for (long j = 1; j <= nxy; j++) {
+		for (integer i = 1; i <= nxy; i++) {
+			for (integer j = 1; j <= nxy; j++) {
 				double d = maximumDissimilarity - thy data[i][j];
 				thy data[i][j] = d > 0 ? d : 0;
 			}
@@ -1033,8 +1030,8 @@ autoDistance Dissimilarity_to_Distance (Dissimilarity me, int scale) {
 				Melder_warning (U"Dissimilarity_to_Distance: could not determine \"additive constant\", the average dissimilarity was used as its value.");
 			}
 		}
-		for (long i = 1; i <= my numberOfRows - 1; i++) {
-			for (long j = i + 1; j <= my numberOfColumns; j++) {
+		for (integer i = 1; i <= my numberOfRows - 1; i++) {
+			for (integer j = i + 1; j <= my numberOfColumns; j++) {
 				double d = 0.5 * (my data[i][j] + my data[j][i]) + additiveConstant;
 				thy data[i][j] = thy data[j][i] = d;
 			}
@@ -1049,8 +1046,8 @@ autoWeight Dissimilarity_to_Weight (Dissimilarity me) {
 	try {
 		autoWeight thee = Weight_create (my numberOfRows);
 		TableOfReal_copyLabels (me, thee.get(), 1, 1);
-		for (long i = 1; i <= my numberOfRows; i++) {
-			for (long j = i; j <= my numberOfRows; j++) {
+		for (integer i = 1; i <= my numberOfRows; i++) {
+			for (integer j = i; j <= my numberOfRows; j++) {
 				if (my data[i][j] > 0.0) {
 					thy data[i][j] = 1.0;
 				}
@@ -1076,8 +1073,8 @@ autoDissimilarity Confusion_to_Dissimilarity_pdf (Confusion me, double minimumCo
 
 		// Correct "zero" responses.
 
-		for (long i = 1; i <= my numberOfColumns; i++) {
-			for (long j = 1; j <= my numberOfColumns; j++) {
+		for (integer i = 1; i <= my numberOfColumns; i++) {
+			for (integer j = 1; j <= my numberOfColumns; j++) {
 				if (thy data[i][j] == 0.0) {
 					thy data[i][j] = minimumConfusionLevel;
 				}
@@ -1117,8 +1114,8 @@ autoDissimilarity Confusion_to_Dissimilarity_pdf (Confusion me, double minimumCo
 			Make maximum dissimilarity equal to 4sigma.
 		*/
 
-		for (long i = 1; i <= my numberOfColumns; i++) {
-			for (long j = i + 1; j <= my numberOfColumns; j++) {
+		for (integer i = 1; i <= my numberOfColumns; i++) {
+			for (integer j = i + 1; j <= my numberOfColumns; j++) {
 				double x = thy data[i][j] <= thy data[j][i] ? thy data[i][j] : thy data[j][i];
 				double y = thy data[i][j] > thy data[j][i] ? thy data[i][j] : thy data[j][i];
 				x = NUMinvGaussQ (x);
@@ -1134,7 +1131,7 @@ autoDissimilarity Confusion_to_Dissimilarity_pdf (Confusion me, double minimumCo
 	}
 }
 
-void Distance_and_Configuration_drawScatterDiagram (Distance me, Configuration him, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, int garnish) {
+void Distance_and_Configuration_drawScatterDiagram (Distance me, Configuration him, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, bool garnish) {
 	autoDistance dist = Configuration_to_Distance (him);
 	Proximity_Distance_drawScatterDiagram (me, dist.get(), g, xmin, xmax, ymin, ymax, size_mm, mark, garnish);
 }
@@ -1169,8 +1166,8 @@ autoScalarProduct Distance_to_ScalarProduct (Distance me, bool normalize) {
 	try {
 		autoScalarProduct thee = ScalarProduct_create (my numberOfRows);
 		TableOfReal_copyLabels (me, thee.get(), 1, 1);
-		for (long i = 1; i <= my numberOfRows - 1; i++) {
-			for (long j = i + 1; j <= my numberOfColumns; j++) {
+		for (integer i = 1; i <= my numberOfRows - 1; i++) {
+			for (integer j = i + 1; j <= my numberOfColumns; j++) {
 
 				// force symmetry by averaging!
 
@@ -1198,8 +1195,8 @@ autoDistance Configuration_to_Distance (Configuration me) {
 	try {
 		autoDistance thee = Distance_create (my numberOfRows);
 		TableOfReal_copyLabels (me, thee.get(), 1, -1);
-		for (long i = 1; i <= thy numberOfRows - 1; i++) {
-			for (long j = i + 1; j <= thy numberOfColumns; j++) {
+		for (integer i = 1; i <= thy numberOfRows - 1; i++) {
+			for (integer j = i + 1; j <= thy numberOfColumns; j++) {
 				double dmax = 0.0, d = 0.0;
 
 				/*
@@ -1209,14 +1206,14 @@ autoDistance Configuration_to_Distance (Configuration me) {
 					my w[k] * pow (|i-j|) instead of pow (my w[k] * |i-j|)
 				*/
 
-				for (long k = 1; k <= my numberOfColumns; k++) {
+				for (integer k = 1; k <= my numberOfColumns; k++) {
 					double dtmp  = fabs (my data[i][k] - my data[j][k]);
 					if (dtmp > dmax) {
 						dmax = dtmp;
 					}
 				}
 				if (dmax > 0.0) {
-					for (long k = 1; k <= my numberOfColumns; k++) {
+					for (integer k = 1; k <= my numberOfColumns; k++) {
 						double arg = fabs (my data[i][k] - my data[j][k]) / dmax;
 						d += my w[k] * pow (arg, my metric);
 					}
@@ -1230,8 +1227,8 @@ autoDistance Configuration_to_Distance (Configuration me) {
 	}
 }
 
-void Proximity_Distance_drawScatterDiagram (Proximity me, Distance thee, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, int garnish) {
-	long n = my numberOfRows * (my numberOfRows - 1) / 2;
+void Proximity_Distance_drawScatterDiagram (Proximity me, Distance thee, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, bool garnish) {
+	integer n = my numberOfRows * (my numberOfRows - 1) / 2;
 	double **x = my data, **y = thy data;
 
 	if (n == 0) {
@@ -1242,8 +1239,8 @@ void Proximity_Distance_drawScatterDiagram (Proximity me, Distance thee, Graphic
 	}
 	if (xmax <= xmin) {
 		xmin = xmax = x[1][2];
-		for (long i = 1; i <= thy numberOfRows - 1; i++) {
-			for (long j = i + 1; j <= thy numberOfColumns; j++) {
+		for (integer i = 1; i <= thy numberOfRows - 1; i++) {
+			for (integer j = i + 1; j <= thy numberOfColumns; j++) {
 				if (x[i][j] > xmax) {
 					xmax = x[i][j];
 				} else if (x[i][j] < xmin) {
@@ -1254,8 +1251,8 @@ void Proximity_Distance_drawScatterDiagram (Proximity me, Distance thee, Graphic
 	}
 	if (ymax <= ymin) {
 		ymin = ymax = y[1][2];
-		for (long i = 1; i <= my numberOfRows - 1; i++) {
-			for (long j = i + 1; j <= my numberOfColumns; j++) {
+		for (integer i = 1; i <= my numberOfRows - 1; i++) {
+			for (integer j = i + 1; j <= my numberOfColumns; j++) {
 				if (y[i][j] > ymax) {
 					ymax = y[i][j];
 				} else if (y[i][j] < ymin) {
@@ -1266,8 +1263,8 @@ void Proximity_Distance_drawScatterDiagram (Proximity me, Distance thee, Graphic
 	}
 	Graphics_setWindow (g, xmin, xmax, ymin, ymax);
 	Graphics_setInner (g);
-	for (long i = 1; i <= thy numberOfRows - 1; i++) {
-		for (long j = i + 1; j <= thy numberOfColumns; j++) {
+	for (integer i = 1; i <= thy numberOfRows - 1; i++) {
+		for (integer j = i + 1; j <= thy numberOfColumns; j++) {
 			if (x[i][j] >= xmin && x[i][j] <= xmax && y[i][j] >= ymin && y[i][j] <= ymax) {
 				Graphics_mark (g, x[i][j], y[i][j], size_mm, mark);
 			}
@@ -1287,7 +1284,7 @@ void Proximity_Distance_drawScatterDiagram (Proximity me, Distance thee, Graphic
 autoDistanceList MDSVecList_Distance_monotoneRegression (MDSVecList me, Distance thee, int tiesHandling) {
 	try {
 		autoDistanceList him = DistanceList_create ();
-		for (long i = 1; i <= my size; i ++) {
+		for (integer i = 1; i <= my size; i ++) {
 			MDSVec vec = my at [i];
 			if (vec -> nPoints != thy numberOfRows) {
 				Melder_throw (U"Dimension of MDSVec and Distance must be equal.");
@@ -1303,7 +1300,7 @@ autoDistanceList MDSVecList_Distance_monotoneRegression (MDSVecList me, Distance
 
 autoDistance MDSVec_Distance_monotoneRegression (MDSVec me, Distance thee, int tiesHandling) {
 	try {
-		long nProximities = my nProximities;
+		integer nProximities = my nProximities;
 		if (thy numberOfRows != my nPoints) {
 			Melder_throw (U"Distance and MDSVVec dimension do not agreee.");
 		}
@@ -1312,8 +1309,8 @@ autoDistance MDSVec_Distance_monotoneRegression (MDSVec me, Distance thee, int t
 		autoDistance him = Distance_create (thy numberOfRows);
 		TableOfReal_copyLabels (thee, him.get(), 1, 1);
 
-		long *iPoint = my iPoint, *jPoint = my jPoint;
-		for (long i = 1; i <= nProximities; i++) {
+		integer *iPoint = my iPoint, *jPoint = my jPoint;
+		for (integer i = 1; i <= nProximities; i++) {
 			distance[i] = thy data[iPoint[i]][jPoint[i]];
 		}
 
@@ -1324,8 +1321,8 @@ autoDistance MDSVec_Distance_monotoneRegression (MDSVec me, Distance thee, int t
 				Kruskal's secondary approach:
 					Substitute average distance in each tie block
 			*/
-			long ib = 1;
-			for (long i = 2; i <= nProximities; i++) {
+			integer ib = 1;
+			for (integer i = 2; i <= nProximities; i++) {
 				if (my proximity [i] == my proximity [i - 1]) {
 					continue;
 				}
@@ -1334,11 +1331,11 @@ autoDistance MDSVec_Distance_monotoneRegression (MDSVec me, Distance thee, int t
 						NUMsort3 (distance.peek(), iPoint, jPoint, ib, i - 1, 1); // sort ascending
 					} else if (tiesHandling == MDS_SECONDARY_APPROACH) {
 						double mean = 0.0;
-						for (long j = ib; j <= i - 1; j++) {
+						for (integer j = ib; j <= i - 1; j++) {
 							mean += distance [j];
 						}
 						mean /= (i - ib);
-						for (long j = ib; j <= i - 1; j++) {
+						for (integer j = ib; j <= i - 1; j++) {
 							distance [j] = mean;
 						}
 					}
@@ -1351,15 +1348,15 @@ autoDistance MDSVec_Distance_monotoneRegression (MDSVec me, Distance thee, int t
 
 		// Fill Distance with monotone regressed distances
 
-		for (long i = 1; i <= nProximities; i++) {
-			long ip = iPoint[i], jp = jPoint[i];
+		for (integer i = 1; i <= nProximities; i++) {
+			integer ip = iPoint[i], jp = jPoint[i];
 			his data[ip][jp] = his data[jp][ip] = fit[i];
 		}
 
 		// Make rest of distances equal to the maximum fit.
 
-		for (long i = 1; i <= his numberOfRows - 1; i++) {
-			for (long j = i + 1; j <= his numberOfColumns; j++) {
+		for (integer i = 1; i <= his numberOfRows - 1; i++) {
+			for (integer j = i + 1; j <= his numberOfColumns; j++) {
 				if (his data[i][j] == 0.0) {
 					his data[i][j] = his data[j][i] = fit[nProximities];
 				}
@@ -1390,7 +1387,7 @@ autoDistance Dissimilarity_Distance_monotoneRegression (Dissimilarity me, Distan
 autoScalarProductList DistanceList_to_ScalarProductList (DistanceList me, bool normalize) {
 	try {
 		autoScalarProductList thee = ScalarProductList_create ();
-		for (long i = 1; i <= my size; i ++) {
+		for (integer i = 1; i <= my size; i ++) {
 			autoScalarProduct sp = Distance_to_ScalarProduct (my at [i], normalize);
 			thy addItem_move (sp.move());
 		}
@@ -1410,10 +1407,10 @@ void DistanceList_to_Configuration_ytl (DistanceList me, int numberOfDimensions,
 }
 
 void ScalarProductList_to_Configuration_ytl (ScalarProductList me, int numberOfDimensions, autoConfiguration *out1, autoSalience *out2) {
-	long numberOfSources = my size;
+	integer numberOfSources = my size;
 	autoNUMvector<double **> ci (1, numberOfSources);
 	try {
-		long nPoints = my at [1] -> numberOfRows;
+		integer nPoints = my at [1] -> numberOfRows;
 
 		autoConfiguration thee = Configuration_create (nPoints, numberOfDimensions);
 		autoSalience mdsw = Salience_create (numberOfSources, numberOfDimensions);
@@ -1434,18 +1431,18 @@ void ScalarProductList_to_Configuration_ytl (ScalarProductList me, int numberOfD
 		// Determine the average scalar product matrix (Pmean) of
 		// dimension [1..nPoints][1..nPoints].
 
-		for (long i = 1; i <= numberOfSources; i ++) {
+		for (integer i = 1; i <= numberOfSources; i ++) {
 			ScalarProduct sp = my at [i];
-			for (long j = 1; j <= nPoints; j ++) {
-				for (long k = 1; k <= nPoints; k ++) {
+			for (integer j = 1; j <= nPoints; j ++) {
+				for (integer k = 1; k <= nPoints; k ++) {
 					pmean [j] [k] += sp -> data [j] [k];
 				}
 			}
 		}
 
 		if (numberOfSources > 1) {
-			for (long j = 1; j <= nPoints; j ++) {
-				for (long k = 1; k <= nPoints; k ++) {
+			for (integer j = 1; j <= nPoints; j ++) {
+				for (integer k = 1; k <= nPoints; k ++) {
 					pmean [j] [k] /= numberOfSources;
 				}
 			}
@@ -1469,14 +1466,14 @@ void ScalarProductList_to_Configuration_ytl (ScalarProductList me, int numberOfD
 
 		NUMpseudoInverse (y.peek(), nPoints, numberOfDimensions, yinv.peek(), 1e-14);
 
-		for (long i = 1; i <= numberOfSources; i ++) {
+		for (integer i = 1; i <= numberOfSources; i ++) {
 			ScalarProduct sp = my at [i];
 			ci [i] = NUMmatrix<double> (1, numberOfDimensions, 1, numberOfDimensions);
-			for (long j = 1; j <= numberOfDimensions; j ++) {
-				for (long k = 1; k <= numberOfDimensions; k ++) {
-					for (long l = 1; l <= nPoints; l ++) {
+			for (integer j = 1; j <= numberOfDimensions; j ++) {
+				for (integer k = 1; k <= numberOfDimensions; k ++) {
+					for (integer l = 1; l <= nPoints; l ++) {
 						if (yinv [j] [l] != 0.0) {
-							for (long m = 1; m <= nPoints; m ++) {
+							for (integer m = 1; m <= nPoints; m ++) {
 								ci [i] [j] [k] += yinv [j] [l] * sp -> data [l] [m] * yinv [k] [m];
 							}
 						}
@@ -1489,8 +1486,8 @@ void ScalarProductList_to_Configuration_ytl (ScalarProductList me, int numberOfD
 		// a[i][j] = trace (C[i]*C[j]) - trace (C[i]) * trace (C[j]) / numberOfDimensions;
 		// Get the first eigenvector and form matrix cl from a linear combination of the C[i]'s
 
-		for (long i = 1; i <= numberOfSources; i ++) {
-			for (long j = i; j <= numberOfSources; j ++) {
+		for (integer i = 1; i <= numberOfSources; i ++) {
+			for (integer j = i; j <= numberOfSources; j ++) {
 				a [j] [i] = a [i] [j] =  NUMtrace2 (ci [i], ci [j], numberOfDimensions)
 					- NUMtrace (ci [i], numberOfDimensions) * NUMtrace (ci [j], numberOfDimensions) / numberOfDimensions;
 			}
@@ -1498,9 +1495,9 @@ void ScalarProductList_to_Configuration_ytl (ScalarProductList me, int numberOfD
 
 		NUMeigensystem (a.peek(), numberOfSources, evec.peek(), eval.peek());
 
-		for (long i = 1; i <= numberOfSources; i ++) {
-			for (long j = 1; j <= numberOfDimensions; j ++) {
-				for (long k = 1; k <= numberOfDimensions; k ++) {
+		for (integer i = 1; i <= numberOfSources; i ++) {
+			for (integer j = 1; j <= numberOfDimensions; j ++) {
+				for (integer k = 1; k <= numberOfDimensions; k ++) {
 					cl [j] [k] += ci [i] [j] [k] * evec [i] [1]; /* eq. (7) */
 				}
 			}
@@ -1513,10 +1510,10 @@ void ScalarProductList_to_Configuration_ytl (ScalarProductList me, int numberOfD
 
 		// Now get the configuration: X = Y.K
 
-		for (long i = 1; i <= nPoints; i ++) {
-			for (long j = 1; j <= numberOfDimensions; j ++) {
+		for (integer i = 1; i <= nPoints; i ++) {
+			for (integer j = 1; j <= numberOfDimensions; j ++) {
 				double x = 0.0;
-				for (long k = 1; k <= numberOfDimensions; k ++) {
+				for (integer k = 1; k <= numberOfDimensions; k ++) {
 					x += y [i] [k] * K [k] [j];
 				}
 				thy data [i] [j] = x;
@@ -1528,26 +1525,26 @@ void ScalarProductList_to_Configuration_ytl (ScalarProductList me, int numberOfD
 		// And finally the weights: W[i] = K' C[i] K   (eq. (5)).
 		// We are only interested in the diagonal of the resulting matrix W[i].
 
-		for (long i = 1; i <= numberOfSources; i ++) {
-			for (long j = 1; j <= numberOfDimensions; j ++) {
-				double wt = 0.0;
-				for (long k = 1; k <= numberOfDimensions; k ++) {
+		for (integer i = 1; i <= numberOfSources; i ++) {
+			for (integer j = 1; j <= numberOfDimensions; j ++) {
+				real80 wt = 0.0;
+				for (integer k = 1; k <= numberOfDimensions; k ++) {
 					if (K [k] [j] != 0.0) {
-						for (long l = 1; l <= numberOfDimensions; l ++) {
+						for (integer l = 1; l <= numberOfDimensions; l ++) {
 							wt += K [k] [j] * ci [i] [k] [l] * K [l] [j];
 						}
 					}
 				}
-				mdsw -> data [i] [j] = wt;
+				mdsw -> data [i] [j] = (real) wt;
 			}
 		}
 		
 		*out1 = thee.move(); *out2 = mdsw.move();
-		for (long i = 1; i <= numberOfSources; i ++) {
+		for (integer i = 1; i <= numberOfSources; i ++) {
 			NUMmatrix_free<double> (ci [i], 1, 1);
 		}
 	} catch (MelderError) {
-		for (long i = 1; i <= numberOfSources; i ++) {
+		for (integer i = 1; i <= numberOfSources; i ++) {
 			NUMmatrix_free<double> (ci [i], 1, 1);
 		}
 		Melder_throw (me, U": no Configuration (ytl) created.");
@@ -1557,7 +1554,7 @@ void ScalarProductList_to_Configuration_ytl (ScalarProductList me, int numberOfD
 autoDissimilarityList DistanceList_to_DissimilarityList (DistanceList me) {
 	try {
 		autoDissimilarityList thee = DissimilarityList_create ();
-		for (long i = 1; i <= my size; i ++) {
+		for (integer i = 1; i <= my size; i ++) {
 			const char32 *name = Thing_getName (my at [i]);
 			autoDissimilarity him = Distance_to_Dissimilarity (my at [i]);
 			Thing_setName (him.get(), name ? name : U"untitled");
@@ -1573,7 +1570,7 @@ autoDistanceList DissimilarityList_to_DistanceList (DissimilarityList me, int me
 	try {
 		autoDistanceList thee = DistanceList_create ();
 
-		for (long i = 1; i <= my size; i ++) {
+		for (integer i = 1; i <= my size; i ++) {
 			autoDistance him = Dissimilarity_to_Distance (my at [i], measurementLevel == MDS_ORDINAL);
 			const char32 *name = Thing_getName (my at [i]);
 			Thing_setName (him.get(), name ? name : U"untitled");
@@ -1588,7 +1585,7 @@ autoDistanceList DissimilarityList_to_DistanceList (DissimilarityList me, int me
 /*****************  Kruskal *****************************************/
 
 static void smacof_guttmanTransform (Configuration cx, Configuration cz, Distance disp, Weight weight, double **vplus) {
-	long nPoints = cx -> numberOfRows, nDimensions = cx -> numberOfColumns;
+	integer nPoints = cx -> numberOfRows, nDimensions = cx -> numberOfColumns;
 	double **z = cz -> data;
 
 	autoNUMmatrix<double> b (1, nPoints, 1, nPoints);
@@ -1596,9 +1593,9 @@ static void smacof_guttmanTransform (Configuration cx, Configuration cz, Distanc
 
 	// compute B(Z) (eq. 8.25)
 
-	for (long i = 1; i <= nPoints; i++) {
-		double sum = 0.0;
-		for (long j = 1; j <= nPoints; j++) {
+	for (integer i = 1; i <= nPoints; i++) {
+		real80 sum = 0.0;
+		for (integer j = 1; j <= nPoints; j++) {
 			double dzij = distZ -> data[i][j];
 			if (i == j || dzij == 0.0) {
 				continue;
@@ -1606,20 +1603,20 @@ static void smacof_guttmanTransform (Configuration cx, Configuration cz, Distanc
 			b[i][j] = - weight -> data[i][j] * disp -> data[i][j] / dzij;
 			sum += b[i][j];
 		}
-		b[i][i] = - sum;
+		b[i][i] = - (real) sum;
 	}
 
 	// Guttman transform: Xu = (V+)B(Z)Z (eq. 8.29)
 
-	for (long i = 1; i <= nPoints; i++) {
-		for (long j = 1; j <= nDimensions; j++) {
-			double xij = 0.0;
-			for (long k = 1;  k <= nPoints; k++) {
-				for (long l = 1; l <= nPoints; l++) {
+	for (integer i = 1; i <= nPoints; i++) {
+		for (integer j = 1; j <= nDimensions; j++) {
+			real80 xij = 0.0;
+			for (integer k = 1;  k <= nPoints; k++) {
+				for (integer l = 1; l <= nPoints; l++) {
 					xij += vplus[i][k] * b[k][l] * z[l][j];
 				}
 			}
-			cx -> data[i][j] = xij;
+			cx -> data[i][j] = (real) xij;
 		}
 	}
 }
@@ -1648,12 +1645,12 @@ double Distance_Weight_stress (Distance fit, Distance conf, Weight weight, int s
 	} else if (stressMeasure == MDS_STRESS_2) {
 		double m = 0.0, wsum = 0.0, var = 0.0, **w = weight -> data;
 		double **c = conf -> data;
-		long nPoints = conf -> numberOfRows;
+		integer nPoints = conf -> numberOfRows;
 
 		// Get average distance
 
-		for (long i = 1; i <= nPoints - 1; i++) {
-			for (long j = i + 1; j <= nPoints; j++) {
+		for (integer i = 1; i <= nPoints - 1; i++) {
+			for (integer j = i + 1; j <= nPoints; j++) {
 				m += w[i][j] * c[i][j];
 				wsum += w[i][j];
 			}
@@ -1662,8 +1659,8 @@ double Distance_Weight_stress (Distance fit, Distance conf, Weight weight, int s
 		if (m > 0.0) {
 			// Get variance
 
-			for (long i = 1; i <= nPoints - 1; i++) {
-				for (long j = i + 1; j <= nPoints; j++) {
+			for (integer i = 1; i <= nPoints - 1; i++) {
+				for (integer j = i + 1; j <= nPoints; j++) {
 					tmp = c[i][j] - m;
 					var += w[i][j] * tmp * tmp;
 				}
@@ -1681,16 +1678,16 @@ double Distance_Weight_stress (Distance fit, Distance conf, Weight weight, int s
 
 void Distance_Weight_rawStressComponents (Distance fit, Distance conf, Weight weight, double *p_etafit, double *p_etaconf, double *p_rho)
 {
-	long nPoints = conf -> numberOfRows;
+	integer nPoints = conf -> numberOfRows;
 
 	double etafit = 0.0, etaconf = 0.0, rho = 0.0;
 
-	for (long i = 1; i <= nPoints - 1; i++) {
+	for (integer i = 1; i <= nPoints - 1; i++) {
 		double *wi = weight -> data[i];
 		double *fiti = fit -> data[i];
 		double *confi = conf -> data[i];
 
-		for (long j = i + 1; j <= nPoints; j++) {
+		for (integer j = i + 1; j <= nPoints; j++) {
 			etafit += wi[j] * fiti[j] * fiti[j];
 			etaconf += wi[j] * confi[j] * confi[j];
 			rho += wi[j] * fiti[j] * confi[j];
@@ -1708,7 +1705,7 @@ void Distance_Weight_rawStressComponents (Distance fit, Distance conf, Weight we
 }
 
 double Dissimilarity_Configuration_Transformator_Weight_stress (Dissimilarity d, Configuration c, Transformator t, Weight w, int stressMeasure) {
-	long nPoints = d -> numberOfRows;
+	integer nPoints = d -> numberOfRows;
 	double stress = undefined;
 
 	if (nPoints < 1 || nPoints != c -> numberOfRows  || nPoints != t -> numberOfPoints || (w && nPoints != w -> numberOfRows)) {
@@ -1752,7 +1749,7 @@ double Dissimilarity_Configuration_Weight_monotone_stress (Dissimilarity d, Conf
 	return stress;
 }
 
-double Dissimilarity_Configuration_Weight_ispline_stress (Dissimilarity d, Configuration c, Weight w, long numberOfInteriorKnots, long order, int stressMeasure) {
+double Dissimilarity_Configuration_Weight_ispline_stress (Dissimilarity d, Configuration c, Weight w, integer numberOfInteriorKnots, integer order, int stressMeasure) {
 	autoISplineTransformator t = ISplineTransformator_create (d -> numberOfRows, numberOfInteriorKnots, order);
 	double stress = Dissimilarity_Configuration_Transformator_Weight_stress (d, c, t.get(), w, stressMeasure);
 	return stress;
@@ -1760,33 +1757,33 @@ double Dissimilarity_Configuration_Weight_ispline_stress (Dissimilarity d, Confi
 
 void Distance_Weight_smacofNormalize (Distance me, Weight w) {
 	double sumsq = 0.0;
-	for (long i = 1; i <= my numberOfRows - 1; i++) {
+	for (integer i = 1; i <= my numberOfRows - 1; i++) {
 		double *wi = w -> data[i];
 		double *di = my data[i];
-		for (long j = i + 1; j <= my numberOfRows; j++) {
+		for (integer j = i + 1; j <= my numberOfRows; j++) {
 			sumsq += wi[j] * di[j] * di[j];
 		}
 	}
 	double scale = sqrt (my numberOfRows * (my numberOfRows - 1) / (2.0 * sumsq));
-	for (long i = 1; i <= my numberOfRows - 1; i++) {
-		for (long j = i + 1; j <= my numberOfRows; j++) {
+	for (integer i = 1; i <= my numberOfRows - 1; i++) {
+		for (integer j = i + 1; j <= my numberOfRows; j++) {
 			my data[j][i] = (my data[i][j] *= scale);
 		}
 	}
 }
 
 double Distance_Weight_congruenceCoefficient (Distance x, Distance y, Weight w) {
-	long nPoints = x -> numberOfRows;
+	integer nPoints = x -> numberOfRows;
 	if (y -> numberOfRows != nPoints || w -> numberOfRows != nPoints) {
 		return 0.0;
 	}
 
 	double xy = 0.0, x2 = 0.0, y2 = 0.0;
-	for (long i = 1; i <= nPoints - 1; i++) {
+	for (integer i = 1; i <= nPoints - 1; i++) {
 		double *xi = x -> data[i];
 		double *yi = y -> data[i];
 		double *wi = w -> data[i];
-		for (long j = i + 1; j <= nPoints - 1; j++) {
+		for (integer j = i + 1; j <= nPoints - 1; j++) {
 			xy += wi[j] * xi[j] * yi[j];
 			x2 += wi[j] * xi[j] * xi[j];
 			y2 += wi[j] * yi[j] * yi[j];
@@ -1795,10 +1792,10 @@ double Distance_Weight_congruenceCoefficient (Distance x, Distance y, Weight w)
 	return xy / (sqrt (x2) * sqrt (y2));
 }
 
-autoConfiguration Dissimilarity_Configuration_Weight_Transformator_smacof (Dissimilarity me, Configuration conf, Weight weight, Transformator t, double tolerance, long numberOfIterations, bool showProgress, double *stress) {
+autoConfiguration Dissimilarity_Configuration_Weight_Transformator_smacof (Dissimilarity me, Configuration conf, Weight weight, Transformator t, double tolerance, integer numberOfIterations, bool showProgress, double *stress) {
 	try {
-		long nPoints = conf -> numberOfRows;
-		long nDimensions = conf -> numberOfColumns;
+		integer nPoints = conf -> numberOfRows;
+		integer nDimensions = conf -> numberOfColumns;
 		double tol = 1e-6, stressp = 1e308, stres;
 		bool no_weight = ! weight;
 
@@ -1823,23 +1820,23 @@ autoConfiguration Dissimilarity_Configuration_Weight_Transformator_smacof (Dissi
 
 		// Get V (eq. 8.19).
 
-		for (long i = 1; i <= nPoints; i++) {
-			double wsum = 0;
-			for (long j = 1; j <= nPoints; j++) {
+		for (integer i = 1; i <= nPoints; i++) {
+			real80 wsum = 0.0;
+			for (integer j = 1; j <= nPoints; j++) {
 				if (i == j) {
 					continue;
 				}
 				v[i][j] = - w[i][j];
 				wsum += w[i][j];
 			}
-			v[i][i] = wsum;
+			v[i][i] = (real) wsum;
 		}
 
 		// V is row and column centered and therefore: rank(V) <= nPoints-1.
 		// V^-1 does not exist -> get Moore-Penrose inverse.
 
 		NUMpseudoInverse (v.peek(), nPoints, nPoints, vplus.peek(), tol);
-		for (long iter = 1; iter <= numberOfIterations; iter++) {
+		for (integer iter = 1; iter <= numberOfIterations; iter++) {
 			autoDistance dist = Configuration_to_Distance (conf);
 
 			// transform & normalization
@@ -1886,7 +1883,7 @@ autoConfiguration Dissimilarity_Configuration_Weight_Transformator_smacof (Dissi
 	}
 }
 
-autoConfiguration Dissimilarity_Configuration_Weight_Transformator_multiSmacof (Dissimilarity me, Configuration conf,  Weight w, Transformator t, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress) {
+autoConfiguration Dissimilarity_Configuration_Weight_Transformator_multiSmacof (Dissimilarity me, Configuration conf,  Weight w, Transformator t, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress) {
 	int showMulti = showProgress && numberOfRepetitions > 1;
 	try {
 		bool showSingle = ( showProgress && numberOfRepetitions == 1 );
@@ -1899,7 +1896,7 @@ autoConfiguration Dissimilarity_Configuration_Weight_Transformator_multiSmacof (
 			Melder_progress (0.0, U"MDS many times");
 		}
 
-		for (long i = 1; i <= numberOfRepetitions; i++) {
+		for (integer i = 1; i <= numberOfRepetitions; i++) {
 			autoConfiguration cresult = Dissimilarity_Configuration_Weight_Transformator_smacof (me, cstart.get(), w, t, tolerance, numberOfIterations, showSingle, &stress);
 			if (stress < stressmax) {
 				stressmax = stress;
@@ -1924,7 +1921,7 @@ autoConfiguration Dissimilarity_Configuration_Weight_Transformator_multiSmacof (
 	}
 }
 
-autoConfiguration Dissimilarity_Configuration_Weight_absolute_mds (Dissimilarity me, Configuration cstart, Weight w, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress) {
+autoConfiguration Dissimilarity_Configuration_Weight_absolute_mds (Dissimilarity me, Configuration cstart, Weight w, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress) {
 	try {
 		autoTransformator t = Transformator_create (my numberOfRows);
 		autoConfiguration c = Dissimilarity_Configuration_Weight_Transformator_multiSmacof (me, cstart, w, t.get(), tolerance, numberOfIterations, numberOfRepetitions, showProgress);
@@ -1934,7 +1931,7 @@ autoConfiguration Dissimilarity_Configuration_Weight_absolute_mds (Dissimilarity
 	}
 }
 
-autoConfiguration Dissimilarity_Configuration_Weight_ratio_mds (Dissimilarity me, Configuration cstart, Weight w, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress) {
+autoConfiguration Dissimilarity_Configuration_Weight_ratio_mds (Dissimilarity me, Configuration cstart, Weight w, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress) {
 	try {
 		autoRatioTransformator t = RatioTransformator_create (my numberOfRows);
 		autoConfiguration c = Dissimilarity_Configuration_Weight_Transformator_multiSmacof (me, cstart, w, t.get(), tolerance, numberOfIterations, numberOfRepetitions, showProgress);
@@ -1944,7 +1941,7 @@ autoConfiguration Dissimilarity_Configuration_Weight_ratio_mds (Dissimilarity me
 	}
 }
 
-autoConfiguration Dissimilarity_Configuration_Weight_interval_mds (Dissimilarity me, Configuration cstart, Weight w, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress) {
+autoConfiguration Dissimilarity_Configuration_Weight_interval_mds (Dissimilarity me, Configuration cstart, Weight w, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress) {
 	try {
 		autoISplineTransformator t = ISplineTransformator_create (my numberOfRows, 0, 1);
 		autoConfiguration c = Dissimilarity_Configuration_Weight_Transformator_multiSmacof (me, cstart, w, t.get(), tolerance, numberOfIterations, numberOfRepetitions, showProgress);
@@ -1954,7 +1951,7 @@ autoConfiguration Dissimilarity_Configuration_Weight_interval_mds (Dissimilarity
 	}
 }
 
-autoConfiguration Dissimilarity_Configuration_Weight_monotone_mds (Dissimilarity me, Configuration cstart, Weight w, int tiesHandling, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress) {
+autoConfiguration Dissimilarity_Configuration_Weight_monotone_mds (Dissimilarity me, Configuration cstart, Weight w, int tiesHandling, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress) {
 	try {
 		autoMonotoneTransformator t = MonotoneTransformator_create (my numberOfRows);
 		MonotoneTransformator_setTiesProcessing (t.get(), tiesHandling);
@@ -1965,7 +1962,7 @@ autoConfiguration Dissimilarity_Configuration_Weight_monotone_mds (Dissimilarity
 	}
 }
 
-autoConfiguration Dissimilarity_Configuration_Weight_ispline_mds (Dissimilarity me, Configuration cstart, Weight w, long numberOfInteriorKnots, long order, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress) {
+autoConfiguration Dissimilarity_Configuration_Weight_ispline_mds (Dissimilarity me, Configuration cstart, Weight w, integer numberOfInteriorKnots, integer order, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress) {
 	try {
 		autoISplineTransformator t = ISplineTransformator_create (my numberOfRows, numberOfInteriorKnots, order);
 		autoConfiguration c = Dissimilarity_Configuration_Weight_Transformator_multiSmacof (me, cstart, w, t.get(), tolerance, numberOfIterations, numberOfRepetitions, showProgress);
@@ -1975,7 +1972,7 @@ autoConfiguration Dissimilarity_Configuration_Weight_ispline_mds (Dissimilarity
 	}
 }
 
-autoConfiguration Dissimilarity_Weight_absolute_mds (Dissimilarity me, Weight w, long numberOfDimensions, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress) {
+autoConfiguration Dissimilarity_Weight_absolute_mds (Dissimilarity me, Weight w, integer numberOfDimensions, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress) {
 	try {
 		autoDistance d = Dissimilarity_to_Distance (me, MDS_ABSOLUTE);
 		autoConfiguration cstart = Distance_to_Configuration_torsca (d.get(), numberOfDimensions);
@@ -1986,7 +1983,7 @@ autoConfiguration Dissimilarity_Weight_absolute_mds (Dissimilarity me, Weight w,
 	}
 }
 
-autoConfiguration Dissimilarity_Weight_interval_mds (Dissimilarity me, Weight w, long numberOfDimensions, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress) {
+autoConfiguration Dissimilarity_Weight_interval_mds (Dissimilarity me, Weight w, integer numberOfDimensions, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress) {
 	try {
 		autoDistance d = Dissimilarity_to_Distance (me, MDS_RATIO);
 		autoConfiguration cstart = Distance_to_Configuration_torsca (d.get(), numberOfDimensions);
@@ -1997,7 +1994,7 @@ autoConfiguration Dissimilarity_Weight_interval_mds (Dissimilarity me, Weight w,
 	}
 }
 
-autoConfiguration Dissimilarity_Weight_monotone_mds (Dissimilarity me, Weight w, long numberOfDimensions, int tiesHandling, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress) {
+autoConfiguration Dissimilarity_Weight_monotone_mds (Dissimilarity me, Weight w, integer numberOfDimensions, int tiesHandling, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress) {
 	try {
 		autoDistance d = Dissimilarity_to_Distance (me, MDS_ORDINAL);
 		autoConfiguration cstart = Distance_to_Configuration_torsca (d.get(), numberOfDimensions);
@@ -2008,7 +2005,7 @@ autoConfiguration Dissimilarity_Weight_monotone_mds (Dissimilarity me, Weight w,
 	}
 }
 
-autoConfiguration Dissimilarity_Weight_ratio_mds (Dissimilarity me, Weight w, long numberOfDimensions, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress) {
+autoConfiguration Dissimilarity_Weight_ratio_mds (Dissimilarity me, Weight w, integer numberOfDimensions, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress) {
 	try {
 		autoDistance d = Dissimilarity_to_Distance (me, MDS_RATIO);
 		autoConfiguration cstart = Distance_to_Configuration_torsca (d.get(), numberOfDimensions);
@@ -2020,7 +2017,7 @@ autoConfiguration Dissimilarity_Weight_ratio_mds (Dissimilarity me, Weight w, lo
 	}
 }
 
-autoConfiguration Dissimilarity_Weight_ispline_mds (Dissimilarity me, Weight w, long numberOfDimensions, long numberOfInteriorKnots, long order, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress) {
+autoConfiguration Dissimilarity_Weight_ispline_mds (Dissimilarity me, Weight w, integer numberOfDimensions, integer numberOfInteriorKnots, integer order, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress) {
 	try {
 		autoDistance d = Dissimilarity_to_Distance (me, MDS_ORDINAL);
 		autoConfiguration cstart = Distance_to_Configuration_torsca (d.get(), numberOfDimensions);
@@ -2035,21 +2032,21 @@ autoConfiguration Dissimilarity_Weight_ispline_mds (Dissimilarity me, Weight w,
 /***** classical **/
 
 static void MDSVec_Distances_getStressValues (MDSVec me, Distance ddist, Distance dfit, int stress_formula, double *stress, double *s, double *t, double *dbar) {
-	long nProximities = my nProximities;
-	long *iPoint = my iPoint, *jPoint = my jPoint;
+	integer nProximities = my nProximities;
+	integer *iPoint = my iPoint, *jPoint = my jPoint;
 	double **dist = ddist -> data, **fit = dfit -> data;
 
 	*s = *t = *dbar = 0.0;
 
 	if (stress_formula == 2) {
-		for (long i = 1; i <= nProximities; i++) {
+		for (integer i = 1; i <= nProximities; i++) {
 			*dbar += dist[iPoint[i]][jPoint[i]];
 		}
 		*dbar /= nProximities;
 	}
 
-	for (long i = 1; i <= nProximities; i++) {
-		long ii = iPoint[i], jj = jPoint[i];
+	for (integer i = 1; i <= nProximities; i++) {
+		integer ii = iPoint[i], jj = jPoint[i];
 		double st = dist[ii][jj] - fit[ii][jj];
 		double tt = dist[ii][jj] - *dbar;
 		*s += st * st; *t += tt * tt;
@@ -2063,8 +2060,8 @@ static double func (Daata object, const double p[]) {
 	MDSVec him = my vec.get();
 	double **x = my configuration -> data, s, t, dbar, stress;
 	double metric = my configuration -> metric;
-	long numberOfDimensions = my configuration -> numberOfColumns;
-	long numberOfPoints = my configuration -> numberOfRows;
+	integer numberOfDimensions = my configuration -> numberOfColumns;
+	integer numberOfPoints = my configuration -> numberOfRows;
 	int tiesHandling = my process == MDS_CONTINUOUS ? 1 : 0;
 
 	// Substitute results of minimizer into configuration and
@@ -2091,8 +2088,8 @@ static double func (Daata object, const double p[]) {
 
 	// Gradient calculation.
 
-	for (long i = 1; i <= numberOfPoints; i++) {
-		for (long j = 1; j <= numberOfDimensions; j++) {
+	for (integer i = 1; i <= numberOfPoints; i++) {
+		for (integer j = 1; j <= numberOfDimensions; j++) {
 			my dx[i][j] = 0.0;
 		}
 	}
@@ -2103,10 +2100,10 @@ static double func (Daata object, const double p[]) {
 		return stress;
 	}
 
-	for (long i = 1; i <= his nProximities; i++) {
-		long ii = my vec -> iPoint[i], jj = my vec -> jPoint[i];
+	for (integer i = 1; i <= his nProximities; i++) {
+		integer ii = my vec -> iPoint[i], jj = my vec -> jPoint[i];
 		double g1 = stress * ((dist->data[ii][jj] - fit->data[ii][jj]) / s - (dist->data[ii][jj] - dbar) / t);
-		for (long j = 1; j <= numberOfDimensions; j++) {
+		for (integer j = 1; j <= numberOfDimensions; j++) {
 			double dj = x[ii][j] - x[jj][j];
 			double g2 = g1 * pow (fabs (dj) / dist->data[ii][jj], metric - 1.0);
 			if (dj < 0.0) {
@@ -2127,9 +2124,9 @@ static void dfunc (Daata object, const double * /* p */, double dp[]) {
 	Kruskal me = (Kruskal) object;
 	Configuration thee = my configuration.get();
 
-	long k = 1;
-	for (long i = 1; i <= thy numberOfRows; i++) {
-		for (long j = 1; j <= thy numberOfColumns; j++) {
+	integer k = 1;
+	for (integer i = 1; i <= thy numberOfRows; i++) {
+		for (integer j = 1; j <= thy numberOfColumns; j++) {
 			dp[k++] = my dx[i][j];
 		}
 	}
@@ -2140,7 +2137,7 @@ void structKruskal :: v_destroy () noexcept {
 	Kruskal_Parent :: v_destroy ();
 }
 
-autoKruskal Kruskal_create (long numberOfPoints, long numberOfDimensions) {
+autoKruskal Kruskal_create (integer numberOfPoints, integer numberOfDimensions) {
 	try {
 		autoKruskal me = Thing_new (Kruskal);
 		my configuration = Configuration_create (numberOfPoints, numberOfDimensions);
@@ -2152,7 +2149,7 @@ autoKruskal Kruskal_create (long numberOfPoints, long numberOfDimensions) {
 	}
 }
 
-autoConfiguration Dissimilarity_to_Configuration_kruskal (Dissimilarity me, long numberOfDimensions, long /* metric */, int tiesHandling, int stress_formula, double tolerance, long numberOfIterations, long numberOfRepetitions) {
+autoConfiguration Dissimilarity_to_Configuration_kruskal (Dissimilarity me, integer numberOfDimensions, integer /* metric */, int tiesHandling, int stress_formula, double tolerance, integer numberOfIterations, integer numberOfRepetitions) {
 	try {
 		int scale = 1;
 		autoDistance d = Dissimilarity_to_Distance (me, scale);
@@ -2165,7 +2162,7 @@ autoConfiguration Dissimilarity_to_Configuration_kruskal (Dissimilarity me, long
 	}
 }
 
-void Dissimilarity_Configuration_drawShepardDiagram (Dissimilarity me, Configuration him, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, int garnish) {
+void Dissimilarity_Configuration_drawShepardDiagram (Dissimilarity me, Configuration him, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, bool garnish) {
 	autoDistance dist = Configuration_to_Distance (him);
 	Proximity_Distance_drawScatterDiagram (me, dist.get(), g, xmin, xmax, ymin, ymax, size_mm, mark, garnish);
 }
@@ -2184,7 +2181,7 @@ autoDistanceList DissimilarityList_Configuration_monotoneRegression (Dissimilari
 	try {
 		autoDistanceList thee = DistanceList_create ();
 		autoDistance dist = Configuration_to_Distance (configuration);
-		for (long i = 1; i <= my size; i ++) {
+		for (integer i = 1; i <= my size; i ++) {
 			autoDistance d = Dissimilarity_Distance_monotoneRegression (my at [i], dist.get(), tiesHandling);
 			thy addItem_move (d.move());
 		}
@@ -2194,36 +2191,36 @@ autoDistanceList DissimilarityList_Configuration_monotoneRegression (Dissimilari
 	}
 }
 
-void Dissimilarity_Configuration_drawMonotoneRegression (Dissimilarity me, Configuration him, Graphics g, int tiesHandling, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, int garnish) {
+void Dissimilarity_Configuration_drawMonotoneRegression (Dissimilarity me, Configuration him, Graphics g, int tiesHandling, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, bool garnish) {
 	/* obsolete replace by transformator */
 	autoDistance fit = Dissimilarity_Configuration_monotoneRegression (me, him, tiesHandling);
 	Proximity_Distance_drawScatterDiagram (me, fit.get(), g, xmin, xmax, ymin, ymax, size_mm, mark, garnish);
 }
 
-void Dissimilarity_Configuration_Weight_drawAbsoluteRegression (Dissimilarity d, Configuration c, Weight w, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, int garnish) {
+void Dissimilarity_Configuration_Weight_drawAbsoluteRegression (Dissimilarity d, Configuration c, Weight w, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, bool garnish) {
 	autoTransformator t = Transformator_create (d -> numberOfRows);
 	autoDistance fit = Dissimilarity_Configuration_Transformator_Weight_transform (d, c, t.get(), w);
 	Proximity_Distance_drawScatterDiagram (d, fit.get(), g, xmin, xmax, ymin, ymax, size_mm, mark, garnish);
 }
 
-void Dissimilarity_Configuration_Weight_drawRatioRegression (Dissimilarity d, Configuration c, Weight w, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, int garnish) {
+void Dissimilarity_Configuration_Weight_drawRatioRegression (Dissimilarity d, Configuration c, Weight w, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, bool garnish) {
 	autoRatioTransformator t = RatioTransformator_create (d -> numberOfRows);
 	autoDistance fit = Dissimilarity_Configuration_Transformator_Weight_transform (d, c, t.get(), w);
 	Proximity_Distance_drawScatterDiagram (d, fit.get(), g, xmin, xmax, ymin, ymax, size_mm, mark, garnish);
 }
 
-void Dissimilarity_Configuration_Weight_drawIntervalRegression (Dissimilarity d, Configuration c, Weight w, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, int garnish) {
+void Dissimilarity_Configuration_Weight_drawIntervalRegression (Dissimilarity d, Configuration c, Weight w, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, bool garnish) {
 	Dissimilarity_Configuration_Weight_drawISplineRegression (d, c, w, g, 0.0, 1.0, xmin, xmax, ymin, ymax, size_mm, mark, garnish);
 }
 
-void Dissimilarity_Configuration_Weight_drawMonotoneRegression (Dissimilarity d, Configuration c, Weight w, Graphics g, int tiesHandling, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, int garnish) {
+void Dissimilarity_Configuration_Weight_drawMonotoneRegression (Dissimilarity d, Configuration c, Weight w, Graphics g, int tiesHandling, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, bool garnish) {
 	autoMonotoneTransformator t = MonotoneTransformator_create (d->numberOfRows);
 	MonotoneTransformator_setTiesProcessing (t.get(), tiesHandling);
 	autoDistance fit = Dissimilarity_Configuration_Transformator_Weight_transform (d, c, t.get(), w);
 	Proximity_Distance_drawScatterDiagram (d, fit.get(), g, xmin, xmax, ymin, ymax, size_mm, mark, garnish);
 }
 
-void Dissimilarity_Configuration_Weight_drawISplineRegression (Dissimilarity d, Configuration c, Weight w, Graphics g, long numberOfInternalKnots, long order, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, int garnish) {
+void Dissimilarity_Configuration_Weight_drawISplineRegression (Dissimilarity d, Configuration c, Weight w, Graphics g, integer numberOfInternalKnots, integer order, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, bool garnish) {
 	autoISplineTransformator t = ISplineTransformator_create (d->numberOfRows, numberOfInternalKnots, order);
 	autoDistance fit = Dissimilarity_Configuration_Transformator_Weight_transform (d, c, t.get(), w);
 	Proximity_Distance_drawScatterDiagram (d, fit.get(), g, xmin, xmax, ymin, ymax, size_mm, mark, garnish);
@@ -2262,14 +2259,14 @@ double Dissimilarity_Configuration_getStress (Dissimilarity me, Configuration hi
 	return stress;
 }
 
-autoConfiguration Dissimilarity_Configuration_kruskal (Dissimilarity me, Configuration him, int tiesHandling, int stress_formula, double tolerance, long numberOfIterations, long numberOfRepetitions) {
+autoConfiguration Dissimilarity_Configuration_kruskal (Dissimilarity me, Configuration him, int tiesHandling, int stress_formula, double tolerance, integer numberOfIterations, integer numberOfRepetitions) {
 	try {
 		// The Configuration is normalized: each dimension centred +
 		//	total variance set
 
-		long numberOfCoordinates = my numberOfRows * his numberOfColumns;
-		long numberOfParameters = numberOfCoordinates - his numberOfColumns - 1;
-		long numberOfData = my numberOfRows * (my numberOfRows - 1) / 2;
+		integer numberOfCoordinates = my numberOfRows * his numberOfColumns;
+		integer numberOfParameters = numberOfCoordinates - his numberOfColumns - 1;
+		integer numberOfData = my numberOfRows * (my numberOfRows - 1) / 2;
 
 		if (numberOfData < numberOfParameters) {
 			Melder_throw (U"The number of data must be larger than number of parameters in the model.");
@@ -2310,8 +2307,8 @@ autoConfiguration Dissimilarity_Configuration_kruskal (Dissimilarity me, Configu
 */
 
 static void indscal_iteration_tenBerge (ScalarProductList zc, Configuration xc, Salience weights) {
-	long nPoints = xc -> numberOfRows, nDimensions = xc -> numberOfColumns;
-	long nSources = zc->size;
+	integer nPoints = xc -> numberOfRows, nDimensions = xc -> numberOfColumns;
+	integer nSources = zc->size;
 	double **x = xc -> data, **w = weights -> data, lambda;
 
 	// tolerance = 1e-4 is nearly optimal for dominant eigenvector estimation.
@@ -2320,26 +2317,26 @@ static void indscal_iteration_tenBerge (ScalarProductList zc, Configuration xc,
 	autoNUMmatrix<double> wsih (1, nPoints, 1, nPoints);
 	autoNUMvector<double> solution (1, nPoints);
 
-	for (long h = 1; h <= nDimensions; h ++) {
+	for (integer h = 1; h <= nDimensions; h ++) {
 		autoScalarProductList sprc = Data_copy (zc);
-		for (long k = 1; k <= nPoints; k ++) {
-			for (long l = 1; l <= nPoints; l ++) {
+		for (integer k = 1; k <= nPoints; k ++) {
+			for (integer l = 1; l <= nPoints; l ++) {
 				wsih [k] [l] = 0.0;
 			}
 		}
 
-		for (long i = 1; i <= nSources; i ++) {
+		for (integer i = 1; i <= nSources; i ++) {
 			ScalarProduct spr = sprc -> at [i];
 			double **sih = spr -> data;
 
 			// Construct the S[i][h] matrices (eq. 6)
 
-			for (long j = 1; j <= nDimensions; j ++) {
+			for (integer j = 1; j <= nDimensions; j ++) {
 				if (j == h) {
 					continue;
 				}
-				for (long k = 1; k <= nPoints; k ++) {
-					for (long l = 1; l <= nPoints; l ++) {
+				for (integer k = 1; k <= nPoints; k ++) {
+					for (integer l = 1; l <= nPoints; l ++) {
 						sih [k] [l] -= x [k] [j] * x [l] [j] * w [i] [j];
 					}
 				}
@@ -2347,8 +2344,8 @@ static void indscal_iteration_tenBerge (ScalarProductList zc, Configuration xc,
 
 			// the weighted S matrix (eq. 8)
 
-			for (long k = 1; k <= nPoints; k ++) {
-				for (long l = 1; l <= nPoints; l ++) {
+			for (integer k = 1; k <= nPoints; k ++) {
+				for (integer l = 1; l <= nPoints; l ++) {
 					wsih [k] [l] += w [i] [h] * sih [k] [l];
 				}
 			}
@@ -2356,7 +2353,7 @@ static void indscal_iteration_tenBerge (ScalarProductList zc, Configuration xc,
 
 		// largest eigenvalue of m (nonsymmetric matrix!!) is optimal solution for this dimension
 
-		for (long k = 1; k <= nPoints; k ++) {
+		for (integer k = 1; k <= nPoints; k ++) {
 			solution[k] = x [k] [h];
 		}
 
@@ -2364,9 +2361,9 @@ static void indscal_iteration_tenBerge (ScalarProductList zc, Configuration xc,
 
 		// normalize the solution: centre and x'x = 1
 
-		double mean = 0.0;
-		for (long k = 1; k <= nPoints; k++) {
-			mean += solution[k];
+		real80 mean = 0.0;
+		for (integer k = 1; k <= nPoints; k ++) {
+			mean += solution [k];
 		}
 		mean /= nPoints;
 
@@ -2374,23 +2371,23 @@ static void indscal_iteration_tenBerge (ScalarProductList zc, Configuration xc,
 			continue;
 		}
 
-		double scale = 0.0;
-		for (long k = 1; k <= nPoints; k++) {
-			solution[k] -= mean;
-			scale += solution[k] * solution[k];
+		real80 scale = 0.0;
+		for (integer k = 1; k <= nPoints; k ++) {
+			solution [k] -= mean;
+			scale += solution [k] * solution [k];
 		}
 
-		for (long k = 1; k <= nPoints; k++) {
-			x[k][h] = solution[k] / sqrt (scale);
+		for (integer k = 1; k <= nPoints; k ++) {
+			x[k][h] = solution [k] / sqrt ((real) scale);
 		}
 
 		// update weights. Make negative weights zero.
 
-		for (long i = 1; i <= nSources; i ++) {
+		for (integer i = 1; i <= nSources; i ++) {
 			ScalarProduct spr = sprc -> at [i];
 			double **sih = spr -> data, wih = 0.0;
-			for (long k = 1; k <= nPoints; k ++) {
-				for (long l = 1; l <= nPoints; l ++) {
+			for (integer k = 1; k <= nPoints; k ++) {
+				for (integer l = 1; l <= nPoints; l ++) {
 					wih += x [k] [h] * sih [k] [l] * x [l] [h];
 				}
 			}
@@ -2403,10 +2400,10 @@ static void indscal_iteration_tenBerge (ScalarProductList zc, Configuration xc,
 }
 
 
-void ScalarProductList_Configuration_Salience_indscal (ScalarProductList sp, Configuration configuration, Salience weights, double tolerance, long numberOfIterations, bool showProgress, autoConfiguration *p_conf, autoSalience *p_sal, double *p_varianceAccountedFor) {
+void ScalarProductList_Configuration_Salience_indscal (ScalarProductList sp, Configuration configuration, Salience weights, double tolerance, integer numberOfIterations, bool showProgress, autoConfiguration *p_conf, autoSalience *p_sal, double *p_varianceAccountedFor) {
 	try {
 		double tol = 1e-6, vafp = 0.0, varianceAccountedFor;
-		long nSources = sp->size, iter;
+		integer nSources = sp->size, iter;
 
 		autoConfiguration conf = Data_copy (configuration);
 		autoSalience sal = Data_copy (weights);
@@ -2435,7 +2432,7 @@ void ScalarProductList_Configuration_Salience_indscal (ScalarProductList sp, Con
 
 		// Count number of zero weights
 
-		long nZeros = NUMdmatrix_countZeros (sal -> data, sal -> numberOfRows, sal -> numberOfColumns);
+		integer nZeros = NUMdmatrix_countZeros (sal -> data, sal -> numberOfRows, sal -> numberOfColumns);
 
 		if (p_conf) {
 			Thing_setName (conf.get(), U"indscal");
@@ -2452,7 +2449,7 @@ void ScalarProductList_Configuration_Salience_indscal (ScalarProductList sp, Con
 		if (showProgress) {
 			MelderInfo_writeLine (U"**************** INDSCAL results on Distances *******************\n\n",
 				Thing_className (sp), U"number of objects: ", nSources);
-			for (long i = 1; i <= nSources; i ++) {
+			for (integer i = 1; i <= nSources; i ++) {
 				MelderInfo_writeLine (U"  ", Thing_getName (sp->at [i]));
 			}
 			if (nZeros > 0) {
@@ -2472,7 +2469,7 @@ void ScalarProductList_Configuration_Salience_indscal (ScalarProductList sp, Con
 	}
 }
 
-void DistanceList_Configuration_Salience_indscal (DistanceList distances, Configuration configuration, Salience weights, bool normalizeScalarProducts, double tolerance, long numberOfIterations, bool showProgress, autoConfiguration *out1, autoSalience *out2, double *vaf) {
+void DistanceList_Configuration_Salience_indscal (DistanceList distances, Configuration configuration, Salience weights, bool normalizeScalarProducts, double tolerance, integer numberOfIterations, bool showProgress, autoConfiguration *out1, autoSalience *out2, double *vaf) {
 	try {
 		autoScalarProductList sp = DistanceList_to_ScalarProductList (distances, normalizeScalarProducts);
 		ScalarProductList_Configuration_Salience_indscal (sp.get(), configuration, weights, tolerance, numberOfIterations, showProgress, out1, out2, vaf);
@@ -2481,10 +2478,10 @@ void DistanceList_Configuration_Salience_indscal (DistanceList distances, Config
 	}
 }
 
-void DissimilarityList_Configuration_Salience_indscal (DissimilarityList dissims, Configuration conf, Salience weights, int tiesHandling, bool normalizeScalarProducts, double tolerance, long numberOfIterations, bool showProgress, autoConfiguration *p_configuration, autoSalience *p_salience, double *varianceAccountedFor) {
+void DissimilarityList_Configuration_Salience_indscal (DissimilarityList dissims, Configuration conf, Salience weights, int tiesHandling, bool normalizeScalarProducts, double tolerance, integer numberOfIterations, bool showProgress, autoConfiguration *p_configuration, autoSalience *p_salience, double *varianceAccountedFor) {
 	try {
 		double tol = 1e-6, vafp = 0.0, vaf;
-		long iter, nSources = dissims->size;
+		integer iter, nSources = dissims->size;
 		autoConfiguration configuration = Data_copy (conf);
 		autoSalience salience = Data_copy (weights);
 		autoMDSVecList mdsveclist = DissimilarityList_to_MDSVecList (dissims);
@@ -2514,7 +2511,7 @@ void DissimilarityList_Configuration_Salience_indscal (DissimilarityList dissims
 
 		// Count number of zero weights
 
-		long nZeros = NUMdmatrix_countZeros (salience -> data, salience -> numberOfRows, salience -> numberOfColumns);
+		integer nZeros = NUMdmatrix_countZeros (salience -> data, salience -> numberOfRows, salience -> numberOfColumns);
 
 		// Set labels & names.
 
@@ -2536,7 +2533,7 @@ void DissimilarityList_Configuration_Salience_indscal (DissimilarityList dissims
 			MelderInfo_writeLine (U"**************** INDSCAL with monotone regression *******************");
 			MelderInfo_writeLine (Thing_className (dissims));
 			MelderInfo_writeLine (U"Number of objects: ", nSources);
-			for (long i = 1; i <= nSources; i++) {
+			for (integer i = 1; i <= nSources; i++) {
 				MelderInfo_writeLine (U"  ", Thing_getName (dissims->at [i]));
 			}
 			if (nZeros > 0) {
@@ -2558,7 +2555,7 @@ void DissimilarityList_Configuration_Salience_indscal (DissimilarityList dissims
 	}
 }
 
-void DistanceList_Configuration_indscal (DistanceList dists, Configuration conf, bool normalizeScalarProducts, double tolerance, long numberOfIterations, bool showProgress, autoConfiguration *out1, autoSalience *out2) {
+void DistanceList_Configuration_indscal (DistanceList dists, Configuration conf, bool normalizeScalarProducts, double tolerance, integer numberOfIterations, bool showProgress, autoConfiguration *out1, autoSalience *out2) {
 	try {
 		autoSalience w = Salience_create (dists->size, conf -> numberOfColumns);
 		double vaf;
@@ -2570,10 +2567,10 @@ void DistanceList_Configuration_indscal (DistanceList dists, Configuration conf,
 
 autoDistanceList MDSVecList_Configuration_Salience_monotoneRegression (MDSVecList vecs, Configuration conf, Salience weights, int tiesHandling) {
 	try {
-		long nDimensions = conf -> numberOfColumns;
+		integer nDimensions = conf -> numberOfColumns;
 		autoNUMvector<double> w (NUMvector_copy (conf -> w, 1, nDimensions), 1);
 		autoDistanceList distances = DistanceList_create ();
-		for (long i = 1; i <= vecs->size; i ++) {
+		for (integer i = 1; i <= vecs->size; i ++) {
 			NUMvector_copyElements (weights -> data[i], conf -> w, 1, nDimensions);
 			autoDistance dc = Configuration_to_Distance (conf);
 			autoDistance dist = MDSVec_Distance_monotoneRegression (vecs->at [i], dc.get(), tiesHandling);
@@ -2617,7 +2614,7 @@ autoSalience DissimilarityList_Configuration_to_Salience (DissimilarityList me,
 	}
 }
 
-void DissimilarityList_Configuration_indscal (DissimilarityList dissims, Configuration conf, int tiesHandling, bool normalizeScalarProducts, double tolerance, long numberOfIterations, bool showProgress, autoConfiguration *out1, autoSalience *out2) {
+void DissimilarityList_Configuration_indscal (DissimilarityList dissims, Configuration conf, int tiesHandling, bool normalizeScalarProducts, double tolerance, integer numberOfIterations, bool showProgress, autoConfiguration *out1, autoSalience *out2) {
 	try {
 		autoDistanceList distances = DissimilarityList_Configuration_monotoneRegression (dissims, conf, tiesHandling);
 		autoSalience weights = DistanceList_Configuration_to_Salience (distances.get(), conf, normalizeScalarProducts);
@@ -2628,7 +2625,7 @@ void DissimilarityList_Configuration_indscal (DissimilarityList dissims, Configu
 	}
 }
 
-void DissimilarityList_indscal (DissimilarityList me, long numberOfDimensions, int tiesHandling, bool normalizeScalarProducts, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress, autoConfiguration *p_conf, autoSalience *p_sal) {
+void DissimilarityList_indscal (DissimilarityList me, integer numberOfDimensions, int tiesHandling, bool normalizeScalarProducts, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress, autoConfiguration *p_conf, autoSalience *p_sal) {
 	int showMulti = showProgress && numberOfRepetitions > 1;
 	try {
 		bool showSingle = (showProgress && numberOfRepetitions == 1);
@@ -2644,7 +2641,7 @@ void DissimilarityList_indscal (DissimilarityList me, long numberOfDimensions, i
 			Melder_progress (0.0, U"Indscal many times");
 		}
 
-		for (long iter = 1; iter <= numberOfRepetitions; iter ++) {
+		for (integer iter = 1; iter <= numberOfRepetitions; iter ++) {
 			autoConfiguration cresult; 
 			autoSalience wresult;
 			DissimilarityList_Configuration_Salience_indscal (me, cstart.get(), wstart.get(), tiesHandling,
@@ -2680,7 +2677,7 @@ void DissimilarityList_indscal (DissimilarityList me, long numberOfDimensions, i
 	}
 }
 
-void DistanceList_to_Configuration_indscal (DistanceList distances, long numberOfDimensions, bool normalizeScalarProducts, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress, autoConfiguration *p_conf, autoSalience *p_sal) {
+void DistanceList_to_Configuration_indscal (DistanceList distances, integer numberOfDimensions, bool normalizeScalarProducts, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress, autoConfiguration *p_conf, autoSalience *p_sal) {
 	int showMulti = showProgress && numberOfRepetitions > 1;
 	try {
 		bool showSingle = ( showProgress && numberOfRepetitions == 1 );
@@ -2696,7 +2693,7 @@ void DistanceList_to_Configuration_indscal (DistanceList distances, long numberO
 			Melder_progress (0.0, U"Indscal many times");
 		}
 
-		for (long i = 1; i <= numberOfRepetitions; i++) {
+		for (integer i = 1; i <= numberOfRepetitions; i++) {
 			autoConfiguration cresult;
 			autoSalience wresult;
 			DistanceList_Configuration_Salience_indscal (distances, cstart.get(), wstart.get(), normalizeScalarProducts,  tolerance, numberOfIterations, showSingle, &cresult, &wresult, &vaf);
@@ -2762,8 +2759,8 @@ void ScalarProduct_Configuration_getVariances (ScalarProduct me, Configuration t
 
 	// ScalarProduct is double centred, i.e., mean == 0.
 
-	for (long j = 1; j <= my numberOfRows; j++) {
-		for (long k = 1; k <= my numberOfColumns; k++) {
+	for (integer j = 1; j <= my numberOfRows; j++) {
+		for (integer k = 1; k <= my numberOfColumns; k++) {
 			double d2 = my data[j][k] - fit -> data[j][k];
 			varianceExplained += d2 * d2;
 			varianceTotal += my data[j][k] * my data[j][k];
@@ -2785,7 +2782,7 @@ void ScalarProductList_Configuration_Salience_vaf (ScalarProductList me, Configu
 		}
 
 		double t = 0.0, n = 0.0;
-		for (long i = 1; i <= my size; i ++) {
+		for (integer i = 1; i <= my size; i ++) {
 
 			ScalarProduct sp = my at [i];
 			if (sp -> numberOfRows != thy numberOfRows) {
@@ -2794,7 +2791,7 @@ void ScalarProductList_Configuration_Salience_vaf (ScalarProductList me, Configu
 
 			// weigh configuration before calculating variances
 
-			for (long j = 1; j <= thy numberOfColumns; j ++) {
+			for (integer j = 1; j <= thy numberOfColumns; j ++) {
 				thy w [j] = sqrt (his data [i] [j]);
 			}
 
@@ -2824,8 +2821,8 @@ autoDissimilarity Dissimilarity_createLetterRExample (double noiseStd) {
 		autoDissimilarity me = Distance_to_Dissimilarity (d.get());
 		Thing_setName (me.get(), U"R");
 
-		for (long i = 1; i <= my numberOfRows - 1; i++) {
-			for (long j = i + 1; j <= my numberOfRows; j++) {
+		for (integer i = 1; i <= my numberOfRows - 1; i++) {
+			for (integer j = i + 1; j <= my numberOfRows; j++) {
 				double dis = my data[i][j];
 				my data[j][i] = my data[i][j] = dis * dis + 5.0 + NUMrandomUniform (0.0, noiseStd);
 			}
@@ -2838,13 +2835,13 @@ autoDissimilarity Dissimilarity_createLetterRExample (double noiseStd) {
 
 autoSalience Salience_createCarrollWishExample () {
 	try {
-		long numberOfSources = 8;
+		integer numberOfSources = 8;
 		double wx[9] = {0, 1.0, 0.866, 0.707, 0.5,   0.1, 0.5, 0.354, 0.1};
 		double wy[9] = {0, 0.1, 0.5,   0.707, 0.866,   1, 0.1, 0.354, 0.5};
 		const char32 *name[] = { U"", U"1", U"2", U"3", U"4", U"5", U"6", U"7", U"8"};
 		autoSalience me = Salience_create (numberOfSources, 2);
 
-		for (long i = 1; i <= numberOfSources; i++) {
+		for (integer i = 1; i <= numberOfSources; i++) {
 			my data[i][1] = wx[i];
 			my data[i][2] = wy[i];
 			TableOfReal_setRowLabel (me.get(), i, name[i]);
@@ -2858,16 +2855,16 @@ autoSalience Salience_createCarrollWishExample () {
 autoCollection INDSCAL_createCarrollWishExample (double noiseRange) {
 	try {
 		autoConfiguration c = Configuration_createCarrollWishExample ();
-		long numberOfObjects = c -> numberOfRows, numberOfSources = 8;
+		integer numberOfObjects = c -> numberOfRows, numberOfSources = 8;
 		autoSalience s = Salience_createCarrollWishExample ();
 		autoCollection me = Collection_create ();
-		for (long l = 1; l <= numberOfSources; l ++) {
+		for (integer l = 1; l <= numberOfSources; l ++) {
 			c -> w [1] = s -> data [l] [1];
 			c -> w [2] = s -> data [l] [2];
 			autoDistance d = Configuration_to_Distance (c.get());
 			autoDissimilarity dissim = Distance_to_Dissimilarity (d.get());
-			for (long i = 1; i <= numberOfObjects - 1; i ++) {
-				for (long j = i + 1; j <= numberOfObjects; j ++) {
+			for (integer i = 1; i <= numberOfObjects - 1; i ++) {
+				for (integer j = i + 1; j <= numberOfObjects; j ++) {
 					dissim -> data [i] [j] = (dissim -> data [j] [i] += NUMrandomUniform (0.0, noiseRange));
 				}
 			}
@@ -2881,15 +2878,15 @@ autoCollection INDSCAL_createCarrollWishExample (double noiseRange) {
 	}
 }
 
-void drawSplines (Graphics g, double low, double high, double ymin, double ymax, int splineType, long order, const char32 *interiorKnots, int garnish) {
-	long k = order, numberOfKnots, numberOfInteriorKnots = 0;
-	long nSplines, n = 1000;
+void drawSplines (Graphics g, double low, double high, double ymin, double ymax, int splineType, integer order, const char32 *interiorKnots, bool garnish) {
+	integer k = order, numberOfKnots, numberOfInteriorKnots = 0;
+	integer nSplines, n = 1000;
 	double knot[101], y[1001];
 
 	if (splineType == MDS_ISPLINE) {
 		k++;
 	}
-	for (long i = 1; i <= k; i++) {
+	for (integer i = 1; i <= k; i++) {
 		knot[i] = low;
 	}
 	numberOfKnots = k;
@@ -2912,7 +2909,7 @@ void drawSplines (Graphics g, double low, double high, double ymin, double ymax,
 	}
 
 	numberOfInteriorKnots = numberOfKnots - k;
-	for (long i = 1; i <= k; i ++) {
+	for (integer i = 1; i <= k; i ++) {
 		knot[++numberOfKnots] = high;
 	}
 
@@ -2924,9 +2921,9 @@ void drawSplines (Graphics g, double low, double high, double ymin, double ymax,
 
 	Graphics_setWindow (g, low, high, ymin, ymax);
 	Graphics_setInner (g);
-	for (long i = 1; i <= nSplines; i ++) {
+	for (integer i = 1; i <= nSplines; i ++) {
 		double x, yx, dx = (high - low) / (n - 1);
-		for (long j = 1; j <= n; j++) {
+		for (integer j = 1; j <= n; j++) {
 			x = low + dx * (j - 1);
 			if (splineType == MDS_MSPLINE) {
 				(void) NUMmspline (knot, numberOfKnots, order, i, x, &yx);
@@ -2940,7 +2937,7 @@ void drawSplines (Graphics g, double low, double high, double ymin, double ymax,
 	Graphics_unsetInner (g);
 	if (garnish) {
 		static MelderString ts { };
-		long lastKnot = splineType == MDS_ISPLINE ? numberOfKnots - 2 : numberOfKnots;
+		integer lastKnot = splineType == MDS_ISPLINE ? numberOfKnots - 2 : numberOfKnots;
 		Graphics_drawInnerBox (g);
 		Graphics_textLeft (g, false, splineType == MDS_MSPLINE ? U"\\s{M}\\--spline" : U"\\s{I}\\--spline");
 		Graphics_marksTop (g, 2, true, true, false);
@@ -2955,7 +2952,7 @@ void drawSplines (Graphics g, double low, double high, double ymin, double ymax,
 			}
 			Graphics_markBottom (g, low, false, false, false, ts.string);
 		}
-		for (long i = 1; i <= numberOfInteriorKnots; i ++) {
+		for (integer i = 1; i <= numberOfInteriorKnots; i ++) {
 			if (low <= knot[k + i] && knot[k + i] < high) {
 				MelderString_copy (&ts, U"t__", order + i, U"_");
 				Graphics_markBottom (g, knot[k + i], false, true, true, ts.string);
@@ -2974,7 +2971,7 @@ void drawSplines (Graphics g, double low, double high, double ymin, double ymax,
 }
 
 void drawMDSClassRelations (Graphics g) {
-	long nBoxes = 6;
+	integer nBoxes = 6;
 	double boxWidth = 0.3, boxWidth2 = boxWidth / 2.0, boxWidth3 = boxWidth / 3.0;
 	double boxHeight = 0.1, boxHeight2 = boxHeight / 2.0;
 	double boxHeight3 = boxHeight / 3.0;
@@ -2987,7 +2984,7 @@ void drawMDSClassRelations (Graphics g) {
 
 	Graphics_setWindow (g, -0.05, 1.05, -0.05, 1.05);
 	Graphics_setTextAlignment (g, Graphics_CENTRE, Graphics_HALF);
-	for (long i = 1; i <= nBoxes; i++) {
+	for (integer i = 1; i <= nBoxes; i++) {
 		x2 = x[i] + boxWidth; y2 = y[i] + boxHeight;
 		xm = x[i] + boxWidth2; ym = y[i] + boxHeight2;
 		Graphics_roundedRectangle (g, x[i], x2, y[i], y2, r_mm);
diff --git a/dwtools/MDS.h b/dwtools/MDS.h
index 19c16f7..5881951 100644
--- a/dwtools/MDS.h
+++ b/dwtools/MDS.h
@@ -4,7 +4,7 @@
  *
  * Multi Dimensional Scaling
  *
- * Copyright (C) 1993-2011, 2015-2016 David Weenink, 2015 Paul Boersma
+ * Copyright (C) 1993-2011, 2015-2016 David Weenink, 2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -76,40 +76,40 @@
 Thing_define (Weight, TableOfReal) {
 };
 
-autoWeight Weight_create (long numberOfPoints);
+autoWeight Weight_create (integer numberOfPoints);
 
 /************************** class Salience **************************************/
 
 Thing_define (Salience, TableOfReal) {
 };
 
-autoSalience Salience_create (long numberOfSources, long numberOfDimensions);
+autoSalience Salience_create (integer numberOfSources, integer numberOfDimensions);
 
 void Salience_setDefaults (Salience me);
 
-long Salience_correctNegatives (Salience me);
+integer Salience_correctNegatives (Salience me);
 
-void Salience_draw (Salience me, Graphics g, int xdimension, int ydimension, int garnish);
+void Salience_draw (Salience me, Graphics g, int xdimension, int ydimension, bool garnish);
 
 /************************** class MDSVec ******************************/
 
 Thing_define (MDSVec, Daata) {
-	long nProximities, nPoints;
+	integer nProximities, nPoints;
 	double *proximity;
-	long *iPoint, *jPoint;
+	integer *iPoint, *jPoint;
 
 	void v_destroy () noexcept
 		override;
 };
 
-autoMDSVec MDSVec_create (long nObjects);
+autoMDSVec MDSVec_create (integer nObjects);
 
 /************** class MDSVecs *********************************/
 
 Collection_define (MDSVecList, OrderedOf, MDSVec) {
 };
 
-autoConfiguration ContingencyTable_to_Configuration_ca (ContingencyTable me, long numberOfDimensions, int scaling);
+autoConfiguration ContingencyTable_to_Configuration_ca (ContingencyTable me, integer numberOfDimensions, int scaling);
 
 /********************* class ProximityList *******************************/
 
@@ -148,7 +148,7 @@ Collection_define (DistanceList, OrderedOf, Distance) {
 Thing_define (ScalarProduct, TableOfReal) {
 };
 
-autoScalarProduct ScalarProduct_create (long numberOfPoints);
+autoScalarProduct ScalarProduct_create (integer numberOfPoints);
 
 
 #pragma mark - class ScalarProductList
@@ -165,7 +165,7 @@ Collection_define (ScalarProductList, OrderedOf, ScalarProduct) {
 Thing_define (Dissimilarity, Proximity) {
 };
 
-autoDissimilarity Dissimilarity_create (long numberOfPoints);
+autoDissimilarity Dissimilarity_create (integer numberOfPoints);
 
 double Dissimilarity_getAdditiveConstant (Dissimilarity me);
 /*
@@ -178,22 +178,22 @@ double Dissimilarity_getAdditiveConstant (Dissimilarity me);
 #pragma mark - class Transformator
 
 Thing_define (Transformator, Thing) {
-	long numberOfPoints;
+	integer numberOfPoints;
 	int normalization;
 
 	virtual autoDistance v_transform (MDSVec vec, Distance dist, Weight w);
 };
 
-void Transformator_init (Transformator me, long numberOfPoints);
+void Transformator_init (Transformator me, integer numberOfPoints);
 
-autoTransformator Transformator_create (long numberOfPoints);
+autoTransformator Transformator_create (integer numberOfPoints);
 
 void Transformator_setNormalization (Transformator me, int normalization);
 
 autoDistance Transformator_transform (Transformator me, MDSVec vec, Distance dist, Weight w);
 
 Thing_define (ISplineTransformator, Transformator) {
-	long numberOfInteriorKnots, order, numberOfParameters;
+	integer numberOfInteriorKnots, order, numberOfParameters;
 	double **m, *b, *knot;
 
 	void v_destroy () noexcept
@@ -202,7 +202,7 @@ Thing_define (ISplineTransformator, Transformator) {
 		override;
 };
 
-autoISplineTransformator ISplineTransformator_create (long numberOfPoints, long numberOfInteriorKnots, long order);
+autoISplineTransformator ISplineTransformator_create (integer numberOfPoints, integer numberOfInteriorKnots, integer order);
 
 Thing_define (RatioTransformator, Transformator) {
 	double ratio;
@@ -211,7 +211,7 @@ Thing_define (RatioTransformator, Transformator) {
 		override;
 };
 
-autoRatioTransformator RatioTransformator_create (long numberOfPoints);
+autoRatioTransformator RatioTransformator_create (integer numberOfPoints);
 
 Thing_define (MonotoneTransformator, Transformator) {
 	int tiesHandling;
@@ -220,7 +220,7 @@ Thing_define (MonotoneTransformator, Transformator) {
 		override;
 };
 
-autoMonotoneTransformator MonotoneTransformator_create (long numberPoints);
+autoMonotoneTransformator MonotoneTransformator_create (integer numberPoints);
 
 void MonotoneTransformator_setTiesProcessing (MonotoneTransformator, int tiesHandling);
 
@@ -242,7 +242,7 @@ Collection_define (DissimilarityList, OrderedOf, Dissimilarity) {
 Thing_define (Similarity, Proximity) {
 };
 
-autoSimilarity Similarity_create (long numberOfPoints);
+autoSimilarity Similarity_create (integer numberOfPoints);
 
 
 /************** KRUSKAL *********************************************/
@@ -262,7 +262,7 @@ Thing_define (Kruskal, Thing) {
 		override;
 };
 
-autoKruskal Kruskal_create (long numberOfpoints, long numberOfDimensions);
+autoKruskal Kruskal_create (integer numberOfpoints, integer numberOfDimensions);
 
 double Dissimilarity_Configuration_Weight_Transformator_normalizedStress (Dissimilarity me, Configuration conf, Weight weight, Transformator t);
 
@@ -299,45 +299,45 @@ double Dissimilarity_Configuration_Weight_interval_stress (Dissimilarity d, Conf
 
 double Dissimilarity_Configuration_Weight_monotone_stress (Dissimilarity d, Configuration c, Weight w, int tiesHandling, int stressMeasure);
 
-double Dissimilarity_Configuration_Weight_ispline_stress (Dissimilarity d, Configuration c, Weight w, long numberOfInteriorKnots, long order, int stressMeasure);
+double Dissimilarity_Configuration_Weight_ispline_stress (Dissimilarity d, Configuration c, Weight w, integer numberOfInteriorKnots, integer order, int stressMeasure);
 
 void Distance_Weight_smacofNormalize (Distance d, Weight w);
 
-autoConfiguration Dissimilarity_Configuration_Weight_Transformator_smacof (Dissimilarity me, Configuration conf, Weight weight, Transformator t, double tolerance, long numberOfIterations, bool showProgress, double *stress);
+autoConfiguration Dissimilarity_Configuration_Weight_Transformator_smacof (Dissimilarity me, Configuration conf, Weight weight, Transformator t, double tolerance, integer numberOfIterations, bool showProgress, double *stress);
 
-autoConfiguration Dissimilarity_Configuration_Weight_Transformator_multiSmacof (Dissimilarity me, Configuration conf, Weight w, Transformator t, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress);
+autoConfiguration Dissimilarity_Configuration_Weight_Transformator_multiSmacof (Dissimilarity me, Configuration conf, Weight w, Transformator t, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress);
 
-autoConfiguration Dissimilarity_Configuration_Weight_absolute_mds (Dissimilarity dis, Configuration cstart, Weight w, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress);
+autoConfiguration Dissimilarity_Configuration_Weight_absolute_mds (Dissimilarity dis, Configuration cstart, Weight w, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress);
 
-autoConfiguration Dissimilarity_Configuration_Weight_ratio_mds (Dissimilarity dis, Configuration cstart, Weight w, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress);
+autoConfiguration Dissimilarity_Configuration_Weight_ratio_mds (Dissimilarity dis, Configuration cstart, Weight w, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress);
 
-autoConfiguration Dissimilarity_Configuration_Weight_interval_mds (Dissimilarity dis, Configuration cstart, Weight w, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress);
+autoConfiguration Dissimilarity_Configuration_Weight_interval_mds (Dissimilarity dis, Configuration cstart, Weight w, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress);
 
-autoConfiguration Dissimilarity_Configuration_Weight_monotone_mds (Dissimilarity dis, Configuration cstart, Weight w, int tiesHandling, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress);
+autoConfiguration Dissimilarity_Configuration_Weight_monotone_mds (Dissimilarity dis, Configuration cstart, Weight w, int tiesHandling, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress);
 
-autoConfiguration Dissimilarity_Configuration_Weight_ispline_mds (Dissimilarity me, Configuration cstart, Weight w, long numberOfInteriorKnots, long order, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress);
+autoConfiguration Dissimilarity_Configuration_Weight_ispline_mds (Dissimilarity me, Configuration cstart, Weight w, integer numberOfInteriorKnots, integer order, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress);
 
-autoConfiguration Dissimilarity_Weight_absolute_mds (Dissimilarity me, Weight w, long numberOfDimensions, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress);
+autoConfiguration Dissimilarity_Weight_absolute_mds (Dissimilarity me, Weight w, integer numberOfDimensions, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress);
 
-autoConfiguration Dissimilarity_Weight_ratio_mds (Dissimilarity dis, Weight w, long numberOfDimensions, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress);
+autoConfiguration Dissimilarity_Weight_ratio_mds (Dissimilarity dis, Weight w, integer numberOfDimensions, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress);
 
 
-autoConfiguration Dissimilarity_Weight_interval_mds (Dissimilarity dis, Weight w, long numberOfDimensions, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress);
+autoConfiguration Dissimilarity_Weight_interval_mds (Dissimilarity dis, Weight w, integer numberOfDimensions, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress);
 
-autoConfiguration Dissimilarity_Weight_monotone_mds(Dissimilarity me, Weight w, long int numberOfDimensions, int tiesHandling, double tolerance, long int numberOfIterations, long int numberOfRepetitions, bool showProgress);
+autoConfiguration Dissimilarity_Weight_monotone_mds(Dissimilarity me, Weight w, integer numberOfDimensions, int tiesHandling, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress);
 
-autoConfiguration Dissimilarity_Weight_ispline_mds (Dissimilarity me, Weight weight, long numberOfDimensions,
-	long numberOfInteriorKnots, long order, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress);
+autoConfiguration Dissimilarity_Weight_ispline_mds (Dissimilarity me, Weight weight, integer numberOfDimensions,
+	integer numberOfInteriorKnots, integer order, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress);
 
-void Dissimilarity_Configuration_Weight_drawAbsoluteRegression (Dissimilarity d, Configuration c, Weight w, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, int garnish);
+void Dissimilarity_Configuration_Weight_drawAbsoluteRegression (Dissimilarity d, Configuration c, Weight w, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, bool garnish);
 
-void Dissimilarity_Configuration_Weight_drawRatioRegression (Dissimilarity d, Configuration c, Weight w, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, int garnish);
+void Dissimilarity_Configuration_Weight_drawRatioRegression (Dissimilarity d, Configuration c, Weight w, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, bool garnish);
 
-void Dissimilarity_Configuration_Weight_drawIntervalRegression (Dissimilarity d, Configuration c, Weight w, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, int garnish);
+void Dissimilarity_Configuration_Weight_drawIntervalRegression (Dissimilarity d, Configuration c, Weight w, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, bool garnish);
 
-void Dissimilarity_Configuration_Weight_drawMonotoneRegression (Dissimilarity d, Configuration c, Weight w, Graphics g, int tiesHandling, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, int garnish);
+void Dissimilarity_Configuration_Weight_drawMonotoneRegression (Dissimilarity d, Configuration c, Weight w, Graphics g, int tiesHandling, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, bool garnish);
 
-void Dissimilarity_Configuration_Weight_drawISplineRegression (Dissimilarity d, Configuration c, Weight w, Graphics g, long numberOfInternalKnots, long order, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, int garnish);
+void Dissimilarity_Configuration_Weight_drawISplineRegression (Dissimilarity d, Configuration c, Weight w, Graphics g, integer numberOfInternalKnots, integer order, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, bool garnish);
 
 autoDistance Dissimilarity_Configuration_Transformator_Weight_transform (Dissimilarity d, Configuration c, Transformator t, Weight w);
 
@@ -349,19 +349,19 @@ autoScalarProduct Distance_to_ScalarProduct (Distance me, bool normalize);
 
 /************** DISTANCE & PROXIMITY ********************************/
 
-void Proximity_Distance_drawScatterDiagram (Proximity me, Distance thee, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, int garnish);
+void Proximity_Distance_drawScatterDiagram (Proximity me, Distance thee, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, bool garnish);
 
 
 /********** COVARIANCE & CONFIGURATION ***************************/
 
-autoConfiguration SSCP_to_Configuration (SSCP me, long numberOfDimensions);
+autoConfiguration SSCP_to_Configuration (SSCP me, integer numberOfDimensions);
 
-autoConfiguration Covariance_to_Configuration (Covariance me, long numberOfDimensions);
+autoConfiguration Covariance_to_Configuration (Covariance me, integer numberOfDimensions);
 
 
 /************ CORRELATION & CONFIGURATION ************************/
 
-autoConfiguration Correlation_to_Configuration (Correlation me, long numberOfDimensions);
+autoConfiguration Correlation_to_Configuration (Correlation me, integer numberOfDimensions);
 
 
 /************** DISTANCE & CONFIGURATION **************************/
@@ -369,26 +369,26 @@ autoConfiguration Correlation_to_Configuration (Correlation me, long numberOfDim
 autoDistance Configuration_to_Distance (Configuration me);
 /* Calculates distances between the points */
 
-void Distance_and_Configuration_drawScatterDiagram (Distance me, Configuration him, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, int garnish);
+void Distance_and_Configuration_drawScatterDiagram (Distance me, Configuration him, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, bool garnish);
 
 autoConfiguration Distance_to_Configuration_torsca (Distance me, int numberOfDimensions);
 
 
 /************** DISSIMILARITY & CONFIGURATION ************************/
 
-autoConfiguration Dissimilarity_to_Configuration_kruskal (Dissimilarity me, long numberOfDimensions, long metric, int tiesHandling, int stress_formula, double tolerance, long numberOfIterations, long numberOfRepetitions);
+autoConfiguration Dissimilarity_to_Configuration_kruskal (Dissimilarity me, integer numberOfDimensions, integer metric, int tiesHandling, int stress_formula, double tolerance, integer numberOfIterations, integer numberOfRepetitions);
 
-autoConfiguration Dissimilarity_Configuration_kruskal (Dissimilarity me, Configuration him, int tiesHandling, int stress_formula, double tolerance, long numberOfIterations, long numberOfRepetitions);
+autoConfiguration Dissimilarity_Configuration_kruskal (Dissimilarity me, Configuration him, int tiesHandling, int stress_formula, double tolerance, integer numberOfIterations, integer numberOfRepetitions);
 
 double Dissimilarity_Configuration_getStress (Dissimilarity me, Configuration him, int tiesHandling, int stress_formula);
 
-void Dissimilarity_Configuration_drawShepardDiagram (Dissimilarity me, Configuration him, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, int garnish);
+void Dissimilarity_Configuration_drawShepardDiagram (Dissimilarity me, Configuration him, Graphics g, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, bool garnish);
 
 autoDistance Dissimilarity_Configuration_monotoneRegression (Dissimilarity dis, Configuration conf, int tiesHandling);
 
 autoDistanceList DissimilarityList_Configuration_monotoneRegression (DissimilarityList dissims, Configuration conf, int tiesHandling);
 
-void Dissimilarity_Configuration_drawMonotoneRegression	(Dissimilarity me, Configuration him, Graphics g, int tiesHandling, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, int garnish);
+void Dissimilarity_Configuration_drawMonotoneRegression	(Dissimilarity me, Configuration him, Graphics g, int tiesHandling, double xmin, double xmax, double ymin, double ymax, double size_mm, const char32 *mark, bool garnish);
 
 
 /************** SIMILARITY & TABLESOFREAL ********************************/
@@ -472,26 +472,26 @@ autoScalarProductList DistanceList_to_ScalarProductList (DistanceList me, bool n
 
 void ScalarProductList_to_Configuration_ytl (ScalarProductList me, int numberOfDimensions, autoConfiguration *out1, autoSalience *out2);
 
-void ScalarProductList_Configuration_Salience_indscal (ScalarProductList sp, Configuration conf, Salience weights, double tolerance, long numberOfIterations, bool showProgress, autoConfiguration *out1, autoSalience *out2, double *vaf);
+void ScalarProductList_Configuration_Salience_indscal (ScalarProductList sp, Configuration conf, Salience weights, double tolerance, integer numberOfIterations, bool showProgress, autoConfiguration *out1, autoSalience *out2, double *vaf);
 
 
 /************** INDSCAL & ....... ***********************************/
 
-void DissimilarityList_indscal (DissimilarityList me, long numberOfDimensions, int tiesHandlingMethod, bool normalizeScalarProducts, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress, autoConfiguration *out1, autoSalience *out2);
+void DissimilarityList_indscal (DissimilarityList me, integer numberOfDimensions, int tiesHandlingMethod, bool normalizeScalarProducts, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress, autoConfiguration *out1, autoSalience *out2);
 
-void DistanceList_to_Configuration_indscal (DistanceList me, long numberOfDimensions, bool normalizeScalarProducts, double tolerance, long numberOfIterations, long numberOfRepetitions, bool showProgress, autoConfiguration *out1, autoSalience *out2);
+void DistanceList_to_Configuration_indscal (DistanceList me, integer numberOfDimensions, bool normalizeScalarProducts, double tolerance, integer numberOfIterations, integer numberOfRepetitions, bool showProgress, autoConfiguration *out1, autoSalience *out2);
 
-void DissimilarityList_Configuration_indscal (DissimilarityList me, Configuration conf, int tiesHandlingMethod, bool normalizeScalarProducts, double tolerance, long numberOfIterations, bool showProgress, autoConfiguration *out1, autoSalience *out2);
+void DissimilarityList_Configuration_indscal (DissimilarityList me, Configuration conf, int tiesHandlingMethod, bool normalizeScalarProducts, double tolerance, integer numberOfIterations, bool showProgress, autoConfiguration *out1, autoSalience *out2);
 
-void DistanceList_Configuration_indscal (DistanceList dists, Configuration conf, bool normalizeScalarProducts, double tolerance, long numberOfIterations,
+void DistanceList_Configuration_indscal (DistanceList dists, Configuration conf, bool normalizeScalarProducts, double tolerance, integer numberOfIterations,
 	bool showProgress, autoConfiguration *out1, autoSalience *out2);
 
 void DissimilarityList_Configuration_Salience_indscal (DissimilarityList dissims, Configuration conf, Salience w, int tiesHandlingMethod,
-	bool normalizeScalarProducts, double tolerance, long numberOfIterations, bool showProgress, autoConfiguration *out1, autoSalience *out2, double *vaf);
+	bool normalizeScalarProducts, double tolerance, integer numberOfIterations, bool showProgress, autoConfiguration *out1, autoSalience *out2, double *vaf);
 
 autoDistanceList MDSVecList_Configuration_Salience_monotoneRegression (MDSVecList vecs, Configuration conf, Salience weights, int tiesHandlingMethod);
 
-void DistanceList_Configuration_Salience_indscal (DistanceList dists, Configuration conf, Salience weights, bool normalizeScalarProducts, double tolerance, long numberOfIterations, bool showProgress, autoConfiguration *out1, autoSalience *out2, double *vaf);
+void DistanceList_Configuration_Salience_indscal (DistanceList dists, Configuration conf, Salience weights, bool normalizeScalarProducts, double tolerance, integer numberOfIterations, bool showProgress, autoConfiguration *out1, autoSalience *out2, double *vaf);
 
 void DistanceList_Configuration_Salience_vaf (DistanceList me, Configuration thee, Salience him, bool normalizeScalarProducts, double *vaf);
 
@@ -532,7 +532,7 @@ autoCollection INDSCAL_createCarrollWishExample (double noiseStd);
 
 autoSalience Salience_createCarrollWishExample ();
 
-void drawSplines (Graphics g, double low, double high, double ymin, double ymax, int type, long order, char32 const *interiorKnots, int garnish);
+void drawSplines (Graphics g, double low, double high, double ymin, double ymax, int type, integer order, char32 const *interiorKnots, bool garnish);
 
 void drawMDSClassRelations (Graphics g);
 
diff --git a/dwtools/OptimalCeilingTierEditor.h b/dwtools/OptimalCeilingTierEditor.h
index a2a0a9a..55ca8e9 100644
--- a/dwtools/OptimalCeilingTierEditor.h
+++ b/dwtools/OptimalCeilingTierEditor.h
@@ -2,7 +2,7 @@
 #define _OptimalCeilingTierEditor_h_
 /* OptimalCeilingTierEditor.h
  *
- * Copyright (C) 2015 David Weenink
+ * Copyright (C) 2015 David Weenink, 2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -29,8 +29,6 @@ Thing_define (OptimalCeilingTierEditor, RealTierEditor) {
 		override;
 	const char32 * v_quantityText ()
 		override { return U"Frequency (Hz)"; }
-	const char32 * v_quantityKey ()
-		override { return U"Frequency"; }
 	const char32 * v_rightTickUnits ()
 		override { return U" Hz"; }
 	double v_defaultYmin ()
@@ -47,10 +45,6 @@ Thing_define (OptimalCeilingTierEditor, RealTierEditor) {
 		override { return U"Minimum frequency (Hz)"; }
 	const char32 * v_ymaxText ()
 		override { return U"Maximum frequency (Hz)"; }
-	const char32 * v_yminKey ()
-		override { return U"Minimum frequency"; }
-	const char32 * v_ymaxKey ()
-		override { return U"Maximum frequency"; }
 };
 
 autoOptimalCeilingTierEditor OptimalCeilingTierEditor_create (const char32 *title,
diff --git a/dwtools/PCA_def.h b/dwtools/PCA_def.h
index c6056d3..554cfeb 100644
--- a/dwtools/PCA_def.h
+++ b/dwtools/PCA_def.h
@@ -23,7 +23,7 @@
 #define ooSTRUCT PCA
 oo_DEFINE_CLASS (PCA, Eigen)
 	
-	oo_LONG (numberOfObservations)
+	oo_INTEGER (numberOfObservations)
 	oo_STRING_VECTOR (labels, dimension)
 	oo_DOUBLE_VECTOR (centroid, dimension)
 
diff --git a/dwtools/Polynomial.cpp b/dwtools/Polynomial.cpp
index 4b18cbf..15faf5d 100644
--- a/dwtools/Polynomial.cpp
+++ b/dwtools/Polynomial.cpp
@@ -1189,7 +1189,7 @@ void Roots_draw (Roots me, Graphics g, double rmin, double rmax, double imin, do
 
 autoRoots Polynomial_to_Roots (Polynomial me) {
 	try {
-		long np1 = my numberOfCoefficients, n = np1 - 1, n2 = n * n;
+		integer np1 = my numberOfCoefficients, n = np1 - 1, n2 = n * n;
 
 		if (n < 1) {
 			Melder_throw (U"Cannot find roots of a constant function.");
@@ -1198,24 +1198,24 @@ autoRoots Polynomial_to_Roots (Polynomial me) {
 		// Allocate storage for Hessenberg matrix (n * n) plus real and imaginary
 		// parts of eigenvalues wr[1..n] and wi[1..n].
 
-		autoNUMvector<double> hes (1, n2 + n + n);
+		autoNUMvector <double> hes (1, n2 + n + n);
 		double *wr = & hes [n2];
 		double *wi = & hes [n2 + n];
 
 		// Fill the upper Hessenberg matrix (storage is Fortran)
 		// C: [i][j] -> Fortran: (j-1)*n + i
 
-		for (long i = 1; i <= n; i++) {
-			hes[ (i - 1) *n + 1] = - (my coefficients[np1 - i] / my coefficients[np1]);
+		for (integer i = 1; i <= n; i ++) {
+			hes [(i - 1) * n + 1] = - (my coefficients [np1 - i] / my coefficients [np1]);
 			if (i < n) {
-				hes[ (i - 1) *n + 1 + i] = 1;
+				hes [(i - 1) * n + 1 + i] = 1;
 			}
 		}
 
 		// Find out the working storage needed
 
 		char job = 'E', compz = 'N';
-		long ilo = 1, ihi = n, ldh = n, ldz = n, lwork = -1, info;
+		integer ilo = 1, ihi = n, ldh = n, ldz = n, lwork = -1, info;
 		double *z = 0, wt [1];
 		NUMlapack_dhseqr (&job, &compz, &n, &ilo, &ihi, &hes[1], &ldh, &wr[1], &wi[1], z, &ldz, wt, &lwork, &info);
 		if (info != 0) {
@@ -1223,8 +1223,8 @@ autoRoots Polynomial_to_Roots (Polynomial me) {
 				Melder_throw (U"Programming error. Argument ", info, U" in NUMlapack_dhseqr has illegal value.");
 			}
 		}
-		lwork = (long) floor (wt[0]);
-		autoNUMvector<double> work (1, lwork);
+		lwork = (integer) floor (wt[0]);
+		autoNUMvector <double> work (1, lwork);
 
 		// Find eigenvalues.
 
diff --git a/dwtools/Polynomial_def.h b/dwtools/Polynomial_def.h
index f940be2..3a07bc4 100644
--- a/dwtools/Polynomial_def.h
+++ b/dwtools/Polynomial_def.h
@@ -24,11 +24,11 @@
 #define ooSTRUCT FunctionTerms
 oo_DEFINE_CLASS (FunctionTerms, Function)
 
-	oo_LONG (numberOfCoefficients)
+	oo_INTEGER (numberOfCoefficients)
 	oo_DOUBLE_VECTOR (coefficients, numberOfCoefficients)
 	
 	#if !oo_READING && !oo_WRITING
-		oo_LONG (_capacity)
+		oo_INTEGER (_capacity)
 	#endif
 		
 	#if oo_READING
@@ -51,8 +51,8 @@ oo_END_CLASS (FunctionTerms)
 #define ooSTRUCT Spline
 oo_DEFINE_CLASS (Spline, FunctionTerms)
 
-	oo_LONG (degree)
-	oo_LONG (numberOfKnots)
+	oo_INTEGER (degree)
+	oo_INTEGER (numberOfKnots)
 	oo_DOUBLE_VECTOR (knots, numberOfKnots)
 	
 	#if oo_DECLARING
diff --git a/dwtools/SPINET_def.h b/dwtools/SPINET_def.h
index 028a667..78b8d9c 100644
--- a/dwtools/SPINET_def.h
+++ b/dwtools/SPINET_def.h
@@ -19,7 +19,7 @@
 #define ooSTRUCT SPINET
 oo_DEFINE_CLASS (SPINET, SampledXY)
 
-	oo_LONG (gamma)						/* filter order */
+	oo_INTEGER (gamma)						/* filter order */
 	oo_DOUBLE (excitationErbProportion)	/* excitatory bandwidth proportionality factor*/
 	oo_DOUBLE (inhibitionErbProportion)	/* inhibitatory bandwidth proportionality factor*/
 	oo_DOUBLE_MATRIX (y, ny, nx) /* short term average energy spectrum */
diff --git a/dwtools/SSCP.cpp b/dwtools/SSCP.cpp
index f0ba2e7..e81f83e 100644
--- a/dwtools/SSCP.cpp
+++ b/dwtools/SSCP.cpp
@@ -801,10 +801,10 @@ void SSCP_setCentroid (SSCP me, long component, double value) {
 	my centroid[component] = value;
 }
 
-autoCCA SSCP_to_CCA (SSCP me, long ny) {
+autoCCA SSCP_to_CCA (SSCP me, integer ny) {
 	try {
 		char upper = 'L', diag = 'N';
-		long info;
+		integer info;
 
 		if (ny < 1 || ny >= my numberOfRows) {
 			Melder_throw (U"ny < 1 || ny >= my numberOfRows");
@@ -813,7 +813,7 @@ autoCCA SSCP_to_CCA (SSCP me, long ny) {
 			Melder_throw (U"Matrix is diagonal.");
 		}
 
-		long m = my numberOfRows, nx = m - ny, xy_interchanged = nx < ny, yof = 0, xof = ny;
+		integer m = my numberOfRows, nx = m - ny, xy_interchanged = nx < ny, yof = 0, xof = ny;
 		if (xy_interchanged) {
 			yof = ny; xof = 0;
 			nx = ny; ny = m - nx;
@@ -846,11 +846,11 @@ autoCCA SSCP_to_CCA (SSCP me, long ny) {
 		// Cholesky decomposition: Syy = Uy'*Uy and Sxx = Ux'*Ux.
 		// (Pretend as if colum-major storage)
 
-		(void) NUMlapack_dpotf2 (&upper, &ny, &syy[1][1], &ny, &info);
+		(void) NUMlapack_dpotf2 (& upper, & ny, & syy [1] [1], & ny, & info);
 		if (info != 0) Melder_throw (U"The leading minor of order ", info, U" is not positive definite, and the "
 			                             U"factorization of Syy could not be completed.");
 
-		(void) NUMlapack_dpotf2 (&upper, &nx, &sxx[1][1], &nx, &info);
+		(void) NUMlapack_dpotf2 (& upper, & nx, & sxx [1] [1], & nx, & info);
 		if (info != 0) Melder_throw (U"The leading minor of order ", info, U" is not positive definite, and the "
 			                             U"factorization of Sxx could not be completed.");
 
@@ -892,13 +892,13 @@ autoCCA SSCP_to_CCA (SSCP me, long ny) {
 
 		// Prepare Uxi' * Syx' = (Syx * Uxi)'
 
-		for (long i = 1; i <= ny; i++) {
-			for (long j = 1; j <= nx; j++) {
-				double t = 0.0;
-				for (long k = 1; k <= j; k++) {
-					t += syx[i][k] * sxx[k][j];
+		for (integer i = 1; i <= ny; i ++) {
+			for (integer j = 1; j <= nx; j ++) {
+				real80 t = 0.0;
+				for (integer k = 1; k <= j; k ++) {
+					t += syx [i] [k] * sxx [k] [j];
 				}
-				a[j][i] = t;
+				a [j] [i] = (real) t;
 			}
 		}
 
diff --git a/dwtools/SSCP.h b/dwtools/SSCP.h
index f48d23d..1872f07 100644
--- a/dwtools/SSCP.h
+++ b/dwtools/SSCP.h
@@ -124,7 +124,7 @@ void SSCP_expandPCA (SSCP me);
 
 void SSCP_unExpandPCA (SSCP me);
 
-autoCCA SSCP_to_CCA (SSCP me, long ny);
+autoCCA SSCP_to_CCA (SSCP me, integer ny);
 
 autoCovariance Covariance_create (long dimension);
 
diff --git a/dwtools/SSCP_def.h b/dwtools/SSCP_def.h
index e599a99..353db8f 100644
--- a/dwtools/SSCP_def.h
+++ b/dwtools/SSCP_def.h
@@ -29,7 +29,7 @@ oo_DEFINE_CLASS (SSCP, TableOfReal)
 		or for efficiently calculating many times a distance like a'S^(-1)a
 	*/
 	#if !oo_READING && !oo_WRITING
-		oo_LONG (expansionNumberOfRows)
+		oo_INTEGER (expansionNumberOfRows)
 		oo_INT (dataChanged)
 		oo_DOUBLE_MATRIX (expansion, expansionNumberOfRows, numberOfColumns)
 		oo_DOUBLE (lnd)
diff --git a/dwtools/Sound_and_PCA.cpp b/dwtools/Sound_and_PCA.cpp
index 5f0c6c7..e8dbc9a 100644
--- a/dwtools/Sound_and_PCA.cpp
+++ b/dwtools/Sound_and_PCA.cpp
@@ -25,8 +25,8 @@
 #include "Sound_extensions.h"
 #include "NUM2.h"
 
-static void checkChannelsWithinRange (long *channels, long n, long min, long max) {
-	for (long i = 1; i <= n; i++) {
+static void checkChannelsWithinRange (integer *channels, integer n, integer min, integer max) {
+	for (integer i = 1; i <= n; i++) {
 		if (channels[i] < min || channels[i] > max) {
 			Melder_throw (U"Channel ", channels[i], U" is not within range [", min, U", ", max, U"].");
 		}
@@ -44,7 +44,7 @@ autoPCA Sound_to_PCA_channels (Sound me, double startTime, double endTime) {
 	}
 }
 
-autoSound 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, integer numberOfComponents, integer *channels, integer numberOfChannels) {
 	try {
 		bool channelSelection = channels != 0 && numberOfChannels > 0;
 		if (numberOfComponents <= 0 || numberOfComponents > thy numberOfEigenvalues) {
@@ -57,12 +57,12 @@ autoSound Sound_and_PCA_to_Sound_pc_selectedChannels (Sound me, PCA thee, long n
 		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++) {
-			long channel_k = channelSelection ? channels[k] : k;
-			for (long i = 1; i <= numberOfComponents; i++) {
-				long channel_i = channelSelection ? channels[i] : i;
+		for (integer k = 1; k <= thy dimension; k++) {
+			integer channel_k = channelSelection ? channels[k] : k;
+			for (integer i = 1; i <= numberOfComponents; i++) {
+				integer channel_i = channelSelection ? channels[i] : i;
 				double ev_ik = thy eigenvectors[i][k];
-				for (long j = 1; j <= my nx; j++) {
+				for (integer j = 1; j <= my nx; j++) {
 					his z[channel_i][j] += ev_ik * my z[channel_k][j];
 				}
 			}
@@ -73,11 +73,11 @@ autoSound Sound_and_PCA_to_Sound_pc_selectedChannels (Sound me, PCA thee, long n
 	}
 }
 
-autoSound Sound_and_PCA_principalComponents (Sound me, PCA thee, long numberOfComponents) {
+autoSound Sound_and_PCA_principalComponents (Sound me, PCA thee, integer numberOfComponents) {
 	return Sound_and_PCA_to_Sound_pc_selectedChannels (me, thee, numberOfComponents, nullptr, 0);
 }
 
-autoSound Sound_and_PCA_whitenSelectedChannels (Sound me, PCA thee, long numberOfComponents, long *channels, long numberOfChannels) {
+autoSound Sound_and_PCA_whitenSelectedChannels (Sound me, PCA thee, integer numberOfComponents, integer *channels, integer numberOfChannels) {
 	try {
 		bool channelSelection = channels != 0 && numberOfChannels > 0;
 		if (numberOfComponents <= 0 || numberOfComponents > thy numberOfEigenvalues) {
@@ -86,25 +86,25 @@ autoSound Sound_and_PCA_whitenSelectedChannels (Sound me, PCA thee, long numberO
 		if (channelSelection) {
 			checkChannelsWithinRange (channels, numberOfChannels, 1, my ny);
 		}
-        autoNUMmatrix<double> whiten (1, thy dimension, 1, thy dimension);
+        autoNUMmatrix <double> whiten (1, thy dimension, 1, thy dimension);
 		// W = E D^(-1/2) E' from http://cis.legacy.ics.tkk.fi/aapo/papers/IJCNN99_tutorialweb/node26.html
-        for (long i = 1; i <= thy dimension; i++) {
-            for (long j = i; j <= thy dimension; j++) {
-                double wij = 0;
-                for (long k = 1; k <= numberOfComponents; k++) {
-                    wij += thy eigenvectors[k][i] * thy eigenvectors[k][j] / sqrt (thy eigenvalues[k]);
+        for (integer i = 1; i <= thy dimension; i++) {
+            for (integer j = i; j <= thy dimension; j++) {
+                real80 wij = 0.0;
+                for (integer k = 1; k <= numberOfComponents; k++) {
+                    wij += thy eigenvectors [k] [i] * thy eigenvectors [k] [j] / sqrt (thy eigenvalues [k]);
                 }
-                whiten[i][j] = whiten[j][i] = wij;
+                whiten [i] [j] = whiten [j] [i] = wij;
             }
         }
 		autoSound him = Sound_create (my ny, my xmin, my xmax, my nx, my dx, my x1);
-		for (long k = 1; k <= numberOfChannels; k++) {
-			long channel_k = channelSelection ? channels[k] : k;
-            for (long i = 1; i <= numberOfChannels; i++) {
-                long channel_i = channelSelection ? channels[i] : i;
+		for (integer k = 1; k <= numberOfChannels; k ++) {
+			integer channel_k = channelSelection ? channels [k] : k;
+            for (integer i = 1; i <= numberOfChannels; i++) {
+                integer channel_i = channelSelection ? channels [i] : i;
 				double w_ik = whiten[i][k];
-                for (long j = 1; j <= my nx; j++) {
-                    his z[channel_i][j] += w_ik * my z[channel_k][j];
+                for (integer j = 1; j <= my nx; j ++) {
+                    his z [channel_i] [j] += w_ik * my z [channel_k] [j];
                 }
             }
         }
@@ -114,7 +114,7 @@ autoSound Sound_and_PCA_whitenSelectedChannels (Sound me, PCA thee, long numberO
 	}
 }
 
-autoSound Sound_and_PCA_whitenChannels (Sound me, PCA thee, long numberOfComponents) {
+autoSound Sound_and_PCA_whitenChannels (Sound me, PCA thee, integer 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 e29196f..48bb386 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, 2015 David Weenink
+ * Copyright (C) 2012,2015 David Weenink
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,21 +18,18 @@
  * along with this work. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/*
- djmw 20121001
-*/
-
 #include "PCA.h"
 #include "Sound.h"
 
 autoPCA Sound_to_PCA_channels (Sound me, double startTime, double endTime);
 
-autoSound 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, integer numberOfComponents, integer *channels, integer numberOfChannels);
 
-autoSound Sound_and_PCA_principalComponents (Sound me, PCA thee, long numberOfComponents);
+autoSound Sound_and_PCA_principalComponents (Sound me, PCA thee, integer numberOfComponents);
 
-autoSound Sound_and_PCA_whitenSelectedChannels (Sound me, PCA thee, long numberOfComponents, long *channels, long numberOfChannels);
+autoSound Sound_and_PCA_whitenSelectedChannels (Sound me, PCA thee, integer numberOfComponents, integer *channels, integer numberOfChannels);
 
-autoSound Sound_and_PCA_whitenChannels (Sound me, PCA thee, long numberOfComponents);
+autoSound Sound_and_PCA_whitenChannels (Sound me, PCA thee, integer numberOfComponents);
 
-#endif /* _Sound_and_PCA_h_ */
+/* End of file Sound_and_PCA.h */
+#endif
diff --git a/dwtools/Sound_extensions.cpp b/dwtools/Sound_extensions.cpp
index 84ae2af..c03d01c 100644
--- a/dwtools/Sound_extensions.cpp
+++ b/dwtools/Sound_extensions.cpp
@@ -2139,11 +2139,11 @@ void Sounds_paintEnclosed (Sound me, Sound thee, Graphics g, Graphics_Colour col
 
 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);
+		integer numberOfChannels;
+		autoNUMvector <integer> channels (NUMstring_getElementsOfRanges (ranges, my ny, & numberOfChannels, nullptr, U"channel", true), 1);
 		autoSound thee = Sound_create (numberOfChannels, my xmin, my xmax, my nx, my dx, my x1);
-		for (long i = 1; i <= numberOfChannels; i++) {
-			double *from = my z[channels[i]], *to = thy z[i];
+		for (integer i = 1; i <= numberOfChannels; i ++) {
+			double *from = my z[channels[i]], *to = thy z [i];
 			NUMvector_copyElements<double> (from, to, 1, my nx);
 		}
 		return thee;
diff --git a/dwtools/Spectrogram_extensions.cpp b/dwtools/Spectrogram_extensions.cpp
index 577ae67..81faad2 100644
--- a/dwtools/Spectrogram_extensions.cpp
+++ b/dwtools/Spectrogram_extensions.cpp
@@ -64,7 +64,7 @@ void structMelSpectrogram :: v_info () {
 }
 
 // Preconditions: 1 <= iframe <= nx; 1 <= irow <= ny
-double structBandFilterSpectrogram :: v_getValueAtSample (long iframe, long ifreq, int units) {
+double structBandFilterSpectrogram :: v_getValueAtSample (integer iframe, integer ifreq, int units) {
 	double val = undefined;
 	if (units == 0) {
 		val = z [ifreq] [iframe];
diff --git a/dwtools/Spectrogram_extensions.h b/dwtools/Spectrogram_extensions.h
index b4195a5..c0c4621 100644
--- a/dwtools/Spectrogram_extensions.h
+++ b/dwtools/Spectrogram_extensions.h
@@ -49,7 +49,7 @@
 Thing_define (BandFilterSpectrogram, Matrix) {
 	void v_info ()
 		override;
-	double v_getValueAtSample (long icol, long irow, int units)
+	double v_getValueAtSample (integer icol, integer irow, int units)
 		override;
 
 	virtual double v_frequencyToHertz (double f) { return f; }
diff --git a/dwtools/SpeechSynthesizer.cpp b/dwtools/SpeechSynthesizer.cpp
index a5446d5..723b7d7 100644
--- a/dwtools/SpeechSynthesizer.cpp
+++ b/dwtools/SpeechSynthesizer.cpp
@@ -117,7 +117,7 @@ void SpeechSynthesizerVoice_initFromEspeakVoice (SpeechSynthesizerVoice me, voic
 	}
 }
 
-Thing_implement (SpeechSynthesizer, Daata, 0);
+Thing_implement (SpeechSynthesizer, Daata, 1);
 
 void structSpeechSynthesizer :: v_info () {
 	SpeechSynthesizer_Parent :: v_info ();
@@ -129,22 +129,22 @@ void structSpeechSynthesizer :: v_info () {
 	MelderInfo_writeLine (U"Sampling frequency: ", d_samplingFrequency, U" Hz");
 	MelderInfo_writeLine (U"Word gap: ", d_wordgap, U" s");
 	MelderInfo_writeLine (U"Pitch adjustment value: ", d_pitchAdjustment, U" (0-100)");
-	MelderInfo_writeLine (U"Speeking rate: ", d_wordsPerMinute, U" words per minute", (d_estimateWordsPerMinute ? U" (but estimated from data if possible)" : U" (fixed)"));
+	MelderInfo_writeLine (U"Speaking rate: ", d_wordsPerMinute, U" words per minute", (d_estimateWordsPerMinute ? U" (but estimated from data if possible)" : U" (fixed)"));
 
 	MelderInfo_writeLine (U"Output phoneme coding: ", (d_inputPhonemeCoding == SpeechSynthesizer_PHONEMECODINGS_KIRSHENBAUM ? U"Kirshenbaum" : d_inputPhonemeCoding == SpeechSynthesizer_PHONEMECODINGS_IPA ? U"IPA" : U"???"));
 	MelderInfo_writeLine (U"Text to speech synthesis with eSpeak version 1.48.04");
 }
 
-static void NUMvector_extendNumberOfElements (long elementSize, void **v, long lo, long *hi, long extraDemand)
+static void NUMvector_extendNumberOfElements (integer elementSize, void **v, integer lo, integer *hi, integer extraDemand)
 {
 	try {
 		char *result;
 		if (! *v) {
-			long newhi = lo + extraDemand - 1;
+			integer newhi = lo + extraDemand - 1;
 			result = reinterpret_cast <char *> (NUMvector (elementSize, lo, newhi, true));
 			*hi = newhi;
 		} else {
-			long offset = lo * elementSize;
+			integer offset = lo * elementSize;
 			for (;;) {   // not very infinite: 99.999 % of the time once, 0.001 % twice
 				result = reinterpret_cast <char *> (Melder_realloc ((char *) *v + offset, (*hi - lo + 1 + extraDemand) * elementSize));
 				if ((result -= offset)) break;   // this will normally succeed at the first try
@@ -159,16 +159,16 @@ static void NUMvector_extendNumberOfElements (long elementSize, void **v, long l
 	}
 }
 
-static void NUMvector_supplyStorage (long elementSize, void **v, long lo, long *hi, long nfilled, long extraDemand)
+static void NUMvector_supplyStorage (integer elementSize, void **v, integer lo, integer *hi, integer nfilled, integer extraDemand)
 {
-	long old_capacity = *hi - lo + 1, new_capacity = nfilled + extraDemand;
+	integer old_capacity = *hi - lo + 1, new_capacity = nfilled + extraDemand;
 	if (new_capacity < old_capacity) return;
 	new_capacity = new_capacity > 2 * old_capacity ? new_capacity : 2 * old_capacity;
 	NUMvector_extendNumberOfElements (elementSize, v, lo, hi, new_capacity);
 }
 
 template <class T>
-void NUMvector_supplyStorage (T** v, long lo, long *hi, long nfilled, long extraDemand) {
+void NUMvector_supplyStorage (T** v, integer lo, integer *hi, integer nfilled, integer extraDemand) {
 	NUMvector_supplyStorage (sizeof (T), (void**) v, lo, hi, nfilled, extraDemand);
 }
 
diff --git a/dwtools/SpeechSynthesizer_def.h b/dwtools/SpeechSynthesizer_def.h
index bccf107..d57b5c8 100644
--- a/dwtools/SpeechSynthesizer_def.h
+++ b/dwtools/SpeechSynthesizer_def.h
@@ -21,20 +21,20 @@
 oo_DEFINE_CLASS (SpeechSynthesizerVoice, Daata)
 	oo_STRING (d_v_name)
 
-	oo_LONG (d_phoneme_tab_ix)  // phoneme table number
-	oo_LONG (d_pitch_base)    // Hz
-	oo_LONG (d_pitch_range)   // Hz
+	oo_INTEGER (d_phoneme_tab_ix)  // phoneme table number
+	oo_INTEGER (d_pitch_base)    // Hz
+	oo_INTEGER (d_pitch_range)   // Hz
 
-	oo_LONG (d_speedf1)
-	oo_LONG (d_speedf2)
-	oo_LONG (d_speedf3)
+	oo_INTEGER (d_speedf1)
+	oo_INTEGER (d_speedf2)
+	oo_INTEGER (d_speedf3)
 
 	oo_DOUBLE (d_speed_percent)      // adjust the WPM speed by this percentage
 	oo_DOUBLE (d_flutter)
 	oo_DOUBLE (d_roughness)
 	oo_DOUBLE (d_echo_delay)
 	oo_DOUBLE (d_echo_amp)
-	oo_LONG (d_n_harmonic_peaks)  // highest formant which is formed from adding harmonics
+	oo_INTEGER (d_n_harmonic_peaks)  // highest formant which is formed from adding harmonics
 	oo_INT (d_peak_shape)        // alternative shape for formant peaks (0=standard 1=squarer)
 	oo_DOUBLE (d_voicing)           // 100% = 64, level of formant-synthesized sound
 	oo_DOUBLE (d_formant_factor)      // adjust nominal formant frequencies by this  because of the voice's pitch (256ths)
@@ -44,7 +44,7 @@ oo_DEFINE_CLASS (SpeechSynthesizerVoice, Daata)
 	oo_INT_VECTOR_FROM (d_klattv, 0, 7)
 
 	// parameters used by Wavegen
-	oo_LONG (d_numberOfFormants)
+	oo_INTEGER (d_numberOfFormants)
 	oo_INT_VECTOR_FROM (d_freq, 0, d_numberOfFormants)		// 100% = 256
 	oo_INT_VECTOR_FROM (d_height, 0, d_numberOfFormants)	// 100% = 256
 	oo_INT_VECTOR_FROM (d_width, 0, d_numberOfFormants)		// 100% = 256
@@ -67,7 +67,7 @@ oo_DEFINE_CLASS (SpeechSynthesizer, Daata)
 	// sythesizers language /voice
 	oo_STRING (d_voiceLanguageName)
 	oo_STRING (d_voiceVariantName)
-	oo_LONG (d_wordsPerMinute)
+	oo_INTEGER (d_wordsPerMinute)
 	// text-only, phonemes-only, mixed
 	oo_INT (d_inputTextFormat)
 	// 1/: output phonemes in espeak/ notation
@@ -79,14 +79,23 @@ oo_DEFINE_CLASS (SpeechSynthesizer, Daata)
 	oo_DOUBLE (d_pitchRange)
 	// 1/2: output phonemes in espeak/IPA notation
 	oo_INT (d_outputPhonemeCoding)
-	oo_BOOL (d_estimateWordsPerMinute)
+
+	#if oo_READING_TEXT
+		if (formatVersion < 1) {
+			oo_INT (d_estimateWordsPerMinute)   // this used to be oo_BOOL, which was written in text as 0 or 1, which is inappropriate for boolean text
+		} else {
+			oo_QUESTION (d_estimateWordsPerMinute)
+		}
+	#else
+		oo_QUESTION (d_estimateWordsPerMinute)
+	#endif
 
 	#if !oo_READING && !oo_WRITING
 		// Filled by the call back
 		oo_AUTO_OBJECT (Table, 0, d_events)
 		oo_DOUBLE (d_internalSamplingFrequency)
-		oo_LONG (d_numberOfSamples)
-		oo_LONG (d_wavCapacity)
+		oo_INTEGER (d_numberOfSamples)
+		oo_INTEGER (d_wavCapacity)
 		oo_INT_VECTOR (d_wav, d_wavCapacity)
 	#endif
 	#if oo_READING
diff --git a/dwtools/Strings_extensions.cpp b/dwtools/Strings_extensions.cpp
index 3153f1b..f687408 100644
--- a/dwtools/Strings_extensions.cpp
+++ b/dwtools/Strings_extensions.cpp
@@ -35,7 +35,7 @@
 #include "Strings_extensions.h"
 #include "NUM2.h"
 
-autoStrings Strings_createFixedLength (long numberOfStrings) {
+autoStrings Strings_createFixedLength (integer numberOfStrings) {
 	try {
 		if (numberOfStrings <= 0) {
 			Melder_throw (U"The number of strings must be positive.");
@@ -54,7 +54,7 @@ autoStrings Strings_createAsCharacters (const char32 *string) {
 		autoStrings me = Thing_new (Strings);
 		my numberOfStrings = str32len (string);
 		my strings = NUMvector<char32 *> (1, my numberOfStrings);
-		for (long i = 1; i <= my numberOfStrings; i++) {
+		for (integer i = 1; i <= my numberOfStrings; i++) {
 			my strings[i] = Melder_dup (Melder_character (*string++));
 		}
 		return me;
@@ -83,7 +83,7 @@ autoStrings Strings_createAsTokens (const char32 *token_string, const char32 *se
 		autostring32 copy = Melder_dup (token_string);
 		char32 *index, *tokens = copy.peek();
 		const char32 *indexs;
-		long numberOfTokens = 0;
+		integer numberOfTokens = 0;
 		for (index = tokens, indexs = token_string; *indexs != U'\0'; indexs ++, index ++) {
 			for (const char32 *s = separators; *s != U'\0'; s++) {
 				if (*index == *s) {
@@ -117,10 +117,10 @@ autoStrings Strings_createAsTokens (const char32 *token_string, const char32 *se
 	} catch (MelderError) {
 		Melder_throw (U"Strings as tokens not created.");
 	}
-		
 }
-long Strings_findString (Strings me, const char32 *string) {
-	for (long i = 1; i <= my numberOfStrings; i++) {
+
+integer Strings_findString (Strings me, const char32 *string) {
+	for (integer i = 1; i <= my numberOfStrings; i++) {
 		if (Melder_equ (my strings[i], string)) {
 			return i;
 		}
@@ -130,18 +130,18 @@ long Strings_findString (Strings me, const char32 *string) {
 
 autoStrings Strings_append (OrderedOf<structStrings>* me) {
 	try {
-		long index = 1, numberOfStrings = 0;
+		integer index = 1, numberOfStrings = 0;
 
-		for (long i = 1; i <= my size; i ++) {
+		for (integer i = 1; i <= my size; i ++) {
 			Strings s = my at [i];
 			numberOfStrings += s -> numberOfStrings;
 		}
 
 		autoStrings thee = Strings_createFixedLength (numberOfStrings);
 
-		for (long i = 1; i <= my size; i ++) {
+		for (integer i = 1; i <= my size; i ++) {
 			Strings s = my at [i];
-			for (long j = 1; j <= s -> numberOfStrings; j ++, index ++) {
+			for (integer j = 1; j <= s -> numberOfStrings; j ++, index ++) {
 				thy strings [index] = Melder_dup (s -> strings [j]);
 			}
 		}
@@ -151,7 +151,7 @@ autoStrings Strings_append (OrderedOf<structStrings>* me) {
 	}
 }
 
-autoStrings Strings_change (Strings me, const char32 *search, const char32 *replace, int maximumNumberOfReplaces, long *nmatches, long *nstringmatches, int use_regexp) {
+autoStrings Strings_change (Strings me, const char32 *search, const char32 *replace, int maximumNumberOfReplaces, integer *nmatches, integer *nstringmatches, int use_regexp) {
 	try {
 		autoStrings thee = Thing_new (Strings);
 		char32 **strings = strs_replace (my strings, 1, my numberOfStrings, search, replace, maximumNumberOfReplaces, nmatches, nstringmatches, use_regexp);
@@ -163,10 +163,10 @@ autoStrings Strings_change (Strings me, const char32 *search, const char32 *repl
 	}
 }
 
-autoStrings strings_to_Strings (char32 **strings, long from, long to) {
+autoStrings strings_to_Strings (char32 **strings, integer from, integer to) {
 	try {
 		autoStrings thee = Strings_createFixedLength (to - from + 1);
-		for (long i = from; i <= to; i++) {
+		for (integer i = from; i <= to; i++) {
 			thy strings[i - from + 1]  = Melder_dup (strings[i]);
 		}
 		return thee;
@@ -175,7 +175,7 @@ autoStrings strings_to_Strings (char32 **strings, long from, long to) {
 	}
 }
 
-autoStrings Strings_extractPart (Strings me, long from, long to) {
+autoStrings Strings_extractPart (Strings me, integer from, integer to) {
 	try {
 		if (from < 1 || to > my numberOfStrings || from > to) Melder_throw
 			(U"Strings_extractPart: begin and end must be in interval [1, ", my numberOfStrings, U"].");
@@ -185,10 +185,10 @@ autoStrings Strings_extractPart (Strings me, long from, long to) {
 	}
 }
 
-autoStrings strings_to_Strings_link (char32 **strings, long n) {
+autoStrings strings_to_Strings_link (char32 **strings, integer n) {
 	try {
 		autoStrings me = Strings_createFixedLength (n);
-		for (long i = 1; i <= n; i++) {
+		for (integer i = 1; i <= n; i ++) {
 			my strings[i] = strings[i];
 		}
 		return me;
@@ -198,7 +198,7 @@ autoStrings strings_to_Strings_link (char32 **strings, long n) {
 }
 
 void Strings_unlink (Strings me) {
-	for (long i = 1; i <= my numberOfStrings; i++) {
+	for (integer i = 1; i <= my numberOfStrings; i ++) {
 		my strings[i] = nullptr;
 	}
 }
@@ -220,8 +220,8 @@ autoStrings Strings_and_Permutation_permuteStrings (Strings me, Permutation thee
 		if (my numberOfStrings != thy numberOfElements) Melder_throw (U"Strings_and_Permutation_permuteStrings: "
 			        U"The number of strings and the number of elements in the Permutation must be equal.");
 		autoStrings him = Strings_createFixedLength (my numberOfStrings);
-		for (long i = 1; i <= thy numberOfElements; i++) {
-			long index = thy p[i];
+		for (integer i = 1; i <= thy numberOfElements; i ++) {
+			integer index = thy p [i];
 			his strings[i] = Melder_dup (my strings[index]);
 		}
 		return him;
@@ -233,18 +233,18 @@ autoStrings Strings_and_Permutation_permuteStrings (Strings me, Permutation thee
 autoStringsIndex Stringses_to_StringsIndex (Strings me, Strings classes) {
 	try {
 		autoStringsIndex tmp = Strings_to_StringsIndex (classes);
-		long numberOfClasses = tmp -> classes->size;
+		integer numberOfClasses = tmp -> classes->size;
 
 		autoStringsIndex him = StringsIndex_create (my numberOfStrings);
-		for (long i = 1; i <= numberOfClasses; i ++) {
+		for (integer i = 1; i <= numberOfClasses; i ++) {
 			SimpleString t = (SimpleString) tmp -> classes->at [i];   // FIXME cast
 			autoSimpleString t2 = Data_copy (t);
 			his classes -> addItem_move (t2.move());
 		}
-		for (long j = 1; j <= my numberOfStrings; j ++) {
-			long index = 0;
+		for (integer j = 1; j <= my numberOfStrings; j ++) {
+			integer index = 0;
 			char32 *stringsj = my strings [j];
-			for (long i = 1; i <= numberOfClasses; i ++) {
+			for (integer i = 1; i <= numberOfClasses; i ++) {
 				SimpleString ss = (SimpleString) his classes->at [i];   // FIXME cast
 				if (Melder_equ (stringsj, ss -> string)) {
 					index = i;
@@ -263,10 +263,10 @@ autoStringsIndex Strings_to_StringsIndex (Strings me) {
 	try {
 		autoStringsIndex thee = StringsIndex_create (my numberOfStrings);
 		autoPermutation sorted = Strings_to_Permutation (me, 1);
-		long numberOfClasses = 0;
+		integer numberOfClasses = 0;
 		char32 *strings = nullptr;
-		for (long i = 1; i <= sorted -> numberOfElements; i ++) {
-			long index = sorted -> p [i];
+		for (integer i = 1; i <= sorted -> numberOfElements; i ++) {
+			integer index = sorted -> p [i];
 			char32 *stringsi = my strings [index];
 			if (i == 1 || Melder_cmp (strings, stringsi) != 0) {
 				numberOfClasses ++;
@@ -285,7 +285,7 @@ autoStringsIndex Strings_to_StringsIndex (Strings me) {
 autoStrings StringsIndex_to_Strings (StringsIndex me) {
 	try {
 		autoStrings thee = Strings_createFixedLength (my numberOfItems);
-		for (long i = 1; i <= thy numberOfStrings; i ++) {
+		for (integer i = 1; i <= thy numberOfStrings; i ++) {
 			SimpleString s = (SimpleString) my classes->at [my classIndex [i]];   // FIXME cast, FIXME classIndex
 			thy strings [i] = Melder_dup (s -> string);
 		}
@@ -295,15 +295,15 @@ autoStrings StringsIndex_to_Strings (StringsIndex me) {
 	}
 }
 
-autoStringsIndex Table_to_StringsIndex_column (Table me, long column) {
+autoStringsIndex Table_to_StringsIndex_column (Table me, integer column) {
 	try {
 		if (column < 1 || column > my numberOfColumns) {
 			Melder_throw (U"Invalid column number.");
 		}
-		long numberOfRows = my rows.size;
+		integer numberOfRows = my rows.size;
 		Table_numericize_Assert (me, column);
 		autoNUMvector<char32 *> groupLabels (1, numberOfRows);
-		for (long irow = 1; irow <= numberOfRows; irow ++) {
+		for (integer irow = 1; irow <= numberOfRows; irow ++) {
 			groupLabels [irow] = my rows.at [irow] -> cells [column] .string;
 		}
 		autoStrings thee = strings_to_Strings (groupLabels.peek(), 1, numberOfRows);
diff --git a/dwtools/Strings_extensions.h b/dwtools/Strings_extensions.h
index 0bc3063..b27fcf2 100644
--- a/dwtools/Strings_extensions.h
+++ b/dwtools/Strings_extensions.h
@@ -33,38 +33,36 @@
 #include "Index.h"
 #include "Table.h"
 
-
-autoStrings Strings_createFixedLength (long numberOfStrings);
+autoStrings Strings_createFixedLength (integer numberOfStrings);
 
 autoStrings Strings_createAsCharacters (const char32 *string);
 
 autoStrings Strings_createAsTokens (const char32 *string, const char32 *separators);
 
-long Strings_findString (Strings me, const char32 *string);
+integer Strings_findString (Strings me, const char32 *string);
 
 autoStrings Strings_append (OrderedOf<structStrings>* me);
 
 autoStrings Strings_change (Strings me, const char32 *search, const char32 *replace,
-	int maximumNumberOfReplaces, long *nmatches, long *nstringmatches, int use_regexp);
+	int maximumNumberOfReplaces, integer *nmatches, integer *nstringmatches, int use_regexp);
 
-autoStrings strings_to_Strings (char32 **strings, long from, long to);
+autoStrings strings_to_Strings (char32 **strings, integer from, integer to);
 
 // If the Strings is only an intermediate object to achieve other goals, use the following two routines to avoid copying.
-autoStrings strings_to_Strings_link (char32** strings, long n);
+autoStrings strings_to_Strings_link (char32** strings, integer n);
 // for (i=1; i<= n; i++) my strings[i] = strings[i];
 
 void Strings_unlink (Strings me);
 // for (i=1; i<= my numberOfStrings; i++) my strings[i] = nullptr;
 
-autoStrings Strings_extractPart (Strings me, long start, long end);
-
+autoStrings Strings_extractPart (Strings me, integer start, integer end);
 
 autoStringsIndex Strings_to_StringsIndex (Strings me);
 
 autoStringsIndex Stringses_to_StringsIndex (Strings me, Strings classes);
 /* Construct the index with strings in classes, index[i]=0 when my strings[i] doesn't occur in classes */
 
-autoStringsIndex Table_to_StringsIndex_column (Table me, long column);
+autoStringsIndex Table_to_StringsIndex_column (Table me, integer column);
 
 autoStrings StringsIndex_to_Strings (StringsIndex me);
 
diff --git a/dwtools/TableOfReal_extensions.cpp b/dwtools/TableOfReal_extensions.cpp
index bb88e5d..934569e 100644
--- a/dwtools/TableOfReal_extensions.cpp
+++ b/dwtools/TableOfReal_extensions.cpp
@@ -70,8 +70,8 @@
 #define Graphics_TWOWAYARROW 2
 #define Graphics_LINE 3
 
-static autoTableOfReal TableOfReal_and_TableOfReal_columnCorrelations (TableOfReal me, TableOfReal thee, int center, int normalize);
-static autoTableOfReal TableOfReal_and_TableOfReal_rowCorrelations (TableOfReal me, TableOfReal thee, int center, int normalize);
+static autoTableOfReal TableOfReal_and_TableOfReal_columnCorrelations (TableOfReal me, TableOfReal thee, bool center, bool normalize);
+static autoTableOfReal TableOfReal_and_TableOfReal_rowCorrelations (TableOfReal me, TableOfReal thee, bool center, bool normalize);
 
 long TableOfReal_getColumnIndexAtMaximumInRow (TableOfReal me, long rowNumber) {
 	long columnNumber = 0;
@@ -1117,7 +1117,7 @@ autoTableOfReal TableOfReal_bootstrap (TableOfReal me) {
 	}
 }
 
-void TableOfReal_changeRowLabels (TableOfReal me, const char32 *search, const char32 *replace, int maximumNumberOfReplaces, long *nmatches, long *nstringmatches, int use_regexp) {
+void TableOfReal_changeRowLabels (TableOfReal me, const char32 *search, const char32 *replace, int maximumNumberOfReplaces, integer *nmatches, integer *nstringmatches, int use_regexp) {
 	try {
 		autostring32vector rowLabels (strs_replace (my rowLabels, 1, my numberOfRows, search, replace, maximumNumberOfReplaces, nmatches, nstringmatches, use_regexp), 1, my numberOfRows);
 		NUMstrings_free (my rowLabels, 1, my numberOfRows);
@@ -1127,7 +1127,7 @@ void TableOfReal_changeRowLabels (TableOfReal me, const char32 *search, const ch
 	}
 }
 
-void TableOfReal_changeColumnLabels (TableOfReal me, const char32 *search, const char32 *replace, int maximumNumberOfReplaces, long *nmatches, long *nstringmatches, int use_regexp) {
+void TableOfReal_changeColumnLabels (TableOfReal me, const char32 *search, const char32 *replace, int maximumNumberOfReplaces, integer *nmatches, integer *nstringmatches, int use_regexp) {
 	try {
 		autostring32vector columnLabels (strs_replace (my columnLabels, 1, my numberOfColumns, search, replace, maximumNumberOfReplaces, nmatches, nstringmatches, use_regexp), 1, my numberOfColumns);
 		NUMstrings_free (my columnLabels, 1, my numberOfColumns);
@@ -1263,14 +1263,14 @@ void TableOfReal_drawColumnAsDistribution (TableOfReal me, Graphics g, int colum
 	}
 }
 
-autoTableOfReal TableOfReal_sortRowsByIndex (TableOfReal me, long index[], int reverse) {
+autoTableOfReal TableOfReal_sortRowsByIndex (TableOfReal me, integer index[], int reverse) {
 	try {
 		if (my rowLabels == 0) {
 			Melder_throw (U"No labels to sort");
 		}
 
 		double min, max;
-		NUMvector_extrema (index, 1, my numberOfRows, &min, &max);
+		NUMvector_extrema (index, 1, my numberOfRows, & min, & max);
 		if (min < 1 || max > my numberOfRows) {
 			Melder_throw (U"One or more indices out of range [1, ", my numberOfRows, U"].");
 		}
@@ -1303,9 +1303,9 @@ autoTableOfReal TableOfReal_sortRowsByIndex (TableOfReal me, long index[], int r
 	}
 }
 
-long *TableOfReal_getSortedIndexFromRowLabels (TableOfReal me) {
+integer *TableOfReal_getSortedIndexFromRowLabels (TableOfReal me) {
 	try {
-		autoNUMvector<long> index (1, my numberOfRows);
+		autoNUMvector <integer> index (1, my numberOfRows);
 		NUMindexx_s (my rowLabels, my numberOfRows, index.peek());
 		return index.transfer();
 	} catch (MelderError) {
@@ -1354,7 +1354,7 @@ static void NUMstatsColumns (double **a, long rb, long re, long cb, long ce, boo
 autoTableOfReal TableOfReal_meansByRowLabels (TableOfReal me, bool expand, bool useMedians) {
 	try {
 		autoTableOfReal thee;
-		autoNUMvector<long> index (TableOfReal_getSortedIndexFromRowLabels (me), 1);
+		autoNUMvector <integer> index (TableOfReal_getSortedIndexFromRowLabels (me), 1);
 		autoTableOfReal sorted = TableOfReal_sortRowsByIndex (me, index.peek(), 0);
 
 		long indexi = 1, indexr = 0;
@@ -1444,10 +1444,10 @@ autoTableOfReal TableOfReal_to_TableOfReal (TableOfReal me) {
 	}
 }
 
-autoTableOfReal TableOfReal_choleskyDecomposition (TableOfReal me, int upper, int inverse) {
+autoTableOfReal TableOfReal_choleskyDecomposition (TableOfReal me, bool upper, bool inverse) {
 	try {
 		char diag = 'N';
-		long n = my numberOfColumns, lda = my numberOfRows, info;
+		integer n = my numberOfColumns, lda = my numberOfRows, info;
 
 		if (n != lda) {
 			Melder_throw (U"The table must be a square symmetric table.");
@@ -1455,16 +1455,20 @@ autoTableOfReal TableOfReal_choleskyDecomposition (TableOfReal me, int upper, in
 		autoTableOfReal thee = Data_copy (me);
 
 		if (upper) {
-			for (long i = 2; i <= n; i++) for (long j = 1; j < i; j++) {
-					thy data[i][j] = 0.0;
+			for (integer i = 2; i <= n; i ++) {
+				for (integer j = 1; j < i; j ++) {
+					thy data [i] [j] = 0.0;
 				}
+			}
 		} else {
-			for (long i = 1; i < n; i++) for (long j = i + 1; j <= n; j++) {
-					thy data[i][j] = 0.0;
+			for (integer i = 1; i < n; i ++) {
+				for (integer j = i + 1; j <= n; j ++) {
+					thy data [i] [j] = 0.0;
 				}
+			}
 		}
 		char uplo = upper ? 'L' : 'U';
-		NUMlapack_dpotf2 (&uplo, &n, &thy data[1][1], &lda, &info);
+		NUMlapack_dpotf2 (& uplo, & n, & thy data [1] [1], & lda, & info);
 		if (info != 0) {
 			Melder_throw (U"dpotf2 fails");
 		}
@@ -1625,12 +1629,12 @@ double TableOfReal_normalityTest_BHEP (TableOfReal me, double *h, double *p_tnb,
 	}
 }
 
-autoTableOfReal TableOfReal_and_TableOfReal_crossCorrelations (TableOfReal me, TableOfReal thee, int by_columns, int center, int normalize) {
+autoTableOfReal TableOfReal_and_TableOfReal_crossCorrelations (TableOfReal me, TableOfReal thee, bool by_columns, bool center, bool normalize) {
 	return by_columns ? TableOfReal_and_TableOfReal_columnCorrelations (me, thee, center, normalize) :
 	       TableOfReal_and_TableOfReal_rowCorrelations (me, thee, center, normalize);
 }
 
-autoTableOfReal TableOfReal_and_TableOfReal_rowCorrelations (TableOfReal me, TableOfReal thee, int center, int normalize) {
+autoTableOfReal TableOfReal_and_TableOfReal_rowCorrelations (TableOfReal me, TableOfReal thee, bool center, bool normalize) {
 	try {
 		if (my numberOfColumns != thy numberOfColumns) {
 			Melder_throw (U"Both tables must have the same number of columns.");
@@ -1664,7 +1668,7 @@ autoTableOfReal TableOfReal_and_TableOfReal_rowCorrelations (TableOfReal me, Tab
 	}
 }
 
-autoTableOfReal TableOfReal_and_TableOfReal_columnCorrelations (TableOfReal me, TableOfReal thee, int center, int normalize) {
+autoTableOfReal TableOfReal_and_TableOfReal_columnCorrelations (TableOfReal me, TableOfReal thee, bool center, bool normalize) {
 	try {
 		if (my numberOfRows != thy numberOfRows) {
 			Melder_throw (U"Both tables must have the same number of rows.");
diff --git a/dwtools/TableOfReal_extensions.h b/dwtools/TableOfReal_extensions.h
index 4482485..b11008d 100644
--- a/dwtools/TableOfReal_extensions.h
+++ b/dwtools/TableOfReal_extensions.h
@@ -39,9 +39,9 @@ void TableOfReal_and_Categories_setRowLabels (TableOfReal me, Categories thee);
 
 autoTableOfReal TableOfReal_sortOnlyByRowLabels (TableOfReal me);
 
-long *TableOfReal_getSortedIndexFromRowLabels (TableOfReal me);
+integer *TableOfReal_getSortedIndexFromRowLabels (TableOfReal me);
 
-autoTableOfReal TableOfReal_sortRowsByIndex (TableOfReal me, long index[], int reverse);
+autoTableOfReal TableOfReal_sortRowsByIndex (TableOfReal me, integer index[], int reverse);
 // thy data[reverse ? i : index[i]][j] = my data[reverse ? index[i] : i]
 
 autoTableOfReal TableOfReal_createIrisDataset ();
@@ -115,10 +115,10 @@ int TableOfReal_hasRowLabels (TableOfReal me);
 int TableOfReal_hasColumnLabels (TableOfReal me);
 
 void TableOfReal_changeRowLabels (TableOfReal me, const char32 *search, const char32 *replace,
-	int maximumNumberOfReplaces, long *nmatches, long *nstringmatches, int use_regexp);
+	int maximumNumberOfReplaces, integer *nmatches, integer *nstringmatches, int use_regexp);
 
 void TableOfReal_changeColumnLabels (TableOfReal me, const char32 *search, const char32 *replace,
-	int maximumNumberOfReplaces, long *nmatches, long *nstringmatches, int use_regexp);
+	int maximumNumberOfReplaces, integer *nmatches, integer *nstringmatches, int use_regexp);
 /*
 	Change all row/column labels. The 'search' and 'replace' string are
 	interpreted as regular expressions when 'use_regexp' != 0.
@@ -184,7 +184,7 @@ autoTableOfReal TableOfReal_randomizeRows (TableOfReal me);
 /* For the inheritors */
 autoTableOfReal TableOfReal_to_TableOfReal (TableOfReal me);
 
-autoTableOfReal TableOfReal_choleskyDecomposition (TableOfReal me, int upper, int inverse);
+autoTableOfReal TableOfReal_choleskyDecomposition (TableOfReal me, bool upper, bool inverse);
 
 autoTableOfReal TableOfReal_appendColumns (TableOfReal me, TableOfReal thee);
 
@@ -193,7 +193,7 @@ void TableOfReal_copyOneRowWithLabel (TableOfReal me, TableOfReal thee, long myr
 /* Henze & Wagner (1997), A new approach to the BHEP tests for multivariate normality, Journal of Multivariate Analysis 62, 1-23. */
 double TableOfReal_normalityTest_BHEP (TableOfReal me, double *beta /* input and output */, double *tnb, double *lnmu, double *lnvar);
 
-autoTableOfReal TableOfReal_and_TableOfReal_crossCorrelations (TableOfReal me, TableOfReal thee, int by_columns, int center, int normalize);
+autoTableOfReal TableOfReal_and_TableOfReal_crossCorrelations (TableOfReal me, TableOfReal thee, bool by_columns, bool center, bool normalize);
 
 
 #pragma mark - class TableOfRealList
diff --git a/dwtools/Table_extensions.cpp b/dwtools/Table_extensions.cpp
index 20ff734..356c794 100644
--- a/dwtools/Table_extensions.cpp
+++ b/dwtools/Table_extensions.cpp
@@ -3400,25 +3400,25 @@ autoTable Table_getOneWayKruskalWallis (Table me, long column, long factorColumn
 		if (factorColumn < 1 || factorColumn > my numberOfColumns || factorColumn == column) {
 			Melder_throw (U"Invalid group column number.");
 		}
-		long numberOfData = my rows.size;
+		integer numberOfData = my rows.size;
 		Table_numericize_Assert (me, column);
 		autoNUMvector<double> data (1, numberOfData);
 		autoStringsIndex levels = Table_to_StringsIndex_column (me, factorColumn);
-		long numberOfLevels = levels -> classes->size;
+		integer numberOfLevels = levels -> classes->size;
 		if (numberOfLevels < 2) {
 			Melder_throw (U"There must be at least two levels.");
 		}
 
-		for (long irow = 1; irow <= numberOfData; irow++) {
+		for (integer irow = 1; irow <= numberOfData; irow ++) {
 			data [irow] = my rows.at [irow] -> cells [column]. number;
 		}
-		NUMsort2<double, long> (numberOfData, data.peek(), levels -> classIndex);
-		NUMrank<double> (numberOfData, data.peek());
+		NUMsort2 <double, integer> (numberOfData, data.peek(), levels -> classIndex);
+		NUMrank <double> (numberOfData, data.peek());
 
 		// Get correctionfactor for ties
 		// Hayes pg. 831
-		double c = 0.0;
-		long jt, j = 1;
+		real80 c = 0.0;
+		integer jt, j = 1;
 		while (j < numberOfData) {
         	for (jt = j + 1; jt <= numberOfData && data [jt] == data [j]; jt ++) { }
         	double multiplicity = jt - j;
@@ -3427,19 +3427,19 @@ autoTable Table_getOneWayKruskalWallis (Table me, long column, long factorColumn
 			}
         	j = jt;
 		}
-		double tiesCorrection = 1.0 - c / (numberOfData * (numberOfData * numberOfData - 1.0));
+		double tiesCorrection = 1.0 - (real) c / (numberOfData * (numberOfData * numberOfData - 1.0));
 
-		autoNUMvector<long> factorLevelSizes (1, numberOfLevels);
-		autoNUMvector<double> factorLevelSums (1, numberOfLevels);
-		autoNUMvector<long> ties (1, numberOfLevels);
-		for (long i = 1; i <= numberOfData; i++) {
-			long index = levels -> classIndex[i];
-			factorLevelSizes[index] ++;
-			factorLevelSums[index] += data[i];
+		autoNUMvector <integer> factorLevelSizes (1, numberOfLevels);
+		autoNUMvector <double> factorLevelSums (1, numberOfLevels);
+		autoNUMvector <integer> ties (1, numberOfLevels);
+		for (integer i = 1; i <= numberOfData; i ++) {
+			integer index = levels -> classIndex [i];
+			factorLevelSizes [index] ++;
+			factorLevelSums [index] += data [i];
 		}
 
-		double kruskalWallis = 0;
-		for (j = 1; j <= numberOfLevels; j++) {
+		real80 kruskalWallis = 0.0;
+		for (j = 1; j <= numberOfLevels; j ++) {
 			if (factorLevelSizes[j] < 2) {
 				SimpleString ss = (SimpleString) levels -> classes->at [j];   // FIXME cast
 				Melder_throw (U"Group ", ss -> string, U" has fewer than two cases.");
@@ -3453,13 +3453,13 @@ autoTable Table_getOneWayKruskalWallis (Table me, long column, long factorColumn
 			*p_df = df;
 		}
 		if (p_kruskalWallis) {
-			*p_kruskalWallis = kruskalWallis;
+			*p_kruskalWallis = (real) kruskalWallis;
 		}
 		if (prob) {
-			*prob = NUMchiSquareQ (kruskalWallis, df);
+			*prob = NUMchiSquareQ ((real) kruskalWallis, df);
 		}
 		autoTable him = Table_createWithColumnNames (numberOfLevels, U"Group(R) Sums(R) Cases");
-		for (long irow = 1; irow <= numberOfLevels; irow++) {
+		for (integer irow = 1; irow <= numberOfLevels; irow++) {
 			SimpleString ss = (SimpleString) levels -> classes->at [irow];
 			Table_setStringValue (him.get(), irow, 1, ss -> string);
 			Table_setNumericValue (him.get(), irow, 2, factorLevelSums[irow]);
@@ -3478,29 +3478,29 @@ static void _Table_postHocTukeyHSD (Table me, double sumOfSquaresWithin, double
 	try {
 		Table_numericize_Assert (me, 2);
 		Table_numericize_Assert (me, 3);
-		long numberOfMeans = my rows.size;
+		integer numberOfMeans = my rows.size;
 		autoNUMvector<double> means (1, numberOfMeans);
 		autoNUMvector<double> cases (1, numberOfMeans);
 		autoTable meansD = Table_create (numberOfMeans - 1, numberOfMeans);
-		for (long i = 1; i <= numberOfMeans; i++) {
+		for (integer i = 1; i <= numberOfMeans; i++) {
 			TableRow row = my rows.at [i];
 			means [i] = row -> cells [2]. number;
 			cases [i] = row -> cells [3]. number;
 		}
-		for (long i = 1; i <= numberOfMeans - 1; i ++) {
+		for (integer i = 1; i <= numberOfMeans - 1; i ++) {
 			Table_setStringValue (meansD.get(), i, 1, my rows.at [i] -> cells [1]. string);
 			Table_setColumnLabel (meansD.get(), i + 1, my rows.at [i + 1] -> cells [1]. string);
 		}
 
-		for (long irow = 1; irow <= numberOfMeans - 1; irow ++) {
-			for (long icol = irow + 1; icol <= numberOfMeans; icol ++) {
+		for (integer irow = 1; irow <= numberOfMeans - 1; irow ++) {
+			for (integer icol = irow + 1; icol <= numberOfMeans; icol ++) {
 				double dif = fabs (means [irow] - means [icol]);
 				Table_setNumericValue (meansD.get(), irow, icol, dif);
 			}
 		}
 		autoTable meansP = Data_copy (meansD.get());
-		for (long irow = 1; irow <= numberOfMeans - 1; irow ++) {
-			for (long icol = irow + 1; icol <= numberOfMeans; icol ++) {
+		for (integer irow = 1; irow <= numberOfMeans - 1; irow ++) {
+			for (integer icol = irow + 1; icol <= numberOfMeans; icol ++) {
 				// Tukey-Kramer correction for unequal sample sizes
 				double oneOverNstar =  0.5 * (1.0 / cases [icol] + 1.0 / cases [irow]);
 				double s = sqrt (sumOfSquaresWithin * oneOverNstar);
@@ -3533,14 +3533,14 @@ void Table_printAsAnovaTable (Table me) {
 		Melder_pad (width[5], U"F"), U"\t",
 		Melder_pad (width[6], U"P")
 	);
-	for (long icol = 2; icol <= 6; icol++) {
+	for (integer icol = 2; icol <= 6; icol++) {
 		Table_numericize_Assert (me, icol);
 	}
 
-	for (long i = 1; i <= my rows.size; i ++) {
+	for (integer i = 1; i <= my rows.size; i ++) {
 		TableRow row = my rows.at [i];
 		MelderString_copy (&s, Melder_padOrTruncate (width [1], row -> cells [1]. string), U"\t");
-		for (long j = 2; j <= 6; j ++) {
+		for (integer j = 2; j <= 6; j ++) {
 			double value = row -> cells [j]. number;
 			if (isdefined (value)) {
 				MelderString_append (&s, Melder_pad (width [j], Melder_single (value)), j == 6 ? U"" : U"\t");
@@ -3554,19 +3554,19 @@ void Table_printAsAnovaTable (Table me) {
 
 void Table_printAsMeansTable (Table me) {
 	autoMelderString s;
-	for (long icol = 2; icol <= my numberOfColumns; icol ++) {
+	for (integer icol = 2; icol <= my numberOfColumns; icol ++) {
 		Table_numericize_Assert (me, icol);
 	}
-	for (long j = 1; j <= my numberOfColumns; j ++) {
+	for (integer j = 1; j <= my numberOfColumns; j ++) {
 		MelderString_append (&s,
 			Melder_padOrTruncate (10, ! my columnHeaders [j]. label ? U"" : my columnHeaders [j]. label),
 			j == my numberOfColumns ? U"" : U"\t");
 	}
 	MelderInfo_writeLine (s.string);
-	for (long i = 1; i <= my rows.size; i ++) {
+	for (integer i = 1; i <= my rows.size; i ++) {
 		TableRow row = my rows.at [i];
 		MelderString_copy (&s, Melder_padOrTruncate (10, row -> cells [1]. string), U"\t");
-		for (long j = 2; j <= my numberOfColumns; j++) {
+		for (integer j = 2; j <= my numberOfColumns; j++) {
 			double value = row -> cells[j].number;
 			if (isdefined (value)) {
 				MelderString_append (&s,
@@ -4202,11 +4202,11 @@ void Table_distributionPlotWhere (Table me, Graphics g,
 
 static autoStrings itemizeColourString (const char32 *colourString) {
 	// remove all spaces within { } so each {1,2,3} can be itemized
-	long nmatches_sub = 0;
+	integer nmatches_sub = 0;
 	const char32 *searchRE = U"\\{\\s*([0-9.]+)\\s*,\\s*([0-9.]+)\\s*,\\s*([0-9.]+)\\s*\\}";
 	regexp *compiledRE = CompileRE_throwable (searchRE, 0);
 	autoMelderString colour;
-	MelderString_append (&colour, str_replace_regexp (colourString, compiledRE, U"{\\1,\\2,\\3}", 0, &nmatches_sub));
+	MelderString_append (& colour, str_replace_regexp (colourString, compiledRE, U"{\\1,\\2,\\3}", 0, & nmatches_sub));
 	autoStrings thee = Strings_createAsTokens (colour.string, U" ");
 	return thee;
 }
@@ -4308,7 +4308,7 @@ void Table_barPlotWhere (Table me, Graphics g,
 		autoStrings colour = itemizeColourString (colours);   // removes all spaces within { } so each {} can be parsed as 1 item
 		
 		autoNUMvector <integer> selectedRows (Table_findRowsMatchingCriterion (me, formula, interpreter, & numberOfRowMatches), 1);
-		if (ymax <= ymin) { // autoscaling
+		if (ymax <= ymin) {   // autoscaling
 			ymin = 1e308; ymax= - ymin;
 			for (long icol = 1; icol <= numberOfColumns; icol++) {
 				double cmin, cmax;
@@ -4327,19 +4327,19 @@ void Table_barPlotWhere (Table me, Graphics g,
 		double bar_width = 1 / (numberOfGroups * groupSize + 2 * xoffsetFraction + (numberOfGroups - 1) * interbarsFraction + numberOfGroups * (groupSize - 1) * interbarFraction);
 		double dx = (interbarsFraction + groupSize + (groupSize - 1) * interbarFraction) * bar_width;
 
-		for (long icol = 1; icol <= groupSize; icol++) {
+		for (long icol = 1; icol <= groupSize; icol ++) {
 			double xb = xoffsetFraction * bar_width + (icol - 1) * (1 + interbarFraction) * bar_width;
 			double x1 = xb;
 			Graphics_Colour color = Strings_colourToValue  (colour.get(), icol);
-			for (long irow = 1; irow <= numberOfRowMatches; irow++) {
+			for (long irow = 1; irow <= numberOfRowMatches; irow ++) {
 				double x2 = x1 + bar_width;
-				double y2 = Table_getNumericValue_Assert (me, selectedRows[irow], columnIndex[icol]);
+				double y2 = Table_getNumericValue_Assert (me, selectedRows [irow], columnIndex [icol]);
 				y2 = y2 > ymax ? ymax : (y2 < ymin ? ymin : y2);
 				double y1 = ymin < 0 ? 0 : ymin;
 				
 				Graphics_setColour (g, color);
 				Graphics_fillRectangle (g, x1, x2, y1, y2);
-				Graphics_setGrey (g, 0); /* Black */
+				Graphics_setGrey (g, 0);   // black
 				Graphics_rectangle (g, x1, x2, y1, y2);
 
 				x1 += dx;
@@ -4355,7 +4355,7 @@ void Table_barPlotWhere (Table me, Graphics g,
 				int currentFontSize = Graphics_inqFontSize (g);
 				Graphics_setTextRotation (g, angle);
 				if (angle < 0) {
-					y -= 0.3*lineSpacing;
+					y -= 0.3 * lineSpacing;
 					xb -= 0.5 * bar_width;
 					Graphics_setFontSize (g, currentFontSize - (currentFontSize > 12 ? 2 : 1));
 					Graphics_setTextAlignment (g, Graphics_LEFT, Graphics_TOP);
@@ -4381,7 +4381,7 @@ void Table_barPlotWhere (Table me, Graphics g,
 		}
 		Graphics_unsetInner (g);
 		if (garnish) {
-			if (ymin * ymax < 0) {
+			if (ymin * ymax < 0.0) {
 				Graphics_markLeft (g, 0.0, true, true, true, nullptr);
 			}
 
@@ -4400,10 +4400,12 @@ static int Graphics_getConnectingLine (Graphics g, const char32 *text1, double x
 	double xi[3], yi[3], xleft = x1 < x2 ? x1 : x2, xright = x2 > x1 ? x2 : x1;
 	int numberOfIntersections = NUMgetIntersectionsWithRectangle (x1, y1, x2, y2, xleft - width1 / 2.0, y1 - h/2, xleft + width1 / 2.0, y1 + h/2, xi, yi);
 	if (numberOfIntersections == 1) {
-		*x3 = xi[1]; *y3 = yi[1];
+		*x3 = xi [1];
+		*y3 = yi [1];
 		numberOfIntersections = NUMgetIntersectionsWithRectangle (x1, y1, x2, y2, xright - width2 / 2.0, y2 - h/2, xright + width2 / 2.0, y2 + h/2, xi, yi);
 		if (numberOfIntersections == 1) {
-			*x4 = xi[1]; *y4 = yi[1];
+			*x4 = xi [1];
+			*y4 = yi [1];
 			drawLine = 1;
 		}
 	}
@@ -4719,15 +4721,15 @@ void Table_drawEllipsesWhere (Table me, Graphics g, long xcolumn, long ycolumn,
 
 autoTable Table_extractColumnRanges (Table me, const char32 *ranges) {
 	try {
-		long numberOfSelectedColumns, numberOfRows = my rows.size;
-		autoNUMvector<long> columnRanges (NUMstring_getElementsOfRanges (ranges, my numberOfColumns, & numberOfSelectedColumns, nullptr, U"columnn number", true), 1);
+		integer numberOfSelectedColumns, numberOfRows = my rows.size;
+		autoNUMvector <integer> columnRanges (NUMstring_getElementsOfRanges (ranges, my numberOfColumns, & numberOfSelectedColumns, nullptr, U"columnn number", true), 1);
 		autoTable thee = Table_createWithoutColumnNames (numberOfRows, numberOfSelectedColumns); 
-		for (long icol = 1; icol <= numberOfSelectedColumns; icol ++) {
+		for (integer icol = 1; icol <= numberOfSelectedColumns; icol ++) {
 			Table_setColumnLabel (thee.get(), icol, my v_getColStr (columnRanges [icol]));
 		}
-		for (long irow = 1; irow <= numberOfRows; irow ++) {
+		for (integer irow = 1; irow <= numberOfRows; irow ++) {
 			//TableRow row = thy rows -> items [irow];
-			for (long icol = 1; icol <= numberOfSelectedColumns; icol ++) {
+			for (integer icol = 1; icol <= numberOfSelectedColumns; icol ++) {
 				const char32 *value = Table_getStringValue_Assert (me, irow, columnRanges [icol]);
 				Table_setStringValue (thee.get(), irow, icol, value);
 			}
diff --git a/dwtools/TextGrid_extensions.cpp b/dwtools/TextGrid_extensions.cpp
index c213964..d0bfc67 100644
--- a/dwtools/TextGrid_extensions.cpp
+++ b/dwtools/TextGrid_extensions.cpp
@@ -591,7 +591,7 @@ void IntervalTier_cutIntervalsOnLabelMatch (IntervalTier me, const char32 *label
 	}
 }
 
-void IntervalTier_changeLabels (IntervalTier me, long from, long to, const char32 *search, const char32 *replace, int use_regexp, long *nmatches, long *nstringmatches) {
+void IntervalTier_changeLabels (IntervalTier me, integer from, integer to, const char32 *search, const char32 *replace, int use_regexp, integer *nmatches, integer *nstringmatches) {
 	try {
 		if (from == 0) {
 			from = 1;
@@ -606,7 +606,7 @@ void IntervalTier_changeLabels (IntervalTier me, long from, long to, const char3
 			Melder_throw (U"The regex search string cannot be empty.\nYou may search for an empty string with the expression \"^$\"");
 		}
 
-		long nlabels = to - from + 1;
+		integer nlabels = to - from + 1;
 		autoNUMvector<char32 *> labels (1, nlabels);
 
 		for (long i = from; i <= to; i ++) {
@@ -615,7 +615,7 @@ void IntervalTier_changeLabels (IntervalTier me, long from, long to, const char3
 		}
 		autostring32vector newlabels (strs_replace (labels.peek(), 1, nlabels, search, replace, 0, nmatches, nstringmatches, use_regexp), 1, nlabels);
 
-		for (long i = from; i <= to; i ++) {
+		for (integer i = from; i <= to; i ++) {
 			TextInterval interval = my intervals.at [i];
 			Melder_free (interval -> text);
 			interval -> text = newlabels [i - from + 1];   // Transfer of ownership.
@@ -626,7 +626,7 @@ void IntervalTier_changeLabels (IntervalTier me, long from, long to, const char3
 	}
 }
 
-void TextTier_changeLabels (TextTier me, long from, long to, const char32 *search, const char32 *replace, int use_regexp, long *nmatches, long *nstringmatches) {
+void TextTier_changeLabels (TextTier me, integer from, integer to, const char32 *search, const char32 *replace, int use_regexp, integer *nmatches, integer *nstringmatches) {
 	try {
 		if (from == 0) {
 			from = 1;
@@ -640,7 +640,7 @@ void TextTier_changeLabels (TextTier me, long from, long to, const char32 *searc
 		if (use_regexp && str32len (search) == 0) {
 			Melder_throw (U"The regex search string cannot be empty.\nYou may search for an empty string with the expression \"^$\"");
 		}
-		long nmarks = to - from + 1;
+		integer nmarks = to - from + 1;
 		autoNUMvector<char32 *> marks (1, nmarks);   // a non-owning vector of strings
 
 		for (long i = from; i <= to; i ++) {
@@ -649,7 +649,7 @@ void TextTier_changeLabels (TextTier me, long from, long to, const char32 *searc
 		}
 		autostring32vector newMarks (strs_replace (marks.peek(), 1, nmarks, search, replace, 0, nmatches, nstringmatches, use_regexp), 1, nmarks);
 
-		for (long i = from; i <= to; i ++) {
+		for (integer i = from; i <= to; i ++) {
 			TextPoint point = my points.at [i];
 			Melder_free (point -> mark);   // this discards the original mark, and dangles its reference copy in `marks`, which will not be used
 			point -> mark = newMarks [i - from + 1];   // move the new mark; this consists of a copy from A to B...
@@ -660,7 +660,7 @@ void TextTier_changeLabels (TextTier me, long from, long to, const char32 *searc
 	}
 }
 
-void TextGrid_changeLabels (TextGrid me, int tier, long from, long to, const char32 *search, const char32 *replace, int use_regexp, long *nmatches, long *nstringmatches) {
+void TextGrid_changeLabels (TextGrid me, integer tier, integer from, integer to, const char32 *search, const char32 *replace, int use_regexp, integer *nmatches, integer *nstringmatches) {
 	try {
 		long ntiers = my tiers->size;
 		if (tier < 1 || tier > ntiers) {
diff --git a/dwtools/TextGrid_extensions.h b/dwtools/TextGrid_extensions.h
index 5ecbed8..1e12e05 100644
--- a/dwtools/TextGrid_extensions.h
+++ b/dwtools/TextGrid_extensions.h
@@ -78,9 +78,9 @@ void TextGrid_extendTime (TextGrid me, double delta_time, int position);
 
 void TextGrid_setTierName (TextGrid me, long itier, const char32 *newName);
 
-void TextTier_changeLabels (TextTier me, long from, long to, const char32 *search, const char32 *replace, int use_regexp, long *nmatches, long *nstringmatches);
+void TextTier_changeLabels (TextTier me, integer from, integer to, const char32 *search, const char32 *replace, int use_regexp, integer *nmatches, integer *nstringmatches);
 
-void IntervalTier_changeLabels (IntervalTier me, long from, long to, const char32 *search, const char32 *replace, int use_regexp, long *nmatches, long *nstringmatches);
+void IntervalTier_changeLabels (IntervalTier me, integer from, integer to, const char32 *search, const char32 *replace, int use_regexp, integer *nmatches, integer *nstringmatches);
 
 void IntervalTier_removeBoundariesBetweenIdenticallyLabeledIntervals (IntervalTier me, const char32 *label);
 
@@ -88,7 +88,7 @@ void IntervalTier_cutIntervalsOnLabelMatch (IntervalTier me, const char32 *label
 
 void IntervalTier_cutIntervals_minimumDuration (IntervalTier me, const char32 *label, double minimumDuration);
 
-void TextGrid_changeLabels (TextGrid me, int tier, long from, long to, const char32 *search, const char32 *replace, int use_regexp, long *nmatches, long *nstringmatches);
+void TextGrid_changeLabels (TextGrid me, integer tier, integer from, integer to, const char32 *search, const char32 *replace, int use_regexp, integer *nmatches, integer *nstringmatches);
 
 /* Set the start/end time to a smaller/larger value.
  * If mark is null, only times are changed
diff --git a/dwtools/VowelEditor.cpp b/dwtools/VowelEditor.cpp
index 8a62b20..6301845 100644
--- a/dwtools/VowelEditor.cpp
+++ b/dwtools/VowelEditor.cpp
@@ -877,31 +877,31 @@ static void menu_cb_help (VowelEditor /* me */, EDITOR_ARGS_DIRECT) {
 
 static void menu_cb_prefs (VowelEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Preferences", nullptr);
-		BOOLEAN (U"Sound follows mouse", true)
+		BOOLEAN (soundFollowsMouse, U"Sound follows mouse", true)
 	EDITOR_OK
-		SET_INTEGER (U"Sound follows mouse", prefs.soundFollowsMouse)
+		SET_BOOLEAN (soundFollowsMouse, prefs.soundFollowsMouse)
 	EDITOR_DO
-		my soundFollowsMouse = prefs.soundFollowsMouse = GET_INTEGER (U"Sound follows mouse");
+		my soundFollowsMouse = prefs.soundFollowsMouse = soundFollowsMouse;
 		Graphics_updateWs (my graphics.get());
 	EDITOR_END
 }
 
 static void menu_cb_ranges_f1f2 (VowelEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"F1 (vert) and F2 (hor) view ranges", nullptr);
-		POSITIVE (U"left F1 range (Hz)", U"200.0")
-		POSITIVE (U"right F1 range (Hz)", U"1000.0")
-		POSITIVE (U"left F2 range (Hz)", U"500.0")
-		POSITIVE (U"right F2 range (Hz)", U"2500.0")
+		POSITIVE (f1min, U"left F1 range (Hz)", U"200.0")
+		POSITIVE (f1max, U"right F1 range (Hz)", U"1000.0")
+		POSITIVE (f2min, U"left F2 range (Hz)", U"500.0")
+		POSITIVE (f2max, U"right F2 range (Hz)", U"2500.0")
 	EDITOR_OK
-		SET_REAL (U"left F1 range", prefs.f1min)
-		SET_REAL (U"right F1 range", prefs.f1max)
-		SET_REAL (U"left F2 range", prefs.f2min)
-		SET_REAL (U"right F2 range", prefs.f2max)
+		SET_REAL (f1min, prefs.f1min)
+		SET_REAL (f1max, prefs.f1max)
+		SET_REAL (f2min, prefs.f2min)
+		SET_REAL (f2max, prefs.f2max)
 	EDITOR_DO
-		my f1min = prefs.f1min = GET_REAL (U"left F1 range");
-		my f1max = prefs.f1max = GET_REAL (U"right F1 range");
-		my f2min = prefs.f2min = GET_REAL (U"left F2 range");
-		my f2max = prefs.f2max = GET_REAL (U"right F2 range");
+		my f1min = prefs.f1min = f1min;
+		my f1max = prefs.f1max = f1max;
+		my f2min = prefs.f2min = f2min;
+		my f2max = prefs.f2max = f2max;
 		Graphics_updateWs (my graphics.get());
 	EDITOR_END
 }
@@ -936,11 +936,10 @@ static void menu_cb_extract_PitchTier (VowelEditor me, EDITOR_ARGS_DIRECT) {
 static void menu_cb_drawTrajectory (VowelEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Draw trajectory", nullptr)
 		my v_form_pictureWindow (cmd);
-		BOOLEAN (U"Garnish", true)
+		BOOLEAN (garnish, U"Garnish", true)
 	EDITOR_OK
 		my v_ok_pictureWindow (cmd);
 	EDITOR_DO
-		int garnish = GET_INTEGER (U"Garnish");
 		my v_do_pictureWindow (cmd);
 		Editor_openPraatPicture (me);
 		if (garnish) {
@@ -953,14 +952,11 @@ static void menu_cb_drawTrajectory (VowelEditor me, EDITOR_ARGS_FORM) {
 
 static void menu_cb_showOneVowelMark (VowelEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Show one vowel mark", nullptr);
-		POSITIVE (U"F1 (Hz)", U"300.0")
-		POSITIVE (U"F2 (Hz)", U"600.0")
-		WORD (U"Mark", U"u")
+		POSITIVE (f1, U"F1 (Hz)", U"300.0")
+		POSITIVE (f2, U"F2 (Hz)", U"600.0")
+		WORD (mark, U"Mark", U"u")
 	EDITOR_OK
 	EDITOR_DO
-		double f1 = GET_REAL (U"F1");
-		double f2 = GET_REAL (U"F2");
-		char32 *label = GET_STRING (U"Mark");
 		if (f1 >= my f1min && f1 <= my f1max && f2 >= my f2min && f2 <= my f2max) {
 			long irow = 1;
 			if (! my marks) {
@@ -969,7 +965,7 @@ static void menu_cb_showOneVowelMark (VowelEditor me, EDITOR_ARGS_FORM) {
 				Table_appendRow (my marks.get());
 			}
 			irow = my marks -> rows.size;
-			Table_setStringValue (my marks.get(), irow, 1, label);
+			Table_setStringValue (my marks.get(), irow, 1, mark);
 			Table_setNumericValue (my marks.get(), irow, 2, f1);
 			Table_setNumericValue (my marks.get(), irow, 3, f2);
 			Graphics_updateWs (my graphics.get());
@@ -979,25 +975,25 @@ static void menu_cb_showOneVowelMark (VowelEditor me, EDITOR_ARGS_FORM) {
 
 static void menu_cb_showVowelMarks (VowelEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Show vowel marks", nullptr);
-		LABEL (U"note", U"")
-		OPTIONMENU (U"Data set", 1)
+		MUTABLE_LABEL (note, U"")
+		OPTIONMENU (dataSet, U"Data set", 1)
 			OPTION (U"American English")
 			OPTION (U"Dutch")
 			OPTION (U"None")
-		OPTIONMENU (U"Speaker", 1)
+		OPTIONMENU (speaker, U"Speaker", 1)
 			OPTION (U"Man")
 			OPTION (U"Woman")
 			OPTION (U"Child")
-		NATURAL (U"Font size (points)", U"14")
+		NATURAL (fontSize, U"Font size (points)", U"14")
 	EDITOR_OK
-		if (my marksDataset == 9999) SET_STRING (U"note", U"(Warning: current vowel marks are not from one of these data sets.)")
-		SET_INTEGER (U"Data set", my marksDataset);
-		SET_INTEGER (U"Speaker", my speakerType);
-		SET_INTEGER (U"Font size", my marksFontSize);
+		if (my marksDataset == 9999) SET_STRING (note, U"(Warning: the current vowel marks are not from one of these data sets.)")
+		SET_OPTION (dataSet, my marksDataset)
+		SET_OPTION (speaker, my speakerType)
+		SET_INTEGER (fontSize, my marksFontSize)
 	EDITOR_DO
-		my marksDataset = prefs.marksDataset = GET_INTEGER (U"Data set");
-		my speakerType = prefs.speakerType = GET_INTEGER (U"Speaker");
-		my marksFontSize = prefs.marksFontSize = GET_INTEGER (U"Font size");
+		my marksDataset = prefs.marksDataset = dataSet;
+		my speakerType = prefs.speakerType = speaker;
+		my marksFontSize = prefs.marksFontSize = fontSize;
 		VowelEditor_setMarks (me, my marksDataset, my speakerType, my marksFontSize);
 		Graphics_updateWs (my graphics.get());
 	EDITOR_END
@@ -1015,14 +1011,13 @@ static void menu_cb_showVowelMarksFromTableFile (VowelEditor me, EDITOR_ARGS_FOR
 
 static void menu_cb_setF0 (VowelEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Set F0", nullptr);
-		POSITIVE (U"Start F0 (Hz)", U"150.0")
-		REAL (U"Slope (oct/s)", U"0.0")
+		POSITIVE (startF0, U"Start F0 (Hz)", U"150.0")
+		REAL (slope, U"Slope (oct/s)", U"0.0")
 	EDITOR_OK
 	EDITOR_DO
-		double f0 = GET_REAL (U"Start F0");
-		checkF0 (&my f0, &f0);
-		my f0.start = f0;
-		my f0.slopeOctPerSec = GET_REAL (U"Slope");
+		checkF0 (& my f0, & startF0);
+		my f0.start = startF0;
+		my f0.slopeOctPerSec = slope;
 		GuiText_setString (my f0TextField, Melder_double (my f0.start));
 		GuiText_setString (my f0SlopeTextField, Melder_double (my f0.slopeOctPerSec));
 	EDITOR_END
@@ -1030,14 +1025,12 @@ static void menu_cb_setF0 (VowelEditor me, EDITOR_ARGS_FORM) {
 
 static void menu_cb_setF3F4 (VowelEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Set F3 & F4", nullptr);
-		POSITIVE (U"F3 (Hz)", U"2500.0")
-		POSITIVE (U"B3 (Hz)", U"250.0")
-		POSITIVE (U"F4 (Hz)", U"3500.0")
-		POSITIVE (U"B4 (Hz)", U"350.0")
+		POSITIVE (f3, U"F3 (Hz)", U"2500.0")
+		POSITIVE (b3, U"B3 (Hz)", U"250.0")
+		POSITIVE (f4, U"F4 (Hz)", U"3500.0")
+		POSITIVE (b4, U"B4 (Hz)", U"350.0")
 	EDITOR_OK
 	EDITOR_DO
-		double f3 = GET_REAL (U"F3"), b3 = GET_REAL (U"B3");
-		double f4 = GET_REAL (U"F4"), b4 = GET_REAL (U"B4");
 		if (f3 >= f4) {
 			Melder_throw (U"F4 must be larger than F3.");
 		}
@@ -1069,27 +1062,24 @@ static void VowelEditor_Vowel_addData (VowelEditor me, Vowel thee, double time,
 
 static void menu_cb_newTrajectory (VowelEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"New Trajectory", nullptr);
-		POSITIVE (U"Start F1 (Hz)", U"700.0")
-		POSITIVE (U"Start F2 (Hz)", U"1200.0")
-		POSITIVE (U"End F1 (Hz)", U"350.0")
-		POSITIVE (U"End F2 (Hz)", U"800.0")
-		POSITIVE (U"Duration (s)", U"0.25")
+		POSITIVE (startF1, U"Start F1 (Hz)", U"700.0")
+		POSITIVE (startF2, U"Start F2 (Hz)", U"1200.0")
+		POSITIVE (endF1, U"End F1 (Hz)", U"350.0")
+		POSITIVE (endF2, U"End F2 (Hz)", U"800.0")
+		POSITIVE (duration, U"Duration (s)", U"0.25")
 	EDITOR_OK
 	EDITOR_DO
-		double duration = GET_REAL (U"Duration");
 		autoVowel newVowel = Vowel_create (duration);
-		double time = 0.0;
-		double f0 = getF0 (&my f0, time);
-		double f1 = GET_REAL (U"Start F1");
-		double f2 = GET_REAL (U"Start F2");
-		checkF1F2 (me, &f1, &f2);
-		VowelEditor_Vowel_addData (me, newVowel.get(), time, f1, f2, f0);
-		time = duration;
-		f0 = getF0 (&my f0, time);
-		f1 = GET_REAL (U"End F1");
-		f2 = GET_REAL (U"End F2");
-		checkF1F2 (me, &f1, &f2);
-		VowelEditor_Vowel_addData (me, newVowel.get(), time, f1, f2, f0);
+
+		double startTime = 0.0;
+		double startF0 = getF0 (& my f0, startTime);
+		checkF1F2 (me, & startF1, & startF2);
+		VowelEditor_Vowel_addData (me, newVowel.get(), startTime, startF1, startF2, startF0);
+
+		double endTime = duration;
+		double endF0 = getF0 (& my f0, endTime);
+		checkF1F2 (me, & endF1, & endF2);
+		VowelEditor_Vowel_addData (me, newVowel.get(), endTime, endF1, endF2, endF0);
 
 		GuiText_setString (my durationTextField, Melder_double (MICROSECPRECISION (duration)));
 		my vowel = newVowel.move();
@@ -1100,19 +1090,17 @@ static void menu_cb_newTrajectory (VowelEditor me, EDITOR_ARGS_FORM) {
 
 static void menu_cb_extendTrajectory (VowelEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Extend Trajectory", nullptr);
-		POSITIVE (U"To F1 (Hz)", U"500.0")
-		POSITIVE (U"To F2 (Hz)", U"1500.0")
-		POSITIVE (U"Extra duration (s)", U"0.1")
+		POSITIVE (toF1, U"To F1 (Hz)", U"500.0")
+		POSITIVE (toF2, U"To F2 (Hz)", U"1500.0")
+		POSITIVE (extraDuration, U"Extra duration (s)", U"0.1")
 	EDITOR_OK
 	EDITOR_DO
 		Vowel thee = my vowel.get();
-		double newDuration = thy xmax + GET_REAL (U"Extra duration");
-		double f0 = getF0 (&my f0, newDuration);
-		double f1 = GET_REAL (U"To F1");
-		double f2 = GET_REAL (U"To F2");
+		double newDuration = thy xmax + extraDuration;
+		double toF0 = getF0 (& my f0, newDuration);
 		thy xmax = thy pt -> xmax = thy ft -> xmax = newDuration;
-		checkF1F2 (me, &f1, &f2);
-		VowelEditor_Vowel_addData (me, thee, newDuration, f1, f2, f0);
+		checkF1F2 (me, & toF1, & toF2);
+		VowelEditor_Vowel_addData (me, thee, newDuration, toF1, toF2, toF0);
 
 		GuiText_setString (my durationTextField, Melder_double (MICROSECPRECISION (newDuration)));
 		Graphics_updateWs (my graphics.get());
@@ -1121,33 +1109,33 @@ static void menu_cb_extendTrajectory (VowelEditor me, EDITOR_ARGS_FORM) {
 
 static void menu_cb_modifyTrajectoryDuration (VowelEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Modify duration", nullptr);
-		POSITIVE (U"New duration (s)", U"0.5")
+		POSITIVE (newDuration, U"New duration (s)", U"0.5")
 	EDITOR_OK
 	EDITOR_DO
-		GuiText_setString (my durationTextField, Melder_double (MICROSECPRECISION (GET_REAL (U"New duration"))));
+		GuiText_setString (my durationTextField, Melder_double (MICROSECPRECISION (newDuration)));
 	EDITOR_END
 }
 
 static void menu_cb_shiftTrajectory (VowelEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Shift trajectory", nullptr);
-		REAL (U"F1 (semitones)", U"0.5")
-		REAL (U"F2 (semitones)", U"0.5")
+		REAL (f1, U"F1 (semitones)", U"0.5")
+		REAL (f2, U"F2 (semitones)", U"0.5")
 	EDITOR_OK
 	EDITOR_DO
-		VowelEditor_shiftF1F2 (me, GET_REAL (U"F1"), GET_REAL (U"F2"));
+		VowelEditor_shiftF1F2 (me, f1, f2);
 		Graphics_updateWs (my graphics.get());
 	EDITOR_END
 }
 
 static void menu_cb_showTrajectoryTimeMarksEvery (VowelEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Show trajectory time marks every", nullptr);
-		REAL (U"Distance (s)", U"0.05")
+		REAL (distance, U"Distance (s)", U"0.05")
 	EDITOR_OK
-		SET_REAL (U"Distance", my markTraceEvery)
+		SET_REAL (distance, my markTraceEvery)
 	EDITOR_DO
-		my markTraceEvery = GET_REAL (U"Distance");
-		if (my markTraceEvery < 0) {
-			my markTraceEvery = 0;
+		my markTraceEvery = distance;
+		if (my markTraceEvery < 0.0) {
+			my markTraceEvery = 0.0;
 		}
 		Graphics_updateWs (my graphics.get());
 	EDITOR_END
diff --git a/dwtools/praat_BSS_init.cpp b/dwtools/praat_BSS_init.cpp
index 21a1afc..6cc00e3 100644
--- a/dwtools/praat_BSS_init.cpp
+++ b/dwtools/praat_BSS_init.cpp
@@ -34,23 +34,23 @@ void praat_TableOfReal_init3 (ClassInfo klas);
 FORM (NEW_EEG_to_CrossCorrelationTable, U"EEG: To CrossCorrelationTable", U"EEG: To CrossCorrelationTable...") {
 	praat_TimeFunction_RANGE (fromTime,toTime)
 	REAL (lagTime, U"Lag step (s)", U"0.05")
-	TEXTFIELD (channelRanges, U"Channel ranges", U"1:64")
-	LABEL (U"", U"To supply rising or falling ranges, use e.g. 2:6 or 5:3.")
+	TEXTFIELD (channels, U"Channels:", U"1:64")
+	LABEL (U"To supply rising or falling ranges, use e.g. 2:6 or 5:3.")
 	OK
 DO
 	CONVERT_EACH (EEG)
-		autoCrossCorrelationTable result = EEG_to_CrossCorrelationTable (me, fromTime, toTime, lagTime, channelRanges);
+		autoCrossCorrelationTable result = EEG_to_CrossCorrelationTable (me, fromTime, toTime, lagTime, channels);
 	CONVERT_EACH_END (my name, U"_", round (lagTime * 1000.0))
 }
 
 FORM (NEW_EEG_to_Covariance, U"EEG: To Covariance", U"EEG: To Covariance...") {
 	praat_TimeFunction_RANGE (fromTime,toTime)
-	TEXTFIELD (channelRanges, U"Channel ranges", U"1:64")
-	LABEL (U"", U"To supply rising or falling ranges, use e.g. 2:6 or 5:3.")
+	TEXTFIELD (channels, U"Channels:", U"1:64")
+	LABEL (U"To supply rising or falling ranges, use e.g. 2:6 or 5:3.")
 	OK
 DO
 	CONVERT_EACH (EEG)
-		autoCovariance result = EEG_to_Covariance (me, fromTime, toTime, channelRanges);
+		autoCovariance result = EEG_to_Covariance (me, fromTime, toTime, channels);
 	CONVERT_EACH_END (my name)
 }
 
@@ -58,13 +58,13 @@ FORM (NEW_EEG_to_CrossCorrelationTableList, U"EEG: To CrossCorrelationTableList"
 	praat_TimeFunction_RANGE (fromTime,toTime)
 	POSITIVE (lagTime, U"Lag step (s)", U"0.02")
 	NATURAL (numberOfCrossCorrelations, U"Number of cross-correlations", U"40")
-	LABEL (U"", U"To supply rising or falling ranges, use e.g. 2:6 or 5:3.")
-	TEXTFIELD (channelRanges, U"Channel ranges", U"1:64")
+	TEXTFIELD (channels, U"Channels:", U"1:64")
+	LABEL (U"To supply rising or falling ranges, use e.g. 2:6 or 5:3.")
 	OK
 DO
 	CONVERT_EACH (EEG)
 		autoCrossCorrelationTableList result = EEG_to_CrossCorrelationTableList (me, fromTime, toTime,
-			lagTime, numberOfCrossCorrelations, channelRanges);
+			lagTime, numberOfCrossCorrelations, channels);
 	CONVERT_EACH_END (my name)
 }
 
@@ -72,14 +72,14 @@ FORM (NEW_EEG_to_EEG_bss, U"EEG: To EEG (bss)", U"EEG: To EEG (bss)...") {
 	praat_TimeFunction_RANGE (fromTime,toTime)
 	NATURAL (numberOfCrossCorrelations, U"Number of cross-correlations", U"40")
 	POSITIVE (lagTime, U"Lag step (s)", U"0.002")
-	LABEL (U"", U"To supply rising or falling ranges, use e.g. 2:6 or 5:3.")
-	TEXTFIELD (channels, U"Channel ranges", U"1:64")
-	LABEL (U"", U"Pre-whitening parameters")
-	OPTIONMENU (whiteningMethod, U"Whitening method", 1)
+	TEXTFIELD (channels, U"Channels:", U"1:64")
+	LABEL (U"To supply rising or falling ranges, use e.g. 2:6 or 5:3.")
+	LABEL (U"Pre-whitening parameters")
+	OPTIONMENUx (whiteningMethod, U"Whitening method", 1, 0)
 		OPTION (U"No whitening")
 		OPTION (U"Covariance")
 		OPTION (U"Correlation")
-	LABEL (U"", U"Iteration parameters")
+	LABEL (U"Iteration parameters")
 	NATURAL (maximumNumberOfIterations, U"Maximum number of iterations", U"100")
 	POSITIVE (tolerance, U"Tolerance", U"0.001")
 	OPTIONMENU (diagonalizationMethod, U"Diagonalization method", 2)
@@ -88,22 +88,22 @@ FORM (NEW_EEG_to_EEG_bss, U"EEG: To EEG (bss)", U"EEG: To EEG (bss)...") {
 	OK
 DO
 	CONVERT_EACH (EEG)
-		autoEEG result = EEG_to_EEG_bss (me, fromTime, toTime, numberOfCrossCorrelations, lagTime, channels, whiteningMethod - 1, diagonalizationMethod, maximumNumberOfIterations, tolerance);
+		autoEEG result = EEG_to_EEG_bss (me, fromTime, toTime, numberOfCrossCorrelations, lagTime, channels, whiteningMethod, diagonalizationMethod, maximumNumberOfIterations, tolerance);
 	CONVERT_EACH_END (my name, U"_bss")
 }
 
 
 FORM (NEW_EEG_to_PCA, U"EEG: To PCA", U"EEG: To PCA...") {
 	praat_TimeFunction_RANGE (fromTime,toTime)
-	TEXTFIELD (channelRanges, U"Channel ranges", U"1:64")
-	LABEL (U"", U"To supply rising or falling ranges, use e.g. 2:6 or 5:3.")
+	TEXTFIELD (channels, U"Channels:", U"1:64")
+	LABEL (U"To supply rising or falling ranges, use e.g. 2:6 or 5:3.")
 	OPTIONMENU (method, U"Method", 1)
 		OPTION (U"Covariance")
 		OPTION (U"Correlation")
 	OK
 DO
 	CONVERT_EACH (EEG)
-		autoPCA result = EEG_to_PCA (me, fromTime, toTime, channelRanges, (method == 2));
+		autoPCA result = EEG_to_PCA (me, fromTime, toTime, channels, (method == 2));
 	CONVERT_EACH_END (my name)
 }
 
@@ -128,12 +128,12 @@ DO
 FORM (NEW_EEG_to_Sound_modulated, U"EEG: To Sound (modulated)", nullptr) {
 	POSITIVE (baseFrequency, U"Base frequency (Hz)", U"100.0")
 	POSITIVE (channelBandwidth, U"Channel bandwidth (Hz)", U"100.0")
-	TEXTFIELD (channelRanges, U"Channel ranges", U"1:64")
-	LABEL (U"", U"To supply rising or falling ranges, use e.g. 2:6 or 5:3.")
+	TEXTFIELD (channels, U"Channels:", U"1:64")
+	LABEL (U"To supply rising or falling ranges, use e.g. 2:6 or 5:3.")
 	OK
 DO
 	CONVERT_EACH (EEG)
-		autoSound result = EEG_to_Sound_modulated (me, baseFrequency, channelBandwidth, channelRanges);
+		autoSound result = EEG_to_Sound_modulated (me, baseFrequency, channelBandwidth, channels);
 	CONVERT_EACH_END (my name)
 }
 
@@ -324,7 +324,7 @@ DIRECT (NEW1_CrossCorrelationTableList_and_Diagonalizer_diagonalize) {
 }
 
 FORM (MODIFY_CrossCorrelationTableList_and_MixingMatrix_improveUnmixing, U"", nullptr) {
-	LABEL (U"", U"Iteration parameters")
+	LABEL (U"Iteration parameters")
 	NATURAL (maximumNumberOfIterations, U"Maximum number of iterations", U"100")
 	POSITIVE (tolerance, U"Tolerance", U"0.001")
 	OPTIONMENU (diagonalizationMethod, U"Diagonalization method", 2)
@@ -372,7 +372,7 @@ FORM (NEW_Sound_to_MixingMatrix, U"Sound: To MixingMatrix", nullptr) {
 	praat_TimeFunction_RANGE (fromTime, toTime)
 	NATURAL (numberOfCrossCorrelations, U"Number of cross-correlations", U"40")
 	POSITIVE (lagTime, U"Lag step (s)", U"0.002")
-	LABEL (U"", U"Iteration parameters")
+	LABEL (U"Iteration parameters")
 	NATURAL (maximumNumberOfIterations, U"Maximum number of iterations", U"100")
 	POSITIVE (tolerance, U"Tolerance", U"0.001")
 	OPTIONMENU (diagonalizationMethod, U"Diagonalization method", 2)
@@ -389,7 +389,7 @@ FORM (MODIFY_Sound_and_MixingMatrix_improveUnmixing, U"", nullptr) {
 	praat_TimeFunction_RANGE (fromTime, toTime)
 	NATURAL (numberOfCrossCorrelations, U"Number of cross-correlations", U"40")
 	POSITIVE (lagTime, U"Lag step (s)", U"0.002")
-	LABEL (U"", U"Iteration parameters")
+	LABEL (U"Iteration parameters")
 	NATURAL (maximumNumberOfIterations, U"Maximum number of iterations", U"100")
 	POSITIVE (tolerance, U"Tolerance", U"0.001")
 	OPTIONMENU (diagonalizationMethod, U"Diagonalization method", 2)
@@ -417,7 +417,7 @@ FORM (NEW_Sound_to_Sound_bss, U"Sound: To Sound (blind source separation)", U"So
 	praat_TimeFunction_RANGE (fromTime, toTime)
 	NATURAL (numberOfCrossCorrelations, U"Number of cross-correlations", U"40")
 	POSITIVE (lagStep, U"Lag step (s)", U"0.002")
-	LABEL (U"", U"Iteration parameters")
+	LABEL (U"Iteration parameters")
 	NATURAL (maximumNumberOfIterations, U"Maximum number of iterations", U"100")
 	POSITIVE (tolerance, U"Tolerance", U"0.001")
 	OPTIONMENU (diagonalizationMethod, U"Diagonalization method", 2)
diff --git a/dwtools/praat_DataModeler_init.cpp b/dwtools/praat_DataModeler_init.cpp
index 8ff95e5..0f96209 100644
--- a/dwtools/praat_DataModeler_init.cpp
+++ b/dwtools/praat_DataModeler_init.cpp
@@ -214,7 +214,7 @@ DIRECT (REAL_DataModeler_getCoefficientOfDetermination) {
 
 
 FORM (INFO_DataModeler_reportChiSquared, U"DataModeler: Report chi squared", nullptr) {
-	OPTIONMENU (weighDataType, U"Weigh data", 2)
+	OPTIONMENUx (weighDataType, U"Weigh data", 2, 0)
 		OPTION (U"Equally")
 		OPTION (U"Sigma")
 		OPTION (U"Relative")
@@ -236,7 +236,7 @@ DIRECT (REAL_DataModeler_getDegreesOfFreedom) {
 
 
 FORM (MODIFY_DataModeler_setDataWeighing, U"DataModeler: Set data weighing", nullptr) {
-	OPTIONMENU (weighDataType, U"Weigh data", 1)
+	OPTIONMENUx (weighDataType, U"Weigh data", 1, 0)
 		OPTION (U"Equally")
 		OPTION (U"Sigma")
 		OPTION (U"Relative")
@@ -244,7 +244,7 @@ FORM (MODIFY_DataModeler_setDataWeighing, U"DataModeler: Set data weighing", nul
 	OK
 DO
 	MODIFY_EACH (DataModeler)
-		DataModeler_setDataWeighing (me, weighDataType - 1);
+		DataModeler_setDataWeighing (me, weighDataType);
 	MODIFY_EACH_END
 }
 
@@ -370,7 +370,7 @@ FORM (NEW_Formant_to_FormantModeler, U"Formant: To FormantModeler", nullptr) {
 	REAL (toTime, U"right End time", U"0.1")
 	NATURAL (numberOfFormants, U"Number of formants", U"3")
 	INTEGER (order, U"Order of polynomials", U"3")
-	OPTIONMENU (weighDataType, U"Weigh data", 2)
+	OPTIONMENUx (weighDataType, U"Weigh data", 2, 0)
 		OPTION (U"Equally")
 		OPTION (U"Bandwidth")
 		OPTION (U"Bandwidth / frequency")
@@ -379,7 +379,7 @@ FORM (NEW_Formant_to_FormantModeler, U"Formant: To FormantModeler", nullptr) {
 DO
 	REQUIRE (order >= 0, U"The order must be greater than or equal to zero.")
 	CONVERT_EACH (Formant)
-		autoFormantModeler result = Formant_to_FormantModeler (me, fromTime, toTime, numberOfFormants, order + 1, weighDataType - 1);
+		autoFormantModeler result = Formant_to_FormantModeler (me, fromTime, toTime, numberOfFormants, order + 1, weighDataType);
 	CONVERT_EACH_END (my name, U"_o", order);
 }
 
@@ -388,13 +388,13 @@ FORM (NEW1_Formants_extractSmoothestPart, U"Formants: Extract smoothest part", U
 	REAL (toTime, U"right Time range (s)", U"0.0")
 	NATURAL (numberOfFormantTracks, U"Number of formant tracks", U"4")
 	INTEGER (order, U"Order of polynomials", U"3")
-	LABEL (U"", U"Use bandwidths to model the formant tracks:")
-	OPTIONMENU (weighDataType, U"Weigh data", 2)
+	LABEL (U"Use bandwidths to model the formant tracks:")
+	OPTIONMENUx (weighDataType, U"Weigh data", 2, 0)
 		OPTION (U"Equally")
 		OPTION (U"Bandwidth")
 		OPTION (U"Bandwidth / frequency")
 		OPTION (U"Sqrt bandwidth")
-	LABEL (U"", U"Zero parameter values whose range include zero:")
+	LABEL (U"Zero parameter values whose range include zero:")
 	REAL (numberOfSigmas, U"Number of sigmas", U"1.0")
 	REAL (power, U"Parameter variance power", U"1.5")
 	OK
@@ -404,7 +404,7 @@ DO
 		iam (Formant);
 		formants. addItem_ref (me);
 	}
-	long index = Formants_getSmoothestInInterval (& formants, fromTime, toTime, numberOfFormantTracks, order + 1, weighDataType - 1, 0, numberOfSigmas, power, 1.0, 1.0, 1.0, 1.0, 1.0);
+	long index = Formants_getSmoothestInInterval (& formants, fromTime, toTime, numberOfFormantTracks, order + 1, weighDataType, 0, numberOfSigmas, power, 1.0, 1.0, 1.0, 1.0, 1.0);
 	// next code is necessary to get the Formant at postion index selected and to get its name
 	long iselected = 0;
 	Formant him = nullptr;
@@ -424,16 +424,16 @@ FORM (NEW1_Formants_extractSmoothestPart_constrained, U"Formants: Extract smooth
 	REAL (toTime, U"right Time range (s)", U"0.0")
 	NATURAL (numberOfFormantTracks, U"Number of formant tracks", U"4")
 	INTEGER (order, U"Order of polynomials", U"3")
-	LABEL (U"", U"Use bandwidths to model the formant tracks:")
-	OPTIONMENU (weighDataType, U"Weigh data", 2)
+	LABEL (U"Use bandwidths to model the formant tracks:")
+	OPTIONMENUx (weighDataType, U"Weigh data", 2, 0)
 		OPTION (U"Equally")
 		OPTION (U"Bandwidth")
 		OPTION (U"Bandwidth / frequency")
 		OPTION (U"Sqrt bandwidth")
-	LABEL (U"", U"Zero parameter values whose range include zero:")
+	LABEL (U"Zero parameter values whose range include zero:")
 	REAL (numberOfSigmas, U"Number of sigmas", U"1.0")
 	REAL (power, U"Parameter variance power", U"1.5")
-	LABEL (U"", U"The constraints on the formants:")
+	LABEL (U"The constraints on the formants:")
 	REAL (minimumF1, U"Minimum F1 (Hz)", U"100.0")
 	REAL (maximumF1, U"Maximum F1 (Hz)", U"1200.0")
 	REAL (minimumF2, U"Minimum F2 (Hz)", U"0.0")
@@ -446,7 +446,7 @@ DO
 		iam (Formant);
 		formants. addItem_ref (me);
 	}
-	long index = Formants_getSmoothestInInterval (& formants, fromTime, toTime, numberOfFormantTracks, order + 1, weighDataType - 1, 1, numberOfSigmas, power, minimumF1, maximumF1, minimumF2, maximumF2, minimumF3);
+	long index = Formants_getSmoothestInInterval (& formants, fromTime, toTime, numberOfFormantTracks, order + 1, weighDataType, 1, numberOfSigmas, power, minimumF1, maximumF1, minimumF2, maximumF2, minimumF3);
 	// next code is necessary to get the Formant at postion index selected and to get its name
 	long iselected = 0;
 	Formant him = nullptr;
@@ -521,7 +521,7 @@ FORM (GRAPHICS_FormantModeler_drawOutliersMarked, U"FormantModeler: Draw outlier
 	NATURAL (fromFormant, U"left Formant range", U"1")
 	NATURAL (toFormant, U"right Formant range", U"3")
 	POSITIVE (numberOfSigmas, U"Number of sigmas", U"3.0")
-	OPTIONMENU (weighDataType, U"Weigh data", 2)
+	OPTIONMENUx (weighDataType, U"Weigh data", 2, 0)
 		OPTION (U"Equally")
 		OPTION (U"Bandwidth")
 		OPTION (U"Bandwidth / frequency")
@@ -533,7 +533,7 @@ FORM (GRAPHICS_FormantModeler_drawOutliersMarked, U"FormantModeler: Draw outlier
 	OK
 DO
 	GRAPHICS_EACH (FormantModeler)
-		FormantModeler_drawOutliersMarked (me, GRAPHICS, fromTime, toTime, maximumFrequency, fromFormant, toFormant, numberOfSigmas, weighDataType - 1, mark_string, fontSize, xOffset_mm, garnish);
+		FormantModeler_drawOutliersMarked (me, GRAPHICS, fromTime, toTime, maximumFrequency, fromFormant, toFormant, numberOfSigmas, weighDataType, mark_string, fontSize, xOffset_mm, garnish);
 	GRAPHICS_EACH_END
 }
 
@@ -561,7 +561,7 @@ FORM (GRAPHICS_FormantModeler_drawCumulativeChiScores, U"FormantModeler: Draw cu
 	REAL (toTime, U"right Time range (s)", U"0.0")
 	REAL (fromChisq, U"left Chisq range", U"0.0")
 	REAL (toChisq, U"right Chisq range", U"0.0")
-	OPTIONMENU (weighDataType, U"Weigh data", 2)
+	OPTIONMENUx (weighDataType, U"Weigh data", 2, 0)
 		OPTION (U"Equally")
 		OPTION (U"Bandwidth")
 		OPTION (U"Bandwidth / frequency")
@@ -577,7 +577,7 @@ DO
 
 FORM (GRAPHICS_FormantModeler_normalProbabilityPlot, U"FormantModeler: Normal probability plot", nullptr) {
 	NATURAL (formantNumber, U"Formant number", U"1")
-	OPTIONMENU (weighDataType, U"Weigh data", 2)
+	OPTIONMENUx (weighDataType, U"Weigh data", 2, 0)
 		OPTION (U"Equally")
 		OPTION (U"Bandwidth")
 		OPTION (U"Bandwidth / frequency")
@@ -590,7 +590,7 @@ FORM (GRAPHICS_FormantModeler_normalProbabilityPlot, U"FormantModeler: Normal pr
 	OK
 DO
 	GRAPHICS_EACH (FormantModeler)
-		FormantModeler_normalProbabilityPlot (me, GRAPHICS, formantNumber, weighDataType - 1, numberOfQuantiles, numberOfSigmas, fontSize, label, garnish);
+		FormantModeler_normalProbabilityPlot (me, GRAPHICS, formantNumber, weighDataType, numberOfQuantiles, numberOfSigmas, fontSize, label, garnish);
 	GRAPHICS_EACH_END
 }
 
@@ -773,7 +773,7 @@ DO
 }
 
 FORM (INFO_FormantModeler_reportChiSquared, U"FormantModeler: Report chi squared", nullptr) {
-	OPTIONMENU (weighDataType, U"Weigh data", 2)
+	OPTIONMENUx (weighDataType, U"Weigh data", 2, 0)
 		OPTION (U"Equally")
 		OPTION (U"Bandwidth")
 		OPTION (U"Bandwidth / frequency")
@@ -837,7 +837,7 @@ DO
 FORM (MODIFY_FormantModeler_setDataWeighing, U"FormantModeler: Set data weighing", nullptr) {
 	INTEGER (fromFormant, U"left Formant range", U"0")
 	INTEGER (toFormant, U"right Formant range", U"0")
-	OPTIONMENU (weighDataType, U"Weigh data", 2)
+	OPTIONMENUx (weighDataType, U"Weigh data", 2, 0)
 		OPTION (U"Equally")
 		OPTION (U"Bandwidth")
 		OPTION (U"Bandwidth / frequency")
@@ -845,7 +845,7 @@ FORM (MODIFY_FormantModeler_setDataWeighing, U"FormantModeler: Set data weighing
 	OK
 DO
 	MODIFY_EACH (FormantModeler)
-		FormantModeler_setDataWeighing (me, fromFormant, toFormant, weighDataType - 1);
+		FormantModeler_setDataWeighing (me, fromFormant, toFormant, weighDataType);
 	MODIFY_EACH_END
 }
 
@@ -1021,18 +1021,18 @@ FORM (REAL_Sound_getOptimalFormantCeiling, U"Sound: Get optimal formant ceiling"
 	POSITIVE (preEmphasisFrequency, U"Pre-emphasis from (Hz)", U"50.0")
 	NATURAL (numberOfFormantTracks, U"Number of formant tracks in model", U"4")
 	INTEGER (order, U"Order of polynomials", U"3")
-	OPTIONMENU (weighDataType, U"Weigh data", 2)
+	OPTIONMENUx (weighDataType, U"Weigh data", 2, 0)
 		OPTION (U"Equally")
 		OPTION (U"Bandwidth")
 		OPTION (U"Bandwidth / frequency")
 		OPTION (U"Sqrt bandwidth")
-	LABEL (U"", U"Make parameters that include zero in their confidence region zero")
+	LABEL (U"Make parameters that include zero in their confidence region zero")
 	REAL (numberOfSigmas, U"Number of sigmas", U"1.0")
 	REAL (power, U"Parameter variance power", U"1.5")
 	OK
 DO
 	NUMBER_ONE (Sound)
-		double result = Sound_getOptimalFormantCeiling (me, fromTime, toTime, windowLength, timeStep, fromFrequency, toFrequency, numberOfFrequencySteps, preEmphasisFrequency, numberOfFormantTracks, order + 1, weighDataType - 1, numberOfSigmas, power);
+		double result = Sound_getOptimalFormantCeiling (me, fromTime, toTime, windowLength, timeStep, fromFrequency, toFrequency, numberOfFrequencySteps, preEmphasisFrequency, numberOfFormantTracks, order + 1, weighDataType, numberOfSigmas, power);
 	NUMBER_ONE_END (U" Hz");
 }
 
@@ -1047,19 +1047,19 @@ FORM (NEW_Sound_to_Formant_interval, U"Sound: To Formant (interval)", nullptr) {
 	POSITIVE (preEmphasisFrequency, U"Pre-emphasis from (Hz)", U"50.0")
 	NATURAL (numberOfFormantTracks, U"Number of formant tracks in model", U"4")
 	INTEGER (order, U"Order of polynomials", U"3")
-	OPTIONMENU (weighDataType, U"Weigh data", 2)
+	OPTIONMENUx (weighDataType, U"Weigh data", 2, 0)
 		OPTION (U"Equally")
 		OPTION (U"Bandwidth")
 		OPTION (U"Bandwidth / frequency")
 		OPTION (U"Sqrt bandwidth")
-	LABEL (U"", U"Make parameters that include zero in their confidence region zero")
+	LABEL (U"Make parameters that include zero in their confidence region zero")
 	REAL (numberOfSigmas, U"Number of sigmas", U"1.0")
 	REAL (power, U"Parameter variance power", U"1.5")
 	OK
 DO
 	CONVERT_EACH (Sound)
 		double ceiling;
-		autoFormant result = Sound_to_Formant_interval (me, fromTime, toTime, windowLength, timeStep, fromFrequency, toFrequency, numberOfFrequencySteps, preEmphasisFrequency, numberOfFormantTracks, order + 1, weighDataType - 1, numberOfSigmas, power, 0, 1, 1, 1, 1, 1, &ceiling);
+		autoFormant result = Sound_to_Formant_interval (me, fromTime, toTime, windowLength, timeStep, fromFrequency, toFrequency, numberOfFrequencySteps, preEmphasisFrequency, numberOfFormantTracks, order + 1, weighDataType, numberOfSigmas, power, 0, 1, 1, 1, 1, 1, &ceiling);
 	CONVERT_EACH_END (my name, U"_", Melder_fixed (ceiling, 0))
 }
 
@@ -1074,15 +1074,15 @@ FORM (NEW_Sound_to_Formant_interval_constrained, U"Sound: To Formant (interval,
 	POSITIVE (preEmphasisFrequency, U"Pre-emphasis from (Hz)", U"50.0")
 	NATURAL (numberOfFormantTracks, U"Number of formant tracks in model", U"4")
 	INTEGER (order, U"Order of polynomials", U"3")
-	OPTIONMENU (weighDataType, U"Weigh data", 2)
+	OPTIONMENUx (weighDataType, U"Weigh data", 2, 0)
 		OPTION (U"Equally")
 		OPTION (U"Bandwidth")
 		OPTION (U"Bandwidth / frequency")
 		OPTION (U"Sqrt bandwidth")
-	LABEL (U"", U"Make parameters that include zero in their confidence region zero")
+	LABEL (U"Make parameters that include zero in their confidence region zero")
 	REAL (numberOfSigmas, U"Number of sigmas", U"1.0")
 	REAL (power, U"Parameter variance power", U"1.5")
-	LABEL (U"", U"Formant frequency constraints")
+	LABEL (U"Formant frequency constraints")
 	REAL (minimumF1, U"Minimum F1 (Hz)", U"100.0")
 	REAL (maximumF1, U"Maximum F1 (Hz)", U"1200.0")
 	REAL (minimumF2, U"Minimum F2 (Hz)", U"0.0")
@@ -1092,7 +1092,7 @@ FORM (NEW_Sound_to_Formant_interval_constrained, U"Sound: To Formant (interval,
 DO
 	CONVERT_EACH (Sound)
 		double ceiling;
-		autoFormant result = Sound_to_Formant_interval (me, fromTime, toTime, windowLength, timeStep, fromFrequency,  toFrequency, numberOfFrequencySteps, preEmphasisFrequency, numberOfFormantTracks, order + 1, weighDataType - 1, numberOfSigmas, power, 1, minimumF1, maximumF1, minimumF2, maximumF2, minimumF3, & ceiling);
+		autoFormant result = Sound_to_Formant_interval (me, fromTime, toTime, windowLength, timeStep, fromFrequency,  toFrequency, numberOfFrequencySteps, preEmphasisFrequency, numberOfFormantTracks, order + 1, weighDataType, numberOfSigmas, power, 1, minimumF1, maximumF1, minimumF2, maximumF2, minimumF3, & ceiling);
 	CONVERT_EACH_END (my name, U"_", Melder_fixed (ceiling, 0));
 }
 
@@ -1107,15 +1107,15 @@ FORM (NEW_Sound_to_Formant_interval_constrained_robust, U"Sound: To Formant (int
 	POSITIVE (preEmphasisFrequency, U"Pre-emphasis from (Hz)", U"50.0")
 	NATURAL (numberOfFormantTracks, U"Number of formant tracks in model", U"4")
 	INTEGER (order, U"Order of polynomials", U"3")
-	OPTIONMENU (weighDataType, U"Weigh data", 2)
+	OPTIONMENUx (weighDataType, U"Weigh data", 2, 0)
 		OPTION (U"Equally")
 		OPTION (U"Bandwidth")
 		OPTION (U"Bandwidth / frequency")
 		OPTION (U"Sqrt bandwidth")
-	LABEL (U"", U"Make parameters that include zero in their confidence region zero")
+	LABEL (U"Make parameters that include zero in their confidence region zero")
 	REAL (numberOfSigmas, U"Number of sigmas", U"1.0")
 	REAL (power, U"Parameter variance power", U"1.5")
-	LABEL (U"", U"Formant frequency constraints")
+	LABEL (U"Formant frequency constraints")
 	REAL (minimumF1, U"Minimum F1 (Hz)", U"100.0")
 	REAL (maximumF1, U"Maximum F1 (Hz)", U"1200.0")
 	REAL (minimumF2, U"Minimum F2 (Hz)", U"0.0")
@@ -1125,7 +1125,7 @@ FORM (NEW_Sound_to_Formant_interval_constrained_robust, U"Sound: To Formant (int
 DO
 	CONVERT_EACH (Sound)
 		double ceiling;
-		autoFormant result = Sound_to_Formant_interval_robust (me, fromTime, toTime, windowLength, timeStep, fromFrequency, fromFrequency, numberOfFrequencySteps, preEmphasisFrequency, numberOfFormantTracks, order + 1, weighDataType - 1, numberOfSigmas, power, 1, minimumF1, maximumF1, minimumF2, minimumF2, minimumF3, &ceiling);
+		autoFormant result = Sound_to_Formant_interval_robust (me, fromTime, toTime, windowLength, timeStep, fromFrequency, fromFrequency, numberOfFrequencySteps, preEmphasisFrequency, numberOfFormantTracks, order + 1, weighDataType, numberOfSigmas, power, 1, minimumF1, maximumF1, minimumF2, minimumF2, minimumF3, &ceiling);
 	CONVERT_EACH_END (my name, U"_", Melder_fixed (ceiling, 0))
 }
 
@@ -1139,18 +1139,18 @@ FORM (NEW_Sound_to_OptimalCeilingTier, U"", nullptr) {
 	REAL (smoothingWindow_s, U"Formant smoothing window (s)", U"0.05")
 	NATURAL (numberOfFormantTracks, U"Number of formant tracks in model", U"4")
 	INTEGER (order, U"Order of polynomials", U"2")
-	OPTIONMENU (weighDataType, U"Weigh data", 2)
+	OPTIONMENUx (weighDataType, U"Weigh data", 2, 0)
 		OPTION (U"Equally")
 		OPTION (U"Bandwidth")
 		OPTION (U"Bandwidth / frequency")
 		OPTION (U"Sqrt bandwidth")
-	LABEL (U"", U"Make parameters that include zero in their confidence region zero")
+	LABEL (U"Make parameters that include zero in their confidence region zero")
 	REAL (numberOfSigmas, U"Number of sigmas", U"1.0")
 	REAL (power, U"Parameter variance power", U"1.5")
 	OK
 DO
 	CONVERT_EACH (Sound)
-		autoOptimalCeilingTier result = Sound_to_OptimalCeilingTier (me, windowLength, timeStep, fromFrequency, toFrequency, numberOfFrequencySteps, preEmphasisFrequency, smoothingWindow_s, numberOfFormantTracks, order + 1, weighDataType - 1, numberOfSigmas, power);
+		autoOptimalCeilingTier result = Sound_to_OptimalCeilingTier (me, windowLength, timeStep, fromFrequency, toFrequency, numberOfFrequencySteps, preEmphasisFrequency, smoothingWindow_s, numberOfFormantTracks, order + 1, weighDataType, numberOfSigmas, power);
 	CONVERT_EACH_END (my name);
 }
 
diff --git a/dwtools/praat_David_init.cpp b/dwtools/praat_David_init.cpp
index a0fc65a..5e447b8 100644
--- a/dwtools/praat_David_init.cpp
+++ b/dwtools/praat_David_init.cpp
@@ -154,7 +154,7 @@ void praat_BandFilterSpectrogram_query_init (ClassInfo klas);
 void praat_EditDistanceTable_as_TableOfReal_init (ClassInfo klas);
 
 #define DTW_constraints_addCommonFields(matchStart,matchEnd,slopeConstraint) \
-	LABEL (U"", U"Boundary conditions") \
+	LABEL (U"Boundary conditions") \
 	BOOLEAN (matchStart, U"Match begin positions", false) \
 	BOOLEAN (matchEnd, U"Match end positions", false) \
 	RADIO (slopeConstraint, U"Slope constraint", 1) \
@@ -178,8 +178,8 @@ void praat_EditDistanceTable_as_TableOfReal_init (ClassInfo klas);
 /********************** Activation *******************************************/
 
 FORM (MODIFY_ActivationList_formula, U"ActivationList: Formula", nullptr) {
-	LABEL (U"label", U"for col := 1 to ncol do { self [row, col] := `formula' ; x := x + dx } y := y + dy }}")
-	TEXTFIELD (formula, U"formula", U"self")
+	LABEL (U"for col := 1 to ncol do { self [row, col] := `formula' ; x := x + dx } y := y + dy }}")
+	TEXTFIELD (formula, U"Formula:", U"self")
 	OK
 DO
 	MODIFY_EACH (ActivationList)
@@ -456,7 +456,7 @@ DO
 }
 
 FORM (NEW1_CCs_to_DTW, U"CC: To DTW", U"CC: To DTW...") {
-	LABEL (U"", U"Distance  between cepstral coefficients")
+	LABEL (U"Distance  between cepstral coefficients")
 	REAL (cepstralWeight, U"Cepstral weight", U"1.0")
 	REAL (logEnergyWeight, U"Log energy weight", U"0.0")
 	REAL (regressionWeight, U"Regression weight", U"0.0")
@@ -488,9 +488,9 @@ FORM (GRAPHICS_CCA_drawEigenvector, U"CCA: Draw eigenvector", U"Eigen: Draw eige
 		OPTION (U"y")
 		OPTION (U"x")
 	INTEGER (eigenVectorNumber, U"Eigenvector number", U"1")
-	LABEL (U"", U"Multiply by eigenvalue?")
+	LABEL (U"Multiply by eigenvalue?")
 	BOOLEAN (useComponentLoadings, U"Component loadings", false)
-	LABEL (U"", U"Select part of the eigenvector:")
+	LABEL (U"Select part of the eigenvector:")
 	INTEGER (fromElement, U"left Element range", U"0")
 	INTEGER (toElement, U"right Element range", U"0")
 	REAL (fromAmplitude, U"left Amplitude range", U"-1.0")
@@ -551,11 +551,11 @@ DIRECT (NEW1_CCA_and_Correlation_factorLoadings) {
 }
 
 FORM (REAL_CCA_and_Correlation_getVarianceFraction, U"CCA & Correlation: Get variance fraction", U"CCA & Correlation: Get variance fraction...") {
-	LABEL (U"", U"Get the fraction of variance from the data in set...")
+	LABEL (U"Get the fraction of variance from the data in set...")
 	OPTIONMENU (xOrY, U"X or Y", 1)
 		OPTION (U"y")
 		OPTION (U"x")
-	LABEL (U"", U"extracted by...")
+	LABEL (U"extracted by...")
 	NATURAL (fromCanonicalVariate, U"left Canonical variate range", U"1")
 	NATURAL (toCanonicalVariate, U"right Canonical variate range", U"1")
 	OK
@@ -566,14 +566,14 @@ DO
 }
 
 FORM (REAL_CCA_and_Correlation_getRedundancy_sl, U"CCA & Correlation: Get Stewart-Love redundancy", U"CCA & Correlation: Get redundancy (sl)...") {
-	LABEL (U"", U"Get the redundancy of the data in set...")
+	LABEL (U"Get the redundancy of the data in set...")
 	OPTIONMENU (xOrY, U"X or Y", 1)
 		OPTION (U"y")
 		OPTION (U"x")
-	LABEL (U"", U"extracted by...")
+	LABEL (U"extracted by...")
 	NATURAL (fromCanonicalVariate, U"left Canonical variate range", U"1")
 	NATURAL (toCanonicalVariate, U"right Canonical variate range", U"1")
-	LABEL (U"", U"...given the availability of the data in the other set.")
+	LABEL (U"...given the availability of the data in the other set.")
 	OK
 DO
 	NUMBER_TWO (CCA, Correlation)
@@ -597,7 +597,7 @@ DO
 }
 
 FORM (NEW1_CCA_and_TableOfReal_predict, U"CCA & TableOfReal: Predict", U"CCA & TableOfReal: Predict...") {
-	LABEL (U"", U"The data set from which to predict starts at...")
+	LABEL (U"The data set from which to predict starts at...")
 	INTEGER (columnNumber, U"Column number", U"1")
 	OK
 DO
@@ -625,11 +625,11 @@ DIRECT (HELP_ChebyshevSeries_help) {
 
 FORM (NEW1_ChebyshevSeries_create, U"Create ChebyshevSeries", U"Create ChebyshevSeries...") {
 	WORD (name, U"Name", U"cs")
-	LABEL (U"", U"Domain")
+	LABEL (U"Domain")
 	REAL (xmin, U"Xmin", U"-1")
 	REAL (xmax, U"Xmax", U"1")
-	LABEL (U"", U"ChebyshevSeries(x) = c[1] T[0](x) + c[2] T[1](x) + ... c[n+1] T[n](x)")
-	LABEL (U"", U"T[k] is a Chebyshev polynomial of degree k")
+	LABEL (U"ChebyshevSeries(x) = c[1] T[0](x) + c[2] T[1](x) + ... c[n+1] T[n](x)")
+	LABEL (U"T[k] is a Chebyshev polynomial of degree k")
 	SENTENCE (coefficients_string, U"Coefficients (c[k])", U"0 0 1.0")
 	OK
 DO
@@ -961,10 +961,10 @@ DO
 }
 
 FORM (REAL_Covariance_getSignificanceOfOneMean, U"Covariance: Get significance of one mean", U"Covariance: Get significance of one mean...") {
-	LABEL (U"", U"Get probability that the estimated mean for")
+	LABEL (U"Get probability that the estimated mean for")
 	NATURAL (index, U"Index", U"1")
-	LABEL (U"", U"(or an estimated mean even further away)")
-	LABEL (U"", U"could arise if the true mean were")
+	LABEL (U"(or an estimated mean even further away)")
+	LABEL (U"could arise if the true mean were")
 	REAL (value, U"Value", U"0.0")
 	OK
 DO
@@ -975,14 +975,14 @@ DO
 }
 
 FORM (REAL_Covariance_getSignificanceOfMeansDifference, U"Covariance: Get significance of means difference", U"Covariance: Get significance of means difference...") {
-	LABEL (U"", U"Get probability that the estimated difference between the means for")
+	LABEL (U"Get probability that the estimated difference between the means for")
 	NATURAL (index1, U"Index1", U"1")
 	NATURAL (index2, U"Index2", U"2")
-	LABEL (U"", U"could arise if the true mean were")
+	LABEL (U"could arise if the true mean were")
 	REAL (value, U"Value", U"0.0")
-	LABEL (U"", U"Assume the means are ")
+	LABEL (U"Assume the means are ")
 	BOOLEAN (paired, U"Paired", true)
-	LABEL (U"", U"and have")
+	LABEL (U"and have")
 	BOOLEAN (equalVariances, U"Equal variances", true)
 	OK
 DO
@@ -993,10 +993,10 @@ DO
 }
 
 FORM (REAL_Covariance_getSignificanceOfOneVariance, U"Covariance: Get significance of one variance", U"Covariance: Get significance of one variance...") {
-	LABEL (U"", U"Get the probability that the estimated variance for")
+	LABEL (U"Get the probability that the estimated variance for")
 	NATURAL (index, U"Index", U"1")
-	LABEL (U"", U"(or an even larger estimated variance)")
-	LABEL (U"", U"could arise if the true variance were")
+	LABEL (U"(or an even larger estimated variance)")
+	LABEL (U"could arise if the true variance were")
 	REAL (value, U"Value", U"0.0")
 	OK
 DO
@@ -1007,11 +1007,11 @@ DO
 }
 
 FORM (REAL_Covariance_getSignificanceOfVariancesRatio, U"Covariance: Get significance of variances ratio", nullptr) {
-	LABEL (U"", U"Get the probability that the estimated variance ratio observed for")
+	LABEL (U"Get the probability that the estimated variance ratio observed for")
 	NATURAL (index1, U"Index1", U"1")
 	NATURAL (index2, U"Index2", U"2")
-	LABEL (U"", U"(or an estimated ratio even further away)")
-	LABEL (U"", U"could arise if the true ratio were")
+	LABEL (U"(or an estimated ratio even further away)")
+	LABEL (U"could arise if the true ratio were")
 	REAL (value, U"Value", U"1.0")
 	OK
 DO
@@ -1032,10 +1032,10 @@ DO
 }
 
 FORM (INFO_Covariances_reportMultivariateMeanDifference, U"Covariances: Report multivariate mean difference", U"Covariances: Report multivariate mean difference...") {
-	LABEL (U"", U"Get probability that the estimated multivariate means difference could arise ")
-	LABEL (U"", U"if the actual means were equal.")
-	LABEL (U"", U"")
-	LABEL (U"", U"Assume for both means we have")
+	LABEL (U"Get probability that the estimated multivariate means difference could arise ")
+	LABEL (U"if the actual means were equal.")
+	LABEL (U"")
+	LABEL (U"Assume for both means we have")
 	BOOLEAN (covariancesAreEqual, U"Equal covariances", true)
 	OK
 DO
@@ -1214,7 +1214,7 @@ DO
 }
 
 FORM (REAL_Discriminant_getWilksLambda, U"Discriminant: Get Wilks' lambda", U"Discriminant: Get Wilks' lambda...") {
-	LABEL (U"", U"Product (i=from..numberOfEigenvalues, 1 / (1 + eigenvalue[i]))")
+	LABEL (U"Product (i=from..numberOfEigenvalues, 1 / (1 + eigenvalue[i]))")
 	INTEGER (from, U"From", U"1") //TODO better name
 	OK
 DO
@@ -1326,7 +1326,7 @@ FORM (MODIFY_Discriminant_invertEigenvector, U"Discriminant: Invert eigenvector"
 	OK
 DO
 	MODIFY_EACH (Discriminant)
-		Eigen_invertEigenvector (my eigen.get(), GET_INTEGER (U"Index of eigenvector"));
+		Eigen_invertEigenvector (my eigen.get(), eigenvectorNumber);
 	MODIFY_EACH_END
 }
 
@@ -1823,9 +1823,9 @@ DIRECT (REAL_DTW_getMaximumDistance) {
 }
 
 FORM (MODIFY_DTW_formulaDistances, U"DTW: Formula (distances)", nullptr) {
-	LABEL (U"label", U"y := y1; for row := 1 to nrow do { x := x1; "
+	LABEL (U"y := y1; for row := 1 to nrow do { x := x1; "
 		"for col := 1 to ncol do { self [row, col] := `formula' ; x := x + dx } y := y + dy }")
-	TEXTFIELD (formula, U"formula", U"self")
+	TEXTFIELD (formula, U"Formula:", U"self")
 	OK
 DO
 	LOOP {
@@ -2124,10 +2124,10 @@ DO
 }
 
 FORM (MODIFY_EditCostsTable_setOthersCosts, U"EditCostsTable: Set costs (others)", nullptr) {
-	LABEL (U"", U"Others costs")
+	LABEL (U"Others costs")
 	REAL (insertionCosts, U"Insertion", U"1.0")
 	REAL (deletionCosts, U"Deletion", U"1.0")
-	LABEL ( U"", U"Substitution costs")
+	LABEL (U"Substitution costs")
 	REAL (equalityCosts, U"Equality", U"0.0")
 	REAL (inequalityCosts, U"Inequality", U"2.0")
 	OK
@@ -2268,7 +2268,7 @@ FORM (NEW1_Eigen_and_Matrix_projectColumns, U"Eigen & Matrix: Project columns",
 	OK
 DO
 	CONVERT_TWO (Eigen, Matrix)
-		autoMatrix result = Eigen_and_Matrix_to_Matrix_projectColumns (me, you, GET_INTEGER (U"Number of dimensions"));
+		autoMatrix result = Eigen_and_Matrix_to_Matrix_projectColumns (me, you, numberOfDimensions);
 	CONVERT_TWO_END (my name, U"_", your name)
 }
 
@@ -2368,8 +2368,8 @@ DIRECT (NEW1_Excitations_to_ExcitationList) {
 /******************** ExcitationList ********************************************/
 
 FORM (MODIFY_ExcitationList_formula, U"ExcitationList: Formula", nullptr) {
-	LABEL (U"label", U"for all objects in ExcitationList do { for col := 1 to ncol do { self [col] := `formula' ; x := x + dx } }")
-	TEXTFIELD (formula, U"formula", U"self")
+	LABEL (U"for all objects in ExcitationList do { for col := 1 to ncol do { self [col] := `formula' ; x := x + dx } }")
+	TEXTFIELD (formula, U"Formula:", U"self")
 	OK
 DO
 	MODIFY_EACH (ExcitationList)
@@ -2450,8 +2450,7 @@ DO
 
 FORM (NEW_FileInMemorySet_createFromDirectoryContents, U"Create files in memory from directory contents", nullptr) {
 	SENTENCE (name, U"Name", U"list")
-	LABEL (U"", U"Directory:")
-	TEXTFIELD (directory, U"Directory", U"/home/david/praat/src/espeak-work/espeak-1.46.13/espeak-data")
+	TEXTFIELD (directory, U"Directory:", U"/home/david/praat/src/espeak-work/espeak-1.46.13/espeak-data")
 	WORD (fileGlobber, U"Only files that match pattern", U"*.txt")
 	OK
 DO
@@ -2885,7 +2884,7 @@ FORM (GRAPHICS_FormantGrid_draw, U"FormantGrid: Draw", nullptr) {
 	REAL (toFrequency, U"right Frequency range (Hz)", U"0.0 (= auto)")
 	BOOLEAN (bandwidths, U"Bandwidths", false)
 	BOOLEAN (garnish, U"Garnish", true)
-	LABEL (U"", U"")
+	LABEL (U"")
 	OPTIONMENUSTR (drawingMethod, U"Drawing method", 1)
 		OPTION (U"lines")
 		OPTION (U"speckles")
@@ -2944,7 +2943,7 @@ DIRECT (INTEGER_FunctionTerms_getNumberOfCoefficients) {
 }
 
 FORM (REAL_FunctionTerms_getCoefficient, U"FunctionTerms: Get coefficient", nullptr) {
-	LABEL (U"", U"p(x) = c[1] + c[2] x + ... c[n+1] x^n")
+	LABEL (U"p(x) = c[1] + c[2] x + ... c[n+1] x^n")
 	NATURAL (index, U"Index", U"1")
 	OK
 DO
@@ -2960,7 +2959,7 @@ DIRECT (INTEGER_FunctionTerms_getDegree) {
 }
 
 FORM (REAL_FunctionTerms_getMaximum, U"FunctionTerms: Get maximum", U"Polynomial: Get maximum...") {
-	LABEL (U"", U"Interval")
+	LABEL (U"Interval")
 	REAL (xmin, U"Xmin", U"0.0")
 	REAL (xmax, U"Xmax", U"0.0")
 	OK
@@ -2971,7 +2970,7 @@ DO
 }
 
 FORM (REAL_FunctionTerms_getMinimum, U"FunctionTerms: Get minimum", U"Polynomial: Get minimum...") {
-	LABEL (U"", U"Interval")
+	LABEL (U"Interval")
 	REAL (xmin, U"Xmin", U"0.0")
 	REAL (xmax, U"Xmax", U"0.0")
 	OK
@@ -2982,7 +2981,7 @@ DO
 }
 
 FORM (REAL_FunctionTerms_getXOfMaximum, U"FunctionTerms: Get x of maximum", U"Polynomial: Get x of maximum...") {
-	LABEL (U"", U"Interval")
+	LABEL (U"Interval")
 	REAL (xmin, U"Xmin", U"0.0")
 	REAL (xmax, U"Xmax", U"0.0")
 	OK
@@ -2993,7 +2992,7 @@ DO
 }
 
 FORM (REAL_FunctionTerms_getXOfMinimum, U"FunctionTerms: Get x of minimum", U"Polynomial: Get x of minimum...") {
-	LABEL (U"", U"Interval")
+	LABEL (U"Interval")
 	REAL (xmin, U"Xmin", U"0.0")
 	REAL (xmax, U"Xmax", U"0.0")
 	OK
@@ -3004,8 +3003,8 @@ DO
 }
 
 FORM (MODIFY_FunctionTerms_setCoefficient, U"FunctionTerms: Set coefficient", nullptr) {
-	LABEL (U"", U"p(x) = c[1]F[0] + c[2]F[1] + ... c[n+1]F[n]")
-	LABEL (U"", U"F[k] is of degree k")
+	LABEL (U"p(x) = c[1]F[0] + c[2]F[1] + ... c[n+1]F[n]")
+	LABEL (U"F[k] is of degree k")
 	NATURAL (index, U"Index", U"1")
 	REAL (value, U"Value", U"0.0")
 	OK
@@ -3076,12 +3075,12 @@ DIRECT (HELP_ISpline_help) {
 
 FORM (NEW1_ISpline_create, U"Create ISpline", U"Create ISpline...") {
 	WORD (name, U"Name", U"ispline")
-	LABEL (U"", U"Domain")
+	LABEL (U"Domain")
 	REAL (xmin, U"Xmin", U"0")
 	REAL (xmax, U"Xmax", U"1")
-	LABEL (U"", U"ISpline(x) = c[1] I[1](x) + c[2] I[1](x) + ... c[n] I[n](x)")
-	LABEL (U"", U"all I[k] are polynomials of degree \"Degree\"")
-	LABEL (U"", U"Relation: numberOfCoefficients == numberOfInteriorKnots + degree")
+	LABEL (U"ISpline(x) = c[1] I[1](x) + c[2] I[1](x) + ... c[n] I[n](x)")
+	LABEL (U"all I[k] are polynomials of degree \"Degree\"")
+	LABEL (U"Relation: numberOfCoefficients == numberOfInteriorKnots + degree")
 	INTEGER (degree, U"Degree", U"3")
 	SENTENCE (coefficients_string, U"Coefficients (c[k])", U"1.2 2.0 1.2 1.2 3.0 0.0")
 	SENTENCE (knots_string, U"Interior knots" , U"0.3 0.5 0.6")
@@ -3190,8 +3189,7 @@ static void print_means (Table me) {
 }
 
 FORM (INTEGER_Table_getNumberOfRowsWhere, U"", nullptr) {
-	LABEL (U"", U"Count only rows where the following condition holds:")
-	TEXTFIELD (formula, U"Formula", U"1; self$[\"gender\"]=\"M\"")
+	TEXTFIELD (formula, U"Count only rows where the following condition holds:", U"1; self$[\"gender\"]=\"M\"")
 	OK
 DO
 	INTEGER_ONE (Table)
@@ -3292,11 +3290,11 @@ DO
 
 FORM (NEW1_LegendreSeries_create, U"Create LegendreSeries", U"Create LegendreSeries...") {
 	WORD (name, U"Name", U"ls")
-	LABEL (U"", U"Domain")
+	LABEL (U"Domain")
 	REAL (xmin, U"Xmin", U"-1")
 	REAL (xmax, U"Xmax", U"1")
-	LABEL (U"", U"LegendreSeries(x) = c[1] P[0](x) + c[2] P[1](x) + ... c[n+1] P[n](x)")
-	LABEL (U"", U"P[k] is a Legendre polynomial of degree k")
+	LABEL (U"LegendreSeries(x) = c[1] P[0](x) + c[2] P[1](x) + ... c[n+1] P[n](x)")
+	LABEL (U"P[k] is a Legendre polynomial of degree k")
 	SENTENCE (coefficients_string, U"Coefficients", U"0 0 1.0")
 	OK
 DO
@@ -3375,15 +3373,15 @@ DO
 }
 
 FORM (GRAPHICS_Matrix_drawDistribution, U"Matrix: Draw distribution", U"Matrix: Draw distribution...") {
-	LABEL (U"", U"Selection of (part of) Matrix")
+	LABEL (U"Selection of (part of) Matrix")
 	REAL (xmin, U"left Horizontal range", U"0.0")
 	REAL (xmax, U"right Horizontal range", U"0.0")
 	REAL (ymin, U"left Vertical range", U"0.0")
 	REAL (ymax, U"right Vertical range", U"0.0")
-	LABEL (U"", U"Selection of Matrix values")
+	LABEL (U"Selection of Matrix values")
 	REAL (minimumValue, U"Minimum value", U"0.0")
 	REAL (maximumValue, U"Maximum value", U"0.0")
-	LABEL (U"", U"Display of the distribution")
+	LABEL (U"Display of the distribution")
 	NATURAL (numberOfBins, U"Number of bins", U"10")
 	REAL (minimumFrequency, U"Minimum frequency", U"0.0")
 	REAL (maximumFrequency, U"Maximum frequency", U"0.0")
@@ -3396,15 +3394,15 @@ DO
 }
 
 FORM (GRAPHICS_Matrix_drawCumulativeDistribution, U"Matrix: Draw cumulative distribution", nullptr) {
-	LABEL (U"", U"Selection of (part of) Matrix")
+	LABEL (U"Selection of (part of) Matrix")
 	REAL (xmin, U"left Horizontal range", U"0.0")
 	REAL (xmax, U"right Horizontal range", U"0.0")
 	REAL (ymin, U"left Vertical range", U"0.0")
 	REAL (ymax, U"right Vertical range", U"0.0")
-	LABEL (U"", U"Selection of Matrix values")
+	LABEL (U"Selection of Matrix values")
 	REAL (minimumValue, U"Minimum value", U"0.0")
 	REAL (maximumValue, U"Maximum value", U"0.0")
-	LABEL (U"", U"Display of the distribution")
+	LABEL (U"Display of the distribution")
 	NATURAL (numberOfBins, U"Number of bins", U"10")
 	REAL (minimum, U"Minimum", U"0.0")
 	REAL (maximum, U"Maximum", U"0.0")
@@ -3441,7 +3439,7 @@ DO
 }
 
 FORM (MODIFY_Matrix_scale, U"Matrix: Scale", nullptr) {
-	LABEL (U"", U"self[row, col] := self[row, col] / `Scale factor'")
+	LABEL (U"self[row, col] := self[row, col] / `Scale factor'")
 	RADIO (scaleMethod, U"Scale factor", 1)
 		RADIOBUTTON (U"Extremum in matrix")
 		RADIOBUTTON (U"Extremum in each row")
@@ -3517,7 +3515,7 @@ DIRECT (NEW_Matrix_to_ActivationList) {
 }
 
 FORM (NEW1_Matrices_to_DTW, U"Matrices: To DTW", U"Matrix: To DTW...") {
-	LABEL (U"", U"Distance  between cepstral coefficients")
+	LABEL (U"Distance  between cepstral coefficients")
 	REAL (distanceMetric, U"Distance metric", U"2.0")
 	DTW_constraints_addCommonFields (matchStart, matchEnd, slopeConstraint)
 	OK
@@ -3904,12 +3902,12 @@ DIRECT (NEW_MFCC_to_Sound) {
 
 FORM (NEW_MSpline_create, U"Create MSpline", U"Create MSpline...") {
 	WORD (name, U"Name", U"mspline")
-	LABEL (U"", U"Domain")
+	LABEL (U"Domain")
 	REAL (xmin, U"Xmin", U"0")
 	REAL (xmax, U"Xmax", U"1")
-	LABEL (U"", U"MSpline(x) = c[1] M[1](x) + c[2] M[1](x) + ... c[n] M[n](x)")
-	LABEL (U"", U"all M[k] are polynomials of degree \"Degree\"")
-	LABEL (U"", U"Relation: numberOfCoefficients == numberOfInteriorKnots + degree + 1")
+	LABEL (U"MSpline(x) = c[1] M[1](x) + c[2] M[1](x) + ... c[n] M[n](x)")
+	LABEL (U"all M[k] are polynomials of degree \"Degree\"")
+	LABEL (U"Relation: numberOfCoefficients == numberOfInteriorKnots + degree + 1")
 	INTEGER (degree, U"Degree", U"2")
 	SENTENCE (coefficients_string, U"Coefficients (c[k])", U"1.2 2.0 1.2 1.2 3.0 0.0")
 	SENTENCE (knots_string, U"Interior knots" , U"0.3 0.5 0.6")
@@ -3970,10 +3968,10 @@ DO
 }
 
 FORM (MODIFY_PatternList_formula, U"PatternList: Formula", nullptr) {
-	LABEL (U"label", U"        y := 1; for row := 1 to nrow do { x := 1; "
+	LABEL (U"        y := 1; for row := 1 to nrow do { x := 1; "
 		"for col := 1 to ncol do { self [row, col] := `formula' ; x := x + 1 } "
 		"y := y + 1 }}")
-	TEXTFIELD (formula, U"formula", U"self")
+	TEXTFIELD (formula, U"Formula:", U"self")
 	OK
 DO
 	MODIFY_EACH (PatternList)
@@ -4145,7 +4143,7 @@ DO
 
 FORM (NEW_PCA_extractEigenvector, U"PCA: Extract eigenvector", U"Eigen: Extract eigenvector...") {
 	NATURAL (eigenvectorNumber, U"Eigenvector number", U"1")
-	LABEL (U"", U"Reshape as")
+	LABEL (U"Reshape as")
 	INTEGER (numberOfRows, U"Number of rows", U"0")
 	INTEGER (numberOfColumns, U"Number of columns", U"0")
 	OK
@@ -4273,10 +4271,10 @@ DO
 }
 
 FORM (MODIFY_Permutation_swapOneFromRange, U"Permutation: Swap one from range", U"Permutation: Swap one from range...") {
-	LABEL (U"", U"A randomly chosen element from ")
+	LABEL (U"A randomly chosen element from ")
 	INTEGER (fromIndex, U"left Index range", U"0")
 	INTEGER (toIndex, U"right Index range", U"0")
-	LABEL (U"", U"is swapped with the element at")
+	LABEL (U"is swapped with the element at")
 	NATURAL (index, U"Index", U"1")
 	BOOLEAN (forbidSame, U"Forbid same", true)
 	OK
@@ -4391,14 +4389,14 @@ DO
 FORM (MODIFY_PitchTier_modifyInterval, U"PitchTier: Modify interval", U"PitchTier: Modify interval...") {
 	REAL (fromTime, U"left Time range (s)", U"0.0")
 	REAL (toTime, U"right Time range", U"0.0 (= all)")
-	LABEL (U"", U"")
+	LABEL (U"")
 	SENTENCE (timesString, U"Relative times", U"0.0 0.5 1.0")
 	OPTIONMENU (timeOffset, U"...are...", 1)
 		OPTION (U"fractions")
 		OPTION (U"percentages")
 		OPTION (U"independent")
-	LABEL (U"", U"...of the interval duration which will be added...")
-	LABEL (U"", U"...to the start time of the interval.")
+	LABEL (U"...of the interval duration which will be added...")
+	LABEL (U"...to the start time of the interval.")
 	SENTENCE (pitches_string, U"The \"pitch\" values", U"100 200 100")
 	OPTIONMENU (pitch_as, U"...are...", 1)
 		OPTION (U"frequencies")
@@ -4408,7 +4406,7 @@ FORM (MODIFY_PitchTier_modifyInterval, U"PitchTier: Modify interval", U"PitchTie
 		OPTION (U"slopes and end")
 		OPTION (U"music notes")
 //		OPTION (U"semitones")
-	LABEL (U"", U"...to be added to the anchor value (if used)...")
+	LABEL (U"...to be added to the anchor value (if used)...")
 	OPTIONMENU (pitch_is, U"...which is the...", 1)
 		OPTION (U"not used")
 		OPTION (U"current")
@@ -4418,11 +4416,10 @@ FORM (MODIFY_PitchTier_modifyInterval, U"PitchTier: Modify interval", U"PitchTie
 		OPTION (U"mean of the points")
 		OPTION (U"maximum")
 		OPTION (U"minimum")
-	LABEL (U"", U"...frequency value in the interval.")
-	LABEL (U"", U"")
+	LABEL (U"...frequency value in the interval.")
+	LABEL (U"")
 	OPTIONMENU (pitch_unit, U"Pitch frequency unit", 1)
 		OPTION (U"Hertz")
-
 	OK
 DO
 	MODIFY_EACH (PitchTier)
@@ -4437,14 +4434,14 @@ FORM (MODIFY_PitchTier_modifyInterval_toneLevels, U"PitchTier: Modify interval (
 	REAL (fmin, U"left Pitch range (Hz)", U"80.0")
 	REAL (fmax, U"right Pitch range", U"200.0")
 	NATURAL (numberOfToneLevels, U"Number of tone levels", U"5")
-	LABEL (U"", U"")
+	LABEL (U"")
 	SENTENCE (times_string, U"Relative times", U"0.0 0.5 1.0")
 	OPTIONMENU (time_offset, U"...are...", 1)
 		OPTION (U"fractions")
 		OPTION (U"percentages")
 		OPTION (U"independent")
-	LABEL (U"", U"...of the interval duration which will be added...")
-	LABEL (U"", U"...to the start time of the interval.")
+	LABEL (U"...of the interval duration which will be added...")
+	LABEL (U"...to the start time of the interval.")
 	SENTENCE (pitches_string, U"Tone levels", U"2.1 2.1 5.0")
 	OK
 DO
@@ -4504,7 +4501,7 @@ DO
 }
 
 FORM (INFO_Polygon_getLocationOfPoint, U"Get location of point", U"Polygon: Get location of point...") {
-	LABEL (U"", U"Point is (I)n, (O)ut, (E)dge or (V)ertex?")
+	LABEL (U"Point is (I)n, (O)ut, (E)dge or (V)ertex?")
 	REAL (x, U"X", U"0.0")
 	REAL (y, U"Y", U"0.0")
 	REAL (eps, U"Precision", U"1.64e-15")
@@ -4557,9 +4554,9 @@ DO
 }
 
 FORM (MODIFY_Polygon_rotate, U"Polygon: Rotate", U"Polygon: Rotate...") {
-	LABEL (U"", U"Rotate counterclockwise over the")
+	LABEL (U"Rotate counterclockwise over the")
 	REAL (angle_degrees, U"Angle (degrees)", U"0.0")
-	LABEL (U"", U"With respect to the point")
+	LABEL (U"With respect to the point")
 	REAL (x, U"X", U"0.0")
 	REAL (y, U"Y", U"0.0")
 	OK
@@ -4612,10 +4609,10 @@ DIRECT (HELP_Polynomial_help) {
 
 FORM (NEW1_Polynomial_create, U"Create Polynomial from coefficients", U"Create Polynomial...") {
 	WORD (name, U"Name", U"p")
-	LABEL (U"", U"Domain of polynomial")
+	LABEL (U"Domain of polynomial")
 	REAL (xmin, U"Xmin", U"-3.0")
 	REAL (xmax, U"Xmax", U"4.0")
-	LABEL (U"", U"p(x) = c[1] + c[2] x + ... c[n+1] x^n")
+	LABEL (U"p(x) = c[1] + c[2] x + ... c[n+1] x^n")
 	SENTENCE (coefficients_string, U"Coefficients", U"2.0 -1.0 -2.0 1.0")
 	OK
 DO
@@ -4627,10 +4624,10 @@ DO
 
 FORM (NEW1_Polynomial_createFromProducts, U"Create Polynomial from second order products", nullptr) {
 	WORD (name, U"Name", U"p")
-	LABEL (U"", U"Domain of polynomial")
+	LABEL (U"Domain of polynomial")
 	REAL (xmin, U"Xmin", U"-2.0")
 	REAL (xmax, U"Xmax", U"2.0")
-	LABEL (U"", U"(1+a[1]*x+x^2)*(1+a[2]*x+x^2)*...*(1+a[n]*x+x^2)")
+	LABEL (U"(1+a[1]*x+x^2)*(1+a[2]*x+x^2)*...*(1+a[n]*x+x^2)")
 	SENTENCE (coefficients_string, U"The a's", U"1.0 2.0")
 	OK
 DO
@@ -4642,10 +4639,10 @@ DO
 
 FORM (NEW1_Polynomial_createFromZeros, U"Create Polynomial from first order products", nullptr) {
 	WORD (name, U"Name", U"p")
-	LABEL (U"", U"Domain of polynomial")
+	LABEL (U"Domain of polynomial")
 	REAL (xmin, U"Xmin", U"-3.0")
 	REAL (xmax, U"Xmax", U"3.0")
-	LABEL (U"", U"(P(x) = (x-zero[1])*(1-zero[2])*...*(x-zero[n])")
+	LABEL (U"(P(x) = (x-zero[1])*(1-zero[2])*...*(x-zero[n])")
 	SENTENCE (zeros_string, U"The zero's", U"1.0 2.0")
 	OK
 DO
@@ -4656,7 +4653,7 @@ DO
 }
 
 FORM (MODIFY_Polynomial_divide_secondOrderFactor, U"Polynomial: Divide second order factor", nullptr) {
-	LABEL (U"", U"P(x) / (x^2 - factor)")
+	LABEL (U"P(x) / (x^2 - factor)")
 	REAL (factor, U"Factor", U"1.0")
 	OK
 DO
@@ -4666,7 +4663,7 @@ DO
 }
 
 FORM (REAL_Polynomial_getArea, U"Polynomial: Get area", U"Polynomial: Get area...") {
-	LABEL (U"", U"Interval")
+	LABEL (U"Interval")
 	REAL (xmin, U"Xmin", U"0.0")
 	REAL (xmax, U"Xmax", U"0.0")
 	OK
@@ -4677,7 +4674,7 @@ DO
 }
 
 FORM (REAL_Polynomial_getRemainderAfterDivision, U"Polynomial: Get remainder after division", nullptr) {
-	LABEL (U"", U"P(x) / (x - factor)")
+	LABEL (U"P(x) / (x - factor)")
 	REAL (factor, U"Monomial factor", U"1.0")
 	OK
 DO
@@ -4705,7 +4702,7 @@ DO
 }
 
 FORM (REAL_Polynomial_getOneRealRoot, U"Polynomial: Get one real root", nullptr) {
-	LABEL (U"", U"Interval: ")
+	LABEL (U"Interval: ")
 	REAL (xmin, U"left X Range", U"-1.0")
 	REAL (xmax, U"right X Range", U"1.0")
 	OK
@@ -4731,7 +4728,7 @@ DO
 }
 
 FORM (NEW_Polynomial_scaleX, U"Polynomial: Scale x", U"Polynomial: Scale x...") {
-	LABEL (U"", U"New domain")
+	LABEL (U"New domain")
 	REAL (xmin, U"Xmin", U"-1.0")
 	REAL (xmax, U"Xmax", U"1.0")
 	OK
@@ -4861,7 +4858,7 @@ FORM (REAL_Roots_getImaginaryPartOfRoot, U"Roots: Get imaginary part", nullptr)
 	OK
 DO
 	NUMBER_ONE (Roots)
-		dcomplex z = Roots_getRoot (me, GET_INTEGER (U"Root number"));
+		dcomplex z = Roots_getRoot (me, rootNumber);
 		double result = z.im;
 	NUMBER_ONE_END (U" i")
 }
@@ -4994,7 +4991,7 @@ static void Sound_create_checkCommonFields (double startTime, double endTime, do
 FORM (NEW1_Sound_and_Pitch_to_FormantFilter, U"Sound & Pitch: To FormantFilter", U"Sound & Pitch: To Spectrogram...") {
 	POSITIVE (windowLength, U"Analysis window duration (s)", U"0.015")
 	POSITIVE (timeStep, U"Time step (s)", U"0.005")
-	LABEL (U"", U"Filter bank parameters")
+	LABEL (U"Filter bank parameters")
 	POSITIVE (firstFrequency, U"Position of first filter (Hz)", U"100.0")
 	POSITIVE (deltaFrequency, U"Distance between filters (Hz)", U"50.0")
 	REAL (maximumFrequency, U"Maximum frequency", U"0");
@@ -5009,7 +5006,7 @@ DO
 FORM (NEW1_Sound_and_Pitch_to_Spectrogram, U"Sound & Pitch: To Spectrogram", U"Sound & Pitch: To Spectrogram...") {
 	POSITIVE (windowLength, U"Analysis window duration (s)", U"0.015")
 	POSITIVE (timeStep, U"Time step (s)", U"0.005")
-	LABEL (U"", U"Filter bank parameters")
+	LABEL (U"Filter bank parameters")
 	POSITIVE (firstFrequency, U"Position of first filter (Hz)", U"100.0")
 	POSITIVE (deltaFrequency, U"Distance between filters (Hz)", U"50.0")
 	REAL (maximumFrequency, U"Maximum frequency", U"0");
@@ -5094,14 +5091,13 @@ FORM (GRAPHICS_Sound_drawWhere, U"Sound: Draw where", U"Sound: Draw where...") {
 	REAL (ymin, U"left Vertical range", U"0.0")
 	REAL (ymax, U"right Vertical range", U"0.0 (= auto)")
 	BOOLEAN (garnish, U"Garnish", true)
-	LABEL (U"", U"")
+	LABEL (U"")
 	OPTIONMENUSTR (drawingMethod, U"Drawing method", 1)
 		OPTION (U"Curve")
 		OPTION (U"Bars")
 		OPTION (U"Poles")
 		OPTION (U"Speckles")
-	LABEL (U"", U"Draw only those parts where the following condition holds:")
-	TEXTFIELD (formula, U"Formula", U"x < xmin + (xmax - xmin) / 2; first half")
+	TEXTFIELD (formula, U"Draw only those parts where the following condition holds:", U"x < xmin + (xmax - xmin) / 2; first half")
 	OK
 DO
 	long numberOfBisections = 10;
@@ -5140,7 +5136,7 @@ END }
 FORM (NEW1_Sounds_to_DTW, U"Sounds: To DTW", nullptr) {
     POSITIVE (windowLength, U"Window length (s)", U"0.015")
     POSITIVE (timeStep, U"Time step (s)", U"0.005")
-    LABEL (U"", U"")
+    LABEL (U"")
     REAL (sakoeChibaBand, U"Sakoe-Chiba band (s)", U"0.1")
     RADIO (slopeConstraint, U"Slope constraint", 1)
 		RADIOBUTTON (U"no restriction")
@@ -5155,10 +5151,10 @@ DO
 }
 
 FORM (NEW_Sound_to_TextGrid_detectSilences, U"Sound: To TextGrid (silences)", U"Sound: To TextGrid (silences)...") {
-	LABEL (U"", U"Parameters for the intensity analysis")
+	LABEL (U"Parameters for the intensity analysis")
 	POSITIVE (minimumPitch, U"Minimum pitch (Hz)", U"100")
 	REAL (timeStep, U"Time step (s)", U"0.0 (= auto)")
-	LABEL (U"", U"Silent intervals detection")
+	LABEL (U"Silent intervals detection")
 	REAL (silenceThreshold, U"Silence threshold (dB)", U"-25.0")
 	POSITIVE (minimumSilenceDuration, U"Minimum silent interval duration (s)", U"0.1")
 	POSITIVE (minimumSoundingDuration, U"Minimum sounding interval duration (s)", U"0.1")
@@ -5172,23 +5168,22 @@ DO
 }
 
 FORM (NEW_Sound_copyChannelRanges, U"Sound: Copy channel ranges", nullptr) {
-	LABEL (U"", U"Create a new Sound from the following channels:")
-	TEXTFIELD (channels_string, U"Ranges", U"1:64")
-	LABEL (U"", U"To supply rising or falling ranges, use e.g. 2:6 or 5:3.")
+	TEXTFIELD (channels, U"Create a new Sound from the following channels:", U"1:64")
+	LABEL (U"To supply rising or falling ranges, use e.g. 2:6 or 5:3.")
 	OK
 DO
 	CONVERT_EACH (Sound)
-		autoSound result = Sound_copyChannelRanges (me, channels_string);
+		autoSound result = Sound_copyChannelRanges (me, channels);
 	CONVERT_EACH_END (my name, U"_channels")
 }
 
 FORM (NEW_Sound_trimSilences, U"Sound: Trim silences", U"Sound: Trim silences...") {
     REAL (trimDuration, U"Trim duration (s)", U"0.08")
 	BOOLEAN (onlyAtStartAndEnd, U"Only at start and end", true);
-	LABEL (U"", U"Parameters for the intensity analysis")
+	LABEL (U"Parameters for the intensity analysis")
 	POSITIVE (minimumPitch, U"Minimum pitch (Hz)", U"100")
 	REAL (timeStep, U"Time step (s)", U"0.0 (= auto)")
-	LABEL (U"", U"Silent intervals detection")
+	LABEL (U"Silent intervals detection")
 	REAL (silenceThreshold, U"Silence threshold (dB)", U"-35.0")
 	POSITIVE (minimumSilenceDuration, U"Minimum silent interval duration (s)", U"0.1")
 	POSITIVE (minimumSoundingDuration, U"Minimum sounding interval duration (s)", U"0.05")
@@ -5210,7 +5205,7 @@ DO
 FORM (NEW_Sound_to_BarkFilter, U"Sound: To BarkFilter", U"Sound: To BarkSpectrogram...") {
 	POSITIVE (windowLength, U"Window length (s)", U"0.015")
 	POSITIVE (timeStep, U"Time step (s)", U"0.005")
-	LABEL (U"", U"Filter bank parameters")
+	LABEL (U"Filter bank parameters")
 	POSITIVE (firstFrequency, U"Position of first filter (bark)", U"1.0")
 	POSITIVE (deltaFrequency, U"Distance between filters (bark)", U"1.0")
 	REAL (maximumFrequency, U"Maximum frequency (bark)", U"0.0");
@@ -5224,7 +5219,7 @@ DO
 FORM (NEW_Sound_to_BarkSpectrogram, U"Sound: To BarkSpectrogram", U"Sound: To BarkSpectrogram...") {
 	POSITIVE (windowLength, U"Window length (s)", U"0.015")
 	POSITIVE (timeStep, U"Time step (s)", U"0.005")
-	LABEL (U"", U"Filter bank parameters")
+	LABEL (U"Filter bank parameters")
 	POSITIVE (firstFrequency, U"Position of first filter (bark)", U"1.0")
 	POSITIVE (deltaFrequency, U"Distance between filters (bark)", U"1.0")
 	REAL (maximumFrequency, U"Maximum frequency (bark)", U"0.0");
@@ -5239,12 +5234,12 @@ DO
 FORM (NEW_Sound_to_FormantFilter, U"Sound: To FormantFilter", U"Sound: To FormantFilter...") {
 	POSITIVE (windowLength, U"Window length (s)", U"0.015")
 	POSITIVE (timeStep, U"Time step (s)", U"0.005")
-	LABEL (U"", U"Filter bank parameters")
+	LABEL (U"Filter bank parameters")
 	POSITIVE (firstFrequency, U"Position of first filter (Hz)", U"100.0")
 	POSITIVE (deltaFrequency, U"Distance between filters (Hz)", U"50.0")
 	REAL (maximumFrequency, U"Maximum frequency", U"0.0");
 	POSITIVE (relativeBandwidth, U"Relative bandwidth", U"1.1")
-	LABEL (U"", U"Pitch analysis")
+	LABEL (U"Pitch analysis")
 	REAL (minimumPitch, U"Minimum pitch (Hz)", U"75.0")
 	REAL (maximumPitch, U"Maximum pitch (Hz)", U"600.0")
 	OK
@@ -5257,12 +5252,12 @@ DO
 FORM (NEW_Sound_to_Spectrogram_pitchDependent, U"Sound: To Spectrogram (pitch-dependent)", U"Sound: To Spectrogram (pitch-dependent)...") {
 	POSITIVE (windowLength, U"Window length (s)", U"0.015")
 	POSITIVE (timeStep, U"Time step (s)", U"0.005")
-	LABEL (U"", U"Filter bank parameters")
+	LABEL (U"Filter bank parameters")
 	POSITIVE (firstFrequency, U"Position of first filter (Hz)", U"100.0")
 	POSITIVE (deltaFrequency, U"Distance between filters (Hz)", U"50.0")
 	REAL (maximumFrequency, U"Maximum frequency", U"0.0");
 	POSITIVE (relativeBandwidth, U"Relative bandwidth", U"1.1")
-	LABEL (U"", U"Pitch analysis")
+	LABEL (U"Pitch analysis")
 	REAL (minimumPitch, U"Minimum pitch (Hz)", U"75.0")
 	REAL (maximumPitch, U"Maximum pitch (Hz)", U"600.0")
 	OK
@@ -5276,7 +5271,7 @@ DO
 FORM (NEW_Sound_to_MelFilter, U"Sound: To MelFilter", U"Sound: To MelFilter...") {
 	POSITIVE (windowLength, U"Window length (s)", U"0.015")
 	POSITIVE (timeStep, U"Time step (s)", U"0.005")
-	LABEL (U"", U"Filter bank parameters")
+	LABEL (U"Filter bank parameters")
 	POSITIVE (firstFrequency, U"Position of first filter (mel)", U"100.0")
 	POSITIVE (deltaFrequency, U"Distance between filters (mel)", U"100.0")
 	REAL (maximumFrequency, U"Maximum frequency (mel)", U"0.0");
@@ -5290,7 +5285,7 @@ DO
 FORM (NEW_Sound_to_MelSpectrogram, U"Sound: To MelSpectrogram", U"Sound: To MelSpectrogram...") {
 	POSITIVE (windowLength, U"Window length (s)", U"0.015")
 	POSITIVE (timeStep, U"Time step (s)", U"0.005")
-	LABEL (U"", U"Filter bank parameters")
+	LABEL (U"Filter bank parameters")
 	POSITIVE (firstFrequency, U"Position of first filter (mel)", U"100.0")
 	POSITIVE (deltaFrequency, U"Distance between filters (mel)", U"100.0")
 	REAL (maximumFrequency, U"Maximum frequency (mel)", U"0.0");
@@ -5315,7 +5310,7 @@ FORM (NEW_Sound_to_Pitch_shs, U"Sound: To Pitch (shs)", U"Sound: To Pitch (shs).
 	POSITIVE (timeStep, U"Time step (s)", U"0.01")
 	POSITIVE (pitchFloor, U"Minimum pitch (Hz)", U"50.0")
 	NATURAL (maximumNumberOfCandidates, U"Max. number of candidates (Hz)", U"15")
-	LABEL (U"", U"Algorithm parameters")
+	LABEL (U"Algorithm parameters")
 	POSITIVE (maximumFrequency, U"Maximum frequency component (Hz)", U"1250.0")
 	NATURAL (maximumNumberOfSubharmonics, U"Max. number of subharmonics", U"15")
 	POSITIVE (compressionFactor, U"Compression factor (<=1)", U"0.84")
@@ -5356,15 +5351,15 @@ DO
 
 FORM (NEW_Sound_to_KlattGrid_simple, U"Sound: To KlattGrid (simple)", U"Sound: To KlattGrid (simple)...") {
 	POSITIVE (timeStep, U"Time step (s)", U"0.005")
-	LABEL (U"", U"Formant determination")
+	LABEL (U"Formant determination")
 	NATURAL (numberOfFormants, U"Max. number of formants", U"5")
 	POSITIVE (maximumFormant, U"Maximum formant (Hz)", U"5500 (= adult female)")
 	POSITIVE (windowLength, U"Window length (s)", U"0.025")
 	POSITIVE (preEmphasisFrequency, U"Pre-emphasis from (Hz)", U"50.0")
-	LABEL (U"", U"Pitch determination")
+	LABEL (U"Pitch determination")
 	POSITIVE (pitchFloor, U"Pitch floor (Hz)", U"60.0")
 	POSITIVE (pitchCeiling, U"Pitch ceiling (Hz)", U"600.0")
-	LABEL (U"", U"Intensity determination")
+	LABEL (U"Intensity determination")
 	POSITIVE (minimumPitch, U"Minimum pitch (Hz)", U"100.0")
 	BOOLEAN (subtractMean, U"Subtract mean", true)
 	OK
@@ -5377,7 +5372,7 @@ DO
 FORM (NEW_Sound_to_Pitch_SPINET, U"Sound: To SPINET", U"Sound: To SPINET...") {
 	POSITIVE (timeStep, U"Time step (s)", U"0.005")
 	POSITIVE (windowLength, U"Window length (s)", U"0.040")
-	LABEL (U"", U"Gammatone filter bank")
+	LABEL (U"Gammatone filter bank")
 	POSITIVE (minimumFrequency, U"Minimum filter frequency (Hz)", U"70.0")
 	POSITIVE (maximumFrequency, U"Maximum filter frequency (Hz)", U"5000.0")
 	NATURAL (numberOfFilters, U"Number of filters", U"250");
@@ -5431,7 +5426,7 @@ FORM (NEW_Sound_removeNoise, U"Sound: Remove noise", U"Sound: Remove noise...")
 	REAL (fromTime, U"left Noise time range (s)", U"0.0")
 	REAL (toTime, U"right Noise time range (s)", U"0.0")
 	POSITIVE (windowLength, U"Window length (s)", U"0.025")
-	LABEL (U"", U"Filter")
+	LABEL (U"Filter")
 	REAL (fromFrequency, U"left Filter frequency range (Hz)", U"80.0")
 	REAL (toFrequency, U"right Filter frequency range (Hz)", U"10000.0")
 	POSITIVE (smoothingBandwidth, U"Smoothing bandwidth, (Hz)", U"40.0")
@@ -5445,10 +5440,10 @@ DO
 }
 
 FORM (NEW_Sound_changeSpeaker, U"Sound: Change speaker", U"Sound: Change speaker...") {
-	LABEL (U"", U"Pitch measurement parameters")
+	LABEL (U"Pitch measurement parameters")
 	POSITIVE (pitchFloor, U"Pitch floor (Hz)", U"75.0")
 	POSITIVE (pitchCeiling, U"Pitch ceiling (Hz)", U"600.0")
-	LABEL (U"", U"Modification parameters")
+	LABEL (U"Modification parameters")
 	POSITIVE (formantMultiplicationFactor, U"Multiply formants by", U"1.2")
 	POSITIVE (pitchMultiplicationFactor, U"Multiply pitch by", U"1.0")
 	REAL (pitchRangeMultiplicationFactor, U"Multiply pitch range by", U"1.0 (= no change)")
@@ -5462,10 +5457,10 @@ DO
 }
 
 FORM (NEW_Sound_changeGender, U"Sound: Change gender", U"Sound: Change gender...") {
-	LABEL (U"", U"Pitch measurement parameters")
+	LABEL (U"Pitch measurement parameters")
 	POSITIVE (pitchFloor, U"Pitch floor (Hz)", U"75.0")
 	POSITIVE (pitchCeiling, U"Pitch ceiling (Hz)", U"600.0")
-	LABEL (U"", U"Modification parameters")
+	LABEL (U"Modification parameters")
 	POSITIVE (formantShiftRatio, U"Formant shift ratio", U"1.2")
 	REAL (pitchMedian, U"New pitch median (Hz)", U"0.0 (= no change)")
 	REAL (pitchRangeMultiplicationFactor, U"Pitch range factor", U"1.0 (= no change)")
@@ -5479,26 +5474,24 @@ DO
 }
 
 FORM (GRAPHICS_Sound_paintWhere, U"Sound paint where", U"Sound: Paint where...") {
-	COLOUR (U"Colour (0-1, name, or {r,g,b})", U"0.5")
+	COLOUR (colour, U"Colour (0-1, name, or {r,g,b})", U"0.5")
 	praat_TimeFunction_RANGE(fromTime,toTime)
 	REAL (ymin, U"left Vertical range", U"0.0")
 	REAL (ymax, U"right Vertical range", U"0.0")
 	REAL (level, U"Fill from level", U"0.0")
 	BOOLEAN (garnish, U"Garnish", true)
-	LABEL (U"", U"Paint only those parts where the following condition holds:")
-	TEXTFIELD (formula, U"Formula", U"1; always")
+	TEXTFIELD (formula, U"Paint only those parts where the following condition holds:", U"1; always")
 	OK
 DO
-	Graphics_Colour colour = GET_COLOUR (U"Colour");
 	long numberOfBisections = 10;
 	GRAPHICS_EACH (Sound)
 		Sound_paintWhere (me, GRAPHICS, colour, fromTime, toTime, ymin, ymax, level, garnish, numberOfBisections, formula,
-		interpreter);
+			interpreter);
 	GRAPHICS_EACH_END
 }
 
 FORM (GRAPHICS_Sounds_paintEnclosed, U"Sounds paint enclosed", U"Sounds: Paint enclosed...") {
-	COLOUR (U"Colour (0-1, name, or {r,g,b})", U"0.5")
+	COLOUR (colour, U"Colour (0-1, name, or {r,g,b})", U"0.5")
 	REAL (xFromTime, U"left Horizontal time range (s)", U"0.0")
 	REAL (xToTime, U"right Horizontal time range (s)", U"0.0")
 	REAL (yFromTime, U"left Vertical time range", U"0.0")
@@ -5506,7 +5499,6 @@ FORM (GRAPHICS_Sounds_paintEnclosed, U"Sounds paint enclosed", U"Sounds: Paint e
 	BOOLEAN (garnish, U"Garnish", true)
 	OK
 DO
-	Graphics_Colour colour = GET_COLOUR (U"Colour");
 	GRAPHICS_COUPLE (Sound)
 		Sounds_paintEnclosed (me, you, GRAPHICS, colour, xFromTime, xToTime, yFromTime, yToTime, garnish);
 	GRAPHICS_COUPLE_END
@@ -5667,7 +5659,7 @@ DO
 }
 
 FORM (PLAY_SpeechSynthesizer_playText, U"SpeechSynthesizer: Play text", U"SpeechSynthesizer: Play text...") {
-	TEXTFIELD (text, U"Text", U"This is some text.")
+	TEXTFIELD (text, U"Text:", U"This is some text.")
 	OK
 DO
 	LOOP {
@@ -5677,7 +5669,7 @@ DO
 END }
 
 FORM (NEWMANY_SpeechSynthesizer_to_Sound, U"SpeechSynthesizer: To Sound", U"SpeechSynthesizer: To Sound...") {
-	TEXTFIELD (text, U"Text", U"This is some text.")
+	TEXTFIELD (text, U"Text:", U"This is some text.")
 	BOOLEAN (wantTextGrid, U"Create TextGrid with annotations", false);
 	OK
 DO
@@ -5812,7 +5804,7 @@ DIRECT (INTEGER_Spline_getOrder) {
 }
 
 FORM (NEW_Spline_scaleX, U"Spline: Scale x", U"Spline: Scale x...") {
-	LABEL (U"", U"New domain")
+	LABEL (U"New domain")
 	REAL (xmin, U"Xmin", U"-1.0")
 	REAL (xmax, U"Xmax", U"1.0")
 	OK
@@ -5983,7 +5975,7 @@ DO
 }
 
 FORM (NEW1_old_Strings_createAsTokens, U"Strings: Create as tokens", nullptr) {
-	TEXTFIELD (text, U"Text", U"There are seven tokens in this text")
+	TEXTFIELD (text, U"Text:", U"There are seven tokens in this text")
 	OK
 DO
 	CREATE_ONE
@@ -5992,7 +5984,7 @@ DO
 }
 
 FORM (NEW1_Strings_createAsTokens, U"Strings: Create as tokens", U"Create Strings as tokens...") {
-	TEXTFIELD (text, U"Text", U"There are seven tokens in this text")
+	TEXTFIELD (text, U"Text:", U"There are seven tokens in this text")
 	SENTENCE (separators, U"Separators", U" ,")
 	OK
 DO_ALTERNATIVE (NEW1_old_Strings_createAsTokens)
@@ -6023,7 +6015,7 @@ FORM (NEW_Strings_change, U"Strings: Change", U"Strings: Change") {
 	OK
 DO
 	CONVERT_EACH (Strings)
-		long nmatches, nstringmatches;
+		integer nmatches, nstringmatches;
 		autoStrings result = Strings_change (me, search_string, replace_string, replaceLimit, &nmatches, &nstringmatches, stringType - 1);
 	CONVERT_EACH_END (my name)
 }
@@ -6118,8 +6110,7 @@ FORM (GRAPHICS_Table_scatterPlotWhere, U"Table: Scatter plot where", nullptr) {
 	WORD (markColumn_string, U"Column with marks", U"")
 	NATURAL (fontSize, U"Font size", U"12")
 	BOOLEAN (garnish, U"Garnish", true)
-	LABEL (U"", U"Use only data from rows where the following condition holds:")
-	TEXTFIELD (formula, U"Formula", U"1; self$[\"gender\"]=\"male\"")
+	TEXTFIELD (formula, U"Use only data from rows where the following condition holds:", U"1; self$[\"gender\"]=\"male\"")
 	OK
 DO
 	GRAPHICS_EACH (Table)
@@ -6141,8 +6132,7 @@ FORM (GRAPHICS_Table_scatterPlotMarkWhere, U"Scatter plot where (marks)", nullpt
 	POSITIVE (markSize_mm, U"Mark size (mm)", U"1.0")
 	BOOLEAN (garnish, U"Garnish", true)
 	SENTENCE (mark_string, U"Mark string (+xo.)", U"+")
-	LABEL (U"", U"Use only data from rows where the following condition holds:")
-	TEXTFIELD (formula, U"Formula", U"1; self$[\"gender\"]=\"male\"")
+	TEXTFIELD (formula, U"Use only data from rows where the following condition holds:", U"1; self$[\"gender\"]=\"male\"")
 	OK
 DO
 	GRAPHICS_EACH (Table)
@@ -6158,19 +6148,18 @@ FORM (GRAPHICS_Table_barPlotWhere, U"Table: Bar plot where", U"Table: Bar plot w
 	REAL (ymin, U"left Vertical range", U"0.0")
 	REAL (ymax, U"right Vertical range", U"0.0 (= auto)")
 	SENTENCE (markColumn_string, U"Column with labels", U"")
-	LABEL (U"", U"Distances are in units of 'bar width'")
+	LABEL (U"Distances are in units of 'bar width'")
 	REAL (distanceFromBorder, U"Distance of first bar from border", U"1.0")
 	REAL (distanceBetweenGroups, U"Distance between bar groups", U"1.0")
 	REAL (distanceWithinGroup, U"Distance between bars within group", U"0.0")
 	SENTENCE (colours, U"Colours", U"Grey")
-	REAL (angle_degrees, U"Label text angle (degrees)", U"0.0");
+	REAL (angle, U"Label text angle (degrees)", U"0.0");
 	BOOLEAN (garnish, U"Garnish", true)
-	LABEL (U"", U"Use only data from rows where the following condition holds:")
-	TEXTFIELD (formula, U"Formula", U"row >= 1 and row <= 8")
+	TEXTFIELD (formula, U"Use only data from rows where the following condition holds:", U"row >= 1 and row <= 8")
 	OK
 DO
 	GRAPHICS_EACH (Table)
-		Table_barPlotWhere (me, GRAPHICS, yColumns_string, ymin, ymax, markColumn_string, distanceFromBorder, distanceWithinGroup, distanceBetweenGroups, colours, angle_degrees, garnish, formula, interpreter);
+		Table_barPlotWhere (me, GRAPHICS, yColumns_string, ymin, ymax, markColumn_string, distanceFromBorder, distanceWithinGroup, distanceBetweenGroups, colours, angle, garnish, formula, interpreter);
 	GRAPHICS_EACH_END
 }
 
@@ -6182,16 +6171,15 @@ FORM (GRAPHICS_Table_LineGraphWhere, U"Table: Line graph where", U"Table: Line g
 	REAL (xmin, U"left Horizontal range", U"0.0")
 	REAL (xmax, U"right Horizontal range", U"0.0 (= auto)")
 	WORD (text, U"Text", U"+")
-	REAL (angle_degrees, U"Label text angle (degrees)", U"0.0");
+	REAL (angle, U"Label text angle (degrees)", U"0.0");
 	BOOLEAN (garnish, U"Garnish", true)
-	LABEL (U"", U"Use only data from rows where the following condition holds:")
-	TEXTFIELD (formula, U"Formula", U"1; (= everything)")
+	TEXTFIELD (formula, U"Use only data from rows where the following condition holds:", U"1; (= everything)")
 	OK
 DO
 	GRAPHICS_EACH (Table)
 		long ycolumn = Table_getColumnIndexFromColumnLabel (me, yColumn_string);
 		long xcolumn = Table_findColumnIndexFromColumnLabel (me, xColumn_string);
-		Table_lineGraphWhere (me, GRAPHICS, xcolumn, xmin, xmax,ycolumn, ymin, ymax, text, angle_degrees, garnish, formula, interpreter);
+		Table_lineGraphWhere (me, GRAPHICS, xcolumn, xmin, xmax,ycolumn, ymin, ymax, text, angle, garnish, formula, interpreter);
 	GRAPHICS_EACH_END
 }
 
@@ -6215,8 +6203,7 @@ FORM (GRAPHICS_Table_boxPlotsWhere, U"Table: Box plots where", U"Table: Box plot
 	REAL (ymin, U"left Vertical range", U"0.0")
 	REAL (ymax, U"right Vertical range", U"0.0")
 	BOOLEAN (garnish, U"Garnish", true);
-	LABEL (U"", U"Use only data in rows where the following condition holds:")
-	TEXTFIELD (formula, U"Formula", U"1; self$[\"gender\"]=\"male\"")
+	TEXTFIELD (formula, U"Use only data in rows where the following condition holds:", U"1; self$[\"gender\"]=\"male\"")
 	OK
 DO
 	GRAPHICS_EACH (Table)
@@ -6234,8 +6221,7 @@ FORM (GRAPHICS_Table_drawEllipseWhere, U"Draw ellipse (standard deviation)", nul
 	REAL (ymax, U"right Vertical range", U"0.0 (= auto)")
 	POSITIVE (numberOfSigmas, U"Number of sigmas", U"2.0")
 	BOOLEAN (garnish, U"Garnish", true)
-	LABEL (U"", U"Use only data in rows where the following condition holds:")
-	TEXTFIELD (formula, U"Formula", U"1; self$[\"gender\"]=\"male\"")
+	TEXTFIELD (formula, U"Use only data in rows where the following condition holds:", U"1; self$[\"gender\"]=\"male\"")
 	OK
 DO
 	GRAPHICS_EACH (Table)
@@ -6278,8 +6264,7 @@ FORM (GRAPHICS_Table_drawEllipsesWhere, U"Table: Draw ellipses where", nullptr)
 	POSITIVE (numberOfSigmas, U"Number of sigmas", U"1.0")
 	INTEGER (fontSize, U"Font size", U"12 (0 = no label)")
 	BOOLEAN (garnish, U"Garnish", true)
-	LABEL (U"", U"Use only data in rows where the following condition holds:")
-	TEXTFIELD (formula, U"Formula", U"1; self$[\"gender\"]=\"male\"")
+	TEXTFIELD (formula, U"Use only data in rows where the following condition holds:", U"1; self$[\"gender\"]=\"male\"")
 	
 	OK
 DO
@@ -6314,8 +6299,7 @@ FORM (GRAPHICS_Table_normalProbabilityPlotWhere, U"Table: Normal probability plo
 	NATURAL (labelSize, U"Label size", U"12")
 	WORD (label, U"Label", U"+")
 	BOOLEAN (garnish, U"Garnish", true);
-	LABEL (U"", U"Use only data in rows where the following condition holds:")
-	TEXTFIELD (formula, U"Formula", U"1; self$[\"gender\"]=\"male\"")
+	TEXTFIELD (formula, U"Use only data in rows where the following condition holds:", U"1; self$[\"gender\"]=\"male\"")
 	OK
 DO
 	GRAPHICS_EACH (Table)
@@ -6392,8 +6376,7 @@ FORM (GRAPHICS_Table_lagPlotWhere, U"Table: lag plot where", nullptr) {
 	NATURAL (labelSize, U"Label size", U"12")
 	WORD (label, U"Label", U"+")
 	BOOLEAN (garnish, U"Garnish", true);
-	LABEL (U"", U"Use only data in rows where the following condition holds:")
-	TEXTFIELD (formula, U"Formula", U"1; self$[\"gender\"]=\"male\"")
+	TEXTFIELD (formula, U"Use only data in rows where the following condition holds:", U"1; self$[\"gender\"]=\"male\"")
 	OK
 DO
 	GRAPHICS_EACH (Table)
@@ -6406,7 +6389,7 @@ FORM (GRAPHICS_Table_distributionPlot, U"Table: Distribution plot", nullptr) {
 	WORD (dataColumn_string, U"Data column", U"data")
 	REAL (minimumValue, U"Minimum value", U"0.0")
 	REAL (maximumValue, U"Maximum value", U"0.0")
-	LABEL (U"", U"Display of the distribution")
+	LABEL (U"Display of the distribution")
 	NATURAL (numberOfBins, U"Number of bins", U"10")
 	REAL (minimumFrequency, U"Minimum frequency", U"0.0")
 	REAL (maximumFrequency, U"Maximum frequency", U"0.0")
@@ -6423,13 +6406,12 @@ FORM (GRAPHICS_Table_distributionPlotWhere, U"Table: Distribution plot where", n
 	WORD (dataColumn_string, U"Data column", U"data")
 	REAL (minimumValue, U"Minimum value", U"0.0")
 	REAL (maximumValue, U"Maximum value", U"0.0")
-	LABEL (U"", U"Display of the distribution")
+	LABEL (U"Display of the distribution")
 	NATURAL (numberOfBins, U"Number of bins", U"10")
 	REAL (minimumFrequency, U"Minimum frequency", U"0.0")
 	REAL (maximumFrequency, U"Maximum frequency", U"0.0")
 	BOOLEAN (garnish, U"Garnish", true)
-	LABEL (U"", U"Use only data in rows where the following condition holds:")
-	TEXTFIELD (formula, U"Formula", U"1; self$[\"gender\"]=\"male\"")
+	TEXTFIELD (formula, U"Use only data in rows where the following condition holds:", U"1; self$[\"gender\"]=\"male\"")
 	OK
 DO
 	GRAPHICS_EACH (Table)
@@ -6471,8 +6453,7 @@ FORM (GRAPHICS_Table_horizontalErrorBarsPlotWhere, U"Table: Horizontal error bar
 	WORD (upperErrorColumn_string, U"Upper error value column", U"error2")
 	REAL (barSize_mm, U"Bar size (mm)", U"1.0")
 	BOOLEAN (garnish, U"Garnish", true);
-	LABEL (U"", U"Use only data in rows where the following condition holds:")
-	TEXTFIELD (formula, U"Formula", U"1; self$[\"gender\"]=\"male\"")
+	TEXTFIELD (formula, U"Use only data in rows where the following condition holds:", U"1; self$[\"gender\"]=\"male\"")
 	OK
 DO
 	GRAPHICS_EACH (Table)
@@ -6517,8 +6498,7 @@ FORM (GRAPHICS_Table_verticalErrorBarsPlotWhere, U"Table: Vertical error bars pl
 	WORD (upperErrorColumn_string, U"Upper error value column", U"error2")
 	REAL (barSize_mm, U"Bar size (mm)", U"1.0")
 	BOOLEAN (garnish, U"Garnish", true);
-	LABEL (U"", U"Use only data in rows where the following condition holds:")
-	TEXTFIELD (formula, U"Formula", U"1; self$[\"gender\"]=\"male\"")
+	TEXTFIELD (formula, U"Use only data in rows where the following condition holds:", U"1; self$[\"gender\"]=\"male\"")
 	OK
 DO
 	GRAPHICS_EACH (Table)
@@ -6531,8 +6511,7 @@ DO
 }
 
 FORM (NEW_Table_extractRowsWhere, U"Table: Extract rows where", nullptr) {
-	LABEL (U"", U"Extract rows where the following condition holds:")
-	TEXTFIELD (formula, U"Formula", U"1; self$[\"gender\"]=\"male\"")
+	TEXTFIELD (formula, U"Extract rows where the following condition holds:", U"1; self$[\"gender\"]=\"male\"")
 	OK
 DO
 	CONVERT_EACH (Table)
@@ -6545,23 +6524,21 @@ FORM (NEW_Table_extractRowsMahalanobisWhere, U"Table: Extract rows where (mahala
 	RADIO_ENUM (haveAMahalanobisDistance, U"...have a mahalanobis distance...", kMelder_number, GREATER_THAN)
 	REAL (numberOfSigmas, U"...the number", U"2.0")
 	WORD (factorColumn_string, U"Factor column", U"")
-	LABEL (U"", U"Process only rows where the following condition holds:")
-	TEXTFIELD (formula, U"Formula", U"1; self$[\"gender\"]=\"male\"")
+	TEXTFIELD (formula, U"Process only rows where the following condition holds:", U"1; self$[\"gender\"]=\"male\"")
 	OK
 DO
 	CONVERT_EACH (Table)
-		autoTable result = Table_extractMahalanobisWhere(me, dataColumns_string, factorColumn_string, numberOfSigmas, haveAMahalanobisDistance, formula, interpreter);
+		autoTable result = Table_extractMahalanobisWhere (me, dataColumns_string, factorColumn_string, numberOfSigmas, haveAMahalanobisDistance, formula, interpreter);
 	CONVERT_EACH_END (my name, U"_mahalanobis")
 }
 
 FORM (NEW_Table_extractColumnRanges, U"Table: Extract column ranges", nullptr) {
-	LABEL (U"", U"Create a new Table from the following columns:")
-	TEXTFIELD (columnRanges_string, U"Ranges", U"1 2")
-	LABEL (U"", U"To supply rising or falling ranges, use e.g. 2:6 or 5:3.")
+	TEXTFIELD (columnRanges, U"Create a new Table from the following columns:", U"1 2")
+	LABEL (U"To supply rising or falling ranges, use e.g. 2:6 or 5:3.")
 	OK
 DO
 	CONVERT_EACH (Table)
-		autoTable result = Table_extractColumnRanges (me, columnRanges_string);
+		autoTable result = Table_extractColumnRanges (me, columnRanges);
 	CONVERT_EACH_END (my name, U"_columns")
 }
 
@@ -6666,12 +6643,12 @@ DO
 	GRAPHICS_EACH_END
 
 FORM (GRAPHICS_TableOfReal_drawScatterPlot, U"TableOfReal: Draw scatter plot", U"TableOfReal: Draw scatter plot...") {
-	LABEL (U"", U"Select the part of the table")
+	LABEL (U"Select the part of the table")
 	NATURAL (xColumn, U"Horizontal axis column number", U"1")
 	NATURAL (yColumn, U"Vertical axis column number", U"2")
 	INTEGER (fromRow, U"left Row number range", U"0")
 	INTEGER (toRow, U"right Row number range", U"0")
-	LABEL (U"", U"Select the drawing area limits")
+	LABEL (U"Select the drawing area limits")
 	REAL (xmin, U"left Horizontal range", U"0.0")
 	REAL (xmax, U"right Horizontal range", U"0.0")
 	REAL (ymin, U"left Vertical range", U"0.0")
@@ -6699,7 +6676,7 @@ DO
 }
 
 FORM (GRAPHICS_TableOfReal_drawBiplot, U"TableOfReal: Draw biplot", U"TableOfReal: Draw biplot...") {
-	LABEL (U"", U"")
+	LABEL (U"")
 	REAL (xmin, U"left Horizontal range", U"0.0")
 	REAL (xmax, U"right Horizontal range", U"0.0")
 	REAL (ymin, U"left Vertical range", U"0.0")
@@ -6715,12 +6692,12 @@ DO
 }
 
 FORM (GRAPHICS_TableOfReal_drawVectors, U"Draw vectors", U"TableOfReal: Draw vectors...") {
-	LABEL (U"", U"From (x1, y1) to (x2, y2)")
+	LABEL (U"From (x1, y1) to (x2, y2)")
 	NATURAL (x1Column, U"X1 column", U"1")
 	NATURAL (y1Column, U"Y1 column", U"2")
 	NATURAL (x2Column, U"X2 column", U"3")
 	NATURAL (y2Column, U"Y2 column", U"4")
-	LABEL (U"", U"Select the drawing area")
+	LABEL (U"Select the drawing area")
 	REAL (xmin, U"left Horizontal range", U"0.0")
 	REAL (xmax, U"right Horizontal range", U"0.0")
 	REAL (ymin, U"left Vertical range", U"0.0")
@@ -6739,14 +6716,14 @@ DO
 }
 
 FORM (GRAPHICS_TableOfReal_drawRowAsHistogram, U"Draw row as histogram", U"TableOfReal: Draw rows as histogram...") {
-	LABEL (U"", U"Select from the table")
+	LABEL (U"Select from the table")
 	WORD (rowNumber, U"Row number", U"1")
 	INTEGER (fromColumn, U"left Column range", U"0")
 	INTEGER (toColumn, U"right Column range", U"0")
-	LABEL (U"", U"Vertical drawing range")
+	LABEL (U"Vertical drawing range")
 	REAL (ymin, U"left Vertical range", U"0.0")
 	REAL (ymax, U"right Vertical range", U"0.0")
-	LABEL (U"", U"Offset and distance in units of 'bar width'")
+	LABEL (U"Offset and distance in units of 'bar width'")
 	REAL (xOffset, U"Horizontal offset", U"0.5")
 	REAL (distanceBetweenBars, U"Distance between bars", U"1.0")
 	WORD (greys, U"Grey value (1=white)", U"0.7")
@@ -6759,14 +6736,14 @@ DO
 }
 
 FORM (GRAPHICS_TableOfReal_drawRowsAsHistogram, U"Draw rows as histogram", U"TableOfReal: Draw rows as histogram...") {
-	LABEL (U"", U"Select from the table")
+	LABEL (U"Select from the table")
 	SENTENCE (rowNumbers_string, U"Row numbers", U"1 2")
 	INTEGER (fromColumn, U"left Column range", U"0")
 	INTEGER (toColumn, U"right Column range", U"0")
-	LABEL (U"", U"Vertical drawing range")
+	LABEL (U"Vertical drawing range")
 	REAL (ymin, U"left Vertical range", U"0.0")
 	REAL (ymax, U"right Vertical range", U"0.0")
-	LABEL (U"", U"Offset and distance in units of 'bar width'")
+	LABEL (U"Offset and distance in units of 'bar width'")
 	REAL (xOffset, U"Horizontal offset", U"1.0")
 	REAL (distanceBetweenBarGroups, U"Distance between bar groups", U"1.0")
 	REAL (distanceBetweenBars, U"Distance between bars", U"0.0")
@@ -6994,7 +6971,7 @@ DO
 /***** TableOfReal and FilterBank  *****/
 
 FORM (MODIFY_TextGrid_extendTime, U"TextGrid: Extend time", U"TextGrid: Extend time...") {
-	LABEL (U"", U"")
+	LABEL (U"")
 	POSITIVE (extendDomainBy, U"Extend domain by (s)", U"1.0")
 	RADIO (position, U"At", 1)
 		RADIOBUTTON (U"End")
@@ -7007,7 +6984,7 @@ DO
 }
 
 FORM (MODIFY_TextGrid_replaceIntervalTexts, U"TextGrid: Replace interval text", U"TextGrid: Replace interval text...") {
-	LABEL (U"", U"")
+	LABEL (U"")
 	NATURAL (tierNumber, U"Tier number", U"1")
 	INTEGER (fromInterval, U"left Interval range", U"0")
 	INTEGER (toInterval, U"right Interval range", U"0")
@@ -7019,13 +6996,13 @@ FORM (MODIFY_TextGrid_replaceIntervalTexts, U"TextGrid: Replace interval text",
 	OK
 DO
 	MODIFY_EACH (TextGrid)
-		long nmatches, nstringmatches;
+		integer nmatches, nstringmatches;
 		TextGrid_changeLabels (me, tierNumber, fromInterval, toInterval, search_string, replace_string, searchType - 1, &nmatches, &nstringmatches);
 	MODIFY_EACH_END
 }
 
 FORM (MODIFY_TextGrid_replacePointTexts, U"TextGrid: Replace point text", U"TextGrid: Replace point text...") {
-	LABEL (U"", U"")
+	LABEL (U"")
 	NATURAL (tierNumber, U"Tier number", U"1")
 	INTEGER (fromInterval, U"left Interval range", U"0")
 	INTEGER (toInterval, U"right Interval range", U"0")
@@ -7037,7 +7014,7 @@ FORM (MODIFY_TextGrid_replacePointTexts, U"TextGrid: Replace point text", U"Text
 	OK
 DO
 	MODIFY_EACH (TextGrid)
-		long nmatches, nstringmatches;
+		integer nmatches, nstringmatches;
 		TextGrid_changeLabels (me, tierNumber, fromInterval, toInterval, search_string, replace_string, searchType - 1, &nmatches, &nstringmatches);
 	MODIFY_EACH_END
 }
diff --git a/dwtools/praat_HMM_init.cpp b/dwtools/praat_HMM_init.cpp
index 73713b9..6ad976c 100644
--- a/dwtools/praat_HMM_init.cpp
+++ b/dwtools/praat_HMM_init.cpp
@@ -247,7 +247,7 @@ FORM (NEW1_HMM_createContinuousModel, U"HMM: Create continuous model", nullptr)
 	BOOLEAN (leftToRightModel, U"Left to right model", false)
 	NATURAL (numberOfStates, U"Number of states", U"3")
 	NATURAL (numberOfSymbols, U"Number of symbols", U"10")
-	LABEL (U"", U"For the Gaussian mixtures:")
+	LABEL (U"For the Gaussian mixtures:")
 	NATURAL (numberOfComponents, U"Number of components", U"3")
 	NATURAL (componentDimension, U"Dimension of component", U"39")
 	OPTIONMENU (matricesType, U"Covariance matrices are", 1)
@@ -262,7 +262,7 @@ DO
 }
 
 FORM (NEW_HMMObservationSequence_to_HMM, U"HMMObservationSequence: To HMM", nullptr) {
-	LABEL (U"", U"(0 states gives a non-hidden model) ")
+	LABEL (U"(0 states gives a non-hidden model) ")
 	INTEGER (numberOfHiddenStates, U"Number of hidden states", U"2")
 	BOOLEAN (leftToRightModel, U"Left to right model", false)
 	OK
diff --git a/dwtools/praat_KlattGrid_init.cpp b/dwtools/praat_KlattGrid_init.cpp
index b32ef84..0e37d75 100644
--- a/dwtools/praat_KlattGrid_init.cpp
+++ b/dwtools/praat_KlattGrid_init.cpp
@@ -158,7 +158,7 @@ FORM (NEW1_KlattGrid_create, U"Create KlattGrid", U"Create KlattGrid...") {
 	INTEGER (numberOfNasalFormants, U"Number of nasal formants", U"1")
 	INTEGER (numberOfNasalAntiFormants, U"Number of nasal antiformants", U"1")
 	INTEGER (numberOfFricationFormants, U"Number of frication formants", U"6")
-	LABEL (U"", U"Coupling between source and filter")
+	LABEL (U"Coupling between source and filter")
 	INTEGER (numberOfTrachealFormants, U"Number of tracheal formants", U"1")
 	INTEGER (numberOfTrachealAntiFormants, U"Number of tracheal antiformants", U"1")
 	INTEGER (numberOfDeltaFormants, U"Number of delta formants", U"1")
@@ -320,9 +320,8 @@ KlattGrid_PHONATION_GET_ADD_REMOVE_EXTRACT_REPLACE (FricationBypass, frication b
 
 #define KlattGrid_FORMULA_FORMANT_FBA_VALUE(Name,namef,ForBs,forbs,textfield,formantType,label)  \
 FORM (MODIFY_KlattGrid_formula##Name##Formant##ForBs, U"KlattGrid: Formula (" #namef "ormant " #forbs ")", U"Formant: Formula (" #forbs ")...") { \
-	LABEL (U"", U"row is formant number, col is point number:\nfor row from 1 to nrow do for col from 1 to ncol do " #ForBs " (row, col) :=") \
-	LABEL (U"", label) \
-	TEXTFIELD (formula, U"formula", textfield) \
+	LABEL (U"row is formant number, col is point number:\nfor row from 1 to nrow do for col from 1 to ncol do " #ForBs " (row, col) :=") \
+	TEXTFIELD (formula, U"Formula:", textfield) \
 	OK \
 DO \
 	MODIFY_EACH (KlattGrid); \
@@ -480,8 +479,8 @@ DIRECT (NEW_KlattGrid_extractPointProcess_glottalClosures) {
 
 FORM (MODIFY_KlattGrid_formula_frequencies, U"KlattGrid: Formula (frequencies)", U"Formant: Formula (frequencies)...") {
 	KlattGrid_6formants_addCommonField (formantType)
-	LABEL (U"", U"row is formant number, col is point number: for row from 1 to nrow do for col from 1 to ncol do F (row, col) :=")
-	TEXTFIELD (formula, U"formula", U"if row = 2 then self + 200 else self fi")
+	LABEL (U"row is formant number, col is point number: for row from 1 to nrow do for col from 1 to ncol do F (row, col) :=")
+	TEXTFIELD (formula, U"Formula:", U"if row = 2 then self + 200 else self fi")
 	OK
 DO
 	MODIFY_EACH (KlattGrid)
@@ -491,8 +490,8 @@ DO
 
 FORM (MODIFY_KlattGrid_formula_bandwidths, U"KlattGrid: Formula (bandwidths)", U"Formant: Formula (bandwidths)...") {
 	KlattGrid_6formants_addCommonField (formantType)
-	LABEL (U"", U"row is formant number, col is point number: for row from 1 to nrow do for col from 1 to ncol do F (row, col) :=")
-	TEXTFIELD (formula, U"formula", U"if row = 2 then self + 200 else self fi")
+	LABEL (U"row is formant number, col is point number: for row from 1 to nrow do for col from 1 to ncol do F (row, col) :=")
+	TEXTFIELD (formula, U"Formula:", U"if row = 2 then self + 200 else self fi")
 	OK
 DO
 	MODIFY_EACH (KlattGrid)
diff --git a/dwtools/praat_MDS_init.cpp b/dwtools/praat_MDS_init.cpp
index ac8093c..27a2dcb 100644
--- a/dwtools/praat_MDS_init.cpp
+++ b/dwtools/praat_MDS_init.cpp
@@ -59,9 +59,9 @@ static const char32 *CONFIGURATION_BUTTON = U"To Configuration -";
 */
 static void TabelOfReal_testSorting (TableOfReal me, long rowtoindex) {
 	try {
-		long  nc = my numberOfColumns;
+		integer nc = my numberOfColumns;
 
-		autoNUMvector<long> index (1, nc);
+		autoNUMvector <integer> index (1, nc);
 		if (my numberOfRows < 6) {
 			Melder_throw (U"TabelOfReal_sort2: we want at least 6 rows!!");
 		}
@@ -79,8 +79,8 @@ static void TabelOfReal_testSorting (TableOfReal me, long rowtoindex) {
 		NUMsort2 (nc, my data[4], my data[5]);
 
 		NUMindexx (my data[rowtoindex], nc, index.peek());
-		for (long i = 1; i <= nc; i++) {
-			my data[6][i] = index[i];
+		for (integer i = 1; i <= nc; i ++) {
+			my data [6] [i] = index [i];
 		}
 	} catch (MelderError) {
 		Melder_throw (me, U": sorting test not ok.");
@@ -102,7 +102,7 @@ DO
 /************************* examples ***************************************/
 
 FORM (NEW1_Dissimilarity_createLetterRExample, U"Create letter R example", U"Create letter R example...") {
-	LABEL (U"", U"For the monotone transformation on the distances")
+	LABEL (U"For the monotone transformation on the distances")
 	REAL (noiseRange, U"Noise range", U"32.5")
 	OK
 DO
@@ -122,8 +122,7 @@ FORM (NEW1_Configuration_create, U"Create Configuration", U"Create Configuration
 	WORD (name, U"Name", U"uniform")
 	NATURAL (numberOfPoints, U"Number of points", U"10")
 	NATURAL (numberOfDimensions, U"Number of dimensions", U"2")
-	LABEL (U"", U"Formula:")
-	TEXTFIELD (formula, U"formula", U"randomUniform(-1.5, 1.5)")
+	TEXTFIELD (formula, U"Formula:", U"randomUniform(-1.5, 1.5)")
 	OK
 DO
 	CREATE_ONE
@@ -299,7 +298,7 @@ DIRECT (MODIFY_Configuration_randomize) {
 
 FORM (MODIFY_Configuration_normalize, U"Configuration: Normalize", U"Configuration: Normalize...") {
 	REAL (sumOfSquares, U"Sum of squares", U"0.0")
-	LABEL (U"", U"On (INDSCAL), Off (Kruskal)")
+	LABEL (U"On (INDSCAL), Off (Kruskal)")
 	BOOLEAN (separateDimensions, U"Each dimension separately", true)
 	OK
 DO
@@ -501,7 +500,7 @@ DO
 /**************** Dissimilarity ***************************************/
 
 #define praat_Dissimilarity_to_Configuration_commonFields(tolerance,maximumNumberOfIterations,numberOfRepetitions) \
-	LABEL (U"", U"Minimization parameters") \
+	LABEL (U"Minimization parameters") \
 	REAL (tolerance, U"Tolerance", U"1e-5") \
 	NATURAL (maximumNumberOfIterations, U"Maximum number of iterations", U"50 (= each repetition)") \
 	NATURAL (numberOfRepetitions, U"Number of repetitions", U"1")
@@ -594,7 +593,7 @@ DO
 }
 
 FORM (NEW1_Dissimilarity_Configuration_ispline_mds, U"Dissimilarity & Configuration: To Configuration (i-spline mds)", U"Dissimilarity & Configuration: To Configuration (i-spline mds)...") {
-	LABEL (U"", U"Spline smoothing")
+	LABEL (U"Spline smoothing")
 	INTEGER (numberOfInteriorKnots, U"Number of interior knots", U"1")
 	INTEGER (order, U"Order of I-spline", U"1")
 	praat_Dissimilarity_to_Configuration_commonFields (tolerance,maximumNumberOfIterations,numberOfRepetitions)
@@ -650,7 +649,7 @@ DO
 }
 
 FORM (NEW1_Dissimilarity_Configuration_Weight_ispline_mds,  U"Dissimilarity & Configuration & Weight: To Configuration (i-spline mds)", U"Dissimilarity & Configuration & Weight: To Configuration...") {
-	LABEL (U"", U"Spline smoothing")
+	LABEL (U"Spline smoothing")
 	INTEGER (numberOfInteriorKnots, U"Number of interior knots", U"1")
 	INTEGER (order, U"Order of I-spline", U"1")
 	praat_Dissimilarity_to_Configuration_commonFields (tolerance,maximumNumberOfIterations,numberOfRepetitions)
@@ -830,7 +829,7 @@ DO
 }
 
 FORM (NEW_Dissimilarity_to_Configuration_kruskal, U"Dissimilarity: To Configuration (kruskal)", U"Dissimilarity: To Configuration (kruskal)...") {
-	LABEL (U"", U"Configuration")
+	LABEL (U"Configuration")
 	NATURAL (numberOfDimensions, U"Number of dimensions", U"2")
 	NATURAL (distanceMetric, U"Distance metric", U"2 (= Euclidean)")
 	RADIO (tiesHandling, U"Handling of ties", 1)
@@ -848,7 +847,7 @@ DO
 }
 
 FORM (NEW_Dissimilarity_to_Configuration_absolute_mds, U"Dissimilarity: To Configuration (absolute mds)", U"Dissimilarity: To Configuration (absolute mds)...") {
-	LABEL (U"", U"Configuration")
+	LABEL (U"Configuration")
 	NATURAL (numberOfDimensions, U"Number of dimensions", U"2")
 	praat_Dissimilarity_to_Configuration_commonFields(tolerance,maximumNumberOfIterations,numberOfRepetitions)	
 	OK
@@ -860,7 +859,7 @@ DO
 }
 
 FORM (NEW_Dissimilarity_to_Configuration_ratio_mds, U"Dissimilarity: To Configuration (ratio mds)", U"Dissimilarity: To Configuration (ratio mds)...") {
-	LABEL (U"", U"Configuration")
+	LABEL (U"Configuration")
 	NATURAL (numberOfDimensions, U"Number of dimensions", U"2")
 	praat_Dissimilarity_to_Configuration_commonFields(tolerance,maximumNumberOfIterations,numberOfRepetitions)	
 	OK
@@ -872,7 +871,7 @@ DO
 }
 
 FORM (NEW_Dissimilarity_to_Configuration_interval_mds, U"Dissimilarity: To Configuration (interval mds)", U"Dissimilarity: To Configuration (interval mds)...") {
-	LABEL (U"", U"Configuration")
+	LABEL (U"Configuration")
 	NATURAL (numberOfDimensions, U"Number of dimensions", U"2")
 	praat_Dissimilarity_to_Configuration_commonFields(tolerance,maximumNumberOfIterations,numberOfRepetitions)	
 	OK
@@ -884,7 +883,7 @@ DO
 }
 
 FORM (NEW_Dissimilarity_to_Configuration_monotone_mds, U"Dissimilarity: To Configuration (monotone mds)", U"Dissimilarity: To Configuration (monotone mds)...") {
-	LABEL (U"", U"Configuration")
+	LABEL (U"Configuration")
 	NATURAL (numberOfDimensions, U"Number of dimensions", U"2")
 	RADIO (tiesHandling, U"Handling of ties", 1)
 		RADIOBUTTON (U"Primary approach")
@@ -899,9 +898,9 @@ DO
 }
 
 FORM (NEW_Dissimilarity_to_Configuration_ispline_mds, U"Dissimilarity: To Configuration (i-spline mds)", U"Dissimilarity: To Configuration (i-spline mds)...") {
-	LABEL (U"", U"Configuration")
+	LABEL (U"Configuration")
 	NATURAL (numberOfDimensions, U"Number of dimensions", U"2")
-	LABEL (U"", U"Spline smoothing")
+	LABEL (U"Spline smoothing")
 	INTEGER (numberOfInteriorKnots, U"Number of interior knots", U"1")
 	INTEGER (order, U"Order of I-spline", U"1")
 	praat_Dissimilarity_to_Configuration_commonFields(tolerance,maximumNumberOfIterations,numberOfRepetitions)	
@@ -917,9 +916,9 @@ DO
 }
 
 FORM (NEW1_Dissimilarity_Weight_ispline_mds, U"Dissimilarity & Weight: To Configuration (i-spline mds)", U"Dissimilarity & Weight: To Configuration (i-spline mds)...") {
-	LABEL (U"", U"Configuration")
+	LABEL (U"Configuration")
 	NATURAL (numberOfDimensions, U"Number of dimensions", U"2")
-	LABEL (U"", U"Spline smoothing")
+	LABEL (U"Spline smoothing")
 	INTEGER (numberOfInteriorKnots, U"Number of interior knots", U"1")
 	INTEGER (order, U"Order of I-spline", U"1")
 	praat_Dissimilarity_to_Configuration_commonFields(tolerance,maximumNumberOfIterations,numberOfRepetitions)	
@@ -935,7 +934,7 @@ DO
 }
 
 FORM (NEW1_Dissimilarity_Weight_absolute_mds, U"Dissimilarity & Weight: To Configuration (absolute mds)", U"Dissimilarity & Weight: To Configuration (absolute mds)...") {
-	LABEL (U"", U"Configuration")
+	LABEL (U"Configuration")
 	NATURAL (numberOfDimensions, U"Number of dimensions", U"2")
 	praat_Dissimilarity_to_Configuration_commonFields(tolerance,maximumNumberOfIterations,numberOfRepetitions)	
 	OK
@@ -947,7 +946,7 @@ DO
 }
 
 FORM (NEW1_Dissimilarity_Weight_ratio_mds, U"Dissimilarity & Weight: To Configuration (ratio mds)", U"Dissimilarity & Weight: To Configuration (ratio mds)...") {
-	LABEL (U"", U"Configuration")
+	LABEL (U"Configuration")
 	NATURAL (numberOfDimensions, U"Number of dimensions", U"2")
 	praat_Dissimilarity_to_Configuration_commonFields(tolerance,maximumNumberOfIterations,numberOfRepetitions)	
 	OK
@@ -959,7 +958,7 @@ DO
 }
 
 FORM (NEW1_Dissimilarity_Weight_interval_mds, U"Dissimilarity & Weight: To Configuration (interval mds)", U"Dissimilarity & Weight: To Configuration (interval mds)...") {
-	LABEL (U"", U"Configuration")
+	LABEL (U"Configuration")
 	NATURAL (numberOfDimensions, U"Number of dimensions", U"2")
 	praat_Dissimilarity_to_Configuration_commonFields(tolerance,maximumNumberOfIterations,numberOfRepetitions)	
 	OK
@@ -971,7 +970,7 @@ DO
 }
 
 FORM (NEW1_Dissimilarity_Weight_monotone_mds, U"Dissimilarity & Weight: To Configuration (monotone mds)", U"Dissimilarity & Weight: To Configuration (monotone mds)...") {
-	LABEL (U"", U"Configuration")
+	LABEL (U"Configuration")
 	NATURAL (numberOfDimensions, U"Number of dimensions", U"2")
 	RADIO (tiesHandling, U"Handling of ties", 1)
 		RADIOBUTTON (U"Primary approach")
@@ -1020,7 +1019,7 @@ DIRECT (NEW_Distance_to_Dissimilarity) {
 FORM (NEWMANY_old_Distances_to_Configuration_indscal, U"Distance: To Configuration (indscal)", U"Distance: To Configuration (indscal)...") {
 	NATURAL (numberOfDimensions, U"Number of dimensions", U"2")
 	BOOLEAN (normalizeScalarProducts, U"Normalize scalar products", true)
-	LABEL (U"", U"Minimization parameters")
+	LABEL (U"Minimization parameters")
 	REAL (tolerance, U"Tolerance", U"1e-5")
 	NATURAL (maximumNumberOfIterations, U"Maximum number of iterations", U"100 (= each repetition)")
 	NATURAL (numberOfRepetitions, U"Number of repetitions", U"1")
@@ -1038,7 +1037,7 @@ DO
 FORM (NEWMANY_Distances_to_Configuration_indscal, U"Distance: To Configuration (indscal)", U"Distance: To Configuration (indscal)...") {
 	NATURAL (numberOfDimensions, U"Number of dimensions", U"2")
 	BOOLEAN (normalizeScalarProducts, U"Normalize scalar products", true)
-	LABEL (U"", U"Minimization parameters")
+	LABEL (U"Minimization parameters")
 	REAL (tolerance, U"Tolerance", U"1e-5")
 	NATURAL (maximumNumberOfIterations, U"Maximum number of iterations", U"100 (= each repetition)")
 	NATURAL (numberOfRepetitions, U"Number of repetitions", U"1")
@@ -1074,7 +1073,7 @@ DO
 
 FORM (NEWMANY_Distance_Configuration_indscal, U"Distance & Configuration: To Configuration (indscal)", U"Distance & Configuration: To Configuration (indscal)...") {
 	BOOLEAN (normalizeScalarProducts, U"Normalize scalar products", true)
-	LABEL (U"", U"Minimization parameters")
+	LABEL (U"Minimization parameters")
 	REAL (tolerance, U"Tolerance", U"1e-5")
 	NATURAL (maximumNumberOfIterations, U"Maximum number of iterations", U"100 (= each repetition)")
 	OK
@@ -1123,7 +1122,7 @@ DO
 
 FORM (NEWMANY_Distance_Configuration_Salience_indscal, U"Distance & Configuration & Salience: To Configuration (indscal)", U"Distance & Configuration & Salience: To Configuration (indscal)...") {
 	BOOLEAN (normalizeScalarProducts, U"Normalize scalar products", true)
-	LABEL (U"", U"Minimization parameters")
+	LABEL (U"Minimization parameters")
 	REAL (tolerance, U"Tolerance", U"1e-5")
 	NATURAL (maximumNumberOfIterations, U"Maximum number of iterations", U"100")
 	OK
diff --git a/external/gsl/Makefile b/external/gsl/Makefile
index e11e06e..000c479 100644
--- a/external/gsl/Makefile
+++ b/external/gsl/Makefile
@@ -1,10 +1,11 @@
 # Makefile for library gsl. This file was generated by the program flatten_gsl.py
 # David Weenink, 22 February 2010
 # Paul Boersma 2017-08-08: brought dependencies in line with include directories
+# Paul Boersma 2017-10-02: removed dependencies on sys/*.h and dwsys/*.h
 
 include ../../makefile.defs
 
-CPPFLAGS = -I ../../sys -I ../../dwsys
+CPPFLAGS =
 
 OBJECTS = gsl_blas__blas.o gsl_block__block.o gsl_block__file.o \
    gsl_block__init.o gsl_bspline__bspline.o gsl_cblas__caxpy.o \
@@ -219,4 +220,4 @@ libgsl.a: $(OBJECTS)
 	$(AR) cq libgsl.a $(OBJECTS)
 	$(RANLIB) libgsl.a
 
-$(OBJECTS): *.h ../../sys/*.h ../../dwsys/*.h
+$(OBJECTS): *.h
diff --git a/external/mp3/mp3.h b/external/mp3/mp3.h
index 2e56ead..9ab3ac0 100644
--- a/external/mp3/mp3.h
+++ b/external/mp3/mp3.h
@@ -21,6 +21,7 @@
 
 #include <sys/types.h>
 #include <stdio.h>
+#include "melder.h"   // for integer
 
 /* The following function is used to identify MP3 files */
 int mp3_recognize (int nread, const char *data);
@@ -39,8 +40,8 @@ typedef int MP3F_SAMPLE;
 #define MP3F_MAX_SAMPLES  1152 /* Per callback */
 
 typedef void (*MP3F_CALLBACK) (
-		const MP3F_SAMPLE *channels[MP3F_MAX_CHANNELS],
-		long num_samples,
+		const MP3F_SAMPLE *channels [MP3F_MAX_CHANNELS],
+		integer num_samples,
 		void *context);
 
 MP3_FILE mp3f_new ();
diff --git a/fon/AmplitudeTierEditor.h b/fon/AmplitudeTierEditor.h
index 6848224..e826dab 100644
--- a/fon/AmplitudeTierEditor.h
+++ b/fon/AmplitudeTierEditor.h
@@ -2,7 +2,7 @@
 #define _AmplitudeTierEditor_h_
 /* AmplitudeTierEditor.h
  *
- * Copyright (C) 2003-2011,2012,2014,2015 Paul Boersma
+ * Copyright (C) 2003-2011,2012,2014,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -29,8 +29,6 @@ Thing_define (AmplitudeTierEditor, RealTierEditor) {
 		override;
 	const char32 * v_quantityText ()
 		override { return U"Sound pressure (Pa)"; }
-	const char32 * v_quantityKey ()
-		override { return U"Sound pressure"; }
 	const char32 * v_rightTickUnits ()
 		override { return U" Pa"; }
 	double v_defaultYmin ()
@@ -47,10 +45,6 @@ Thing_define (AmplitudeTierEditor, RealTierEditor) {
 		override { return U"Minimum amplitude (Pa)"; }
 	const char32 * v_ymaxText ()
 		override { return U"Maximum amplitude (Pa)"; }
-	const char32 * v_yminKey ()
-		override { return U"Minimum amplitude"; }
-	const char32 * v_ymaxKey ()
-		override { return U"Maximum amplitude"; }
 };
 
 autoAmplitudeTierEditor AmplitudeTierEditor_create (const char32 *title,
diff --git a/fon/AnyTier.cpp b/fon/AnyTier.cpp
index c199a75..1aa05dc 100644
--- a/fon/AnyTier.cpp
+++ b/fon/AnyTier.cpp
@@ -1,6 +1,6 @@
 /* AnyTier.cpp
  *
- * Copyright (C) 1992-2011,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2015,2017 Paul Boersma
  *
  * This code 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 @@ Thing_implement (AnyTier, Function, 0);
 
 void structAnyTier :: v_shiftX (double xfrom, double xto) {
 	AnyTier_Parent :: v_shiftX (xfrom, xto);
-	for (long i = 1; i <= our points.size; i ++) {
+	for (integer i = 1; i <= our points.size; i ++) {
 		AnyPoint point = our points.at [i];
 		NUMshift (& point -> number, xfrom, xto);
 	}
@@ -53,15 +53,15 @@ void structAnyTier :: v_shiftX (double xfrom, double xto) {
 
 void structAnyTier :: v_scaleX (double xminfrom, double xmaxfrom, double xminto, double xmaxto) {
 	AnyTier_Parent :: v_scaleX (xminfrom, xmaxfrom, xminto, xmaxto);
-	for (long i = 1; i <= our points.size; i ++) {
+	for (integer i = 1; i <= our points.size; i ++) {
 		AnyPoint point = our points.at [i];
 		NUMscale (& point -> number, xminfrom, xmaxfrom, xminto, xmaxto);
 	}
 }
 
-long AnyTier_timeToLowIndex (AnyTier me, double time) {
+integer AnyTier_timeToLowIndex (AnyTier me, double time) {
 	if (my points.size == 0) return 0;   // undefined
-	long ileft = 1, iright = my points.size;
+	integer ileft = 1, iright = my points.size;
 	double tleft = my points.at [ileft] -> number;
 	if (time < tleft) return 0;   // offleft
 	double tright = my points.at [iright] -> number;
@@ -69,7 +69,7 @@ long AnyTier_timeToLowIndex (AnyTier me, double time) {
 	Melder_assert (time >= tleft && time < tright);
 	Melder_assert (iright > ileft);
 	while (iright > ileft + 1) {
-		long imid = (ileft + iright) / 2;
+		integer imid = (ileft + iright) / 2;
 		double tmid = my points.at [imid] -> number;
 		if (time < tmid) {
 			iright = imid;
@@ -87,9 +87,9 @@ long AnyTier_timeToLowIndex (AnyTier me, double time) {
 	return ileft;
 }
 
-long AnyTier_timeToHighIndex (AnyTier me, double time) {
+integer AnyTier_timeToHighIndex (AnyTier me, double time) {
 	if (my points.size == 0) return 0;   // undefined; is this right?
-	long ileft = 1, iright = my points.size;
+	integer ileft = 1, iright = my points.size;
 	double tleft = my points.at [ileft] -> number;
 	if (time <= tleft) return 1;
 	double tright = my points.at [iright] -> number;
@@ -97,7 +97,7 @@ long AnyTier_timeToHighIndex (AnyTier me, double time) {
 	Melder_assert (time > tleft && time <= tright);
 	Melder_assert (iright > ileft);
 	while (iright > ileft + 1) {
-		long imid = (ileft + iright) / 2;
+		integer imid = (ileft + iright) / 2;
 		double tmid = my points.at [imid] -> number;
 		if (time <= tmid) {
 			iright = imid;
@@ -123,9 +123,9 @@ integer AnyTier_getWindowPoints (AnyTier me, double tmin, double tmax, integer *
 	return *imax - *imin + 1;
 }
 	
-long AnyTier_timeToNearestIndex (AnyTier me, double time) {
+integer AnyTier_timeToNearestIndex (AnyTier me, double time) {
 	if (my points.size == 0) return 0;   // undefined
-	long ileft = 1, iright = my points.size;
+	integer ileft = 1, iright = my points.size;
 	double tleft = my points.at [ileft] -> number;
 	if (time <= tleft) return 1;
 	double tright = my points.at [iright] -> number;
@@ -133,7 +133,7 @@ long AnyTier_timeToNearestIndex (AnyTier me, double time) {
 	Melder_assert (time > tleft && time < tright);
 	Melder_assert (iright > ileft);
 	while (iright > ileft + 1) {
-		long imid = (ileft + iright) / 2;
+		integer imid = (ileft + iright) / 2;
 		double tmid = my points.at [imid] -> number;
 		if (time < tmid) {
 			iright = imid;
@@ -151,9 +151,9 @@ long AnyTier_timeToNearestIndex (AnyTier me, double time) {
 	return time - tleft <= tright - time ? ileft : iright;
 }
 
-long AnyTier_hasPoint (AnyTier me, double t) {
+integer AnyTier_hasPoint (AnyTier me, double t) {
 	if (my points.size == 0) return 0;   // point not found
-	long ileft = 1, iright = my points.size;
+	integer ileft = 1, iright = my points.size;
 	double tleft = my points.at [ileft] -> number;
 	if (t < tleft) return 0;   // offleft
 	double tright = my points.at [iright] -> number;
@@ -163,7 +163,7 @@ long AnyTier_hasPoint (AnyTier me, double t) {
 	Melder_assert (t > tleft && t < tright);
 	Melder_assert (iright > ileft);
 	while (iright > ileft + 1) {
-		long imid = (ileft + iright) / 2;
+		integer imid = (ileft + iright) / 2;
 		double tmid = my points.at [imid] -> number;
 		if (t < tmid) {
 			iright = imid;
@@ -191,29 +191,29 @@ void AnyTier_addPoint_move (AnyTier me, autoAnyPoint point) {
 	}
 }
 
-void AnyTier_removePoint (AnyTier me, long i) {
+void AnyTier_removePoint (AnyTier me, integer i) {
 	if (i >= 1 && i <= my points.size) my points. removeItem (i);
 }
 
 void AnyTier_removePointNear (AnyTier me, double time) {
-	long ipoint = AnyTier_timeToNearestIndex (me, time);
+	integer ipoint = AnyTier_timeToNearestIndex (me, time);
 	if (ipoint) my points.removeItem (ipoint);
 }
 
 void AnyTier_removePointsBetween (AnyTier me, double tmin, double tmax) {
 	if (my points.size == 0) return;
-	long ileft = AnyTier_timeToHighIndex (me, tmin);
-	long iright = AnyTier_timeToLowIndex (me, tmax);
-	for (long i = iright; i >= ileft; i --)
+	integer ileft = AnyTier_timeToHighIndex (me, tmin);
+	integer iright = AnyTier_timeToLowIndex (me, tmax);
+	for (integer i = iright; i >= ileft; i --)
 		my points. removeItem (i);
 }
 
 autoPointProcess AnyTier_downto_PointProcess (AnyTier me) {
 	try {
-		long numberOfPoints = my points.size;
+		integer numberOfPoints = my points.size;
 		autoPointProcess thee = PointProcess_create (my xmin, my xmax, numberOfPoints);
 		/* OPTIMIZATION, bypassing PointProcess_addTime: */
-		for (long i = 1; i <= numberOfPoints; i ++)
+		for (integer i = 1; i <= numberOfPoints; i ++)
 			thy t [i] = my points.at [i] -> number;
 		thy nt = numberOfPoints;
 		return thee;
diff --git a/fon/AnyTier.h b/fon/AnyTier.h
index 2f8da91..e2b5ec6 100644
--- a/fon/AnyTier.h
+++ b/fon/AnyTier.h
@@ -33,19 +33,19 @@ Thing_define (AnyTier, Function) {
 		override;
 };
 
-long AnyTier_timeToLowIndex (AnyTier me, double time);
+integer AnyTier_timeToLowIndex (AnyTier me, double time);
 
-long AnyTier_timeToHighIndex (AnyTier me, double time);
+integer AnyTier_timeToHighIndex (AnyTier me, double time);
 
 integer AnyTier_getWindowPoints (AnyTier me, double tmin, double tmax, integer *imin, integer *imax);
 
-long AnyTier_timeToNearestIndex (AnyTier me, double time);
+integer AnyTier_timeToNearestIndex (AnyTier me, double time);
 
-long AnyTier_hasPoint (AnyTier me, double t);
+integer AnyTier_hasPoint (AnyTier me, double t);
 
 void AnyTier_addPoint_move (AnyTier me, autoAnyPoint point);
 
-void AnyTier_removePoint (AnyTier me, long i);
+void AnyTier_removePoint (AnyTier me, integer i);
 
 void AnyTier_removePointNear (AnyTier me, double time);
 
diff --git a/fon/Cochleagram_and_Excitation.cpp b/fon/Cochleagram_and_Excitation.cpp
index 2574da8..7d9bf08 100644
--- a/fon/Cochleagram_and_Excitation.cpp
+++ b/fon/Cochleagram_and_Excitation.cpp
@@ -1,6 +1,6 @@
 /* Cochleagram_and_Excitation.cpp
  *
- * Copyright (C) 1992-2011,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -27,11 +27,11 @@
 
 autoExcitation Cochleagram_to_Excitation (Cochleagram me, double t) {
 	try {
-		long column = Matrix_xToNearestColumn (me, t);
+		integer column = Matrix_xToNearestColumn (me, t);
 		if (column < 1) column = 1;
 		if (column > my nx) column = my nx;
 		autoExcitation thee = Excitation_create (my dy, my ny);
-		for (long ifreq = 1; ifreq <= my ny; ifreq ++)
+		for (integer ifreq = 1; ifreq <= my ny; ifreq ++)
 			thy z [1] [ifreq] = my z [ifreq] [column];
 		return thee;
 	} catch (MelderError) {
diff --git a/fon/DurationTier.cpp b/fon/DurationTier.cpp
index 4d212c6..ede5438 100644
--- a/fon/DurationTier.cpp
+++ b/fon/DurationTier.cpp
@@ -1,6 +1,6 @@
 /* DurationTier.cpp
  *
- * Copyright (C) 1992-2012,2015,2016 Paul Boersma
+ * Copyright (C) 1992-2012,2015,2016,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@ void DurationTier_draw (DurationTier me, Graphics g, double tmin, double tmax,
 autoDurationTier PointProcess_upto_DurationTier (PointProcess me) {
 	try {
 		autoDurationTier thee = DurationTier_create (my xmin, my xmax);
-		for (long i = 1; i <= my nt; i ++) {
+		for (integer i = 1; i <= my nt; i ++) {
 			RealTier_addPoint (thee.get(), my t [i], 1.0);
 		}
 		return thee;
diff --git a/fon/DurationTierEditor.h b/fon/DurationTierEditor.h
index b575dff..113c8f4 100644
--- a/fon/DurationTierEditor.h
+++ b/fon/DurationTierEditor.h
@@ -2,7 +2,7 @@
 #define _DurationTierEditor_h_
 /* DurationTierEditor.h
  *
- * Copyright (C) 1992-2011,2012,2014,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2012,2014,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -31,8 +31,6 @@ Thing_define (DurationTierEditor, RealTierEditor) {
 		override { return 0.0; }
 	const char32 * v_quantityText ()
 		override { return U"Relative duration"; }
-	const char32 * v_quantityKey ()
-		override { return U"Relative duration"; }
 	const char32 * v_rightTickUnits ()
 		override { return U""; }
 	double v_defaultYmin ()
@@ -49,10 +47,6 @@ Thing_define (DurationTierEditor, RealTierEditor) {
 		override { return U"Minimum duration"; }
 	const char32 * v_ymaxText ()
 		override { return U"Maximum duration"; }
-	const char32 * v_yminKey ()
-		override { return U"Minimum duration"; }
-	const char32 * v_ymaxKey ()
-		override { return U"Maximum duration"; }
 };
 
 autoDurationTierEditor DurationTierEditor_create (const char32 *title,
diff --git a/fon/Excitation.cpp b/fon/Excitation.cpp
index 1be3dea..31c47a2 100644
--- a/fon/Excitation.cpp
+++ b/fon/Excitation.cpp
@@ -60,24 +60,26 @@ double Excitation_soundPressureToPhon (double soundPressure, double bark) {
 
 void structExcitation :: v_info () {
 	double *y = z [1];
-	long numberOfMaxima = 0;
+	integer numberOfMaxima = 0;
 	structDaata :: v_info ();
 	MelderInfo_writeLine (U"Loudness: ", Melder_half (Excitation_getLoudness (this)), U" sones");
-	for (long i = 2; i < nx; i ++) if (y [i] > y [i - 1] && y [i] >= y [i + 1]) {
+	for (integer i = 2; i < nx; i ++) if (y [i] > y [i - 1] && y [i] >= y [i + 1]) {
 		if (++ numberOfMaxima > 15) break;
 		double i_real;
 		double strength = NUMimproveMaximum (z [1], nx, i, NUM_PEAK_INTERPOLATE_SINC70, & i_real);
 		double formant_bark = x1 + (i_real - 1.0) * dx;
 		MelderInfo_write (U"Peak at ", Melder_single (formant_bark), U" Bark");
-		MelderInfo_write (U", ", (long) NUMbarkToHertz (formant_bark), U" Hz");
+		MelderInfo_write (U", ", (integer) NUMbarkToHertz (formant_bark), U" Hz");
 		MelderInfo_writeLine (U", ", Melder_half (strength), U" phon.");
 	}
 }
 
-autoExcitation Excitation_create (double df, long nf) {
+autoExcitation Excitation_create (double frequencyStep, integer numberOfFrequencies) {
 	try {
 		autoExcitation me = Thing_new (Excitation);
-		Matrix_init (me.get(), 0.0, nf * df, nf, df, 0.5 * df, 1.0, 1.0, 1, 1.0, 1.0);
+		Matrix_init (me.get(),
+			0.0, numberOfFrequencies * frequencyStep, numberOfFrequencies, frequencyStep, 0.5 * frequencyStep,
+			1.0, 1.0, 1, 1.0, 1.0);
 		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Excitation not created.");
@@ -85,9 +87,9 @@ autoExcitation Excitation_create (double df, long nf) {
 }
 
 double Excitation_getDistance (Excitation me, Excitation thee) {
-	double distance = 0.0, mean = 0.0;
+	real80 distance = 0.0, mean = 0.0;
 	Melder_assert (my nx == thy nx);
-	for (long i = 1; i <= my nx; i ++) {
+	for (integer i = 1; i <= my nx; i ++) {
 		double dper = my z [1] [i] - thy z [1] [i];
 		mean += dper;
 		distance += dper * dper;
@@ -95,19 +97,19 @@ double Excitation_getDistance (Excitation me, Excitation thee) {
 	mean /= my nx;
 	distance /= my nx;
 	/* distance -= mean * mean; */
-	return sqrt (distance);
+	return sqrt ((real) distance);
 }
 
 double Excitation_getLoudness (Excitation me) {
-	double loudness = 0.0;
-	for (int i = 1; i <= my nx; i ++)
+	real80 loudness = 0.0;
+	for (integer i = 1; i <= my nx; i ++)
 		/*  Sones = 2 ** ((Phones - 40) / 10)  */
 		loudness += pow (2.0, (my z [1] [i] - 40.0) / 10.0);
-	return my dx * loudness;
+	return my dx * (real) loudness;
 }
 
 void Excitation_draw (Excitation me, Graphics g,
-	double fmin, double fmax, double minimum, double maximum, int garnish)
+	double fmin, double fmax, double minimum, double maximum, bool garnish)
 {
 	if (fmax <= fmin) { fmin = my xmin; fmax = my xmax; }
 	integer ifmin, ifmax;
diff --git a/fon/Excitation.h b/fon/Excitation.h
index b49896c..85b5f23 100644
--- a/fon/Excitation.h
+++ b/fon/Excitation.h
@@ -2,7 +2,7 @@
 #define _Excitation_h_
 /* Excitation.h
  *
- * Copyright (C) 1992-2011,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -34,10 +34,10 @@ double Excitation_phonToDifferenceLimens (double phon);
 double Excitation_differenceLimensToPhon (double ndli);
 double Excitation_soundPressureToPhon (double soundPressure, double bark);
 
-autoExcitation Excitation_create (double df, long nf);
+autoExcitation Excitation_create (double frequencyStep, integer numberOfFrequencies);
 double Excitation_getDistance (Excitation me, Excitation thee);
 double Excitation_getLoudness (Excitation me);
-void Excitation_draw (Excitation me, Graphics g, double fmin, double fmax, double minimum, double maximum, int garnish);
+void Excitation_draw (Excitation me, Graphics g, double fmin, double fmax, double minimum, double maximum, bool garnish);
 autoMatrix Excitation_to_Matrix (Excitation me);
 autoExcitation Matrix_to_Excitation (Matrix me);
 
diff --git a/fon/Excitation_to_Formant.cpp b/fon/Excitation_to_Formant.cpp
index 58be15f..68c7bdd 100644
--- a/fon/Excitation_to_Formant.cpp
+++ b/fon/Excitation_to_Formant.cpp
@@ -1,6 +1,6 @@
 /* Excitation_to_Formant.cpp
  *
- * Copyright (C) 1992-2011,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,38 +16,30 @@
  * along with this work. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/*
- * pb 1995/08/23
- * pb 2002/07/16 GPL
- * pb 2008/01/19 double
- * pb 2011/05/24 C++
- */
-
 #include "Excitation_to_Formant.h"
 
-autoFormant Excitation_to_Formant (Excitation me, int maxnFormants) {
+autoFormant Excitation_to_Formant (Excitation me, integer maximumNumberOfFormants) {
 	try {
-		long nfreq = my nx, nform = 0;
+		integer numberOfFrequencies = my nx, nform = 0;
 		double *p = my z [1];
 
-		autoFormant thee = Formant_create (0, 1, 1, 1, 0.5, maxnFormants);
-		thy d_frames [1]. formant = NUMvector <structFormant_Formant> (1, maxnFormants);
-		for (long i = 2; i < nfreq; i ++)
+		autoFormant thee = Formant_create (0.0, 1.0, 1, 1.0, 0.5, maximumNumberOfFormants);
+		thy d_frames [1]. formant = NUMvector <structFormant_Formant> (1, maximumNumberOfFormants);
+		for (integer i = 2; i < numberOfFrequencies; i ++)
 			if (p [i] > p [i - 1] && p [i] >= p [i + 1]) {
-				double min3phon, left, right;
 				double firstDerivative = p [i+1] - p [i-1], secondDerivative = 2 * p [i] - p [i-1] - p [i+1];
-				long j;
+				integer j;
 				Formant_Formant formant = & thy d_frames [1]. formant [++ nform];
 				formant -> frequency = Excitation_barkToHertz (
 					my x1 + my dx * (i - 1 + 0.5 * firstDerivative / secondDerivative));
-				min3phon = p [i] + 0.125 * firstDerivative * firstDerivative / secondDerivative - 3.0;
+				double min3phon = p [i] + 0.125 * firstDerivative * firstDerivative / secondDerivative - 3.0;
 				/* Search left. */
 				j = i - 1; while (p [j] > min3phon && j > 1) j --;
-				left = Excitation_barkToHertz (
+				double left = Excitation_barkToHertz (
 					p [j] > min3phon ? my xmin : my x1 + my dx * (j - 1 + (min3phon - p [j]) / (p [j + 1] - p [j])));
 				 /* Search right. */
-				j = i + 1; while (p [j] > min3phon && j < nfreq) j ++;
-				right = Excitation_barkToHertz (
+				j = i + 1; while (p [j] > min3phon && j < numberOfFrequencies) j ++;
+				double right = Excitation_barkToHertz (
 					p [j] > min3phon ? my xmax : my x1 + my dx * (j - 1 - (min3phon - p [j]) / (p [j - 1] - p [j])));
 				formant -> bandwidth = right - left;
 				if (nform == thy maxnFormants) break;
diff --git a/fon/Excitation_to_Formant.h b/fon/Excitation_to_Formant.h
index 22bd282..cc29628 100644
--- a/fon/Excitation_to_Formant.h
+++ b/fon/Excitation_to_Formant.h
@@ -1,6 +1,6 @@
 /* Excitation_to_Formant.h
  *
- * Copyright (C) 1992-2011,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,6 +19,6 @@
 #include "Excitation.h"
 #include "Formant.h"
 
-autoFormant Excitation_to_Formant (Excitation, int maxnFormants);
+autoFormant Excitation_to_Formant (Excitation, integer maximumNumberOfFormants);
 
 /* End of file Excitation_to_Formant.h */
diff --git a/fon/ExperimentMFC.cpp b/fon/ExperimentMFC.cpp
index 5aafb3e..eb6c18c 100644
--- a/fon/ExperimentMFC.cpp
+++ b/fon/ExperimentMFC.cpp
@@ -164,10 +164,10 @@ static void readSound (ExperimentMFC me, const char32 *fileNameHead, const char3
 	}
 }
 
-static void permuteRandomly (ExperimentMFC me, long first, long last) {
-	for (long itrial = first; itrial < last; itrial ++) {
-		long jtrial = NUMrandomInteger (itrial, last);
-		long dummy = my stimuli [jtrial];
+static void permuteRandomly (ExperimentMFC me, integer first, integer last) {
+	for (integer itrial = first; itrial < last; itrial ++) {
+		integer jtrial = NUMrandomInteger (itrial, last);
+		integer dummy = my stimuli [jtrial];
 		my stimuli [jtrial] = my stimuli [itrial];
 		my stimuli [itrial] = dummy;
 	}
@@ -175,20 +175,20 @@ static void permuteRandomly (ExperimentMFC me, long first, long last) {
 
 void ExperimentMFC_start (ExperimentMFC me) {
 	try {
-		long maximumStimulusPlaySamples, maximumResponsePlaySamples, maximumPlaySamples;
-		long stimulusCarrierBeforeSamples = 0, stimulusCarrierAfterSamples = 0, maximumStimulusSamples = 0;
-		long responseCarrierBeforeSamples = 0, responseCarrierAfterSamples = 0, maximumResponseSamples = 0;
+		integer maximumStimulusPlaySamples, maximumResponsePlaySamples, maximumPlaySamples;
+		integer stimulusCarrierBeforeSamples = 0, stimulusCarrierAfterSamples = 0, maximumStimulusSamples = 0;
+		integer responseCarrierBeforeSamples = 0, responseCarrierAfterSamples = 0, maximumResponseSamples = 0;
 		Melder_warningOff ();
 		my trial = 0;
-		NUMvector_free <long> (my stimuli, 1);
-		NUMvector_free <long> (my responses, 1);
+		NUMvector_free <integer> (my stimuli, 1);
+		NUMvector_free <integer> (my responses, 1);
 		NUMvector_free <double> (my goodnesses, 1);
 		NUMvector_free <double> (my reactionTimes, 1);
 		my playBuffer.reset();   // is this needed?
 		my pausing = false;
 		my numberOfTrials = my numberOfDifferentStimuli * my numberOfReplicationsPerStimulus;
-		my stimuli = NUMvector <long> (1, my numberOfTrials);
-		my responses = NUMvector <long> (1, my numberOfTrials);
+		my stimuli = NUMvector <integer> (1, my numberOfTrials);
+		my responses = NUMvector <integer> (1, my numberOfTrials);
 		my goodnesses = NUMvector <double> (1, my numberOfTrials);
 		my reactionTimes = NUMvector <double> (1, my numberOfTrials);
 		/*
@@ -207,7 +207,7 @@ void ExperimentMFC_start (ExperimentMFC me) {
 					& my stimulusCarrierAfter. name, & my stimulusCarrierAfter. sound);
 				stimulusCarrierAfterSamples = my stimulusCarrierAfter. sound -> nx;
 			}
-			for (long istim = 1; istim <= my numberOfDifferentStimuli; istim ++) {
+			for (integer istim = 1; istim <= my numberOfDifferentStimuli; istim ++) {
 				readSound (me, my stimulusFileNameHead, my stimulusFileNameTail, my stimulusMedialSilenceDuration,
 					& my stimulus [istim]. name, & my stimulus [istim]. sound);
 				if (my stimulus [istim]. sound -> nx > maximumStimulusSamples)
@@ -225,7 +225,7 @@ void ExperimentMFC_start (ExperimentMFC me) {
 					& my responseCarrierAfter. name, & my responseCarrierAfter. sound);
 				responseCarrierAfterSamples = my responseCarrierAfter. sound -> nx;
 			}
-			for (long iresp = 1; iresp <= my numberOfDifferentResponses; iresp ++) {
+			for (integer iresp = 1; iresp <= my numberOfDifferentResponses; iresp ++) {
 				readSound (me, my responseFileNameHead, my responseFileNameTail, my responseMedialSilenceDuration,
 					& my response [iresp]. name, & my response [iresp]. sound);
 				if (my response [iresp]. sound -> nx > maximumResponseSamples)
@@ -250,30 +250,30 @@ void ExperimentMFC_start (ExperimentMFC me) {
 		 * Determine the order in which the stimuli will be presented to the subject.
 		 */
 		if (my randomize == kExperiment_randomize::CYCLIC_NON_RANDOM) {
-			for (long itrial = 1; itrial <= my numberOfTrials; itrial ++)
+			for (integer itrial = 1; itrial <= my numberOfTrials; itrial ++)
 				my stimuli [itrial] = (itrial - 1) % my numberOfDifferentStimuli + 1;
 		} else if (my randomize == kExperiment_randomize::PERMUTE_ALL) {
-			for (long itrial = 1; itrial <= my numberOfTrials; itrial ++)
+			for (integer itrial = 1; itrial <= my numberOfTrials; itrial ++)
 				my stimuli [itrial] = (itrial - 1) % my numberOfDifferentStimuli + 1;
 			permuteRandomly (me, 1, my numberOfTrials);
 		} else if (my randomize == kExperiment_randomize::PERMUTE_BALANCED) {
-			for (long ireplica = 1; ireplica <= my numberOfReplicationsPerStimulus; ireplica ++) {
-				long offset = (ireplica - 1) * my numberOfDifferentStimuli;
-				for (long istim = 1; istim <= my numberOfDifferentStimuli; istim ++)
+			for (integer ireplica = 1; ireplica <= my numberOfReplicationsPerStimulus; ireplica ++) {
+				integer offset = (ireplica - 1) * my numberOfDifferentStimuli;
+				for (integer istim = 1; istim <= my numberOfDifferentStimuli; istim ++)
 					my stimuli [offset + istim] = istim;
 				permuteRandomly (me, offset + 1, offset + my numberOfDifferentStimuli);
 			}
 		} else if (my randomize == kExperiment_randomize::PERMUTE_BALANCED_NO_DOUBLETS) {
-			for (long ireplica = 1; ireplica <= my numberOfReplicationsPerStimulus; ireplica ++) {
-				long offset = (ireplica - 1) * my numberOfDifferentStimuli;
-				for (long istim = 1; istim <= my numberOfDifferentStimuli; istim ++)
+			for (integer ireplica = 1; ireplica <= my numberOfReplicationsPerStimulus; ireplica ++) {
+				integer offset = (ireplica - 1) * my numberOfDifferentStimuli;
+				for (integer istim = 1; istim <= my numberOfDifferentStimuli; istim ++)
 					my stimuli [offset + istim] = istim;
 				do {
 					permuteRandomly (me, offset + 1, offset + my numberOfDifferentStimuli);
 				} while (ireplica != 1 && my stimuli [offset + 1] == my stimuli [offset] && my numberOfDifferentStimuli > 1);
 			}
 		} else if (my randomize == kExperiment_randomize::WITH_REPLACEMENT) {
-			for (long itrial = 1; itrial <= my numberOfTrials; itrial ++)
+			for (integer itrial = 1; itrial <= my numberOfTrials; itrial ++)
 				my stimuli [itrial] = NUMrandomInteger (1, my numberOfDifferentStimuli);
 		}
 		Melder_warningOn ();
@@ -288,18 +288,18 @@ void ExperimentMFC_start (ExperimentMFC me) {
 static void playSound (ExperimentMFC me, Sound sound, Sound carrierBefore, Sound carrierAfter,
 	double initialSilenceDuration, double finalSilenceDuration)
 {
-	long numberOfSamplesWritten = 0;
+	integer numberOfSamplesWritten = 0;
 
-	long initialSilenceSamples = lround (initialSilenceDuration / my samplePeriod);
-	for (long channel = 1; channel <= my numberOfChannels; channel ++) {
-		for (long i = 1; i <= initialSilenceSamples; i ++) {
+	integer initialSilenceSamples = lround (initialSilenceDuration / my samplePeriod);
+	for (integer channel = 1; channel <= my numberOfChannels; channel ++) {
+		for (integer i = 1; i <= initialSilenceSamples; i ++) {
 			my playBuffer -> z [channel] [i] = 0.0;
 		}
 	}
 	numberOfSamplesWritten += initialSilenceSamples;
 
 	if (carrierBefore) {
-		for (long channel = 1; channel <= my numberOfChannels; channel ++) {
+		for (integer channel = 1; channel <= my numberOfChannels; channel ++) {
 			NUMvector_copyElements <double> (carrierBefore -> z [channel],
 				my playBuffer -> z [channel] + numberOfSamplesWritten, 1, carrierBefore -> nx);
 		}
@@ -307,7 +307,7 @@ static void playSound (ExperimentMFC me, Sound sound, Sound carrierBefore, Sound
 	}
 
 	if (sound) {
-		for (long channel = 1; channel <= my numberOfChannels; channel ++) {
+		for (integer channel = 1; channel <= my numberOfChannels; channel ++) {
 			NUMvector_copyElements <double> (sound -> z [channel],
 				my playBuffer -> z [channel] + numberOfSamplesWritten, 1, sound -> nx);
 		}
@@ -315,16 +315,16 @@ static void playSound (ExperimentMFC me, Sound sound, Sound carrierBefore, Sound
 	}
 
 	if (carrierAfter) {
-		for (long channel = 1; channel <= my numberOfChannels; channel ++) {
+		for (integer channel = 1; channel <= my numberOfChannels; channel ++) {
 			NUMvector_copyElements <double> (carrierAfter -> z [channel],
 				my playBuffer -> z [channel] + numberOfSamplesWritten, 1, carrierAfter -> nx);
 		}
 		numberOfSamplesWritten += carrierAfter -> nx;
 	}
 
-	long finalSilenceSamples = lround (finalSilenceDuration / my samplePeriod);
-	for (long channel = 1; channel <= my numberOfChannels; channel ++) {
-		for (long i = 1; i <= finalSilenceSamples; i ++) {
+	integer finalSilenceSamples = lround (finalSilenceDuration / my samplePeriod);
+	for (integer channel = 1; channel <= my numberOfChannels; channel ++) {
+		for (integer i = 1; i <= finalSilenceSamples; i ++) {
 			my playBuffer -> z [channel] [i + numberOfSamplesWritten] = 0.0;
 		}
 	}
@@ -337,13 +337,13 @@ static void playSound (ExperimentMFC me, Sound sound, Sound carrierBefore, Sound
 		my startingTime = Melder_clock ();
 }
 
-void ExperimentMFC_playStimulus (ExperimentMFC me, long istim) {
+void ExperimentMFC_playStimulus (ExperimentMFC me, integer istim) {
 	playSound (me, my stimulus [istim]. sound.get(),
 		my stimulusCarrierBefore. sound.get(), my stimulusCarrierAfter. sound.get(),
 		my stimulusInitialSilenceDuration, my stimulusFinalSilenceDuration);
 }
 
-void ExperimentMFC_playResponse (ExperimentMFC me, long iresp) {
+void ExperimentMFC_playResponse (ExperimentMFC me, integer iresp) {
 	playSound (me, my response [iresp]. sound.get(),
 		my responseCarrierBefore. sound.get(), my responseCarrierAfter. sound.get(),
 		my responseInitialSilenceDuration, my responseFinalSilenceDuration);
@@ -359,7 +359,7 @@ Thing_implement (ExperimentMFCList, Ordered, 0);
 
 Thing_implement (ResultsMFC, Daata, 2);
 
-autoResultsMFC ResultsMFC_create (long numberOfTrials) {
+autoResultsMFC ResultsMFC_create (integer numberOfTrials) {
 	try {
 		autoResultsMFC me = Thing_new (ResultsMFC);
 		my numberOfTrials = numberOfTrials;
@@ -375,7 +375,7 @@ autoResultsMFC ExperimentMFC_extractResults (ExperimentMFC me) {
 		if (my trial == 0 || my trial <= my numberOfTrials)
 			Melder_warning (U"The experiment was not finished. Only the first ", my trial - 1 + my pausing, U" responses are valid.");
 		autoResultsMFC thee = ResultsMFC_create (my numberOfTrials);
-		for (long trial = 1; trial <= my numberOfTrials; trial ++) {
+		for (integer trial = 1; trial <= my numberOfTrials; trial ++) {
 			char32 *pipe = my stimulus [my stimuli [trial]]. visibleText ?
 				str32chr (my stimulus [my stimuli [trial]]. visibleText, U'|') : nullptr;
 			thy result [trial]. stimulus = Melder_dup (Melder_cat (my stimulus [my stimuli [trial]]. name, pipe));
@@ -394,9 +394,9 @@ autoResultsMFC ResultsMFC_removeUnsharedStimuli (ResultsMFC me, ResultsMFC thee)
 	try {
 		autoResultsMFC him = ResultsMFC_create (thy numberOfTrials);
 		his numberOfTrials = 0;
-		for (long i = 1; i <= thy numberOfTrials; i ++) {
+		for (integer i = 1; i <= thy numberOfTrials; i ++) {
 			bool present = false;
-			for (long j = 1; j <= my numberOfTrials; j ++) {
+			for (integer j = 1; j <= my numberOfTrials; j ++) {
 				if (str32equ (thy result [i]. stimulus, my result [j]. stimulus)) {
 					present = true;
 					break;
@@ -418,11 +418,11 @@ autoResultsMFC ResultsMFC_removeUnsharedStimuli (ResultsMFC me, ResultsMFC thee)
 
 autoTable ResultsMFCs_to_Table (OrderedOf<structResultsMFC>* me) {
 	try {
-		long irow = 0;
+		integer irow = 0;
 		bool hasGoodnesses = false, hasReactionTimes = false;
-		for (long iresults = 1; iresults <= my size; iresults ++) {
+		for (integer iresults = 1; iresults <= my size; iresults ++) {
 			ResultsMFC results = my at [iresults];
-			for (long itrial = 1; itrial <= results -> numberOfTrials; itrial ++) {
+			for (integer itrial = 1; itrial <= results -> numberOfTrials; itrial ++) {
 				irow ++;
 				if (results -> result [itrial]. goodness != 0)
 					hasGoodnesses = true;
@@ -439,9 +439,9 @@ autoTable ResultsMFCs_to_Table (OrderedOf<structResultsMFC>* me) {
 		if (hasReactionTimes)
 			Table_setColumnLabel (thee.get(), 4 + hasGoodnesses, U"reactionTime");
 		irow = 0;
-		for (long iresults = 1; iresults <= my size; iresults ++) {
+		for (integer iresults = 1; iresults <= my size; iresults ++) {
 			ResultsMFC results = my at [iresults];
-			for (long itrial = 1; itrial <= results -> numberOfTrials; itrial ++) {
+			for (integer itrial = 1; itrial <= results -> numberOfTrials; itrial ++) {
 				irow ++;
 				Table_setStringValue (thee.get(), irow, 1, results -> name);
 				Table_setStringValue (thee.get(), irow, 2, results -> result [itrial]. stimulus);
@@ -463,7 +463,7 @@ autoTable ResultsMFCs_to_Table (OrderedOf<structResultsMFC>* me) {
 autoCategories ResultsMFC_to_Categories_stimuli (ResultsMFC me) {
 	try {
 		autoCategories thee = Categories_create ();
-		for (long trial = 1; trial <= my numberOfTrials; trial ++) {
+		for (integer trial = 1; trial <= my numberOfTrials; trial ++) {
 			autoSimpleString category = SimpleString_create (my result [trial]. stimulus);
 			thy addItem_move (category.move());
 		}
@@ -476,7 +476,7 @@ autoCategories ResultsMFC_to_Categories_stimuli (ResultsMFC me) {
 autoCategories ResultsMFC_to_Categories_responses (ResultsMFC me) {
 	try {
 		autoCategories thee = Categories_create ();
-		for (long trial = 1; trial <= my numberOfTrials; trial ++) {
+		for (integer trial = 1; trial <= my numberOfTrials; trial ++) {
 			autoSimpleString category = SimpleString_create (my result [trial]. response);
 			thy addItem_move (category.move());
 		}
@@ -494,12 +494,12 @@ void Categories_sort (Categories me) {
 }
 
 double Categories_getEntropy (Categories me) {
-	long numberOfTokens = 0;
+	integer numberOfTokens = 0;
 	char32 *previousString = nullptr;
 	double entropy = 0.0;
 	autoCategories thee = Data_copy (me);
 	Categories_sort (thee.get());
-	for (long i = 1; i <= thy size; i ++) {
+	for (integer i = 1; i <= thy size; i ++) {
 		SimpleString s = thy at [i];
 		char32 *string = s -> string;
 		if (previousString && ! str32equ (string, previousString)) {
diff --git a/fon/ExperimentMFC.h b/fon/ExperimentMFC.h
index f7d4e6e..6b33ab6 100644
--- a/fon/ExperimentMFC.h
+++ b/fon/ExperimentMFC.h
@@ -2,7 +2,7 @@
 #define _ExperimentMFC_h_
 /* ExperimentMFC.h
  *
- * Copyright (C) 2001-2011,2015 Paul Boersma
+ * Copyright (C) 2001-2011,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -27,10 +27,10 @@
 #include "ExperimentMFC_def.h"
 
 void ExperimentMFC_start (ExperimentMFC me);
-void ExperimentMFC_playStimulus (ExperimentMFC me, long istim);
-void ExperimentMFC_playResponse (ExperimentMFC me, long iresp);
+void ExperimentMFC_playStimulus (ExperimentMFC me, integer istim);
+void ExperimentMFC_playResponse (ExperimentMFC me, integer iresp);
 
-autoResultsMFC ResultsMFC_create (long numberOfResults);
+autoResultsMFC ResultsMFC_create (integer numberOfResults);
 autoResultsMFC ExperimentMFC_extractResults (ExperimentMFC me);
 autoResultsMFC ResultsMFC_removeUnsharedStimuli (ResultsMFC me, ResultsMFC thee);
 
diff --git a/fon/ExperimentMFC_def.h b/fon/ExperimentMFC_def.h
index 3cd8403..f4d7617 100644
--- a/fon/ExperimentMFC_def.h
+++ b/fon/ExperimentMFC_def.h
@@ -132,17 +132,17 @@ oo_DEFINE_CLASS (ExperimentMFC, Daata)
 	oo_FROM (6)
 		oo_DOUBLE (stimulusFinalSilenceDuration)
 	oo_ENDFROM
-	oo_LONG (numberOfDifferentStimuli)
+	oo_INTEGER (numberOfDifferentStimuli)
 	oo_STRUCT_VECTOR (StimulusMFC, stimulus, numberOfDifferentStimuli)
-	oo_LONG (numberOfReplicationsPerStimulus)
-	oo_LONG (breakAfterEvery)
+	oo_INTEGER (numberOfReplicationsPerStimulus)
+	oo_INTEGER (breakAfterEvery)
 	oo_ENUM (kExperiment_randomize, randomize)
 	oo_STRING (startText)
 	oo_STRING (runText)
 	oo_STRING (pauseText)
 	oo_STRING (endText)
 	oo_FROM (4)
-		oo_LONG (maximumNumberOfReplays)
+		oo_INTEGER (maximumNumberOfReplays)
 		oo_FLOAT (replay_left)
 		oo_FLOAT (replay_right)
 		oo_FLOAT (replay_bottom)
@@ -174,20 +174,20 @@ oo_DEFINE_CLASS (ExperimentMFC, Daata)
 	oo_FROM (6)
 		oo_DOUBLE (responseFinalSilenceDuration)
 	oo_ENDFROM
-	oo_LONG (numberOfDifferentResponses)
+	oo_INTEGER (numberOfDifferentResponses)
 	oo_STRUCT_VECTOR (ResponseMFC, response, numberOfDifferentResponses)
 	oo_FROM (1)
-		oo_LONG (numberOfGoodnessCategories)
+		oo_INTEGER (numberOfGoodnessCategories)
 		oo_STRUCT_VECTOR (GoodnessMFC, goodness, numberOfGoodnessCategories)
 	oo_ENDFROM
 	#if !oo_READING && !oo_WRITING
 		oo_DOUBLE (samplePeriod)
 		oo_INT16 (numberOfChannels)
 		oo_BOOLEAN (pausing)
-		oo_LONG (trial)
-		oo_LONG (numberOfTrials)
-		oo_LONG_VECTOR (stimuli, numberOfTrials)
-		oo_LONG_VECTOR (responses, numberOfTrials)
+		oo_INTEGER (trial)
+		oo_INTEGER (numberOfTrials)
+		oo_INTEGER_VECTOR (stimuli, numberOfTrials)
+		oo_INTEGER_VECTOR (responses, numberOfTrials)
 		oo_DOUBLE_VECTOR (goodnesses, numberOfTrials)
 		oo_DOUBLE (startingTime)
 		oo_DOUBLE_VECTOR (reactionTimes, numberOfTrials)
@@ -224,7 +224,7 @@ oo_END_STRUCT (TrialMFC)
 #define ooSTRUCT ResultsMFC
 oo_DEFINE_CLASS (ResultsMFC, Daata)
 
-	oo_LONG (numberOfTrials)
+	oo_INTEGER (numberOfTrials)
 	oo_STRUCT_VECTOR (TrialMFC, result, numberOfTrials)
 
 oo_END_CLASS (ResultsMFC)
diff --git a/fon/Formant.cpp b/fon/Formant.cpp
index bbff8d8..15fe57c 100644
--- a/fon/Formant.cpp
+++ b/fon/Formant.cpp
@@ -16,19 +16,6 @@
  * along with this work. If not, see <http://www.gnu.org/licenses/>.
  */
 
-/*
- * pb 2002/07/16 GPL
- * pb 2004/10/05 allow reverse axes in scatter plot (and remove special routine for those)
- * pb 2005/12/08 Formant_getQuantileOfBandwidth
- * pb 2007/03/17 domain quantity
- * pb 2007/10/01 can write as encoding
- * pb 2008/01/19 version 2
- * pb 2008/01/19 don't draw undefined lines
- * pb 2008/06/01 Formant_downto_Table, Formant_list
- * pb 2009/01/18 Interpreter argument to formula
- * pb 2011/05/24 C++
- */
-
 #include "Formant.h"
 
 #include "oo_DESTROY.h"
@@ -50,6 +37,11 @@
 #include "oo_DESCRIPTION.h"
 #include "Formant_def.h"
 
+#include "enums_getText.h"
+#include "Formant_enums.h"
+#include "enums_getValue.h"
+#include "Formant_enums.h"
+
 Thing_implement (Formant, Sampled, 2);   // version 1 = with intensity, 2 = double
 
 void structFormant :: v_info () {
@@ -64,7 +56,7 @@ void structFormant :: v_info () {
 	MelderInfo_writeLine (U"   First frame centred at: ", x1, U" seconds");
 }
 
-double structFormant :: v_getValueAtSample (long iframe, long which, int units) {
+double structFormant :: v_getValueAtSample (integer iframe, integer which, int units) {
 	Formant_Frame frame = & d_frames [iframe];
 	long iformant = which >> 1;
 	if (iformant < 1 || iformant > frame -> nFormants) return undefined;
@@ -84,21 +76,21 @@ double structFormant :: v_getValueAtSample (long iframe, long which, int units)
 	return undefined;
 }
 
-autoFormant Formant_create (double tmin, double tmax, long nt, double dt, double t1,
-	int maxnFormants)
+autoFormant Formant_create (double tmin, double tmax, integer nt, double dt, double t1,
+	integer maximumNumberOfFormants)
 {
 	try {
 		autoFormant me = Thing_new (Formant);
 		Sampled_init (me.get(), tmin, tmax, nt, dt, t1);
 		my d_frames = NUMvector <structFormant_Frame> (1, nt);
-		my maxnFormants = maxnFormants;
+		my maxnFormants = maximumNumberOfFormants;
 		return me;
 	} catch (MelderError) {
 		Melder_throw (U"Formant object not created.");
 	}
 }
 
-long Formant_getMinNumFormants (Formant me) {
+integer Formant_getMinNumFormants (Formant me) {
 	long minNumFormants = 100000000;
 	for (long iframe = 1; iframe <= my nx; iframe ++)
 		if (my d_frames [iframe]. nFormants < minNumFormants)
@@ -106,7 +98,7 @@ long Formant_getMinNumFormants (Formant me) {
 	return minNumFormants;
 }
 
-long Formant_getMaxNumFormants (Formant me) {
+integer Formant_getMaxNumFormants (Formant me) {
 	long maxNumFormants = 0;
 	for (long iframe = 1; iframe <= my nx; iframe ++)
 		if (my d_frames [iframe]. nFormants > maxNumFormants)
@@ -114,7 +106,7 @@ long Formant_getMaxNumFormants (Formant me) {
 	return maxNumFormants;
 }
 
-void Formant_drawTracks (Formant me, Graphics g, double tmin, double tmax, double fmax, int garnish) {
+void Formant_drawTracks (Formant me, Graphics g, double tmin, double tmax, double fmax, bool garnish) {
 	integer itmin, itmax, ntrack = Formant_getMinNumFormants (me);
 	if (tmax <= tmin) { tmin = my xmin; tmax = my xmax; }
 	if (! Sampled_getWindowSamples (me, tmin, tmax, & itmin, & itmax)) return;
@@ -172,7 +164,7 @@ void Formant_drawSpeckles_inside (Formant me, Graphics g, double tmin, double tm
 }
 
 void Formant_drawSpeckles (Formant me, Graphics g, double tmin, double tmax, double fmax, double suppress_dB,
-	int garnish)
+	bool garnish)
 {
 	Graphics_setInner (g);
 	Formant_drawSpeckles_inside (me, g, tmin, tmax, 0.0, fmax, suppress_dB);
@@ -230,7 +222,7 @@ void Formant_formula_frequencies (Formant me, const char32 *formula, Interpreter
 	}
 }
 
-void Formant_getExtrema (Formant me, int iformant, double tmin, double tmax, double *fmin, double *fmax) {
+void Formant_getExtrema (Formant me, integer iformant, double tmin, double tmax, double *fmin, double *fmax) {
 	if (fmin) *fmin = 0.0;
 	if (fmax) *fmax = 0.0;
 	if (iformant < 1) return;
@@ -247,58 +239,58 @@ void Formant_getExtrema (Formant me, int iformant, double tmin, double tmax, dou
 	}
 }
 
-void Formant_getMinimumAndTime (Formant me, int iformant, double tmin, double tmax, int bark, int interpolate,
+void Formant_getMinimumAndTime (Formant me, integer iformant, double tmin, double tmax, kFormant_unit unit, int interpolate,
 	double *return_minimum, double *return_timeOfMinimum)
 {
-	Sampled_getMinimumAndX (me, tmin, tmax, iformant << 1, bark, interpolate, return_minimum, return_timeOfMinimum);
+	Sampled_getMinimumAndX (me, tmin, tmax, iformant << 1, (int) unit, interpolate, return_minimum, return_timeOfMinimum);
 	if (return_minimum && *return_minimum <= 0.0) *return_minimum = undefined;
 }
 
-double Formant_getMinimum (Formant me, int iformant, double tmin, double tmax, int bark, int interpolate) {
+double Formant_getMinimum (Formant me, integer iformant, double tmin, double tmax, kFormant_unit unit, int interpolate) {
 	double minimum;
-	Formant_getMinimumAndTime (me, iformant, tmin, tmax, bark, interpolate, & minimum, nullptr);
+	Formant_getMinimumAndTime (me, iformant, tmin, tmax, unit, interpolate, & minimum, nullptr);
 	return minimum;
 }
 
-double Formant_getTimeOfMinimum (Formant me, int iformant, double tmin, double tmax, int bark, int interpolate) {
+double Formant_getTimeOfMinimum (Formant me, integer iformant, double tmin, double tmax, kFormant_unit unit, int interpolate) {
 	double time;
-	Formant_getMinimumAndTime (me, iformant, tmin, tmax, bark, interpolate, nullptr, & time);
+	Formant_getMinimumAndTime (me, iformant, tmin, tmax, unit, interpolate, nullptr, & time);
 	return time;
 }
 
-void Formant_getMaximumAndTime (Formant me, int iformant, double tmin, double tmax, int bark, int interpolate,
+void Formant_getMaximumAndTime (Formant me, integer iformant, double tmin, double tmax, kFormant_unit unit, int interpolate,
 	double *return_maximum, double *return_timeOfMaximum)
 {
-	Sampled_getMaximumAndX (me, tmin, tmax, iformant << 1, bark, interpolate, return_maximum, return_timeOfMaximum);
+	Sampled_getMaximumAndX (me, tmin, tmax, iformant << 1, (int) unit, interpolate, return_maximum, return_timeOfMaximum);
 	if (return_maximum && *return_maximum <= 0.0) *return_maximum = undefined;   // unlikely
 }
 
-double Formant_getMaximum (Formant me, int iformant, double tmin, double tmax, int bark, int interpolate) {
+double Formant_getMaximum (Formant me, integer iformant, double tmin, double tmax, kFormant_unit unit, int interpolate) {
 	double maximum;
-	Formant_getMaximumAndTime (me, iformant, tmin, tmax, bark, interpolate, & maximum, nullptr);
+	Formant_getMaximumAndTime (me, iformant, tmin, tmax, unit, interpolate, & maximum, nullptr);
 	return maximum;
 }
 
-double Formant_getTimeOfMaximum (Formant me, int iformant, double tmin, double tmax, int bark, int interpolate) {
+double Formant_getTimeOfMaximum (Formant me, integer iformant, double tmin, double tmax, kFormant_unit unit, int interpolate) {
 	double time;
-	Formant_getMaximumAndTime (me, iformant, tmin, tmax, bark, interpolate, nullptr, & time);
+	Formant_getMaximumAndTime (me, iformant, tmin, tmax, unit, interpolate, nullptr, & time);
 	return time;
 }
 
-double Formant_getQuantile (Formant me, int iformant, double quantile, double tmin, double tmax, int bark) {
-	return Sampled_getQuantile (me, tmin, tmax, quantile, iformant << 1, bark);
+double Formant_getQuantile (Formant me, integer iformant, double quantile, double tmin, double tmax, kFormant_unit unit) {
+	return Sampled_getQuantile (me, tmin, tmax, quantile, iformant << 1, (int) unit);
 }
 
-double Formant_getMean (Formant me, int iformant, double tmin, double tmax, int bark) {
-	return Sampled_getMean (me, tmin, tmax, iformant << 1, bark, true);
+double Formant_getMean (Formant me, integer iformant, double tmin, double tmax, kFormant_unit unit) {
+	return Sampled_getMean (me, tmin, tmax, iformant << 1, (int) unit, true);
 }
 
-double Formant_getStandardDeviation (Formant me, int iformant, double tmin, double tmax, int bark) {
+double Formant_getStandardDeviation (Formant me, integer iformant, double tmin, double tmax, kFormant_unit unit) {
 	if (iformant < 1 || isundef (tmin) || isundef (tmax)) return undefined;
 	if (tmax <= tmin) { tmin = my xmin; tmax = my xmax; }
 	integer itmin, itmax;
 	if (! Sampled_getWindowSamples (me, tmin, tmax, & itmin, & itmax)) return undefined;
-	double mean = Formant_getMean (me, iformant, tmin, tmax, bark);
+	double mean = Formant_getMean (me, iformant, tmin, tmax, unit);
 	double sum = 0.0;
 	integer n = 0;
 	for (integer iframe = itmin; iframe <= itmax; iframe ++) {
@@ -306,7 +298,7 @@ double Formant_getStandardDeviation (Formant me, int iformant, double tmin, doub
 		if (iformant > frame -> nFormants) continue;
 		double f = frame -> formant [iformant]. frequency;
 		if (f == 0.0) continue;
-		if (bark) f = NUMhertzToBark (f);
+		if (unit == kFormant_unit::BARK) f = NUMhertzToBark (f);
 		n += 1;
 		sum += (f - mean) * (f - mean);
 	}
@@ -314,21 +306,21 @@ double Formant_getStandardDeviation (Formant me, int iformant, double tmin, doub
 	return undefined;
 }
 
-double Formant_getValueAtTime (Formant me, int iformant, double time, int bark) {
-	return Sampled_getValueAtX (me, time, iformant << 1, bark, true);
+double Formant_getValueAtTime (Formant me, integer iformant, double time, kFormant_unit unit) {
+	return Sampled_getValueAtX (me, time, iformant << 1, (int) unit, true);
 }
 
-double Formant_getBandwidthAtTime (Formant me, int iformant, double time, int bark) {
-	return Sampled_getValueAtX (me, time, (iformant << 1) + 1, bark, true);
+double Formant_getBandwidthAtTime (Formant me, integer iformant, double time, kFormant_unit unit) {
+	return Sampled_getValueAtX (me, time, (iformant << 1) + 1, (int) unit, true);
 }
 
-double Formant_getQuantileOfBandwidth (Formant me, int iformant, double quantile, double tmin, double tmax, int bark) {
-	return Sampled_getQuantile (me, tmin, tmax, quantile, (iformant << 1) + 1, bark);
+double Formant_getQuantileOfBandwidth (Formant me, integer iformant, double quantile, double tmin, double tmax, kFormant_unit unit) {
+	return Sampled_getQuantile (me, tmin, tmax, quantile, (iformant << 1) + 1, (int) unit);
 }
 
 void Formant_scatterPlot (Formant me, Graphics g, double tmin, double tmax,
-	int iformant1, double fmin1, double fmax1, int iformant2, double fmin2, double fmax2,
-	double size_mm, const char32 *mark, int garnish)
+	integer iformant1, double fmin1, double fmax1, integer iformant2, double fmin2, double fmax2,
+	double size_mm, const char32 *mark, bool garnish)
 {
 	if (iformant1 < 1 || iformant2 < 1) return;
 	if (tmax <= tmin) { tmin = my xmin; tmax = my xmax; }
@@ -360,7 +352,7 @@ void Formant_scatterPlot (Formant me, Graphics g, double tmin, double tmax,
 	}
 }
 
-autoMatrix Formant_to_Matrix (Formant me, int iformant) {
+autoMatrix Formant_to_Matrix (Formant me, integer iformant) {
 	try {
 		autoMatrix thee = Matrix_create (my xmin, my xmax, my nx, my dx, my x1, 1.0, 1.0, 1, 1.0, 1.0);
 		for (long iframe = 1; iframe <= my nx; iframe ++) {
@@ -374,7 +366,7 @@ autoMatrix Formant_to_Matrix (Formant me, int iformant) {
 	}
 }
 
-autoMatrix Formant_to_Matrix_bandwidths (Formant me, int iformant) {
+autoMatrix Formant_to_Matrix_bandwidths (Formant me, integer iformant) {
 	try {
 		autoMatrix thee = Matrix_create (my xmin, my xmax, my nx, my dx, my x1, 1.0, 1.0, 1, 1.0, 1.0);
 		for (long iframe = 1; iframe <= my nx; iframe ++) {
@@ -392,7 +384,7 @@ autoMatrix Formant_to_Matrix_bandwidths (Formant me, int iformant) {
 
 struct fparm { Formant me, thee; double dfCost, bfCost, octaveJumpCost, refF [1 + 5]; };
 
-static double getLocalCost (long iframe, long icand, int itrack, void *closure) {
+static double getLocalCost (integer iframe, integer icand, integer itrack, void *closure) {
 	struct fparm *me = (struct fparm *) closure;
 	Formant_Frame frame = & my my d_frames [iframe];
 	Formant_Formant candidate;
@@ -405,7 +397,7 @@ static double getLocalCost (long iframe, long icand, int itrack, void *closure)
 	return my dfCost * fabs (candidate -> frequency - my refF [itrack]) +
 		my bfCost * candidate -> bandwidth / candidate -> frequency;
 }
-static double getTransitionCost (long iframe, long icand1, long icand2, int itrack, void *closure) {
+static double getTransitionCost (integer iframe, integer icand1, integer icand2, integer itrack, void *closure) {
 	struct fparm *me = (struct fparm *) closure;
 	Formant_Frame prevFrame = & my my d_frames [iframe - 1], curFrame = & my my d_frames [iframe];
 	double f1, f2;
@@ -417,7 +409,7 @@ static double getTransitionCost (long iframe, long icand1, long icand2, int itra
 	/*Melder_assert (f2 > 0.0);*/
 	return my octaveJumpCost * fabs (NUMlog2 (f1 / f2));
 }
-static void putResult (long iframe, long place, int itrack, void *closure) {
+static void putResult (integer iframe, integer place, integer itrack, void *closure) {
 	struct fparm *me = (struct fparm *) closure;
 	Melder_assert (iframe > 0 && iframe <= my my nx);
 	Melder_assert (itrack > 0 && itrack <= 5);
@@ -426,7 +418,7 @@ static void putResult (long iframe, long place, int itrack, void *closure) {
 	my thy d_frames [iframe]. formant [itrack] = my my d_frames [iframe]. formant [place];
 }
 
-autoFormant Formant_tracker (Formant me, int ntrack,
+autoFormant Formant_tracker (Formant me, integer ntrack,
 	double refF1, double refF2, double refF3, double refF4, double refF5,
 	double dfCost,   /* Per kHz. */
 	double bfCost, double octaveJumpCost)
@@ -461,24 +453,24 @@ autoFormant Formant_tracker (Formant me, int ntrack,
 }
 
 autoTable Formant_downto_Table (Formant me, bool includeFrameNumbers,
-	bool includeTimes, int timeDecimals,
-	bool includeIntensity, int intensityDecimals,
-	bool includeNumberOfFormants, int frequencyDecimals,
+	bool includeTimes, integer timeDecimals,
+	bool includeIntensity, integer intensityDecimals,
+	bool includeNumberOfFormants, integer frequencyDecimals,
 	bool includeBandwidths)
 {
 	try {
 		autoTable thee = Table_createWithoutColumnNames (my nx, includeFrameNumbers + includeTimes + includeIntensity +
 			includeNumberOfFormants + my maxnFormants * (1 + includeBandwidths));
-		long icol = 0;
+		integer icol = 0;
 		if (includeFrameNumbers)     Table_setColumnLabel (thee.get(), ++ icol, U"frame");
 		if (includeTimes)            Table_setColumnLabel (thee.get(), ++ icol, U"time(s)");
 		if (includeIntensity)        Table_setColumnLabel (thee.get(), ++ icol, U"intensity");
 		if (includeNumberOfFormants) Table_setColumnLabel (thee.get(), ++ icol, U"nformants");
-		for (long iformant = 1; iformant <= my maxnFormants; iformant ++) {
+		for (integer iformant = 1; iformant <= my maxnFormants; iformant ++) {
 			Table_setColumnLabel (thee.get(), ++ icol, Melder_cat (U"F", iformant, U"(Hz)"));
 			if (includeBandwidths) { Table_setColumnLabel (thee.get(), ++ icol, Melder_cat (U"B", iformant, U"(Hz)")); }
 		}
-		for (long iframe = 1; iframe <= my nx; iframe ++) {
+		for (integer iframe = 1; iframe <= my nx; iframe ++) {
 			icol = 0;
 			if (includeFrameNumbers)
 				Table_setNumericValue (thee.get(), iframe, ++ icol, iframe);
@@ -489,13 +481,13 @@ autoTable Formant_downto_Table (Formant me, bool includeFrameNumbers,
 				Table_setStringValue (thee.get(), iframe, ++ icol, Melder_fixed (frame -> intensity, intensityDecimals));
 			if (includeNumberOfFormants)
 				Table_setNumericValue (thee.get(), iframe, ++ icol, frame -> nFormants);
-			for (long iformant = 1; iformant <= frame -> nFormants; iformant ++) {
+			for (integer iformant = 1; iformant <= frame -> nFormants; iformant ++) {
 				Formant_Formant formant = & frame -> formant [iformant];
 				Table_setStringValue (thee.get(), iframe, ++ icol, Melder_fixed (formant -> frequency, frequencyDecimals));
 				if (includeBandwidths)
 					Table_setStringValue (thee.get(), iframe, ++ icol, Melder_fixed (formant -> bandwidth, frequencyDecimals));
 			}
-			for (long iformant = frame -> nFormants + 1; iformant <= my maxnFormants; iformant ++) {
+			for (integer iformant = frame -> nFormants + 1; iformant <= my maxnFormants; iformant ++) {
 				Table_setNumericValue (thee.get(), iframe, ++ icol, undefined);
 				if (includeBandwidths)
 					Table_setNumericValue (thee.get(), iframe, ++ icol, undefined);
@@ -508,9 +500,9 @@ autoTable Formant_downto_Table (Formant me, bool includeFrameNumbers,
 }
 
 void Formant_list (Formant me, bool includeFrameNumbers,
-	bool includeTimes, int timeDecimals,
-	bool includeIntensity, int intensityDecimals,
-	bool includeNumberOfFormants, int frequencyDecimals,
+	bool includeTimes, integer timeDecimals,
+	bool includeIntensity, integer intensityDecimals,
+	bool includeNumberOfFormants, integer frequencyDecimals,
 	bool includeBandwidths)
 {
 	try {
diff --git a/fon/Formant.h b/fon/Formant.h
index cf19739..63d813d 100644
--- a/fon/Formant.h
+++ b/fon/Formant.h
@@ -2,7 +2,7 @@
 #define _Formant_h_
 /* Formant.h
  *
- * Copyright (C) 1992-2011,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2015,2017 Paul Boersma
  *
  * This code 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,10 @@
 #include "Table.h"
 Thing_declare (Interpreter);
 
+#include "Formant_enums.h"
 #include "Formant_def.h"
 
-autoFormant Formant_create (double tmin, double tmax, long nt, double dt, double t1, int maxnFormants);
+autoFormant Formant_create (double tmin, double tmax, integer nt, double dt, double t1, integer maximumNumberOfFormants);
 /*
 	Function:
 		return a new instance of Formant.
@@ -44,57 +45,57 @@ autoFormant Formant_create (double tmin, double tmax, long nt, double dt, double
 		my frames [1..nt]. formants [1..maxnFormants] = 0.0;
 		my frames [1..nt]. bandwidths [1..maxnFormants] = 0.0;
 */
-long Formant_getMinNumFormants (Formant me);
-long Formant_getMaxNumFormants (Formant me);
+integer Formant_getMinNumFormants (Formant me);
+integer Formant_getMaxNumFormants (Formant me);
 
-double Formant_getValueAtTime (Formant me, int iformant, double time, int bark);
-double Formant_getBandwidthAtTime (Formant me, int iformant, double time, int bark);
+double Formant_getValueAtTime (Formant me, integer formantNumber, double time, kFormant_unit unit);
+double Formant_getBandwidthAtTime (Formant me, integer formantNumber, double time, kFormant_unit unit);
 
-void Formant_getExtrema (Formant me, int iformant, double tmin, double tmax, double *fmin, double *fmax);
-void Formant_getMinimumAndTime (Formant me, int iformant, double tmin, double tmax, int bark, int interpolate,
+void Formant_getExtrema (Formant me, integer formantNumber, double tmin, double tmax, double *fmin, double *fmax);
+void Formant_getMinimumAndTime (Formant me, integer formantNumber, double tmin, double tmax, kFormant_unit unit, int interpolate,
 	double *return_minimum, double *return_timeOfMinimum);
-void Formant_getMaximumAndTime (Formant me, int iformant, double tmin, double tmax, int bark, int interpolate,
+void Formant_getMaximumAndTime (Formant me, integer formantNumber, double tmin, double tmax, kFormant_unit unit, int interpolate,
 	double *return_maximum, double *return_timeOfMaximum);
-double Formant_getMinimum (Formant me, int iformant, double tmin, double tmax, int bark, int interpolate);
-double Formant_getMaximum (Formant me, int iformant, double tmin, double tmax, int bark, int interpolate);
-double Formant_getTimeOfMaximum (Formant me, int iformant, double tmin, double tmax, int bark, int interpolate);
-double Formant_getTimeOfMinimum (Formant me, int iformant, double tmin, double tmax, int bark, int interpolate);
+double Formant_getMinimum (Formant me, integer formantNumber, double tmin, double tmax, kFormant_unit unit, int interpolate);
+double Formant_getMaximum (Formant me, integer formantNumber, double tmin, double tmax, kFormant_unit unit, int interpolate);
+double Formant_getTimeOfMaximum (Formant me, integer formantNumber, double tmin, double tmax, kFormant_unit unit, int interpolate);
+double Formant_getTimeOfMinimum (Formant me, integer formantNumber, double tmin, double tmax, kFormant_unit unit, int interpolate);
 
-double Formant_getQuantile (Formant me, int iformant, double quantile, double tmin, double tmax, int bark);
-double Formant_getQuantileOfBandwidth (Formant me, int iformant, double quantile, double tmin, double tmax, int bark);
-double Formant_getMean (Formant me, int iformant, double tmin, double tmax, int bark);
-double Formant_getStandardDeviation (Formant me, int iformant, double tmin, double tmax, int bark);
+double Formant_getQuantile (Formant me, integer formantNumber, double quantile, double tmin, double tmax, kFormant_unit unit);
+double Formant_getQuantileOfBandwidth (Formant me, integer formantNumber, double quantile, double tmin, double tmax, kFormant_unit unit);
+double Formant_getMean (Formant me, integer formantNumber, double tmin, double tmax, kFormant_unit unit);
+double Formant_getStandardDeviation (Formant me, integer formantNumber, double tmin, double tmax, kFormant_unit unit);
 
 void Formant_sort (Formant me);
 
-void Formant_drawTracks (Formant me, Graphics g, double tmin, double tmax, double fmax, int garnish);
-void Formant_drawSpeckles_inside (Formant me, Graphics g, double tmin, double tmax, double fmin, double fmax,
+void Formant_drawTracks (Formant me, Graphics graphics, double tmin, double tmax, double fmax, bool garnish);
+void Formant_drawSpeckles_inside (Formant me, Graphics graphics, double tmin, double tmax, double fmin, double fmax,
 	double suppress_dB);
-void Formant_drawSpeckles (Formant me, Graphics g, double tmin, double tmax, double fmax,
-	double suppress_dB, int garnish);
-void Formant_scatterPlot (Formant me, Graphics g, double tmin, double tmax,
-	int iformant1, double fmin1, double fmax1, int iformant2, double fmin2, double fmax2,
-	double size_mm, const char32 *mark, int garnish);
+void Formant_drawSpeckles (Formant me, Graphics graphics, double tmin, double tmax, double fmax,
+	double suppress_dB, bool garnish);
+void Formant_scatterPlot (Formant me, Graphics graphics, double tmin, double tmax,
+	integer iformant1, double fmin1, double fmax1, integer iformant2, double fmin2, double fmax2,
+	double size_mm, const char32 *mark, bool garnish);
 
-autoMatrix Formant_to_Matrix (Formant me, int iformant);
-autoMatrix Formant_to_Matrix_bandwidths (Formant me, int iformant);
+autoMatrix Formant_to_Matrix (Formant me, integer iformant);
+autoMatrix Formant_to_Matrix_bandwidths (Formant me, integer iformant);
 void Formant_formula_frequencies (Formant me, const char32 *formula, Interpreter interpreter);
 void Formant_formula_bandwidths (Formant me, const char32 *formula, Interpreter interpreter);
 
-autoFormant Formant_tracker (Formant me, int numberOfTracks,
+autoFormant Formant_tracker (Formant me, integer numberOfTracks,
 	double refF1, double refF2, double refF3, double refF4, double refF5,
 	double dfCost,   // per kHz
 	double bfCost, double octaveJumpCost);
 
 autoTable Formant_downto_Table (Formant me, bool includeFrameNumbers,
-	bool includeTimes, int timeDecimals,
-	bool includeIntensity, int intensityDecimals,
-	bool includeNumberOfFormants, int frequencyDecimals,
+	bool includeTimes, integer timeDecimals,
+	bool includeIntensity, integer intensityDecimals,
+	bool includeNumberOfFormants, integer frequencyDecimals,
 	bool includeBandwidths);
 void Formant_list (Formant me, bool includeFrameNumbers,
-	bool includeTimes, int timeDecimals,
-	bool includeIntensity, int intensityDecimals,
-	bool includeNumberOfFormants, int frequencyDecimals,
+	bool includeTimes, integer timeDecimals,
+	bool includeIntensity, integer intensityDecimals,
+	bool includeNumberOfFormants, integer frequencyDecimals,
 	bool includeBandwidths);
 
 /* End of file Formant.h */
diff --git a/fon/FormantGrid.cpp b/fon/FormantGrid.cpp
index a9c3bae..7150515 100644
--- a/fon/FormantGrid.cpp
+++ b/fon/FormantGrid.cpp
@@ -41,12 +41,12 @@
 
 Thing_implement (FormantGrid, Function, 0);
 
-double structFormantGrid :: v_getVector (long irow, long icol) {
+double structFormantGrid :: v_getVector (integer irow, integer icol) {
 	RealTier tier = our formants.at [irow];
 	return RealTier_getValueAtIndex (tier, icol);
 }
 
-double structFormantGrid :: v_getFunction1 (long irow, double x) {
+double structFormantGrid :: v_getFunction1 (integer irow, double x) {
 	RealTier tier = our formants.at [irow];
 	return RealTier_getValueAtTime (tier, x);
 }
diff --git a/fon/FormantGridEditor.cpp b/fon/FormantGridEditor.cpp
index 13f538f..deded20 100644
--- a/fon/FormantGridEditor.cpp
+++ b/fon/FormantGridEditor.cpp
@@ -56,17 +56,17 @@ static void menu_cb_addPointAtCursor (FormantGridEditor me, EDITOR_ARGS_DIRECT)
 
 static void menu_cb_addPointAt (FormantGridEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Add point", nullptr)
-		REAL (U"Time (s)", U"0.0")
-		POSITIVE (U"Frequency (Hz)", U"200.0")
+		REAL (time, U"Time (s)", U"0.0")
+		POSITIVE (frequency, U"Frequency (Hz)", U"200.0")
 	EDITOR_OK
-		SET_REAL (U"Time", 0.5 * (my startSelection + my endSelection))
-		SET_REAL (U"Frequency", my ycursor)
+		SET_REAL (time, 0.5 * (my startSelection + my endSelection))
+		SET_REAL (frequency, my ycursor)
 	EDITOR_DO
 		Editor_save (me, U"Add point");
 		FormantGrid grid = (FormantGrid) my data;
 		OrderedOf<structRealTier>* tiers = ( my editingBandwidths ? & grid -> bandwidths : & grid -> formants );
 		RealTier tier = tiers->at [my selectedFormant];
-		RealTier_addPoint (tier, GET_REAL (U"Time"), GET_REAL (U"Frequency"));
+		RealTier_addPoint (tier, time, frequency);
 		FunctionEditor_redraw (me);
 		Editor_broadcastDataChanged (me);
 	EDITOR_END
@@ -74,28 +74,28 @@ static void menu_cb_addPointAt (FormantGridEditor me, EDITOR_ARGS_FORM) {
 
 static void menu_cb_setFormantRange (FormantGridEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Set formant range", nullptr)
-		REAL (U"Minimum formant (Hz)", my default_formantFloor   ())
-		REAL (U"Maximum formant (Hz)", my default_formantCeiling ())
+		REAL (minimumFormant, U"Minimum formant (Hz)", my default_formantFloor   ())
+		REAL (maximumFormant, U"Maximum formant (Hz)", my default_formantCeiling ())
 	EDITOR_OK
-		SET_REAL (U"Minimum formant", my p_formantFloor)
-		SET_REAL (U"Maximum formant", my p_formantCeiling)
+		SET_REAL (minimumFormant, my p_formantFloor)
+		SET_REAL (maximumFormant, my p_formantCeiling)
 	EDITOR_DO
-		my pref_formantFloor   () = my p_formantFloor   = GET_REAL (U"Minimum formant");
-		my pref_formantCeiling () = my p_formantCeiling = GET_REAL (U"Maximum formant");
+		my pref_formantFloor   () = my p_formantFloor   = minimumFormant;
+		my pref_formantCeiling () = my p_formantCeiling = maximumFormant;
 		FunctionEditor_redraw (me);
 	EDITOR_END
 }
 
 static void menu_cb_setBandwidthRange (FormantGridEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Set bandwidth range", nullptr)
-		REAL (U"Minimum bandwidth (Hz)", my default_bandwidthFloor   ())
-		REAL (U"Maximum bandwidth (Hz)", my default_bandwidthCeiling ())
+		REAL (minimumBandwidth, U"Minimum bandwidth (Hz)", my default_bandwidthFloor   ())
+		REAL (maximumBandwidth, U"Maximum bandwidth (Hz)", my default_bandwidthCeiling ())
 	EDITOR_OK
-		SET_REAL (U"Minimum bandwidth", my p_bandwidthFloor)
-		SET_REAL (U"Maximum bandwidth", my p_bandwidthCeiling)
+		SET_REAL (minimumBandwidth, my p_bandwidthFloor)
+		SET_REAL (maximumBandwidth, my p_bandwidthCeiling)
 	EDITOR_DO
-		my pref_bandwidthFloor   () = my p_bandwidthFloor   = GET_REAL (U"Minimum bandwidth");
-		my pref_bandwidthCeiling () = my p_bandwidthCeiling = GET_REAL (U"Maximum bandwidth");
+		my pref_bandwidthFloor   () = my p_bandwidthFloor   = minimumBandwidth;
+		my pref_bandwidthCeiling () = my p_bandwidthCeiling = maximumBandwidth;
 		FunctionEditor_redraw (me);
 	EDITOR_END
 }
@@ -126,39 +126,39 @@ static void menu_cb_selectEighth  (FormantGridEditor me, EDITOR_ARGS_DIRECT) { s
 static void menu_cb_selectNinth   (FormantGridEditor me, EDITOR_ARGS_DIRECT) { selectFormantOrBandwidth (me, 9); }
 static void menu_cb_selectFormantOrBandwidth (FormantGridEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Select formant or bandwidth", nullptr)
-		NATURAL (U"Formant number", U"1")
+		NATURAL (formantNumber, U"Formant number", U"1")
 	EDITOR_OK
-		SET_INTEGER (U"Formant number", my selectedFormant)
+		SET_INTEGER (formantNumber, my selectedFormant)
 	EDITOR_DO
-		selectFormantOrBandwidth (me, GET_INTEGER (U"Formant number"));
+		selectFormantOrBandwidth (me, formantNumber);
 		FunctionEditor_redraw (me);
 	EDITOR_END
 }
 
 static void menu_cb_pitchSettings (FormantGridEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Source pitch settings", nullptr)
-		LABEL (U"", U"These settings apply to the pitch curve")
-		LABEL (U"", U"that you hear when playing the FormantGrid.")
-		REAL     (U"Starting time",       my default_source_pitch_tStart  ())
-		POSITIVE (U"Starting pitch (Hz)", my default_source_pitch_f0Start ())
-		REAL     (U"Mid time",            my default_source_pitch_tMid    ())
-		POSITIVE (U"Mid pitch (Hz)",      my default_source_pitch_f0Mid   ())
-		REAL     (U"End time",            my default_source_pitch_tEnd    ())
-		POSITIVE (U"End pitch (Hz)",      my default_source_pitch_f0End   ())
+		LABEL (U"These settings apply to the pitch curve")
+		LABEL (U"that you hear when playing the FormantGrid.")
+		REAL     (startTime,  U"Start time",       my default_source_pitch_tStart  ())
+		POSITIVE (startPitch, U"Start pitch (Hz)", my default_source_pitch_f0Start ())
+		REAL     (midTime,    U"Mid time",         my default_source_pitch_tMid    ())
+		POSITIVE (midPitch,   U"Mid pitch (Hz)",   my default_source_pitch_f0Mid   ())
+		REAL     (endTime,    U"End time",         my default_source_pitch_tEnd    ())
+		POSITIVE (endPitch,   U"End pitch (Hz)",   my default_source_pitch_f0End   ())
 	EDITOR_OK
-		SET_REAL (U"Starting time",  my p_source_pitch_tStart)
-		SET_REAL (U"Starting pitch", my p_source_pitch_f0Start)
-		SET_REAL (U"Mid time",       my p_source_pitch_tMid)
-		SET_REAL (U"Mid pitch",      my p_source_pitch_f0Mid)
-		SET_REAL (U"End time",       my p_source_pitch_tEnd)
-		SET_REAL (U"End pitch",      my p_source_pitch_f0End)
+		SET_REAL (startTime,  my p_source_pitch_tStart)
+		SET_REAL (startPitch, my p_source_pitch_f0Start)
+		SET_REAL (midTime,    my p_source_pitch_tMid)
+		SET_REAL (midPitch,   my p_source_pitch_f0Mid)
+		SET_REAL (endTime,    my p_source_pitch_tEnd)
+		SET_REAL (endPitch,   my p_source_pitch_f0End)
 	EDITOR_DO
-		my pref_source_pitch_tStart  () = my p_source_pitch_tStart  = GET_REAL (U"Starting time");
-		my pref_source_pitch_f0Start () = my p_source_pitch_f0Start = GET_REAL (U"Starting pitch");
-		my pref_source_pitch_tMid    () = my p_source_pitch_tMid    = GET_REAL (U"Mid time");
-		my pref_source_pitch_f0Mid   () = my p_source_pitch_f0Mid   = GET_REAL (U"Mid pitch");
-		my pref_source_pitch_tEnd    () = my p_source_pitch_tEnd    = GET_REAL (U"End time");
-		my pref_source_pitch_f0End   () = my p_source_pitch_f0End   = GET_REAL (U"End pitch");
+		my pref_source_pitch_tStart  () = my p_source_pitch_tStart  = startTime;
+		my pref_source_pitch_f0Start () = my p_source_pitch_f0Start = startPitch;
+		my pref_source_pitch_tMid    () = my p_source_pitch_tMid    = midTime;
+		my pref_source_pitch_f0Mid   () = my p_source_pitch_f0Mid   = midPitch;
+		my pref_source_pitch_tEnd    () = my p_source_pitch_tEnd    = endTime;
+		my pref_source_pitch_f0End   () = my p_source_pitch_f0End   = endPitch;
 	EDITOR_END
 }
 
diff --git a/fon/FormantGrid_def.h b/fon/FormantGrid_def.h
index e12a39e..cf9bf8c 100644
--- a/fon/FormantGrid_def.h
+++ b/fon/FormantGrid_def.h
@@ -1,6 +1,6 @@
 /* FormantGrid_def.h
  *
- * Copyright (C) 2008-2011,2015 Paul Boersma & David Weenink
+ * Copyright (C) 2008-2011,2015,2017 Paul Boersma & David Weenink
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,13 +25,13 @@ oo_DEFINE_CLASS (FormantGrid, Function)
 	#if oo_DECLARING
 		bool v_hasGetVector ()
 			override { return true; }
-		double v_getVector (long irow, long icol)
+		double v_getVector (integer irow, integer icol)
 			override;
 		bool v_hasGetFunction1 ()
 			override { return true; }
-		double v_getFunction1 (long irow, double x)
+		double v_getFunction1 (integer irow, double x)
 			override;
-		const char32 * v_getUnitText (long ilevel, int /* unit */, unsigned long /* flags */)
+		const char32 * v_getUnitText (integer ilevel, int /* unit */, uint32 /* flags */)
 			override { return ilevel & 1 ? U"Formant (Hz)" : U"Bandwidth (Hz)"; }
 		void v_shiftX (double xfrom, double xto)
 			override;
diff --git a/fon/Formant_def.h b/fon/Formant_def.h
index c1a9304..4f86fef 100644
--- a/fon/Formant_def.h
+++ b/fon/Formant_def.h
@@ -64,7 +64,7 @@ oo_DEFINE_CLASS (Formant, Sampled)
 			override;
 		int v_domainQuantity ()
 			override { return MelderQuantity_TIME_SECONDS; }
-		double v_getValueAtSample (long iframe, long which, int units)
+		double v_getValueAtSample (integer iframe, integer which, int units)
 			override;
 	#endif
 
diff --git a/fon/Excitation_to_Formant.h b/fon/Formant_enums.h
similarity index 72%
copy from fon/Excitation_to_Formant.h
copy to fon/Formant_enums.h
index 22bd282..27d80c3 100644
--- a/fon/Excitation_to_Formant.h
+++ b/fon/Formant_enums.h
@@ -1,6 +1,6 @@
-/* Excitation_to_Formant.h
+/* Formant_enums.h
  *
- * Copyright (C) 1992-2011,2015 Paul Boersma
+ * Copyright (C) 2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,9 +16,9 @@
  * along with this work. If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "Excitation.h"
-#include "Formant.h"
+enums_begin (kFormant_unit, 0)
+	enums_add (kFormant_unit, 0, HERTZ, U"hertz")
+	enums_add (kFormant_unit, 1, BARK, U"bark")
+enums_end (kFormant_unit, 1, HERTZ)
 
-autoFormant Excitation_to_Formant (Excitation, int maxnFormants);
-
-/* End of file Excitation_to_Formant.h */
+/* End of file Formant_enums.h */
diff --git a/fon/FunctionEditor.cpp b/fon/FunctionEditor.cpp
index 994d374..094b8f2 100644
--- a/fon/FunctionEditor.cpp
+++ b/fon/FunctionEditor.cpp
@@ -403,23 +403,23 @@ static void gui_drawingarea_cb_resize (FunctionEditor me, GuiDrawingArea_ResizeE
 
 static void menu_cb_preferences (FunctionEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Preferences", nullptr)
-		BOOLEAN (U"Synchronize zoom and scroll", my default_synchronizedZoomAndScroll ())
-		BOOLEAN (U"Show selection viewer", my default_showSelectionViewer ())
-		POSITIVE (Melder_cat (U"Arrow scroll step (", my v_format_units (), U")"), my default_arrowScrollStep ())
+		BOOLEAN (synchronizeZoomAndScroll, U"Synchronize zoom and scroll", my default_synchronizedZoomAndScroll ())
+		BOOLEAN (showSelectionViewer, U"Show selection viewer", my default_showSelectionViewer ())
+		POSITIVE (arrowScrollStep, Melder_cat (U"Arrow scroll step (", my v_format_units (), U")"), my default_arrowScrollStep ())
 		my v_prefs_addFields (cmd);
 	EDITOR_OK
-		SET_INTEGER (U"Synchronize zoom and scroll", my pref_synchronizedZoomAndScroll ())
-		SET_INTEGER (U"Show selection viewer", my pref_showSelectionViewer())
-		SET_REAL (U"Arrow scroll step", my p_arrowScrollStep)
+		SET_BOOLEAN (synchronizeZoomAndScroll, my pref_synchronizedZoomAndScroll ())
+		SET_BOOLEAN (showSelectionViewer, my pref_showSelectionViewer())
+		SET_REAL (arrowScrollStep, my p_arrowScrollStep)
 		my v_prefs_setValues (cmd);
 	EDITOR_DO
 		bool oldSynchronizedZoomAndScroll = my pref_synchronizedZoomAndScroll ();
 		bool oldShowSelectionViewer = my p_showSelectionViewer;
-		my pref_synchronizedZoomAndScroll () = GET_INTEGER (U"Synchronize zoom and scroll");
-		my pref_showSelectionViewer () = my p_showSelectionViewer = GET_INTEGER (U"Show selection viewer");
-		my pref_arrowScrollStep () = my p_arrowScrollStep = GET_REAL (U"Arrow scroll step");
+		my pref_synchronizedZoomAndScroll () = synchronizeZoomAndScroll;
+		my pref_showSelectionViewer () = my p_showSelectionViewer = showSelectionViewer;
+		my pref_arrowScrollStep () = my p_arrowScrollStep = arrowScrollStep;
 		if (my p_showSelectionViewer != oldShowSelectionViewer) {
-			struct structGuiDrawingArea_ResizeEvent event { my drawingArea, 0 };
+			struct structGuiDrawingArea_ResizeEvent event { my drawingArea, 0, 0 };
 			event. width  = GuiControl_getWidth  (my drawingArea);
 			event. height = GuiControl_getHeight (my drawingArea);
 			gui_drawingarea_cb_resize (me, & event);
@@ -431,19 +431,21 @@ static void menu_cb_preferences (FunctionEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_END
 }
 
+static bool v_form_pictureSelection_drawSelectionTimes;
+static bool v_form_pictureSelection_drawSelectionHairs;
 void structFunctionEditor :: v_form_pictureSelection (EditorCommand cmd) {
-	BOOLEAN (U"Draw selection times", true);
-	BOOLEAN (U"Draw selection hairs", true);
+	UiForm_addBoolean (cmd -> d_uiform.get(), & v_form_pictureSelection_drawSelectionTimes, nullptr, U"Draw selection times", true);
+	UiForm_addBoolean (cmd -> d_uiform.get(), & v_form_pictureSelection_drawSelectionHairs, nullptr, U"Draw selection hairs", true);
 }
 void structFunctionEditor :: v_ok_pictureSelection (EditorCommand cmd) {
 	FunctionEditor me = (FunctionEditor) cmd -> d_editor;
-	SET_INTEGER (U"Draw selection times", my pref_picture_drawSelectionTimes ());
-	SET_INTEGER (U"Draw selection hairs", my pref_picture_drawSelectionHairs ());
+	SET_BOOLEAN (v_form_pictureSelection_drawSelectionTimes, my pref_picture_drawSelectionTimes ())
+	SET_BOOLEAN (v_form_pictureSelection_drawSelectionHairs, my pref_picture_drawSelectionHairs ())
 }
 void structFunctionEditor :: v_do_pictureSelection (EditorCommand cmd) {
 	FunctionEditor me = (FunctionEditor) cmd -> d_editor;
-	my pref_picture_drawSelectionTimes () = GET_INTEGER (U"Draw selection times");
-	my pref_picture_drawSelectionHairs () = GET_INTEGER (U"Draw selection hairs");
+	my pref_picture_drawSelectionTimes () = v_form_pictureSelection_drawSelectionTimes;
+	my pref_picture_drawSelectionHairs () = v_form_pictureSelection_drawSelectionHairs;
 }
 
 /********** QUERY MENU **********/
@@ -465,16 +467,16 @@ static void menu_cb_getSelectionDuration (FunctionEditor me, EDITOR_ARGS_DIRECT)
 
 static void menu_cb_zoom (FunctionEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Zoom", nullptr)
-		REAL (U"From", U"0.0")
-		REAL (U"To", U"1.0")
+		REAL (from, U"From", U"0.0")
+		REAL (to,   U"To",   U"1.0")
 	EDITOR_OK
-		SET_REAL (U"From", my startWindow)
-		SET_REAL (U"To", my endWindow)
+		SET_REAL (from, my startWindow)
+		SET_REAL (to,   my endWindow)
 	EDITOR_DO
-		my startWindow = GET_REAL (U"From");
+		my startWindow = from;
 		if (my startWindow < my tmin + 1e-12)
 			my startWindow = my tmin;
-		my endWindow = GET_REAL (U"To");
+		my endWindow = to;
 		if (my endWindow > my tmax - 1e-12)
 			my endWindow = my tmax;
 		my v_updateText ();
@@ -599,14 +601,14 @@ static void menu_cb_zoomBack (FunctionEditor me, EDITOR_ARGS_DIRECT) {
 
 static void menu_cb_play (FunctionEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Play", nullptr)
-		REAL (U"From", U"0.0")
-		REAL (U"To", U"1.0")
+		REAL (from, U"From", U"0.0")
+		REAL (to,   U"To",   U"1.0")
 	EDITOR_OK
-		SET_REAL (U"From", my startWindow)
-		SET_REAL (U"To", my endWindow)
+		SET_REAL (from, my startWindow)
+		SET_REAL (to,   my endWindow)
 	EDITOR_DO
 		MelderAudio_stopPlaying (MelderAudio_IMPLICIT);
-		my v_play (GET_REAL (U"From"), GET_REAL (U"To"));
+		my v_play (from, to);
 	EDITOR_END
 }
 
@@ -639,16 +641,16 @@ static void menu_cb_interruptPlaying (FunctionEditor /* me */, EDITOR_ARGS_DIREC
 
 static void menu_cb_select (FunctionEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Select", nullptr)
-		REAL (U"Start of selection", U"0.0")
-		REAL (U"End of selection", U"1.0")
+		REAL (startOfSelection, U"Start of selection", U"0.0")
+		REAL (endOfSelection,   U"End of selection", U"1.0")
 	EDITOR_OK
-		SET_REAL (U"Start of selection", my startSelection)
-		SET_REAL (U"End of selection", my endSelection)
+		SET_REAL (startOfSelection, my startSelection)
+		SET_REAL (endOfSelection,   my endSelection)
 	EDITOR_DO
-		my startSelection = GET_REAL (U"Start of selection");
+		my startSelection = startOfSelection;
 		if (my startSelection < my tmin + 1e-12)
 			my startSelection = my tmin;
-		my endSelection = GET_REAL (U"End of selection");
+		my endSelection = endOfSelection;
 		if (my endSelection > my tmax - 1e-12)
 			my endSelection = my tmax;
 		if (my startSelection > my endSelection) {
@@ -678,11 +680,10 @@ static void menu_cb_moveCursorToE (FunctionEditor me, EDITOR_ARGS_DIRECT) {
 
 static void menu_cb_moveCursorTo (FunctionEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Move cursor to", nullptr)
-		REAL (U"Position", U"0.0")
+		REAL (position, U"Position", U"0.0")
 	EDITOR_OK
-		SET_REAL (U"Position", 0.5 * (my startSelection + my endSelection))
+		SET_REAL (position, 0.5 * (my startSelection + my endSelection))
 	EDITOR_DO
-		double position = GET_REAL (U"Position");
 		if (position < my tmin + 1e-12) position = my tmin;
 		if (position > my tmax - 1e-12) position = my tmax;
 		my startSelection = my endSelection = position;
@@ -694,10 +695,10 @@ static void menu_cb_moveCursorTo (FunctionEditor me, EDITOR_ARGS_FORM) {
 
 static void menu_cb_moveCursorBy (FunctionEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Move cursor by", nullptr)
-		REAL (U"Distance", U"0.05")
+		REAL (distance, U"Distance", U"0.05")
 	EDITOR_OK
 	EDITOR_DO
-		double position = 0.5 * (my startSelection + my endSelection) + GET_REAL (U"Distance");
+		double position = 0.5 * (my startSelection + my endSelection) + distance;
 		if (position < my tmin) position = my tmin;
 		if (position > my tmax) position = my tmax;
 		my startSelection = my endSelection = position;
@@ -709,10 +710,10 @@ static void menu_cb_moveCursorBy (FunctionEditor me, EDITOR_ARGS_FORM) {
 
 static void menu_cb_moveBby (FunctionEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Move start of selection by", nullptr)
-		REAL (U"Distance", U"0.05")
+		REAL (distance, U"Distance", U"0.05")
 	EDITOR_OK
 	EDITOR_DO
-		double position = my startSelection + GET_REAL (U"Distance");
+		double position = my startSelection + distance;
 		if (position < my tmin) position = my tmin;
 		if (position > my tmax) position = my tmax;
 		my startSelection = position;
@@ -729,10 +730,10 @@ static void menu_cb_moveBby (FunctionEditor me, EDITOR_ARGS_FORM) {
 
 static void menu_cb_moveEby (FunctionEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Move end of selection by", nullptr)
-		REAL (U"Distance", U"0.05")
+		REAL (distance, U"Distance", U"0.05")
 	EDITOR_OK
 	EDITOR_DO
-		double position = my endSelection + GET_REAL (U"Distance");
+		double position = my endSelection + distance;
 		if (position < my tmin) position = my tmin;
 		if (position > my tmax) position = my tmax;
 		my endSelection = position;
diff --git a/fon/Function_def.h b/fon/Function_def.h
index a40daf4..6f56519 100644
--- a/fon/Function_def.h
+++ b/fon/Function_def.h
@@ -1,6 +1,6 @@
 /* Function_def.h
  *
- * Copyright (C) 1992-2011,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -41,16 +41,16 @@ oo_DEFINE_CLASS (Function, Daata)
 			override { return xmax; }
 
 		virtual int v_domainQuantity () { return 0; }
-		virtual int v_getMinimumUnit (long ilevel) { (void) ilevel; return 0; }
-		virtual int v_getMaximumUnit (long ilevel) { (void) ilevel; return 0; }
-		virtual const char32 * v_getUnitText (long ilevel, int unit, unsigned long flags)
-			{ (void) ilevel; (void) unit; (void) flags; return U""; }
-		virtual bool v_isUnitLogarithmic (long ilevel, int unit)
-			{ (void) ilevel; (void) unit; return false; }
-		virtual double v_convertStandardToSpecialUnit (double value, long ilevel, int unit)
-			{ (void) ilevel; (void) unit; return value; }
-		virtual double v_convertSpecialToStandardUnit (double value, long ilevel, int unit)
-			{ (void) ilevel; (void) unit; return value; }
+		virtual int v_getMinimumUnit (integer /* level */) { return 0; }
+		virtual int v_getMaximumUnit (integer /* level */) { return 0; }
+		virtual const char32 * v_getUnitText (integer /* level */, int /* unit */, uint32 /* flags */)
+			{ return U""; }
+		virtual bool v_isUnitLogarithmic (integer /* level */, int /* unit */)
+			{ return false; }
+		virtual double v_convertStandardToSpecialUnit (double value, integer /* level */, int /* unit */)
+			{ return value; }
+		virtual double v_convertSpecialToStandardUnit (double value, integer /* level */, int /* unit */)
+			{ return value; }
 		virtual void v_shiftX (double xfrom, double xto);
 		virtual void v_scaleX (double xminfrom, double xmaxfrom, double xminto, double xmaxto);
 	#endif
diff --git a/fon/Harmonics_def.h b/fon/Harmonics_def.h
index df8ceb6..2381535 100644
--- a/fon/Harmonics_def.h
+++ b/fon/Harmonics_def.h
@@ -20,7 +20,7 @@
 #define ooSTRUCT Harmonics
 oo_DEFINE_CLASS (Harmonics, Daata)
 
-	oo_LONG (numberOfHarmonics)
+	oo_INTEGER (numberOfHarmonics)
 
 	oo_DOUBLE_VECTOR (harmonics, numberOfHarmonics)
 
diff --git a/fon/Image_def.h b/fon/Image_def.h
index 90649e2..073ff8a 100644
--- a/fon/Image_def.h
+++ b/fon/Image_def.h
@@ -1,6 +1,6 @@
 /* Image_def.h
  *
- * Copyright (C) 1992-2011 Paul Boersma
+ * Copyright (C) 1992-2011,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ oo_DEFINE_CLASS (Image, Sampled)
 
 	oo_DOUBLE (ymin)
 	oo_DOUBLE (ymax)
-	oo_LONG (ny)
+	oo_INTEGER (ny)
 	oo_DOUBLE (dy)
 	oo_DOUBLE (y1)
 	oo_UBYTE_MATRIX (z, ny, nx)
diff --git a/fon/Intensity.cpp b/fon/Intensity.cpp
index 8344267..c1acaad 100644
--- a/fon/Intensity.cpp
+++ b/fon/Intensity.cpp
@@ -32,8 +32,7 @@ void structIntensity :: v_info () {
 	MelderInfo_writeLine (U"   First frame centred at: ", x1, U" seconds");
 }
 
-double structIntensity :: v_convertStandardToSpecialUnit (double value, long ilevel, int unit) {
-	(void) ilevel;
+double structIntensity :: v_convertStandardToSpecialUnit (double value, integer /* level */, int unit) {
 	if (unit == 1) {
 		return pow (10.0, 0.1 * value);   // energy
 	} else if (unit == 2) {
@@ -42,8 +41,7 @@ double structIntensity :: v_convertStandardToSpecialUnit (double value, long ile
 	return value;   // default, especially if units == 0 (as in Vector_getMean) or units == 3 (averaging_DB)
 }
 
-double structIntensity :: v_convertSpecialToStandardUnit (double value, long ilevel, int unit) {
-	(void) ilevel;
+double structIntensity :: v_convertSpecialToStandardUnit (double value, integer /* level */, int unit) {
 	return
 		unit == 1 ?
 			10.0 * log10 (value) :   // value = energy
@@ -52,11 +50,11 @@ double structIntensity :: v_convertSpecialToStandardUnit (double value, long ile
 		value;   // value = dB
 }
 
-void Intensity_init (Intensity me, double tmin, double tmax, long nt, double dt, double t1) {
+void Intensity_init (Intensity me, double tmin, double tmax, integer nt, double dt, double t1) {
 	Matrix_init (me, tmin, tmax, nt, dt, t1, 1.0, 1.0, 1, 1.0, 1.0);
 }
 
-autoIntensity Intensity_create (double tmin, double tmax, long nt, double dt, double t1) {
+autoIntensity Intensity_create (double tmin, double tmax, integer nt, double dt, double t1) {
 	try {
 		autoIntensity me = Thing_new (Intensity);
 		Intensity_init (me.get(), tmin, tmax, nt, dt, t1);
@@ -101,7 +99,7 @@ void Intensity_drawInside (Intensity me, Graphics g, double tmin, double tmax, d
 }
 
 void Intensity_draw (Intensity me, Graphics g, double tmin, double tmax,
-	double minimum, double maximum, int garnish)
+	double minimum, double maximum, bool garnish)
 {
 	Graphics_setInner (g);
 	Intensity_drawInside (me, g, tmin, tmax, minimum, maximum);
diff --git a/fon/Intensity.h b/fon/Intensity.h
index a0d429e..5bd0409 100644
--- a/fon/Intensity.h
+++ b/fon/Intensity.h
@@ -2,7 +2,7 @@
 #define _Intensity_h_
 /* Intensity.h
  *
- * Copyright (C) 1992-2011,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -35,15 +35,15 @@ Thing_define (Intensity, Vector) {
 		override;
 	int v_domainQuantity ()
 		override { return MelderQuantity_TIME_SECONDS; }
-	double v_convertStandardToSpecialUnit (double value, long ilevel, int unit)
+	double v_convertStandardToSpecialUnit (double value, integer level, int unit)
 		override;
-	double v_convertSpecialToStandardUnit (double value, long ilevel, int unit)
+	double v_convertSpecialToStandardUnit (double value, integer level, int unit)
 		override;
 };
 
-autoIntensity Intensity_create (double tmin, double tmax, long nt, double dt, double t1);
+autoIntensity Intensity_create (double tmin, double tmax, integer nt, double dt, double t1);
 
-void Intensity_init (Intensity me, double tmin, double tmax, long nt, double dt, double t1);
+void Intensity_init (Intensity me, double tmin, double tmax, integer nt, double dt, double t1);
 
 autoMatrix Intensity_to_Matrix (Intensity me);
 
@@ -53,7 +53,7 @@ void Intensity_drawInside (Intensity me, Graphics g, double tmin, double tmax,
 	double minimum, double maximum);
 
 void Intensity_draw (Intensity me, Graphics g, double tmin, double tmax,
-	double minimum, double maximum, int garnish);
+	double minimum, double maximum, bool garnish);
 
 double Intensity_getQuantile (Intensity me, double tmin, double tmax, double quantile);
 
diff --git a/fon/IntensityTierEditor.h b/fon/IntensityTierEditor.h
index dd2b01c..f6998a2 100644
--- a/fon/IntensityTierEditor.h
+++ b/fon/IntensityTierEditor.h
@@ -2,7 +2,7 @@
 #define _IntensityTierEditor_h_
 /* IntensityTierEditor.h
  *
- * Copyright (C) 1992-2011,2012,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2012,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -29,8 +29,6 @@ Thing_define (IntensityTierEditor, RealTierEditor) {
 		override;
 	const char32 * v_quantityText ()
 		override { return U"Intensity (dB)"; }
-	const char32 * v_quantityKey ()
-		override { return U"Intensity"; }
 	const char32 * v_rightTickUnits ()
 		override { return U" dB"; }
 	double v_defaultYmin ()
@@ -47,10 +45,6 @@ Thing_define (IntensityTierEditor, RealTierEditor) {
 		override { return U"Minimum intensity (dB)"; }
 	const char32 * v_ymaxText ()
 		override { return U"Maximum intensity (dB)"; }
-	const char32 * v_yminKey ()
-		override { return U"Minimum intensity"; }
-	const char32 * v_ymaxKey ()
-		override { return U"Maximum intensity"; }
 };
 
 autoIntensityTierEditor IntensityTierEditor_create (const char32 *title,
diff --git a/fon/Label.cpp b/fon/Label.cpp
index edafc88..22d1fb4 100644
--- a/fon/Label.cpp
+++ b/fon/Label.cpp
@@ -1,6 +1,6 @@
 /* Label.cpp
  *
- * Copyright (C) 1992-2011,2015,2016 Paul Boersma
+ * Copyright (C) 1992-2011,2015,2016,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -35,9 +35,9 @@ bool structAutosegment :: v_equal (Daata thee_Daata) {
 }
 
 static struct structData_Description theAutosegment_description [] = {
-	{ U"Autosegment", inheritwa, 0, sizeof (struct structAutosegment), U"Autosegment", & theClassInfo_Function },
-	{ U"name", stringwa, Melder_offsetof (Autosegment, name), sizeof (char32 *) },
-	{ 0 } };
+	{ U"Autosegment", inheritwa, 0, sizeof (struct structAutosegment), U"Autosegment", & theClassInfo_Function, 0, nullptr, nullptr, nullptr, nullptr },
+	{ U"name", stringwa, Melder_offsetof (Autosegment, name), sizeof (char32 *), nullptr, nullptr, 0, nullptr, nullptr, nullptr, nullptr },
+	{ } };
 Data_Description structAutosegment :: s_description = & theAutosegment_description [0];
 
 autoAutosegment Autosegment_create (double tmin, double tmax, const char32 *label) {
diff --git a/fon/LongSound.cpp b/fon/LongSound.cpp
index ae5a0e6..fc426d1 100644
--- a/fon/LongSound.cpp
+++ b/fon/LongSound.cpp
@@ -1,6 +1,6 @@
 /* LongSound.cpp
  *
- * Copyright (C) 1992-2012,2014,2015,2016 Paul Boersma, 2007 Erez Volk (for FLAC and MP3)
+ * Copyright (C) 1992-2012,2014,2015,2016,2017 Paul Boersma, 2007 Erez Volk (for FLAC and MP3)
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -52,10 +52,10 @@ Thing_implement (SoundAndLongSoundList, Ordered, 0);
 #define MARGIN  0.01
 #define USE_MEMMOVE  1
 
-static long prefs_bufferLength;
+static integer prefs_bufferLength;
 
 void LongSound_preferences () {
-	Preferences_addLong (U"LongSound.bufferLength", & prefs_bufferLength, 60);   // seconds
+	Preferences_addInteger (U"LongSound.bufferLength", & prefs_bufferLength, 60);   // seconds
 }
 
 long LongSound_getBufferSizePref_seconds () { return prefs_bufferLength; }
@@ -180,7 +180,7 @@ static void _LongSound_MP3_convertShorts (LongSound me, const MP3F_SAMPLE *chann
 	my compressedShorts += numberOfSamples * my numberOfChannels;
 }
 
-static void _LongSound_MP3_convert (const MP3F_SAMPLE *channels [MP3F_MAX_CHANNELS], long numberOfSamples, void *void_me) {
+static void _LongSound_MP3_convert (const MP3F_SAMPLE *channels [MP3F_MAX_CHANNELS], integer numberOfSamples, void *void_me) {
 	iam (LongSound);
 	if (numberOfSamples > my compressedSamplesLeft)
 		numberOfSamples = my compressedSamplesLeft;
@@ -508,14 +508,14 @@ void LongSound_getWindowExtrema (LongSound me, double tmin, double tmax, int cha
 }
 
 static struct LongSoundPlay {
-	long numberOfSamples, i1, i2, silenceBefore, silenceAfter;
+	integer numberOfSamples, i1, i2, silenceBefore, silenceAfter;
 	double tmin, tmax, dt, t1;
 	int16 *resampledBuffer;
 	Sound_PlayCallback callback;
 	Thing boss;
 } thePlayingLongSound;
 
-static bool melderPlayCallback (void *closure, long samplesPlayed) {
+static bool melderPlayCallback (void *closure, integer samplesPlayed) {
 	struct LongSoundPlay *me = (struct LongSoundPlay *) closure;
 	int phase = 2;
 	double t = samplesPlayed <= my silenceBefore ? my tmin :
@@ -537,7 +537,7 @@ void LongSound_playPart (LongSound me, double tmin, double tmax,
 	MelderAudio_stopPlaying (MelderAudio_IMPLICIT);
 	Melder_free (thy resampledBuffer);   // just in case, and after playing has stopped
 	try {
-		int fits = LongSound_haveWindow (me, tmin, tmax);
+		bool fits = LongSound_haveWindow (me, tmin, tmax);
 		integer bestSampleRate = MelderAudio_getOutputBestSampleRate (my sampleRate), n, i1, i2;
 		if (! fits)
 			Melder_throw (U"Sound too long (", tmax - tmin, U" seconds).");
@@ -569,10 +569,10 @@ void LongSound_playPart (LongSound me, double tmin, double tmax,
 				   thy numberOfSamples, my numberOfChannels, melderPlayCallback, thee);
 			}
 		} else {
-			long newSampleRate = bestSampleRate;
-			long newN = ((double) n * newSampleRate) / my sampleRate - 1;
-			long silenceBefore = (long) (newSampleRate * MelderAudio_getOutputSilenceBefore ());
-			long silenceAfter = (long) (newSampleRate * MelderAudio_getOutputSilenceAfter ());
+			integer newSampleRate = bestSampleRate;
+			integer newN = ((double) n * newSampleRate) / my sampleRate - 1;
+			integer silenceBefore = (long) (newSampleRate * MelderAudio_getOutputSilenceBefore ());
+			integer silenceAfter = (long) (newSampleRate * MelderAudio_getOutputSilenceAfter ());
 			int16 *resampledBuffer = Melder_calloc (int16, (silenceBefore + newN + silenceAfter) * my numberOfChannels);
 			int16 *from = my buffer + (i1 - my imin) * my numberOfChannels;   // guaranteed: from [0 .. (my imax - my imin + 1) * nchan]
 			double t1 = my x1, dt = 1.0 / newSampleRate;
@@ -585,7 +585,7 @@ void LongSound_playPart (LongSound me, double tmin, double tmax,
 			thy silenceAfter = silenceAfter;
 			thy resampledBuffer = resampledBuffer;
 			if (my numberOfChannels == 1) {
-				for (long i = 0; i < newN; i ++) {
+				for (integer i = 0; i < newN; i ++) {
 					double t = t1 + i * dt;   // from t1 to t1 + (newN-1) * dt
 					double index = (t - t1) * my sampleRate;   // from 0
 					long flore = index;   // DANGEROUS: Implicitly rounding down...
@@ -593,7 +593,7 @@ void LongSound_playPart (LongSound me, double tmin, double tmax,
 					resampledBuffer [i + silenceBefore] = (1.0 - fraction) * from [flore] + fraction * from [flore + 1];
 				}
 			} else if (my numberOfChannels == 2) {
-				for (long i = 0; i < newN; i ++) {
+				for (integer i = 0; i < newN; i ++) {
 					double t = t1 + i * dt;
 					double index = (t - t1) * my sampleRate;
 					long flore = index;
@@ -603,13 +603,13 @@ void LongSound_playPart (LongSound me, double tmin, double tmax,
 					resampledBuffer [ii + ii + 1] = (1.0 - fraction) * from [flore + flore + 1] + fraction * from [flore + flore + 3];
 				}
 			} else {
-				for (long i = 0; i < newN; i ++) {
+				for (integer i = 0; i < newN; i ++) {
 					double t = t1 + i * dt;
 					double index = (t - t1) * my sampleRate;
-					long flore = index;
+					integer flore = index;
 					double fraction = index - flore;
-					long ii = (i + silenceBefore) * my numberOfChannels;
-					for (long chan = 0; chan < my numberOfChannels; chan ++) {
+					integer ii = (i + silenceBefore) * my numberOfChannels;
+					for (integer chan = 0; chan < my numberOfChannels; chan ++) {
 						resampledBuffer [ii + chan] =
 							(1.0 - fraction) * from [flore * my numberOfChannels + chan] +
 							fraction * from [(flore + 1) * my numberOfChannels + chan];
diff --git a/fon/LongSound.h b/fon/LongSound.h
index e5facda..8d37752 100644
--- a/fon/LongSound.h
+++ b/fon/LongSound.h
@@ -2,7 +2,7 @@
 #define _LongSound_h_
 /* LongSound.h
  *
- * Copyright (C) 1992-2012,2015,2016 Paul Boersma, 2007 Erez Volk (for FLAC, MP3)
+ * Copyright (C) 1992-2012,2015,2016,2017 Paul Boersma, 2007 Erez Volk (for FLAC, MP3)
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -33,14 +33,14 @@ Thing_define (LongSound, Sampled) {
 	FILE *f;
 	int audioFileType, numberOfChannels, encoding, numberOfBytesPerSamplePoint;
 	double sampleRate;
-	long startOfData;
+	integer startOfData;
 	double bufferLength;
 	int16 *buffer;   // this is always 16-bit, because will always play sounds in 16-bit, even those from 24-bit files
-	long imin, imax, nmax;
+	integer imin, imax, nmax;
 	struct FLAC__StreamDecoder *flacDecoder;
 	struct _MP3_FILE *mp3f;
 	int compressedMode;
-	long compressedSamplesLeft;
+	integer compressedSamplesLeft;
 	double *compressedFloats [2];
 	int16 *compressedShorts;
 
diff --git a/fon/Ltas.cpp b/fon/Ltas.cpp
index 7fac843..7e1d346 100644
--- a/fon/Ltas.cpp
+++ b/fon/Ltas.cpp
@@ -42,8 +42,7 @@ void structLtas :: v_info () {
 	MelderInfo_writeLine (U"Total SPL: ", Melder_single (10.0 * log10 (meanPowerDensity * (xmax - xmin))), U" dB");
 }
 
-double structLtas :: v_convertStandardToSpecialUnit (double value, long ilevel, int unit) {
-	(void) ilevel;
+double structLtas :: v_convertStandardToSpecialUnit (double value, integer /* level */, int unit) {
 	if (unit == 1) {
 		return pow (10.0, 0.1 * value);   // energy
 	} else if (unit == 2) {
@@ -52,8 +51,7 @@ double structLtas :: v_convertStandardToSpecialUnit (double value, long ilevel,
 	return value;
 }
 
-double structLtas :: v_convertSpecialToStandardUnit (double value, long ilevel, int unit) {
-	(void) ilevel;
+double structLtas :: v_convertSpecialToStandardUnit (double value, integer /* level */, int unit) {
 	return
 		unit == 1 ?
 			10.0 * log10 (value) :   // value = energy
@@ -62,7 +60,7 @@ double structLtas :: v_convertSpecialToStandardUnit (double value, long ilevel,
 		value;   // value = dB
 }
 
-autoLtas Ltas_create (long nx, double dx) {
+autoLtas Ltas_create (integer nx, double dx) {
 	try {
 		autoLtas me = Thing_new (Ltas);
 		Matrix_init (me.get(), 0.0, nx * dx, nx, dx, 0.5 * dx, 1.0, 1.0, 1, 1.0, 1.0);
@@ -72,7 +70,7 @@ autoLtas Ltas_create (long nx, double dx) {
 	}
 }
 
-void Ltas_draw (Ltas me, Graphics g, double fmin, double fmax, double minimum, double maximum, int garnish, const char32 *method) {
+void Ltas_draw (Ltas me, Graphics g, double fmin, double fmax, double minimum, double maximum, bool garnish, const char32 *method) {
 	Vector_draw (me, g, & fmin, & fmax, & minimum, & maximum, 1.0, method);
 	if (garnish) {
 		Graphics_drawInnerBox (g);
diff --git a/fon/Ltas.h b/fon/Ltas.h
index 81583cf..ad5fea5 100644
--- a/fon/Ltas.h
+++ b/fon/Ltas.h
@@ -28,9 +28,9 @@ Thing_define (Ltas, Vector) {
 		override;
 	int v_domainQuantity ()
 		override { return MelderQuantity_FREQUENCY_HERTZ; }
-	double v_convertStandardToSpecialUnit (double value, long ilevel, int unit)
+	double v_convertStandardToSpecialUnit (double value, integer level, int unit)
 		override;
-	double v_convertSpecialToStandardUnit (double value, long ilevel, int unit)
+	double v_convertSpecialToStandardUnit (double value, integer level, int unit)
 		override;
 };
 
@@ -46,7 +46,7 @@ Thing_define (Ltas, Vector) {
 		z [1] [1..nx]		// The intensity per band, in db/Hz.
 */
 
-autoLtas Ltas_create (long nx, double dx);
+autoLtas Ltas_create (integer nx, double dx);
 /*
 	Function:
 		create an Ltas.
@@ -63,7 +63,7 @@ autoLtas Ltas_create (long nx, double dx);
  */
 
 void Ltas_draw (Ltas me, Graphics g, double fmin, double fmax,
-	double minimum, double maximum, int garnish, const char32 *method);
+	double minimum, double maximum, bool garnish, const char32 *method);
 
 autoMatrix Ltas_to_Matrix (Ltas me);
 autoLtas Matrix_to_Ltas (Matrix me);
diff --git a/fon/ManipulationEditor.cpp b/fon/ManipulationEditor.cpp
index cf5011c..75475b8 100644
--- a/fon/ManipulationEditor.cpp
+++ b/fon/ManipulationEditor.cpp
@@ -181,14 +181,14 @@ static void menu_cb_addPulseAtCursor (ManipulationEditor me, EDITOR_ARGS_DIRECT)
 
 static void menu_cb_addPulseAt (ManipulationEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Add pulse", nullptr)
-		REAL (U"Position (s)", U"0.0")
+		REAL (position, U"Position (s)", U"0.0")
 	EDITOR_OK
-		SET_REAL (U"Position", 0.5 * (my startSelection + my endSelection))
+		SET_REAL (position, 0.5 * (my startSelection + my endSelection))
 	EDITOR_DO
 		Manipulation ana = (Manipulation) my data;
 		if (! ana -> pulses) return;
 		Editor_save (me, U"Add pulse");
-		PointProcess_addPoint (ana -> pulses.get(), GET_REAL (U"Position"));
+		PointProcess_addPoint (ana -> pulses.get(), position);
 		FunctionEditor_redraw (me);
 		Editor_broadcastDataChanged (me);
 	EDITOR_END
@@ -222,7 +222,7 @@ static void menu_cb_addPitchPointAtSlice (ManipulationEditor me, EDITOR_ARGS_DIR
 	PointProcess pulses = ana -> pulses.get();
 	if (! pulses) Melder_throw (U"There are no pulses.");
 	if (! ana -> pitch) return;
-	long ileft = PointProcess_getLowIndex (pulses, 0.5 * (my startSelection + my endSelection)), iright = ileft + 1, nt = pulses -> nt;
+	integer ileft = PointProcess_getLowIndex (pulses, 0.5 * (my startSelection + my endSelection)), iright = ileft + 1, nt = pulses -> nt;
 	double *t = pulses -> t;
 	double f = my pitchTier.cursor;   // default
 	Editor_save (me, U"Add pitch point");
@@ -256,16 +256,16 @@ static void menu_cb_addPitchPointAtSlice (ManipulationEditor me, EDITOR_ARGS_DIR
 
 static void menu_cb_addPitchPointAt (ManipulationEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Add pitch point", nullptr)
-		REAL (U"Time (s)", U"0.0")
-		REAL (U"Frequency (Hz or st)", U"100.0")
+		REAL (time, U"Time (s)", U"0.0")
+		REAL (frequency, U"Frequency (Hz or st)", U"100.0")
 	EDITOR_OK
-		SET_REAL (U"Time", 0.5 * (my startSelection + my endSelection))
-		SET_REAL (U"Frequency", my pitchTier.cursor)
+		SET_REAL (time, 0.5 * (my startSelection + my endSelection))
+		SET_REAL (frequency, my pitchTier.cursor)
 	EDITOR_DO
 		Manipulation ana = (Manipulation) my data;
 		if (! ana -> pitch) return;
 		Editor_save (me, U"Add pitch point");
-		RealTier_addPoint (ana -> pitch.get(), GET_REAL (U"Time"), YLININV (GET_REAL (U"Frequency")));
+		RealTier_addPoint (ana -> pitch.get(), time, YLININV (frequency));
 		FunctionEditor_redraw (me);
 		Editor_broadcastDataChanged (me);
 	EDITOR_END
@@ -273,20 +273,20 @@ static void menu_cb_addPitchPointAt (ManipulationEditor me, EDITOR_ARGS_FORM) {
 
 static void menu_cb_stylizePitch (ManipulationEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Stylize pitch", U"PitchTier: Stylize...")
-		REAL (U"Frequency resolution", my default_pitch_stylize_frequencyResolution ())
-		RADIO (U"Units", my default_pitch_stylize_useSemitones () + 1)
+		REAL (frequencyResolution, U"Frequency resolution", my default_pitch_stylize_frequencyResolution ())
+		RADIO (units, U"Units", my default_pitch_stylize_useSemitones () + 1)
 			RADIOBUTTON (U"Hertz")
 			RADIOBUTTON (U"semitones")
 	EDITOR_OK
-		SET_REAL    (U"Frequency resolution", my p_pitch_stylize_frequencyResolution)
-		SET_INTEGER (U"Units",                my p_pitch_stylize_useSemitones + 1)
+		SET_REAL   (frequencyResolution, my p_pitch_stylize_frequencyResolution)
+		SET_OPTION (units,               my p_pitch_stylize_useSemitones + 1)
 	EDITOR_DO
 		Manipulation ana = (Manipulation) my data;
 		if (! ana -> pitch) return;
 		Editor_save (me, U"Stylize pitch");
 		PitchTier_stylize (ana -> pitch.get(),
-			my pref_pitch_stylize_frequencyResolution () = my p_pitch_stylize_frequencyResolution = GET_REAL (U"Frequency resolution"),
-			my pref_pitch_stylize_useSemitones        () = my p_pitch_stylize_useSemitones        = GET_INTEGER (U"Units") - 1);
+			my pref_pitch_stylize_frequencyResolution () = my p_pitch_stylize_frequencyResolution = frequencyResolution,
+			my pref_pitch_stylize_useSemitones        () = my p_pitch_stylize_useSemitones        = units - 1);
 		FunctionEditor_redraw (me);
 		Editor_broadcastDataChanged (me);
 	EDITOR_END
@@ -303,15 +303,15 @@ static void menu_cb_stylizePitch_2st (ManipulationEditor me, EDITOR_ARGS_DIRECT)
 
 static void menu_cb_interpolateQuadratically (ManipulationEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Interpolate quadratically", nullptr)
-		NATURAL (U"Number of points per parabola", my default_pitch_interpolateQuadratically_numberOfPointsPerParabola ())
+		NATURAL (numberOfPointsPerParabola, U"Number of points per parabola", my default_pitch_interpolateQuadratically_numberOfPointsPerParabola ())
 	EDITOR_OK
-		SET_INTEGER (U"Number of points per parabola", my p_pitch_interpolateQuadratically_numberOfPointsPerParabola)
+		SET_INTEGER (numberOfPointsPerParabola, my p_pitch_interpolateQuadratically_numberOfPointsPerParabola)
 	EDITOR_DO
 		Manipulation ana = (Manipulation) my data;
 		if (! ana -> pitch) return;
 		Editor_save (me, U"Interpolate quadratically");
 		RealTier_interpolateQuadratically (ana -> pitch.get(),
-			my pref_pitch_interpolateQuadratically_numberOfPointsPerParabola () = my p_pitch_interpolateQuadratically_numberOfPointsPerParabola = GET_INTEGER (U"Number of points per parabola"),
+			my pref_pitch_interpolateQuadratically_numberOfPointsPerParabola () = my p_pitch_interpolateQuadratically_numberOfPointsPerParabola = numberOfPointsPerParabola,
 			my p_pitch_units == kManipulationEditor_pitchUnits::SEMITONES);
 		FunctionEditor_redraw (me);
 		Editor_broadcastDataChanged (me);
@@ -329,8 +329,8 @@ static void menu_cb_interpolateQuadratically_4pts (ManipulationEditor me, EDITOR
 
 static void menu_cb_shiftPitchFrequencies (ManipulationEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Shift pitch frequencies", nullptr)
-		REAL (U"Frequency shift", U"-20.0")
-		OPTIONMENU (U"Unit", 1)
+		REAL (frequencyShift, U"Frequency shift", U"-20.0")
+		OPTIONMENU (unit_i, U"Unit", 1)
 			OPTION (U"Hertz")
 			OPTION (U"mel")
 			OPTION (U"logHertz")
@@ -339,7 +339,6 @@ static void menu_cb_shiftPitchFrequencies (ManipulationEditor me, EDITOR_ARGS_FO
 	EDITOR_OK
 	EDITOR_DO
 		Manipulation ana = (Manipulation) my data;
-		int unit_i = GET_INTEGER (U"Unit");
 		kPitch_unit unit =
 			unit_i == 1 ? kPitch_unit::HERTZ :
 			unit_i == 2 ? kPitch_unit::MEL :
@@ -349,7 +348,7 @@ static void menu_cb_shiftPitchFrequencies (ManipulationEditor me, EDITOR_ARGS_FO
 		if (! ana -> pitch) return;
 		Editor_save (me, U"Shift pitch frequencies");
 		try {
-			PitchTier_shiftFrequencies (ana -> pitch.get(), my startSelection, my endSelection, GET_REAL (U"Frequency shift"), unit);
+			PitchTier_shiftFrequencies (ana -> pitch.get(), my startSelection, my endSelection, frequencyShift, unit);
 			FunctionEditor_redraw (me);
 			Editor_broadcastDataChanged (me);
 		} catch (MelderError) {
@@ -363,14 +362,14 @@ static void menu_cb_shiftPitchFrequencies (ManipulationEditor me, EDITOR_ARGS_FO
 
 static void menu_cb_multiplyPitchFrequencies (ManipulationEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Multiply pitch frequencies", nullptr)
-		POSITIVE (U"Factor", U"1.2")
-		LABEL (U"", U"The multiplication is always done in hertz.")
+		POSITIVE (factor, U"Factor", U"1.2")
+		LABEL (U"The multiplication is always done in hertz.")
 	EDITOR_OK
 	EDITOR_DO
 		Manipulation ana = (Manipulation) my data;
 		if (! ana -> pitch) return;
 		Editor_save (me, U"Multiply pitch frequencies");
-		PitchTier_multiplyFrequencies (ana -> pitch.get(), my startSelection, my endSelection, GET_REAL (U"Factor"));
+		PitchTier_multiplyFrequencies (ana -> pitch.get(), my startSelection, my endSelection, factor);
 		FunctionEditor_redraw (me);
 		Editor_broadcastDataChanged (me);
 	EDITOR_END
@@ -379,11 +378,10 @@ static void menu_cb_multiplyPitchFrequencies (ManipulationEditor me, EDITOR_ARGS
 static void menu_cb_setPitchRange (ManipulationEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Set pitch range", nullptr)
 		/* BUG: should include Minimum */
-		REAL (U"Maximum (Hz or st)", my default_pitch_maximum ())
+		REAL (maximum, U"Maximum (Hz or st)", my default_pitch_maximum ())
 	EDITOR_OK
-		SET_REAL (U"Maximum", my p_pitch_maximum)
+		SET_REAL (maximum, my p_pitch_maximum)
 	EDITOR_DO
-		double maximum = GET_REAL (U"Maximum");
 		if (maximum <= my pitchTier.minPeriodic)
 			Melder_throw (U"Maximum pitch must be greater than ",
 				Melder_half (my pitchTier.minPeriodic), U" ", units_strings [(int) my p_pitch_units], U".");
@@ -394,12 +392,12 @@ static void menu_cb_setPitchRange (ManipulationEditor me, EDITOR_ARGS_FORM) {
 
 static void menu_cb_setPitchUnits (ManipulationEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Set pitch units", nullptr)
-		RADIO_ENUM (U"Pitch units", kManipulationEditor_pitchUnits, my default_pitch_units ())
+		RADIO_ENUM (pitchUnits, U"Pitch units", kManipulationEditor_pitchUnits, my default_pitch_units ())
 	EDITOR_OK
-		SET_ENUM (U"Pitch units", kManipulationEditor_pitchUnits, my p_pitch_units)
+		SET_ENUM (pitchUnits, kManipulationEditor_pitchUnits, my p_pitch_units)
 	EDITOR_DO
 		enum kManipulationEditor_pitchUnits oldPitchUnits = my p_pitch_units;
-		my pref_pitch_units () = my p_pitch_units = GET_ENUM (kManipulationEditor_pitchUnits, U"Pitch units");
+		my pref_pitch_units () = my p_pitch_units = pitchUnits;
 		if (my p_pitch_units == oldPitchUnits) return;
 		if (my p_pitch_units == kManipulationEditor_pitchUnits::HERTZ) {
 			my p_pitch_minimum = 25.0;
@@ -420,14 +418,13 @@ static void menu_cb_setPitchUnits (ManipulationEditor me, EDITOR_ARGS_FORM) {
 
 static void menu_cb_setDurationRange (ManipulationEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Set duration range", nullptr)
-		REAL (U"Minimum", my default_duration_minimum ())
-		REAL (U"Maximum", my default_duration_maximum ())
+		REAL (minimum, U"Minimum", my default_duration_minimum ())
+		REAL (maximum, U"Maximum", my default_duration_maximum ())
 	EDITOR_OK
-		SET_REAL (U"Minimum", my p_duration_minimum)
-		SET_REAL (U"Maximum", my p_duration_maximum)
+		SET_REAL (minimum, my p_duration_minimum)
+		SET_REAL (maximum, my p_duration_maximum)
 	EDITOR_DO
 		Manipulation ana = (Manipulation) my data;
-		double minimum = GET_REAL (U"Minimum"), maximum = GET_REAL (U"Maximum");
 		double minimumValue = ana -> duration ? RealTier_getMinimumValue (ana -> duration.get()) : undefined;
 		double maximumValue = ana -> duration ? RealTier_getMaximumValue (ana -> duration.get()) : undefined;
 		if (minimum > 1) Melder_throw (U"Minimum relative duration must not be greater than 1.");
@@ -447,11 +444,11 @@ static void menu_cb_setDurationRange (ManipulationEditor me, EDITOR_ARGS_FORM) {
 
 static void menu_cb_setDraggingStrategy (ManipulationEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Set dragging strategy", U"ManipulationEditor")
-		RADIO_ENUM (U"Dragging strategy", kManipulationEditor_draggingStrategy, my default_pitch_draggingStrategy ())
+		RADIO_ENUM (draggingStrategy, U"Dragging strategy", kManipulationEditor_draggingStrategy, my default_pitch_draggingStrategy ())
 	EDITOR_OK
-		SET_ENUM (U"Dragging strategy", kManipulationEditor_draggingStrategy, my p_pitch_draggingStrategy)
+		SET_ENUM (draggingStrategy, kManipulationEditor_draggingStrategy, my p_pitch_draggingStrategy)
 	EDITOR_DO
-		my pref_pitch_draggingStrategy () = my p_pitch_draggingStrategy = GET_ENUM (kManipulationEditor_draggingStrategy, U"Dragging strategy");
+		my pref_pitch_draggingStrategy () = my p_pitch_draggingStrategy = draggingStrategy;
 	EDITOR_END
 }
 
@@ -478,15 +475,15 @@ static void menu_cb_addDurationPointAtCursor (ManipulationEditor me, EDITOR_ARGS
 
 static void menu_cb_addDurationPointAt (ManipulationEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Add duration point", nullptr)
-		REAL (U"Time (s)", U"0.0");
-		REAL (U"Relative duration", U"1.0");
+		REAL (time, U"Time (s)", U"0.0");
+		REAL (relativeDuration, U"Relative duration", U"1.0");
 	EDITOR_OK
-		SET_REAL (U"Time", 0.5 * (my startSelection + my endSelection))
+		SET_REAL (time, 0.5 * (my startSelection + my endSelection))
 	EDITOR_DO
 		Manipulation ana = (Manipulation) my data;
 		if (! ana -> duration) return;
 		Editor_save (me, U"Add duration point");
-		RealTier_addPoint (ana -> duration.get(), GET_REAL (U"Time"), GET_REAL (U"Relative duration"));
+		RealTier_addPoint (ana -> duration.get(), time, relativeDuration);
 		FunctionEditor_redraw (me);
 		Editor_broadcastDataChanged (me);
 	EDITOR_END
@@ -668,7 +665,7 @@ static void drawPitchArea (ManipulationEditor me, double ymin, double ymax) {
 	Manipulation ana = (Manipulation) my data;
 	PointProcess pulses = ana -> pulses.get();
 	PitchTier pitch = ana -> pitch.get();
-	long ifirstSelected, ilastSelected, n = pitch ? pitch -> points.size : 0, imin, imax, i;
+	integer ifirstSelected, ilastSelected, n = pitch ? pitch -> points.size : 0, imin, imax, i;
 	int cursorVisible = my startSelection == my endSelection && my startSelection >= my startWindow && my startSelection <= my endWindow;
 	double minimumFrequency = YLIN (50);
 	int rangePrecisions [] = { 0, 1, 2 };
@@ -777,7 +774,7 @@ static void drawPitchArea (ManipulationEditor me, double ymin, double ymax) {
 static void drawDurationArea (ManipulationEditor me, double ymin, double ymax) {
 	Manipulation ana = (Manipulation) my data;
 	DurationTier duration = ana -> duration.get();
-	long ifirstSelected, ilastSelected, n = duration ? duration -> points.size : 0, imin, imax, i;
+	integer ifirstSelected, ilastSelected, n = duration ? duration -> points.size : 0, imin, imax, i;
 	int cursorVisible = my startSelection == my endSelection && my startSelection >= my startWindow && my startSelection <= my endWindow;
 
 	/*
@@ -887,7 +884,7 @@ void structManipulationEditor :: v_draw () {
 	updateMenus (this);
 }
 
-static void drawWhileDragging (ManipulationEditor me, double xWC, double yWC, long first, long last, double dt, double df) {
+static void drawWhileDragging (ManipulationEditor me, double xWC, double yWC, integer first, integer last, double dt, double df) {
 	Manipulation ana = (Manipulation) my data;
 	PitchTier pitch = ana -> pitch.get();
 	(void) xWC;
@@ -896,7 +893,7 @@ static void drawWhileDragging (ManipulationEditor me, double xWC, double yWC, lo
 	/*
 	 * Draw all selected pitch points as magenta empty circles, if inside the window.
 	 */
-	for (long i = first; i <= last; i ++) {
+	for (integer i = first; i <= last; i ++) {
 		RealPoint point = pitch -> points.at [i];
 		double t = point -> number + dt, f = YLIN (point -> value) + df;
 		if (t >= my startWindow && t <= my endWindow)
@@ -922,7 +919,7 @@ static void drawWhileDragging (ManipulationEditor me, double xWC, double yWC, lo
 static bool clickPitch (ManipulationEditor me, double xWC, double yWC, bool shiftKeyPressed) {
 	Manipulation ana = (Manipulation) my data;
 	PitchTier pitch = ana -> pitch.get();
-	long inearestPoint, ifirstSelected, ilastSelected, i;
+	integer inearestPoint, ifirstSelected, ilastSelected, i;
 	RealPoint nearestPoint;
 	double dt = 0, df = 0;
 	int draggingSelection, dragHorizontal, dragVertical;
@@ -1034,14 +1031,14 @@ static bool clickPitch (ManipulationEditor me, double xWC, double yWC, bool shif
 	return FunctionEditor_UPDATE_NEEDED;
 }
 
-static void drawDurationWhileDragging (ManipulationEditor me, double /* xWC */, double /* yWC */, long first, long last, double dt, double df) {
+static void drawDurationWhileDragging (ManipulationEditor me, double /* xWC */, double /* yWC */, integer first, integer last, double dt, double df) {
 	Manipulation ana = (Manipulation) my data;
 	DurationTier duration = ana -> duration.get();
 
 	/*
 	 * Draw all selected duration points as magenta empty circles, if inside the window.
 	 */
-	for (long i = first; i <= last; i ++) {
+	for (integer i = first; i <= last; i ++) {
 		RealPoint point = duration -> points.at [i];
 		double t = point -> number + dt, dur = point -> value + df;
 		if (t >= my startWindow && t <= my endWindow)
@@ -1067,7 +1064,7 @@ static void drawDurationWhileDragging (ManipulationEditor me, double /* xWC */,
 static bool clickDuration (ManipulationEditor me, double xWC, double yWC, int shiftKeyPressed) {
 	Manipulation ana = (Manipulation) my data;
 	DurationTier duration = ana -> duration.get();
-	long inearestPoint, ifirstSelected, ilastSelected;
+	integer inearestPoint, ifirstSelected, ilastSelected;
 	RealPoint nearestPoint;
 	double dt = 0, df = 0;
 	int draggingSelection;
@@ -1155,7 +1152,7 @@ static bool clickDuration (ManipulationEditor me, double xWC, double yWC, int sh
 	/*
 	 * Drop.
 	 */
-	for (long i = ifirstSelected; i <= ilastSelected; i ++) {
+	for (integer i = ifirstSelected; i <= ilastSelected; i ++) {
 		RealPoint point = duration -> points.at [i];
 		point -> number += dt;
 		point -> value += df;
diff --git a/fon/ManipulationEditor_prefs.h b/fon/ManipulationEditor_prefs.h
index 4422149..5d1e2f2 100644
--- a/fon/ManipulationEditor_prefs.h
+++ b/fon/ManipulationEditor_prefs.h
@@ -1,6 +1,6 @@
 /* ManipulationEditor_prefs.h
  *
- * Copyright (C) 2013,2015 Paul Boersma
+ * Copyright (C) 2013,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,15 +18,15 @@
 
 prefs_begin (ManipulationEditor)
 
-	prefs_add_double_with_data (ManipulationEditor, pitch_minimum,                                            1, U"50.0")   // Hz
-	prefs_add_double_with_data (ManipulationEditor, pitch_maximum,                                            1, U"300.0")   // Hz
-	prefs_add_enum_with_data   (ManipulationEditor, pitch_units,            1, kManipulationEditor_pitchUnits,       DEFAULT)
-	prefs_add_enum_with_data   (ManipulationEditor, pitch_draggingStrategy, 1, kManipulationEditor_draggingStrategy, DEFAULT)
-	prefs_add_double_with_data (ManipulationEditor, pitch_stylize_frequencyResolution,                        1, U"2.0")
-	prefs_add_bool_with_data   (ManipulationEditor, pitch_stylize_useSemitones,                               1, true)
-	prefs_add_long_with_data   (ManipulationEditor, pitch_interpolateQuadratically_numberOfPointsPerParabola, 1, U"4")
-	prefs_add_double_with_data (ManipulationEditor, duration_minimum,                                         1, U"0.25")
-	prefs_add_double_with_data (ManipulationEditor, duration_maximum,                                         1, U"3.0")
+	prefs_add_double_with_data  (ManipulationEditor, pitch_minimum,                                            1, U"50.0")   // Hz
+	prefs_add_double_with_data  (ManipulationEditor, pitch_maximum,                                            1, U"300.0")   // Hz
+	prefs_add_enum_with_data    (ManipulationEditor, pitch_units,            1, kManipulationEditor_pitchUnits,       DEFAULT)
+	prefs_add_enum_with_data    (ManipulationEditor, pitch_draggingStrategy, 1, kManipulationEditor_draggingStrategy, DEFAULT)
+	prefs_add_double_with_data  (ManipulationEditor, pitch_stylize_frequencyResolution,                        1, U"2.0")
+	prefs_add_bool_with_data    (ManipulationEditor, pitch_stylize_useSemitones,                               1, true)
+	prefs_add_integer_with_data (ManipulationEditor, pitch_interpolateQuadratically_numberOfPointsPerParabola, 1, U"4")
+	prefs_add_double_with_data  (ManipulationEditor, duration_minimum,                                         1, U"0.25")
+	prefs_add_double_with_data  (ManipulationEditor, duration_maximum,                                         1, U"3.0")
 
 prefs_end (ManipulationEditor)
 
diff --git a/fon/Matrix.cpp b/fon/Matrix.cpp
index 961c594..7630ef6 100644
--- a/fon/Matrix.cpp
+++ b/fon/Matrix.cpp
@@ -88,12 +88,12 @@ void structMatrix :: v_readText (MelderReadText text, int formatVersion) {
 	our z = NUMmatrix_readText_r64 (1, our ny, 1, our nx, text, "z");
 }
 
-double structMatrix :: v_getValueAtSample (long isamp, long ilevel, int unit) {
+double structMatrix :: v_getValueAtSample (integer isamp, integer ilevel, int unit) {
 	double value = our z [ilevel] [isamp];
 	return ( isdefined (value) ? our v_convertStandardToSpecialUnit (value, ilevel, unit) : undefined );
 }
 
-double structMatrix :: v_getMatrix (long irow, long icol) {
+double structMatrix :: v_getMatrix (integer irow, integer icol) {
 	if (irow < 1 || irow > our ny) return 0.0;
 	if (icol < 1 || icol > our nx) return 0.0;
 	return z [irow] [icol];
diff --git a/fon/Matrix_def.h b/fon/Matrix_def.h
index a6b238d..09fba42 100644
--- a/fon/Matrix_def.h
+++ b/fon/Matrix_def.h
@@ -1,6 +1,6 @@
 /* Matrix_def.h
  *
- * Copyright (C) 1992-2011,2013,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2013,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -47,13 +47,13 @@ oo_DEFINE_CLASS (Matrix, SampledXY)
 			override { return nx; }
 		bool v_hasGetMatrix ()
 			override { return true; }
-		double v_getMatrix (long irow, long icol)
+		double v_getMatrix (integer irow, integer icol)
 			override;
 		bool v_hasGetFunction2 ()
 			override { return true; }
 		double v_getFunction2 (double x, double y)
 			override;
-		double v_getValueAtSample (long isamp, long ilevel, int unit)
+		double v_getValueAtSample (integer sampleNumber, integer level, int unit)
 			override;
 	#endif
 
diff --git a/fon/MovieWindow.cpp b/fon/MovieWindow.cpp
index 9f14912..aa2b9ef 100644
--- a/fon/MovieWindow.cpp
+++ b/fon/MovieWindow.cpp
@@ -67,11 +67,11 @@ void structMovieWindow :: v_draw () {
 		Graphics_fillRectangle (our graphics.get(), 0.0, 1.0, 0.0, 1.0);
 		Graphics_setColour (our graphics.get(), Graphics_BLACK);
 		Graphics_setWindow (our graphics.get(), our startWindow, our endWindow, 0.0, 1.0);
-		long firstFrame = Sampled_xToNearestIndex (movie, our startWindow);
-		long lastFrame = Sampled_xToNearestIndex (movie, our endWindow);
+		integer firstFrame = Sampled_xToNearestIndex (movie, our startWindow);
+		integer lastFrame = Sampled_xToNearestIndex (movie, our endWindow);
 		if (firstFrame < 1) firstFrame = 1;
 		if (lastFrame > movie -> nx) lastFrame = movie -> nx;
-		for (long iframe = firstFrame; iframe <= lastFrame; iframe ++) {
+		for (integer iframe = firstFrame; iframe <= lastFrame; iframe ++) {
 			double time = Sampled_indexToX (movie, iframe);
 			double timeLeft = time - 0.5 * movie -> dx, timeRight = time + 0.5 * movie -> dx;
 			if (timeLeft < our startWindow) timeLeft = our startWindow;
diff --git a/fon/ParamCurve.cpp b/fon/ParamCurve.cpp
index 56f1aff..299c0f6 100644
--- a/fon/ParamCurve.cpp
+++ b/fon/ParamCurve.cpp
@@ -111,7 +111,7 @@ autoParamCurve ParamCurve_create (Sound x, Sound y) {
 }
 
 void ParamCurve_draw (ParamCurve me, Graphics g, double t1, double t2, double dt,
-	double x1, double x2, double y1, double y2, int garnish)
+	double x1, double x2, double y1, double y2, bool garnish)
 {
 	if (t2 <= t1) {
 		double tx1 = my x -> x1;
diff --git a/fon/ParamCurve.h b/fon/ParamCurve.h
index f064ae5..ffe0b86 100644
--- a/fon/ParamCurve.h
+++ b/fon/ParamCurve.h
@@ -2,7 +2,7 @@
 #define _ParamCurve_h_
 /* ParamCurve.h
  *
- * Copyright (C) 1992-2011,2012,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2012,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -48,7 +48,7 @@ autoParamCurve ParamCurve_create (Sound x, Sound y);
 */
 
 void ParamCurve_draw (ParamCurve me, Graphics g, double t1, double t2, double dt,
-	double x1, double x2, double y1, double y2, int garnish);
+	double x1, double x2, double y1, double y2, bool garnish);
 /*
 	Function:
 		draw the points of the curve between parameter values t1 and t2,
diff --git a/fon/Photo_def.h b/fon/Photo_def.h
index c6b2126..c963cb5 100644
--- a/fon/Photo_def.h
+++ b/fon/Photo_def.h
@@ -1,6 +1,6 @@
 /* Photo_def.h
  *
- * Copyright (C) 2013,2014,2015 Paul Boersma
+ * Copyright (C) 2013,2014,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -54,7 +54,7 @@ oo_DEFINE_CLASS (Photo, SampledXY)
 			override { return dy; }
 		bool v_hasGetY ()
 			override { return true; }
-		double v_getY (long iy)
+		double v_getY (integer iy)
 			override { return y1 + (iy - 1) * dy; }
 	#endif
 
diff --git a/fon/Pitch.cpp b/fon/Pitch.cpp
index bf17491..08063ba 100644
--- a/fon/Pitch.cpp
+++ b/fon/Pitch.cpp
@@ -51,16 +51,16 @@ Thing_implement (Pitch, Sampled, 1);
 #define STRENGTH(frame)  ((frame) -> candidate [1]. strength)
 #define NOT_VOICED(f)  (! ((f) > 0.0 && (f) < my ceiling))   /* a NaN-resistant formulation */
 
-int structPitch :: v_getMinimumUnit (long ilevel) {
-	return ilevel == Pitch_LEVEL_FREQUENCY ? (int) kPitch_unit::MIN : Pitch_STRENGTH_UNIT_min;
+int structPitch :: v_getMinimumUnit (integer level) {
+	return level == Pitch_LEVEL_FREQUENCY ? (int) kPitch_unit::MIN : Pitch_STRENGTH_UNIT_min;
 }
 
-int structPitch :: v_getMaximumUnit (long ilevel) {
-	return ilevel == Pitch_LEVEL_FREQUENCY ? (int) kPitch_unit::MAX : Pitch_STRENGTH_UNIT_max;
+int structPitch :: v_getMaximumUnit (integer level) {
+	return level == Pitch_LEVEL_FREQUENCY ? (int) kPitch_unit::MAX : Pitch_STRENGTH_UNIT_max;
 }
 
-const char32 * structPitch :: v_getUnitText (long ilevel, int unit, unsigned long flags) {
-	if (ilevel == Pitch_LEVEL_FREQUENCY) {
+const char32 * structPitch :: v_getUnitText (integer level, int unit, uint32 flags) {
+	if (level == Pitch_LEVEL_FREQUENCY) {
 		return
 			unit == (int) kPitch_unit::HERTZ ?
 				flags & Function_UNIT_TEXT_MENU ? U"Hertz" : U"Hz" :
@@ -80,7 +80,7 @@ const char32 * structPitch :: v_getUnitText (long ilevel, int unit, unsigned lon
 			unit == (int) kPitch_unit::ERB ?
 				flags & Function_UNIT_TEXT_SHORT ? U"erb" : U"ERB" :
 			U"";
-	} else if (ilevel == Pitch_LEVEL_STRENGTH) {
+	} else if (level == Pitch_LEVEL_STRENGTH) {
 		return
 			unit == Pitch_STRENGTH_UNIT_AUTOCORRELATION ? U"" :
 			unit == Pitch_STRENGTH_UNIT_NOISE_HARMONICS_RATIO ? U"" :
@@ -90,12 +90,12 @@ const char32 * structPitch :: v_getUnitText (long ilevel, int unit, unsigned lon
 	return U"unknown";
 }
 
-bool structPitch :: v_isUnitLogarithmic (long ilevel, int unit) {
-	return ilevel == Pitch_LEVEL_FREQUENCY && unit == (int) kPitch_unit::HERTZ_LOGARITHMIC;
+bool structPitch :: v_isUnitLogarithmic (integer level, int unit) {
+	return level == Pitch_LEVEL_FREQUENCY && unit == (int) kPitch_unit::HERTZ_LOGARITHMIC;
 }
 
-double structPitch :: v_convertStandardToSpecialUnit (double value, long ilevel, int unit) {
-	if (ilevel == Pitch_LEVEL_FREQUENCY) {
+double structPitch :: v_convertStandardToSpecialUnit (double value, integer level, int unit) {
+	if (level == Pitch_LEVEL_FREQUENCY) {
 		return
 			unit == (int) kPitch_unit::HERTZ ? value :
 			unit == (int) kPitch_unit::HERTZ_LOGARITHMIC ? value <= 0.0 ? undefined : log10 (value) :
@@ -118,8 +118,8 @@ double structPitch :: v_convertStandardToSpecialUnit (double value, long ilevel,
 	}
 }
 
-double structPitch :: v_convertSpecialToStandardUnit (double value, long ilevel, int unit) {
-	if (ilevel == Pitch_LEVEL_FREQUENCY) {
+double structPitch :: v_convertSpecialToStandardUnit (double value, integer level, int unit) {
+	if (level == Pitch_LEVEL_FREQUENCY) {
 		return
 			unit == (int) kPitch_unit::HERTZ ? value :
 			unit == (int) kPitch_unit::HERTZ_LOGARITHMIC ? pow (10.0, value) :
@@ -141,7 +141,7 @@ double structPitch :: v_convertSpecialToStandardUnit (double value, long ilevel,
 	  (unit) == kPitch_unit::SEMITONES_1 || (unit) == kPitch_unit::SEMITONES_100 ||  \
 	  (unit) == kPitch_unit::SEMITONES_200 || (unit) == kPitch_unit::SEMITONES_440 )
 
-double structPitch :: v_getValueAtSample (long iframe, long ilevel, int unit) {
+double structPitch :: v_getValueAtSample (integer iframe, integer ilevel, int unit) {
 	double f = frame [iframe]. candidate [1]. frequency;
 	if (! (f > 0.0 && f < ceiling)) return undefined;   // frequency out of range (or undefined)? Voiceless
 	return v_convertStandardToSpecialUnit (ilevel == Pitch_LEVEL_FREQUENCY ? f : frame [iframe]. candidate [1]. strength, ilevel, unit);
diff --git a/fon/Pitch.h b/fon/Pitch.h
index d8dde33..06a8b04 100644
--- a/fon/Pitch.h
+++ b/fon/Pitch.h
@@ -23,7 +23,6 @@
 Thing_declare (Interpreter);
 
 #include "Pitch_enums.h"
-
 #include "Pitch_def.h"
 
 autoPitch Pitch_create (double tmin, double tmax, long nt, double dt, double t1,
diff --git a/fon/PitchEditor.cpp b/fon/PitchEditor.cpp
index 440e587..50c0d0e 100644
--- a/fon/PitchEditor.cpp
+++ b/fon/PitchEditor.cpp
@@ -30,14 +30,14 @@ Thing_implement (PitchEditor, FunctionEditor, 0);
 
 static void menu_cb_setCeiling (PitchEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Change ceiling", nullptr)
-		POSITIVE (U"Ceiling (Hz)", U"600.0")
+		POSITIVE (ceiling, U"Ceiling (Hz)", U"600.0")
 	EDITOR_OK
 		Pitch pitch = (Pitch) my data;
-		SET_REAL (U"Ceiling", pitch -> ceiling)
+		SET_REAL (ceiling, pitch -> ceiling)
 	EDITOR_DO
 		Pitch pitch = (Pitch) my data;
 		Editor_save (me, U"Change ceiling");
-		Pitch_setCeiling (pitch, GET_REAL (U"Ceiling"));
+		Pitch_setCeiling (pitch, ceiling);
 		FunctionEditor_redraw (me);
 		Editor_broadcastDataChanged (me);
 	EDITOR_END
@@ -45,23 +45,21 @@ static void menu_cb_setCeiling (PitchEditor me, EDITOR_ARGS_FORM) {
 
 static void menu_cb_pathFinder (PitchEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Path finder", nullptr)
-		REAL (U"Silence threshold", U"0.03")
-		REAL (U"Voicing threshold", U"0.45")
-		REAL (U"Octave cost", U"0.01")
-		REAL (U"Octave-jump cost", U"0.35")
-		REAL (U"Voiced/unvoiced cost", U"0.14")
-		POSITIVE (U"Ceiling (Hz)", U"600.0")
-		BOOLEAN (U"Pull formants", false)
+		REAL (silenceThreshold, U"Silence threshold", U"0.03")
+		REAL (voicingThreshold, U"Voicing threshold", U"0.45")
+		REAL (octaveCost, U"Octave cost", U"0.01")
+		REAL (octaveJumpCost, U"Octave-jump cost", U"0.35")
+		REAL (voicedUnvoicedCost, U"Voiced/unvoiced cost", U"0.14")
+		POSITIVE (ceiling, U"Ceiling (Hz)", U"600.0")
+		BOOLEAN (pullFormants, U"Pull formants", false)
 	EDITOR_OK
 		Pitch pitch = (Pitch) my data;
-		SET_REAL (U"Ceiling", pitch -> ceiling)
+		SET_REAL (ceiling, pitch -> ceiling)
 	EDITOR_DO
 		Pitch pitch = (Pitch) my data;
 		Editor_save (me, U"Path finder");
-		Pitch_pathFinder (pitch,
-			GET_REAL (U"Silence threshold"), GET_REAL (U"Voicing threshold"),
-			GET_REAL (U"Octave cost"), GET_REAL (U"Octave-jump cost"),
-			GET_REAL (U"Voiced/unvoiced cost"), GET_REAL (U"Ceiling"), GET_INTEGER (U"Pull formants"));
+		Pitch_pathFinder (pitch, silenceThreshold, voicingThreshold,
+			octaveCost, octaveJumpCost, voicedUnvoicedCost, ceiling, pullFormants);
 		FunctionEditor_redraw (me);
 		Editor_broadcastDataChanged (me);
 	EDITOR_END
@@ -109,14 +107,14 @@ static void menu_cb_octaveDown (PitchEditor me, EDITOR_ARGS_DIRECT) {
 
 static void menu_cb_voiceless (PitchEditor me, EDITOR_ARGS_DIRECT) {
 	Pitch pitch = (Pitch) my data;
-	long ileft = Sampled_xToHighIndex (pitch, my startSelection);
-	long iright = Sampled_xToLowIndex (pitch, my endSelection);
+	integer ileft = Sampled_xToHighIndex (pitch, my startSelection);
+	integer iright = Sampled_xToLowIndex (pitch, my endSelection);
 	if (ileft < 1) ileft = 1;
 	if (iright > pitch -> nx) iright = pitch -> nx;
 	Editor_save (me, U"Unvoice");
-	for (long i = ileft; i <= iright; i ++) {
+	for (integer i = ileft; i <= iright; i ++) {
 		Pitch_Frame frame = & pitch -> frame [i];
-		for (long cand = 1; cand <= frame -> nCandidates; cand ++) {
+		for (integer cand = 1; cand <= frame -> nCandidates; cand ++) {
 			if (frame -> candidate [cand]. frequency == 0.0) {
 				struct structPitch_Candidate help = frame -> candidate [1];
 				frame -> candidate [1] = frame -> candidate [cand];
@@ -296,7 +294,7 @@ bool structPitchEditor :: v_click (double xWC, double yWC, bool dummy) {
 	double minimumDf = 1e30;
 	int cand, bestCandidate = -1;
 
-	long ibestFrame;
+	integer ibestFrame;
 	Pitch_Frame bestFrame;
 	ibestFrame = Sampled_xToNearestIndex (pitch, xWC);
 	if (ibestFrame < 1) ibestFrame = 1;
diff --git a/fon/PitchTierEditor.h b/fon/PitchTierEditor.h
index 74fedfe..ee61f7e 100644
--- a/fon/PitchTierEditor.h
+++ b/fon/PitchTierEditor.h
@@ -2,7 +2,7 @@
 #define _PitchTierEditor_h_
 /* PitchTierEditor.h
  *
- * Copyright (C) 1992-2011,2012,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2012,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -31,8 +31,6 @@ Thing_define (PitchTierEditor, RealTierEditor) {
 		override { return 0.0; }
 	const char32 * v_quantityText ()
 		override { return U"Frequency (Hz)"; }
-	const char32 * v_quantityKey ()
-		override { return U"Frequency"; }
 	const char32 * v_rightTickUnits ()
 		override { return U" Hz"; }
 	double v_defaultYmin ()
@@ -49,10 +47,6 @@ Thing_define (PitchTierEditor, RealTierEditor) {
 		override { return U"Minimum frequency (Hz)"; }
 	const char32 * v_ymaxText ()
 		override { return U"Maximum frequency (Hz)"; }
-	const char32 * v_yminKey ()
-		override { return U"Minimum frequency"; }
-	const char32 * v_ymaxKey ()
-		override { return U"Maximum frequency"; }
 };
 
 autoPitchTierEditor PitchTierEditor_create (const char32 *title,
diff --git a/fon/Pitch_def.h b/fon/Pitch_def.h
index 0961203..0c74670 100644
--- a/fon/Pitch_def.h
+++ b/fon/Pitch_def.h
@@ -59,14 +59,14 @@ oo_DEFINE_STRUCT (Pitch_Frame)
 			oo_FLOAT (intensity)
 		} else if (formatVersion == 0) {
 			oo_FLOAT (intensity)
-			oo_LONG (nCandidates)
+			oo_INTEGER (nCandidates)
 		} else {
 			oo_DOUBLE (intensity)
-			oo_LONG (nCandidates)
+			oo_INTEGER (nCandidates)
 		}
 	#else
 		oo_DOUBLE (intensity)
-		oo_LONG (nCandidates)
+		oo_INTEGER (nCandidates)
 	#endif
 
 	oo_STRUCT_VECTOR (Pitch_Candidate, candidate, nCandidates)
@@ -87,19 +87,19 @@ oo_DEFINE_CLASS (Pitch, Sampled)
 			override;
 		int v_domainQuantity ()
 			override { return MelderQuantity_TIME_SECONDS; }
-		int v_getMinimumUnit (long ilevel)
+		int v_getMinimumUnit (integer level)
 			override;
-		int v_getMaximumUnit (long ilevel)
+		int v_getMaximumUnit (integer level)
 			override;
-		const char32 * v_getUnitText (long ilevel, int unit, unsigned long flags)
+		const char32 * v_getUnitText (integer level, int unit, uint32 flags)
 			override;
-		bool v_isUnitLogarithmic (long ilevel, int unit)
+		bool v_isUnitLogarithmic (integer level, int unit)
 			override;
-		double v_convertStandardToSpecialUnit (double value, long ilevel, int unit)
+		double v_convertStandardToSpecialUnit (double value, integer level, int unit)
 			override;
-		double v_convertSpecialToStandardUnit (double value, long ilevel, int unit)
+		double v_convertSpecialToStandardUnit (double value, integer level, int unit)
 			override;
-		double v_getValueAtSample (long isamp, long ilevel, int unit)
+		double v_getValueAtSample (integer sampleNumber, integer level, int unit)
 			override;
 	#endif
 
diff --git a/fon/PointEditor.cpp b/fon/PointEditor.cpp
index f61da8f..1e74904 100644
--- a/fon/PointEditor.cpp
+++ b/fon/PointEditor.cpp
@@ -105,12 +105,12 @@ static void menu_cb_addPointAtCursor (PointEditor me, EDITOR_ARGS_DIRECT) {
 
 static void menu_cb_addPointAt (PointEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Add point", nullptr)
-		REAL (U"Position", U"0.0");
+		REAL (position, U"Position", U"0.0");
 	EDITOR_OK
-		SET_REAL (U"Position", 0.5 * (my startSelection + my endSelection));
+		SET_REAL (position, 0.5 * (my startSelection + my endSelection));
 	EDITOR_DO
 		Editor_save (me, U"Add point");
-		PointProcess_addPoint ((PointProcess) my data, GET_REAL (U"Position"));
+		PointProcess_addPoint ((PointProcess) my data, position);
 		FunctionEditor_redraw (me);
 		Editor_broadcastDataChanged (me);
 	EDITOR_END
@@ -179,7 +179,7 @@ void structPointEditor :: v_draw () {
 	}
 	Graphics_setColour (our graphics.get(), Graphics_BLUE);
 	Graphics_setWindow (our graphics.get(), our startWindow, our endWindow, -1.0, +1.0);
-	for (long i = 1; i <= point -> nt; i ++) {
+	for (integer i = 1; i <= point -> nt; i ++) {
 		double t = point -> t [i];
 		if (t >= our startWindow && t <= our endWindow)
 			Graphics_line (our graphics.get(), t, -0.9, t, +0.9);
diff --git a/fon/PointProcess_def.h b/fon/PointProcess_def.h
index 083ce99..a6569e0 100644
--- a/fon/PointProcess_def.h
+++ b/fon/PointProcess_def.h
@@ -1,6 +1,6 @@
 /* PointProcess_def.h
  *
- * Copyright (C) 1992-2011,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,10 +21,10 @@
 oo_DEFINE_CLASS (PointProcess, Function)
 
 	#if oo_DECLARING || oo_COPYING
-		oo_LONG (maxnt)
+		oo_INTEGER (maxnt)
 	#endif
 
-	oo_LONG (nt)
+	oo_INTEGER (nt)
 
 	#if oo_COPYING
 		oo_DOUBLE_VECTOR (t, maxnt)
diff --git a/fon/Polygon_def.h b/fon/Polygon_def.h
index 906bd65..f67a63f 100644
--- a/fon/Polygon_def.h
+++ b/fon/Polygon_def.h
@@ -1,6 +1,6 @@
 /* Polygon_def.h
  *
- * Copyright (C) 1992-2011,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2015,2017 Paul Boersma
  *
  * This code 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 @@
 #define ooSTRUCT Polygon
 oo_DEFINE_CLASS (Polygon, Daata)
 
-	oo_LONG (numberOfPoints)
+	oo_INTEGER (numberOfPoints)
 
 	#if oo_READING
 		if (formatVersion >= 1) {
diff --git a/fon/Praat_tests.cpp b/fon/Praat_tests.cpp
index a1477ad..b73c5ec 100644
--- a/fon/Praat_tests.cpp
+++ b/fon/Praat_tests.cpp
@@ -514,7 +514,7 @@ int Praat_tests (kPraatTests itest, char32 *arg1, char32 *arg2, char32 *arg3, ch
 				dataFun3 (data.get());
 			#endif
 			{
-				#if 0
+				#if 1
 				autoMelderAsynchronous x;
 				//autoMelderAsynchronous y = x;   // deleted copy constructor
 				autoMelderAsynchronous y = x.move();   // defined move constructor
@@ -528,6 +528,12 @@ int Praat_tests (kPraatTests itest, char32 *arg1, char32 *arg2, char32 *arg3, ch
 				const autonumvec f { e, 10 };
 				const autonumvec g { 100, true };
 				//return f;   // call to deleted constructor
+				numvec h;
+				autonumvec j;
+				numvec *ph = & h;
+				autonumvec *pj = & j;
+				ph = pj;   // (in)correctly? accepted
+				//pj = ph;   // correctly ruled out
 				#endif
 				autoSound sound = Sound_create (1, 0.0, 1.0, 10000, 0.0001, 0.0);
 				sound = Sound_create (1, 0.0, 1.0, 10000, 0.0001, 0.00005);
diff --git a/fon/RealTier.cpp b/fon/RealTier.cpp
index cb3c153..cd609f1 100644
--- a/fon/RealTier.cpp
+++ b/fon/RealTier.cpp
@@ -58,12 +58,12 @@ void structRealTier :: v_info () {
 	MelderInfo_writeLine (U"Maximum value: ", RealTier_getMaximumValue (this));
 }
 
-double structRealTier :: v_getVector (long irow, long icol) {
+double structRealTier :: v_getVector (integer irow, integer icol) {
 	(void) irow;
 	return RealTier_getValueAtIndex (this, icol);
 }
 
-double structRealTier :: v_getFunction1 (long irow, double x) {
+double structRealTier :: v_getFunction1 (integer irow, double x) {
 	(void) irow;
 	return RealTier_getValueAtTime (this, x);
 }
diff --git a/fon/RealTierEditor.cpp b/fon/RealTierEditor.cpp
index 8f93ea2..0f96c84 100644
--- a/fon/RealTierEditor.cpp
+++ b/fon/RealTierEditor.cpp
@@ -51,19 +51,18 @@ static void menu_cb_addPointAtCursor (RealTierEditor me, EDITOR_ARGS_DIRECT) {
 
 static void menu_cb_addPointAt (RealTierEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Add point", nullptr)
-		REAL (U"Time (s)", U"0.0")
-		REAL (my v_quantityText (), U"0.0")
+		REAL (time, U"Time (s)", U"0.0")
+		REAL (desiredValue, my v_quantityText (), U"0.0")
 	EDITOR_OK
-		SET_REAL (U"Time", 0.5 * (my startSelection + my endSelection))
-		SET_REAL (my v_quantityKey (), my ycursor)
+		SET_REAL (time, 0.5 * (my startSelection + my endSelection))
+		SET_REAL (desiredValue, my ycursor)
 	EDITOR_DO
-		double desiredValue = GET_REAL (my v_quantityKey ());
 		if (isdefined (my v_minimumLegalValue ()) && desiredValue < my v_minimumLegalValue ())
 			Melder_throw (U"Cannot add a point below ", my v_minimumLegalValue (), my v_rightTickUnits (), U".");
 		if (isdefined (my v_maximumLegalValue ()) && desiredValue > my v_maximumLegalValue ())
 			Melder_throw (U"Cannot add a point above ", my v_maximumLegalValue (), my v_rightTickUnits (), U".");
 		Editor_save (me, U"Add point");
-		RealTier_addPoint ((RealTier) my data, GET_REAL (U"Time"), desiredValue);
+		RealTier_addPoint ((RealTier) my data, time, desiredValue);
 		RealTierEditor_updateScaling (me);
 		FunctionEditor_redraw (me);
 		Editor_broadcastDataChanged (me);
@@ -72,14 +71,14 @@ static void menu_cb_addPointAt (RealTierEditor me, EDITOR_ARGS_FORM) {
 
 static void menu_cb_setRange (RealTierEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (my v_setRangeTitle (), nullptr)
-		REAL (my v_yminText (), my v_defaultYminText ())
-		REAL (my v_ymaxText (), my v_defaultYmaxText ())
+		REAL (ymin, my v_yminText (), my v_defaultYminText ())
+		REAL (ymax, my v_ymaxText (), my v_defaultYmaxText ())
 	EDITOR_OK
-		SET_REAL (my v_yminKey (), my ymin)
-		SET_REAL (my v_ymaxKey (), my ymax)
+		SET_REAL (ymin, my ymin)
+		SET_REAL (ymax, my ymax)
 	EDITOR_DO
-		my ymin = GET_REAL (my v_yminKey ());
-		my ymax = GET_REAL (my v_ymaxKey ());
+		my ymin = ymin;
+		my ymax = ymax;
 		if (my ymax <= my ymin) RealTierEditor_updateScaling (me);
 		FunctionEditor_redraw (me);
 	EDITOR_END
@@ -148,7 +147,7 @@ void structRealTierEditor :: v_dataChanged () {
 
 void structRealTierEditor :: v_draw () {
 	RealTier data = (RealTier) our data;
-	long n = data -> points.size;
+	integer n = data -> points.size;
 	trace (U"structRealTierEditor :: v_draw ", n);
 	Graphics_Viewport viewport;
 	if (our d_sound.data) {
@@ -173,12 +172,12 @@ void structRealTierEditor :: v_draw () {
 	Graphics_text (our graphics.get(), our endWindow, our ymax,   Melder_float (Melder_half (ymax)), our v_rightTickUnits ());
 	Graphics_setTextAlignment (our graphics.get(), Graphics_LEFT, Graphics_HALF);
 	Graphics_text (our graphics.get(), our endWindow, our ymin,   Melder_float (Melder_half (our ymin)), our v_rightTickUnits ());
-	long ifirstSelected = AnyTier_timeToHighIndex (data->asAnyTier(), our startSelection);
-	long ilastSelected = AnyTier_timeToLowIndex (data->asAnyTier(), our endSelection);
+	integer ifirstSelected = AnyTier_timeToHighIndex (data->asAnyTier(), our startSelection);
+	integer ilastSelected = AnyTier_timeToLowIndex (data->asAnyTier(), our endSelection);
 	trace (U"structRealTierEditor :: v_draw: selected from ", our startSelection, U" ",
 		ifirstSelected, U" to ", our endSelection, U" ", ilastSelected);
-	long imin = AnyTier_timeToHighIndex (data->asAnyTier(), our startWindow);
-	long imax = AnyTier_timeToLowIndex (data->asAnyTier(), our endWindow);
+	integer imin = AnyTier_timeToHighIndex (data->asAnyTier(), our startWindow);
+	integer imax = AnyTier_timeToLowIndex (data->asAnyTier(), our endWindow);
 	Graphics_setLineWidth (our graphics.get(), 2.0);
 	if (n == 0) {
 		Graphics_setTextAlignment (our graphics.get(), Graphics_CENTRE, Graphics_HALF);
@@ -188,7 +187,7 @@ void structRealTierEditor :: v_draw () {
 		double yleft = RealTier_getValueAtTime (data, our startWindow);
 		double yright = RealTier_getValueAtTime (data, our endWindow);
 		Graphics_line (our graphics.get(), our startWindow, yleft, our endWindow, yright);
-	} else for (long i = imin; i <= imax; i ++) {
+	} else for (integer i = imin; i <= imax; i ++) {
 		RealPoint point = data -> points.at [i];
 		double t = point -> number, y = point -> value;
 		if (i >= ifirstSelected && i <= ilastSelected)
@@ -213,13 +212,13 @@ void structRealTierEditor :: v_draw () {
 	our v_updateMenuItems_file ();
 }
 
-static void drawWhileDragging (RealTierEditor me, double /* xWC */, double /* yWC */, long first, long last, double dt, double dy) {
+static void drawWhileDragging (RealTierEditor me, double /* xWC */, double /* yWC */, integer first, integer last, double dt, double dy) {
 	RealTier data = (RealTier) my data;
 
 	/*
 	 * Draw all selected points as magenta empty circles, if inside the window.
 	 */
-	for (long i = first; i <= last; i ++) {
+	for (integer i = first; i <= last; i ++) {
 		RealPoint point = data -> points.at [i];
 		double t = point -> number + dt, y = point -> value + dy;
 		if (t >= my startWindow && t <= my endWindow)
@@ -267,7 +266,7 @@ bool structRealTierEditor :: v_click (double xWC, double yWC, bool shiftKeyPress
 	/*
 	 * Clicked on a point?
 	 */
-	long inearestPoint = AnyTier_timeToNearestIndex (pitch->asAnyTier(), xWC);
+	integer inearestPoint = AnyTier_timeToNearestIndex (pitch->asAnyTier(), xWC);
 	if (inearestPoint == 0) return our RealTierEditor_Parent :: v_click (xWC, yWC, shiftKeyPressed);
 	RealPoint nearestPoint = pitch -> points.at [inearestPoint];
 	if (Graphics_distanceWCtoMM (our graphics.get(), xWC, yWC, nearestPoint -> number, nearestPoint -> value) > 1.5) {
@@ -280,7 +279,7 @@ bool structRealTierEditor :: v_click (double xWC, double yWC, bool shiftKeyPress
 	 */
 	bool draggingSelection = shiftKeyPressed &&
 		nearestPoint -> number > our startSelection && nearestPoint -> number < our endSelection;
-	long ifirstSelected, ilastSelected;
+	integer ifirstSelected, ilastSelected;
 	if (draggingSelection) {
 		ifirstSelected = AnyTier_timeToHighIndex (pitch->asAnyTier(), our startSelection);
 		ilastSelected = AnyTier_timeToLowIndex (pitch->asAnyTier(), our endSelection);
diff --git a/fon/RealTierEditor.h b/fon/RealTierEditor.h
index 6435b1e..79f09ce 100644
--- a/fon/RealTierEditor.h
+++ b/fon/RealTierEditor.h
@@ -40,7 +40,6 @@ Thing_define (RealTierEditor, TimeSoundEditor) {
 	virtual double v_minimumLegalValue () { return undefined; }
 	virtual double v_maximumLegalValue () { return undefined; }
 	virtual const char32 * v_quantityText () { return U"Y"; }   // normally includes units
-	virtual const char32 * v_quantityKey () { return U"Y"; }   // without units
 	virtual const char32 * v_rightTickUnits () { return U""; }
 	virtual double v_defaultYmin () { return 0.0; }
 	virtual double v_defaultYmax () { return 1.0; }
@@ -49,8 +48,6 @@ Thing_define (RealTierEditor, TimeSoundEditor) {
 	virtual const char32 * v_defaultYmaxText () { return U"1.0"; }
 	virtual const char32 * v_yminText () { return U"Minimum"; }   // normally includes units
 	virtual const char32 * v_ymaxText () { return U"Maximum"; }   // normally includes units
-	virtual const char32 * v_yminKey () { return U"Minimum"; }   // without units
-	virtual const char32 * v_ymaxKey () { return U"Maximum"; }   // without units
 };
 
 void RealTierEditor_updateScaling (RealTierEditor me);
diff --git a/fon/RealTier_def.h b/fon/RealTier_def.h
index 195a9dc..8037731 100644
--- a/fon/RealTier_def.h
+++ b/fon/RealTier_def.h
@@ -1,6 +1,6 @@
 /* RealTier_def.h
  *
- * Copyright (C) 1992-2012,2014,2015,2016 Paul Boersma
+ * Copyright (C) 1992-2012,2014,2015,2016,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -47,7 +47,7 @@ oo_DEFINE_CLASS (RealTier, Function)   // syntactic inheritance
 			override { return points.size; }
 		bool v_hasGetX ()
 			override { return true; }
-		double v_getX (long ix)
+		double v_getX (integer ix)
 			override { return points.at [ix] -> number; }
 		bool v_hasGetNcol ()
 			override { return true; }
@@ -55,13 +55,13 @@ oo_DEFINE_CLASS (RealTier, Function)   // syntactic inheritance
 			override { return points.size; }
 		bool v_hasGetVector ()
 			override { return true; }
-		double v_getVector (long irow, long icol)
+		double v_getVector (integer irow, integer icol)
 			override;
 		bool v_hasGetFunction1 ()
 			override { return true; }
-		double v_getFunction1 (long irow, double x)
+		double v_getFunction1 (integer irow, double x)
 			override;
-		const char32 * v_getUnitText (long /* ilevel */, int /* unit */, unsigned long /* flags */)
+		const char32 * v_getUnitText (integer /* level */, int /* unit */, uint32 /* flags */)
 			override { return U"Time (s)"; }
 	#endif
 
diff --git a/fon/RunnerMFC.cpp b/fon/RunnerMFC.cpp
index d9bedc3..15293ab 100644
--- a/fon/RunnerMFC.cpp
+++ b/fon/RunnerMFC.cpp
@@ -63,7 +63,7 @@ static void drawControlButton (RunnerMFC me, double left, double right, double b
 static void drawNow (RunnerMFC me) {
 	if (! my graphics) return;   // could be the case in the very beginning
 	ExperimentMFC experiment = (ExperimentMFC) my data;
-	long iresponse;
+	integer iresponse;
 	if (! my data) return;
 	Graphics_setGrey (my graphics.get(), 0.8);
 	Graphics_fillRectangle (my graphics.get(), 0.0, 1.0, 0.0, 1.0);
@@ -340,7 +340,7 @@ static void gui_drawingarea_cb_click (RunnerMFC me, GuiDrawingArea_ClickEvent ev
 				do_oops (me);
 			}
 		} else if (experiment -> responses [experiment -> trial] == 0 || experiment -> ok_right > experiment -> ok_left) {
-			for (long iresponse = 1; iresponse <= experiment -> numberOfDifferentResponses; iresponse ++) {
+			for (integer iresponse = 1; iresponse <= experiment -> numberOfDifferentResponses; iresponse ++) {
 				ResponseMFC response = & experiment -> response [iresponse];
 				if (x > response -> left && x < response -> right && y > response -> bottom && y < response -> top && response -> name [0] != '\0') {
 					experiment -> responses [experiment -> trial] = iresponse;
@@ -357,7 +357,7 @@ static void gui_drawingarea_cb_click (RunnerMFC me, GuiDrawingArea_ClickEvent ev
 				}
 			}
 			if (experiment -> responses [experiment -> trial] != 0 && experiment -> ok_right > experiment -> ok_left) {
-				for (long iresponse = 1; iresponse <= experiment -> numberOfGoodnessCategories; iresponse ++) {
+				for (integer iresponse = 1; iresponse <= experiment -> numberOfGoodnessCategories; iresponse ++) {
 					GoodnessMFC cat = & experiment -> goodness [iresponse];
 					if (x > cat -> left && x < cat -> right && y > cat -> bottom && y < cat -> top) {
 						experiment -> goodnesses [experiment -> trial] = iresponse;
@@ -368,7 +368,7 @@ static void gui_drawingarea_cb_click (RunnerMFC me, GuiDrawingArea_ClickEvent ev
 			}
 		} else if (experiment -> responses [experiment -> trial] != 0) {
 			Melder_assert (experiment -> ok_right <= experiment -> ok_left);
-			for (long iresponse = 1; iresponse <= experiment -> numberOfGoodnessCategories; iresponse ++) {
+			for (integer iresponse = 1; iresponse <= experiment -> numberOfGoodnessCategories; iresponse ++) {
 				GoodnessMFC cat = & experiment -> goodness [iresponse];
 				if (x > cat -> left && x < cat -> right && y > cat -> bottom && y < cat -> top) {
 					experiment -> goodnesses [experiment -> trial] = iresponse;
@@ -418,7 +418,7 @@ static void gui_drawingarea_cb_key (RunnerMFC me, GuiDrawingArea_KeyEvent event)
 				do_oops (me);
 			}
 		} else if (experiment -> responses [experiment -> trial] == 0 || experiment -> ok_right > experiment -> ok_left) {
-			for (long iresponse = 1; iresponse <= experiment -> numberOfDifferentResponses; iresponse ++) {
+			for (integer iresponse = 1; iresponse <= experiment -> numberOfDifferentResponses; iresponse ++) {
 				ResponseMFC response = & experiment -> response [iresponse];
 				if (response -> key && response -> key [0] == event -> key) {
 					experiment -> responses [experiment -> trial] = iresponse;
@@ -435,7 +435,7 @@ static void gui_drawingarea_cb_key (RunnerMFC me, GuiDrawingArea_KeyEvent event)
 				}
 			}
 			if (experiment -> responses [experiment -> trial] != 0 && experiment -> ok_right > experiment -> ok_left) {
-				for (long iresponse = 1; iresponse <= experiment -> numberOfGoodnessCategories; iresponse ++) {
+				for (integer iresponse = 1; iresponse <= experiment -> numberOfGoodnessCategories; iresponse ++) {
 					GoodnessMFC cat = & experiment -> goodness [iresponse];
 					if (cat -> key && cat -> key [0] == event -> key) {
 						experiment -> goodnesses [experiment -> trial] = iresponse;
@@ -446,7 +446,7 @@ static void gui_drawingarea_cb_key (RunnerMFC me, GuiDrawingArea_KeyEvent event)
 			}
 		} else if (experiment -> responses [experiment -> trial] != 0) {
 			Melder_assert (experiment -> ok_right <= experiment -> ok_left);
-			for (long iresponse = 1; iresponse <= experiment -> numberOfGoodnessCategories; iresponse ++) {
+			for (integer iresponse = 1; iresponse <= experiment -> numberOfGoodnessCategories; iresponse ++) {
 				GoodnessMFC cat = & experiment -> goodness [iresponse];
 				if (cat -> key && cat -> key [0] == event -> key) {
 					experiment -> goodnesses [experiment -> trial] = iresponse;
diff --git a/fon/RunnerMFC.h b/fon/RunnerMFC.h
index acb9b33..a8e759a 100644
--- a/fon/RunnerMFC.h
+++ b/fon/RunnerMFC.h
@@ -24,9 +24,9 @@
 Thing_define (RunnerMFC, Editor) {
 	GuiDrawingArea d_drawingArea;
 	autoExperimentMFCList experiments;
-	long iexperiment;
+	integer iexperiment;
 	autoGraphics graphics;
-	long numberOfReplays;
+	integer numberOfReplays;
 	bool blanked;
 
 	void v_destroy () noexcept
diff --git a/fon/SampledXY.cpp b/fon/SampledXY.cpp
index cf839d4..ae59c5c 100644
--- a/fon/SampledXY.cpp
+++ b/fon/SampledXY.cpp
@@ -68,8 +68,8 @@ void SampledXY_init (SampledXY me,
 integer SampledXY_getWindowSamplesY (SampledXY me, double fromY, double toY, integer *iymin, integer *iymax) {
 	double riymin = 1.0 + ceil ((fromY - my y1) / my dy);
 	double riymax = 1.0 + floor ((toY - my y1) / my dy);   // could be above 32-bit LONG_MAX
-	*iymin = riymin < 1.0 ? 1 : (long) riymin;
-	*iymax = riymax > (double) my ny ? my ny : (long) riymax;
+	*iymin = riymin < 1.0 ? 1 : (integer) riymin;
+	*iymax = riymax > (double) my ny ? my ny : (integer) riymax;
 	if (*iymin > *iymax) return 0;
 	return *iymax - *iymin + 1;
 }
diff --git a/fon/SampledXY_def.h b/fon/SampledXY_def.h
index fb59e62..25e175f 100644
--- a/fon/SampledXY_def.h
+++ b/fon/SampledXY_def.h
@@ -57,7 +57,7 @@ oo_DEFINE_CLASS (SampledXY, Sampled)
 			override { return dy; }
 		bool v_hasGetY ()
 			override { return true; }
-		double v_getY (long iy)
+		double v_getY (integer iy)
 			override { return y1 + (iy - 1) * dy; }
 	#endif
 
diff --git a/fon/Sampled_def.h b/fon/Sampled_def.h
index 94f0eb6..967496f 100644
--- a/fon/Sampled_def.h
+++ b/fon/Sampled_def.h
@@ -47,14 +47,14 @@ oo_DEFINE_CLASS (Sampled, Function)
 			override { return dx; }
 		bool v_hasGetX ()
 			override { return true; }
-		double v_getX (long ix)
+		double v_getX (integer ix)
 			override { return x1 + (ix - 1) * dx; }
 		void v_shiftX (double xfrom, double xto)
 			override;
 		void v_scaleX (double xminfrom, double xmaxfrom, double xminto, double xmaxto)
 			override;
 
-		virtual double v_getValueAtSample (long /* isamp */, long /* ilevel */, int /* unit */)
+		virtual double v_getValueAtSample (integer /* isamp */, integer /* ilevel */, int /* unit */)
 			{ return undefined; }
 	#endif
 
diff --git a/fon/Sound.cpp b/fon/Sound.cpp
index 4b26c6d..b246b40 100644
--- a/fon/Sound.cpp
+++ b/fon/Sound.cpp
@@ -98,17 +98,17 @@ void structSound :: v_info () {
 	}
 }
 
-double structSound :: v_getMatrix (long irow, long icol) {
+double structSound :: v_getMatrix (integer irow, integer icol) {
 	if (irow < 1 || irow > ny) {
 		if (irow == 0) {
 			if (icol < 1 || icol > nx) return 0.0;
 			if (ny == 1) return z [1] [icol];   // optimization
 			if (ny == 2) return 0.5 * (z [1] [icol] + z [2] [icol]);   // optimization
-			double sum = 0.0;
-			for (long channel = 1; channel <= ny; channel ++) {
+			real80 sum = 0.0;
+			for (integer channel = 1; channel <= ny; channel ++) {
 				sum += z [channel] [icol];
 			}
-			return sum / ny;
+			return (real) sum / ny;
 		}
 		return 0.0;
 	}
diff --git a/fon/Sound.h b/fon/Sound.h
index b556139..3b5aac7 100644
--- a/fon/Sound.h
+++ b/fon/Sound.h
@@ -30,7 +30,7 @@ Thing_define (Sound, Vector) {
 		override;
 	bool v_hasGetMatrix ()
 		override { return true; }
-	double v_getMatrix (long irow, long icol)
+	double v_getMatrix (integer irow, integer icol)
 		override;
 	bool v_hasGetFunction2 ()
 		override { return true; }
diff --git a/fon/SoundEditor.cpp b/fon/SoundEditor.cpp
index 83a4be9..7b39640 100644
--- a/fon/SoundEditor.cpp
+++ b/fon/SoundEditor.cpp
@@ -148,8 +148,8 @@ static void menu_cb_Cut (SoundEditor me, EDITOR_ARGS_DIRECT) {
 
 static void menu_cb_Paste (SoundEditor me, EDITOR_ARGS_DIRECT) {
 	Sound sound = (Sound) my data;
-	long leftSample = Sampled_xToLowIndex (sound, my endSelection);
-	long oldNumberOfSamples = sound -> nx, newNumberOfSamples;
+	integer leftSample = Sampled_xToLowIndex (sound, my endSelection);
+	integer oldNumberOfSamples = sound -> nx, newNumberOfSamples;
 	double **oldData = sound -> z;
 	if (! Sound_clipboard) {
 		Melder_warning (U"Clipboard is empty; nothing pasted.");
@@ -170,15 +170,15 @@ static void menu_cb_Paste (SoundEditor me, EDITOR_ARGS_DIRECT) {
 	 * Check without change.
 	 */
 	autoNUMmatrix <double> newData (1, sound -> ny, 1, newNumberOfSamples);
-	for (long channel = 1; channel <= sound -> ny; channel ++) {
-		long j = 0;
-		for (long i = 1; i <= leftSample; i ++) {
+	for (integer channel = 1; channel <= sound -> ny; channel ++) {
+		integer j = 0;
+		for (integer i = 1; i <= leftSample; i ++) {
 			newData [channel] [++ j] = oldData [channel] [i];
 		}
-		for (long i = 1; i <= Sound_clipboard -> nx; i ++) {
+		for (integer i = 1; i <= Sound_clipboard -> nx; i ++) {
 			newData [channel] [++ j] = Sound_clipboard -> z [channel] [i];
 		}
-		for (long i = leftSample + 1; i <= oldNumberOfSamples; i ++) {
+		for (integer i = leftSample + 1; i <= oldNumberOfSamples; i ++) {
 			newData [channel] [++ j] = oldData [channel] [i];
 		}
 	}
@@ -387,15 +387,15 @@ void structSoundEditor :: v_draw () {
 }
 
 void structSoundEditor :: v_play (double a_tmin, double a_tmax) {
-	long numberOfChannels = d_longSound.data ? d_longSound.data -> numberOfChannels : d_sound.data -> ny;
-	long numberOfMuteChannels = 0;
+	integer numberOfChannels = d_longSound.data ? d_longSound.data -> numberOfChannels : d_sound.data -> ny;
+	integer numberOfMuteChannels = 0;
 	bool *muteChannels = d_sound . muteChannels;
-	for (long i = 1; i <= numberOfChannels; i ++) {
+	for (integer i = 1; i <= numberOfChannels; i ++) {
 		if (muteChannels [i]) {
 			numberOfMuteChannels ++;
 		}
 	}
-	long numberOfChannelsToPlay = numberOfChannels - numberOfMuteChannels;
+	integer numberOfChannelsToPlay = numberOfChannels - numberOfMuteChannels;
 	if (numberOfChannelsToPlay == 0) {
 		Melder_throw (U"Please select at least one channel to play.");
 	}
diff --git a/fon/SoundRecorder.cpp b/fon/SoundRecorder.cpp
index c43be6e..0135abd 100644
--- a/fon/SoundRecorder.cpp
+++ b/fon/SoundRecorder.cpp
@@ -278,7 +278,7 @@ static void showMaximum (SoundRecorder me, int channel, double maximum) {
 	}
 }
 
-static void showMeter (SoundRecorder me, short *buffer, long nsamp) {
+static void showMeter (SoundRecorder me, short *buffer, integer nsamp) {
 	Melder_assert (my graphics);
 	if (nsamp < 1) {
 		Graphics_setWindow (my graphics.get(), 0.0, 1.0, 0.0, 1.0);
@@ -294,12 +294,12 @@ static void showMeter (SoundRecorder me, short *buffer, long nsamp) {
 	if (my p_meter_which == kSoundRecorder_meter::INTENSITY) {
 		int leftMaximum = 0, rightMaximum = 0;
 		if (my numberOfChannels == 1) {
-			for (long i = 0; i < nsamp; i ++) {
+			for (integer i = 0; i < nsamp; i ++) {
 				int value = buffer [i];
 				if (abs (value) > leftMaximum) leftMaximum = abs (value);
 			}
 		} else {
-			for (long i = 0; i < nsamp; i ++) {
+			for (integer i = 0; i < nsamp; i ++) {
 				int left = buffer [i+i], right = buffer [i+i+1];
 				if (abs (left) > leftMaximum) leftMaximum = abs (left);
 				if (abs (right) > rightMaximum) rightMaximum = abs (right);
@@ -324,8 +324,8 @@ static void showMeter (SoundRecorder me, short *buffer, long nsamp) {
 			0.0, nsamp / theControlPanel. sampleRate,
 			nsamp, 1.0 / theControlPanel. sampleRate, 0.5 / theControlPanel. sampleRate);
 		short *p = & buffer [0];
-		for (long isamp = 1; isamp <= nsamp; isamp ++) {
-			for (long ichan = 1; ichan <= my numberOfChannels; ichan ++) {
+		for (integer isamp = 1; isamp <= nsamp; isamp ++) {
+			for (integer ichan = 1; ichan <= my numberOfChannels; ichan ++) {
 				sound -> z [ichan] [isamp] = * (p ++) / 32768.0;
 			}
 		}
@@ -352,8 +352,8 @@ static bool tooManySamplesInBufferToReturnToGui (SoundRecorder me) {
 	return false;
 }
 
-static long getMyNsamp (SoundRecorder me) {
-	volatile long nsamp = my nsamp;   // Prevent inlining.
+static integer getMyNsamp (SoundRecorder me) {
+	volatile integer nsamp = my nsamp;   // Prevent inlining.
 	return nsamp;
 }
 
@@ -396,18 +396,18 @@ static WORKPROC_RETURN workProc (WORKPROC_ARGS) {
 		if (my okButton)     GuiThing_setSensitive (my okButton,     ! my recording && my nsamp > 0);
 		if (my monoButton   && my numberOfChannels == 1) GuiRadioButton_set (my monoButton);
 		if (my stereoButton && my numberOfChannels == 2) GuiRadioButton_set (my stereoButton);
-		for (long i = 1; i <= SoundRecorder_IFSAMP_MAX; i ++)
+		for (integer i = 1; i <= SoundRecorder_IFSAMP_MAX; i ++)
 			if (my fsamps [i]. button && theControlPanel. sampleRate == my fsamps [i]. fsamp)
 				GuiRadioButton_set (my fsamps [i]. button);
 		if (my devices [theControlPanel. inputSource]. button)
 			GuiRadioButton_set (my devices [theControlPanel. inputSource]. button);
 		if (my monoButton)   GuiThing_setSensitive (my monoButton,   ! my recording);
 		if (my stereoButton) GuiThing_setSensitive (my stereoButton, ! my recording);
-		for (long i = 1; i <= SoundRecorder_IFSAMP_MAX; i ++)
+		for (integer i = 1; i <= SoundRecorder_IFSAMP_MAX; i ++)
 			if (my fsamps [i]. button) {
 				GuiThing_setSensitive (my fsamps [i]. button, ! my recording);
 			}
-		for (long i = 1; i <= SoundRecorder_IDEVICE_MAX; i ++)
+		for (integer i = 1; i <= SoundRecorder_IDEVICE_MAX; i ++)
 			if (my devices [i]. button)
 				GuiThing_setSensitive (my devices [i]. button, ! my recording);
 
@@ -455,7 +455,7 @@ static WORKPROC_RETURN workProc (WORKPROC_ARGS) {
 				 * so that the buffer may be being filled during this workproc.
 				 * So we ask for the buffer filling just once, namely here at the beginning.
 				 */
-				long lastSample = 0;
+				integer lastSample = 0;
 				if (my inputUsesPortAudio) {
 					 /*
 					  * The buffer filling is contained in my nsamp,
@@ -473,7 +473,7 @@ static WORKPROC_RETURN workProc (WORKPROC_ARGS) {
 					#elif defined (macintosh)
 					#endif
 				}
-				long firstSample = lastSample - 3000;
+				integer firstSample = lastSample - 3000;
 				if (firstSample < 0) firstSample = 0;
 				showMeter (me, my buffer + firstSample * my numberOfChannels, lastSample - firstSample);
 				GuiScale_setValue (my progressScale, 1000.0 * ((double) lastSample / (double) my nmax));
@@ -511,9 +511,9 @@ static int portaudioStreamCallback (
 	if (Melder_debug == 20)
 		Melder_casual (U"The PortAudio stream callback receives ", frameCount, U" frames.");
 	Melder_assert (my nsamp <= my nmax);
-	unsigned long samplesLeft = my nmax - my nsamp;
+	uinteger samplesLeft = my nmax - my nsamp;
 	if (samplesLeft > 0) {
-		unsigned long dsamples = samplesLeft > frameCount ? frameCount : samplesLeft;
+		uinteger dsamples = samplesLeft > frameCount ? frameCount : samplesLeft;
 		if (Melder_debug == 20)
 			Melder_casual (U"play ", dsamples, U" ", Pa_GetStreamCpuLoad (my portaudioStream));
 		memcpy (my buffer + my nsamp * my numberOfChannels, input, 2 * dsamples * my numberOfChannels);
@@ -596,7 +596,7 @@ static void gui_button_cb_play (SoundRecorder me, GuiButtonEvent /* event */) {
 
 static void publish (SoundRecorder me) {
 	autoSound sound;
-	long nsamp = my fakeMono ? my nsamp / 2 : my nsamp;
+	integer nsamp = my fakeMono ? my nsamp / 2 : my nsamp;
 	if (my nsamp == 0) return;
 	double fsamp = theControlPanel. sampleRate;
 	if (fsamp <= 0.0) fsamp = 44100.0;   // safe
@@ -607,13 +607,13 @@ static void publish (SoundRecorder me) {
 		return;
 	}
 	if (my fakeMono) {
-		for (long i = 1; i <= nsamp; i ++)
+		for (integer i = 1; i <= nsamp; i ++)
 			sound -> z [1] [i] = (my buffer [i + i - 2] + my buffer [i + i - 1]) * (1.0 / 65536);
 	} else if (my numberOfChannels == 1) {
-		for (long i = 1; i <= nsamp; i ++)
+		for (integer i = 1; i <= nsamp; i ++)
 			sound -> z [1] [i] = my buffer [i - 1] * (1.0 / 32768);
 	} else {
-		for (long i = 1; i <= nsamp; i ++) {
+		for (integer i = 1; i <= nsamp; i ++) {
 			sound -> z [1] [i] = my buffer [i + i - 2] * (1.0 / 32768);
 			sound -> z [2] [i] = my buffer [i + i - 1] * (1.0 / 32768);
 		}
@@ -742,7 +742,7 @@ static void gui_radiobutton_cb_fsamp (SoundRecorder me, GuiRadioButtonEvent even
 	if (my recording) return;
 	try {
 		double fsamp = undefined;
-		for (long i = 1; i <= SoundRecorder_IFSAMP_MAX; i ++)
+		for (integer i = 1; i <= SoundRecorder_IFSAMP_MAX; i ++)
 			if (event -> toggle == my fsamps [i]. button)
 				fsamp = my fsamps [i]. fsamp;
 		Melder_assert (isdefined (fsamp));
@@ -753,8 +753,8 @@ static void gui_radiobutton_cb_fsamp (SoundRecorder me, GuiRadioButtonEvent even
 		 * So the following will work (it used to be different with old Motif versions on Linux):
 		 */
 		Melder_casual (U"SoundRecorder:"
-			U" setting the sample rate from ", (long) theControlPanel. sampleRate,
-			U" to ", (long) fsamp, U" Hz.");
+			U" setting the sample rate from ", (integer) theControlPanel. sampleRate,
+			U" to ", (integer) fsamp, U" Hz.");
 		if (fsamp == theControlPanel. sampleRate) return;
 		/*
 		 * Now we know, hopefully, that the message is from the button that was clicked,
@@ -796,7 +796,7 @@ void structSoundRecorder :: v_createChildren ()
 {
 	/* Channels */
 
-	long y = 20 + Machine_getMenuBarHeight ();
+	integer y = 20 + Machine_getMenuBarHeight ();
 	GuiLabel_createShown (our windowForm, 10, 160, y, y + Gui_LABEL_HEIGHT, U"Channels:", 0);
 
 	GuiRadioGroup_begin ();
@@ -818,7 +818,7 @@ void structSoundRecorder :: v_createChildren ()
 	#else
 		GuiLabel_createShown (our windowForm, 10, 170, y, y + Gui_LABEL_HEIGHT, U"Input source:", 0);
 		GuiRadioGroup_begin ();
-		for (long i = 1; i <= SoundRecorder_IDEVICE_MAX; i ++) {
+		for (integer i = 1; i <= SoundRecorder_IDEVICE_MAX; i ++) {
 			if (our devices [i]. canDo) {
 				y += Gui_RADIOBUTTON_HEIGHT + Gui_RADIOBUTTON_SPACING;
 				our devices [i]. button = GuiRadioButton_createShown (our windowForm, 20, 170, y, y + Gui_RADIOBUTTON_HEIGHT,
@@ -841,13 +841,13 @@ void structSoundRecorder :: v_createChildren ()
 	y = 20 + Machine_getMenuBarHeight ();
 	GuiLabel_createShown (our windowForm, -160, -10, y, y + Gui_LABEL_HEIGHT, U"Sampling frequency:", 0);
 	GuiRadioGroup_begin ();
-	for (long i = 1; i <= SoundRecorder_IFSAMP_MAX; i ++) {
+	for (integer i = 1; i <= SoundRecorder_IFSAMP_MAX; i ++) {
 		if (our fsamps [i]. canDo) {
 			double fsamp = our fsamps [i]. fsamp;
 			y += Gui_RADIOBUTTON_HEIGHT + Gui_RADIOBUTTON_SPACING;
 			our fsamps [i]. button = GuiRadioButton_createShown (our windowForm,
 				-150, -10, y, y + Gui_RADIOBUTTON_HEIGHT,
-				Melder_cat (fsamp == floor (fsamp) ? Melder_integer ((long) fsamp) : Melder_fixed (fsamp, 5), U" Hz"),
+				Melder_cat (fsamp == floor (fsamp) ? Melder_integer ((integer) fsamp) : Melder_fixed (fsamp, 5), U" Hz"),
 				gui_radiobutton_cb_fsamp, this, fsamp == theControlPanel. sampleRate ? GuiRadioButton_SET : 0);
 		}
 	}
@@ -886,14 +886,14 @@ void structSoundRecorder :: v_createChildren ()
 }
 
 static void writeFakeMonoFile (SoundRecorder me, MelderFile file, int audioFileType) {
-	long nsamp = my nsamp / 2;
+	integer nsamp = my nsamp / 2;
 	autoMelderFile mfile = MelderFile_create (file);
 	MelderFile_writeAudioFileHeader (file, audioFileType, lround (theControlPanel. sampleRate), nsamp, 1, 16);
 	if (Melder_defaultAudioFileEncoding (audioFileType, 16) == Melder_LINEAR_16_BIG_ENDIAN) {
-		for (long i = 0; i < nsamp; i ++)
+		for (integer i = 0; i < nsamp; i ++)
 			binputi16 ((my buffer [i + i - 2] + my buffer [i + i - 1]) / 2, file -> filePointer);
 	} else {
-		for (long i = 0; i < nsamp; i ++)
+		for (integer i = 0; i < nsamp; i ++)
 			binputi16LE ((my buffer [i + i - 2] + my buffer [i + i - 1]) / 2, file -> filePointer);
 	}
 	MelderFile_writeAudioFileTrailer (file, audioFileType, lround (theControlPanel. sampleRate), nsamp, 1, 16);
@@ -1047,8 +1047,8 @@ autoSoundRecorder SoundRecorder_create (int numberOfChannels) {
 		if (preferences.bufferSizeInMegabytes < 1) preferences.bufferSizeInMegabytes = 1;   // validate preferences
 		if (preferences.bufferSizeInMegabytes > 1000) preferences.bufferSizeInMegabytes = 1000;
 		if (! my buffer) {
-			long nmax_bytes_pref = preferences.bufferSizeInMegabytes * 1000000;
-			long nmax_bytes = my inputUsesPortAudio ? nmax_bytes_pref :
+			integer nmax_bytes_pref = preferences.bufferSizeInMegabytes * 1000000;
+			integer nmax_bytes = my inputUsesPortAudio ? nmax_bytes_pref :
 				#if defined (_WIN32)
 					66150000;   // the maximum physical buffer on Windows XP; shorter than in Windows 98, alas.
 				#else
@@ -1148,7 +1148,7 @@ autoSoundRecorder SoundRecorder_create (int numberOfChannels) {
 		/*
 		 * The default set of possible sampling frequencies, to be modified in the initialize () procedure.
 		 */
-		for (long i = 1; i <= SoundRecorder_IFSAMP_MAX; i ++) my fsamps [i]. canDo = true;   // optimistic: can do all, except two:
+		for (integer i = 1; i <= SoundRecorder_IFSAMP_MAX; i ++) my fsamps [i]. canDo = true;   // optimistic: can do all, except two:
 		my fsamps [SoundRecorder_IFSAMP_9800]. canDo = false;   // sgi only
 		my fsamps [SoundRecorder_IFSAMP_22254]. canDo = false;   // old Mac only
 
diff --git a/fon/SoundRecorder.h b/fon/SoundRecorder.h
index f0753d2..2f4b624 100644
--- a/fon/SoundRecorder.h
+++ b/fon/SoundRecorder.h
@@ -75,10 +75,10 @@ struct SoundRecorder_Fsamp {
 
 Thing_define (SoundRecorder, Editor) {
 	int numberOfChannels;
-	long nsamp, nmax;
+	integer nsamp, nmax;
 	bool fakeMono, synchronous, recording;
 	int lastLeftMaximum, lastRightMaximum;
-	long numberOfInputDevices;
+	integer numberOfInputDevices;
 	struct SoundRecorder_Device devices [1+SoundRecorder_IDEVICE_MAX];
 	struct SoundRecorder_Fsamp fsamps [1+SoundRecorder_IFSAMP_MAX];
 	short *buffer;
@@ -110,7 +110,7 @@ Thing_define (SoundRecorder, Editor) {
 	#elif defined (macintosh)
 		short macSource [1+8];
 		Str255 hybridDeviceNames [1+8];
-		long refNum;
+		int32 refNum;
 	#elif defined (linux)
 		int fd;
 	#else
diff --git a/fon/Sound_audio.cpp b/fon/Sound_audio.cpp
index 17b0285..3141f16 100644
--- a/fon/Sound_audio.cpp
+++ b/fon/Sound_audio.cpp
@@ -489,7 +489,7 @@ static struct SoundPlay {
 	int16 *buffer;
 } thePlayingSound;
 
-static bool melderPlayCallback (void *closure, long samplesPlayed) {
+static bool melderPlayCallback (void *closure, integer samplesPlayed) {
 	struct SoundPlay *me = (struct SoundPlay *) closure;
 	int phase = 2;
 	double t = samplesPlayed <= my silenceBefore ? my tmin :
diff --git a/fon/Sound_files.cpp b/fon/Sound_files.cpp
index 35074af..acdb73e 100644
--- a/fon/Sound_files.cpp
+++ b/fon/Sound_files.cpp
@@ -70,8 +70,7 @@ autoSound Sound_readFromSoundFile (MelderFile file) {
 		autoMelderFile mfile = MelderFile_open (file);
 		int numberOfChannels, encoding;
 		double sampleRate;
-		long startOfData;
-		integer numberOfSamples;
+		integer startOfData, numberOfSamples;
 		int fileType = MelderFile_checkSoundFile (file, & numberOfChannels, & encoding, & sampleRate, & startOfData, & numberOfSamples);
 		if (fileType == 0)
 			Melder_throw (U"Not an audio file.");
diff --git a/fon/SpectrogramEditor.cpp b/fon/SpectrogramEditor.cpp
index 5cdd393..36b218d 100644
--- a/fon/SpectrogramEditor.cpp
+++ b/fon/SpectrogramEditor.cpp
@@ -47,8 +47,8 @@ void structSpectrogramEditor :: v_draw () {
 	Graphics_setWindow (our graphics.get(), 0.0, 1.0, 0.0, our maximum);
 	Graphics_setTextAlignment (our graphics.get(), Graphics_RIGHT, Graphics_HALF);
 	Graphics_setColour (our graphics.get(), Graphics_RED);
-	long df = 1000;
-	for (long f = df; f <= our maximum; f += df) {
+	integer df = 1000;
+	for (integer f = df; f <= our maximum; f += df) {
 		Graphics_line (our graphics.get(), 0.0, f, 1.0, f);
 		Graphics_text (our graphics.get(), -0.01, f,   f, U" Hz");
 	}
@@ -67,7 +67,7 @@ void structSpectrogramEditor :: v_draw () {
 bool structSpectrogramEditor :: v_click (double xWC, double yWC, bool shiftKeyPressed) {
 	Spectrogram spectrogram = (Spectrogram) our data;
 	/*double frequency = yWC * our maximum;*/
-	long bestFrame;
+	integer bestFrame;
 	bestFrame = Sampled_xToNearestIndex (spectrogram, xWC);
 	if (bestFrame < 1)
 		bestFrame = 1;
diff --git a/fon/Spectrum.cpp b/fon/Spectrum.cpp
index b30de1e..13c7559 100644
--- a/fon/Spectrum.cpp
+++ b/fon/Spectrum.cpp
@@ -60,7 +60,7 @@ void structSpectrum :: v_info () {
 	MelderInfo_writeLine (U"Total energy: ", Melder_single (Spectrum_getBandEnergy (this, 0.0, 0.0)), U" Pa2 sec");
 }
 
-double structSpectrum :: v_getValueAtSample (long isamp, long which, int units) {
+double structSpectrum :: v_getValueAtSample (integer isamp, integer which, int units) {
 	if (units == 0) {
 		return which == 1 ? z [1] [isamp] : which == 2 ? z [2] [isamp] : undefined;
 	} else {
diff --git a/fon/SpectrumEditor.cpp b/fon/SpectrumEditor.cpp
index 931698b..3f4b8ca 100644
--- a/fon/SpectrumEditor.cpp
+++ b/fon/SpectrumEditor.cpp
@@ -103,11 +103,11 @@ static void menu_cb_publishSound (SpectrumEditor me, EDITOR_ARGS_DIRECT) {
 
 static void menu_cb_passBand (SpectrumEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Filter (pass Hann band)", U"Spectrum: Filter (pass Hann band)...");
-		REAL (U"Band smoothing (Hz)", my default_bandSmoothing ())
+		REAL (bandSmoothing, U"Band smoothing (Hz)", my default_bandSmoothing ())
 	EDITOR_OK
-		SET_REAL (U"Band smoothing", my p_bandSmoothing)
+		SET_REAL (bandSmoothing, my p_bandSmoothing)
 	EDITOR_DO
-		my pref_bandSmoothing() = my p_bandSmoothing = GET_REAL (U"Band smoothing");
+		my pref_bandSmoothing() = my p_bandSmoothing = bandSmoothing;
 		if (my endSelection <= my startSelection) Melder_throw (U"To apply a band-pass filter, first make a selection.");
 		Editor_save (me, U"Pass band");
 		Spectrum_passHannBand ((Spectrum) my data, my startSelection, my endSelection, my p_bandSmoothing);
@@ -118,11 +118,11 @@ static void menu_cb_passBand (SpectrumEditor me, EDITOR_ARGS_FORM) {
 
 static void menu_cb_stopBand (SpectrumEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Filter (stop Hann band)", nullptr)
-		REAL (U"Band smoothing (Hz)", my default_bandSmoothing ())
+		REAL (bandSmoothing, U"Band smoothing (Hz)", my default_bandSmoothing ())
 	EDITOR_OK
-		SET_REAL (U"Band smoothing", my p_bandSmoothing)
+		SET_REAL (bandSmoothing, my p_bandSmoothing)
 	EDITOR_DO
-		my pref_bandSmoothing () = my p_bandSmoothing = GET_REAL (U"Band smoothing");
+		my pref_bandSmoothing () = my p_bandSmoothing = bandSmoothing;
 		if (my endSelection <= my startSelection) Melder_throw (U"To apply a band-stop filter, first make a selection.");
 		Editor_save (me, U"Stop band");
 		Spectrum_stopHannBand ((Spectrum) my data, my startSelection, my endSelection, my p_bandSmoothing);
@@ -141,11 +141,11 @@ static void menu_cb_moveCursorToPeak (SpectrumEditor me, EDITOR_ARGS_DIRECT) {
 
 static void menu_cb_setDynamicRange (SpectrumEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Set dynamic range", nullptr)
-		POSITIVE (U"Dynamic range (dB)", my default_dynamicRange ())
+		POSITIVE (dynamicRange, U"Dynamic range (dB)", my default_dynamicRange ())
 	EDITOR_OK
-		SET_REAL (U"Dynamic range", my p_dynamicRange)
+		SET_REAL (dynamicRange, my p_dynamicRange)
 	EDITOR_DO
-		my pref_dynamicRange () = my p_dynamicRange = GET_REAL (U"Dynamic range");
+		my pref_dynamicRange () = my p_dynamicRange = dynamicRange;
 		updateRange (me);
 		FunctionEditor_redraw (me);
 	EDITOR_END
diff --git a/fon/SpectrumTier.h b/fon/SpectrumTier.h
index a9e0335..138118a 100644
--- a/fon/SpectrumTier.h
+++ b/fon/SpectrumTier.h
@@ -2,7 +2,7 @@
 #define _SpectrumTier_h_
 /* SpectrumTier.h
  *
- * Copyright (C) 2007-2011,2014,2015 Paul Boersma
+ * Copyright (C) 2007-2011,2014,2015,2017 Paul Boersma
  *
  * This code 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 @@ Thing_define (SpectrumTier, RealTier) {
 		override;
 	int v_domainQuantity ()
 		override { return MelderQuantity_FREQUENCY_HERTZ; }
-	const char32 * v_getUnitText (long /* ilevel */, int /* unit */, unsigned long /* flags */)
+	const char32 * v_getUnitText (integer /* level */, int /* unit */, uint32 /* flags */)
 		override { return U"Frequency (Hz)"; }
 };
 
diff --git a/fon/Spectrum_def.h b/fon/Spectrum_def.h
index ec14967..cd6f443 100644
--- a/fon/Spectrum_def.h
+++ b/fon/Spectrum_def.h
@@ -1,6 +1,6 @@
 /* Spectrum_def.h
  *
- * Copyright (C) 2002-2011,2015 Paul Boersma
+ * Copyright (C) 2002-2011,2015,2017 Paul Boersma
  *
  * This code 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 @@ oo_DEFINE_CLASS (Spectrum, Matrix)
 			override;
 		int v_domainQuantity ()
 			override { return MelderQuantity_FREQUENCY_HERTZ; }
-		double v_getValueAtSample (long isamp, long which, int units)
+		double v_getValueAtSample (integer isamp, integer which, int units)
 			override;
 	#endif
 
diff --git a/fon/SpellingChecker.cpp b/fon/SpellingChecker.cpp
index 188c7de..59a92d4 100644
--- a/fon/SpellingChecker.cpp
+++ b/fon/SpellingChecker.cpp
@@ -195,7 +195,7 @@ void SpellingChecker_addNewWord (SpellingChecker me, const char32 *word) {
 	}
 }
 
-char32 * SpellingChecker_nextNotAllowedWord (SpellingChecker me, const char32 *sentence, long *start) {
+char32 * SpellingChecker_nextNotAllowedWord (SpellingChecker me, const char32 *sentence, integer *start) {
 	const char32 *p = sentence + *start;
 	for (;;) {
 		if (*p == U'\0') {
diff --git a/fon/SpellingChecker.h b/fon/SpellingChecker.h
index 25880fb..6aa3885 100644
--- a/fon/SpellingChecker.h
+++ b/fon/SpellingChecker.h
@@ -2,7 +2,7 @@
 #define _SpellingChecker_h_
 /* SpellingChecker.h
  *
- * Copyright (C) 1999-2011,2015 Paul Boersma
+ * Copyright (C) 1999-2011,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ autoStringSet SpellingChecker_extractUserDictionary (SpellingChecker me);
 void SpellingChecker_replaceUserDictionary (SpellingChecker me, StringSet userDictionary);
 
 bool SpellingChecker_isWordAllowed (SpellingChecker me, const char32 *word);
-char32 * SpellingChecker_nextNotAllowedWord (SpellingChecker me, const char32 *sentence, long *start);
+char32 * SpellingChecker_nextNotAllowedWord (SpellingChecker me, const char32 *sentence, integer *start);
 
 void SpellingChecker_addNewWord (SpellingChecker me, const char32 *word);
 
diff --git a/fon/TextGridEditor.cpp b/fon/TextGridEditor.cpp
index 363feb0..8d87e96 100644
--- a/fon/TextGridEditor.cpp
+++ b/fon/TextGridEditor.cpp
@@ -201,17 +201,17 @@ static void menu_cb_DrawVisibleTextGrid (TextGridEditor me, EDITOR_ARGS_FORM) {
 		my v_form_pictureWindow (cmd);
 		my v_form_pictureMargins (cmd);
 		my v_form_pictureSelection (cmd);
-		BOOLEAN (U"Garnish", my default_picture_garnish ());
+		BOOLEAN (garnish, U"Garnish", my default_picture_garnish ())
 	EDITOR_OK
 		my v_ok_pictureWindow (cmd);
 		my v_ok_pictureMargins (cmd);
 		my v_ok_pictureSelection (cmd);
-		SET_INTEGER (U"Garnish", my pref_picture_garnish ());
+		SET_BOOLEAN (garnish, my pref_picture_garnish ())
 	EDITOR_DO
 		my v_do_pictureWindow (cmd);
 		my v_do_pictureMargins (cmd);
 		my v_do_pictureSelection (cmd);
-		my pref_picture_garnish () = GET_INTEGER (U"Garnish");
+		my pref_picture_garnish () = garnish;
 		Editor_openPraatPicture (me);
 		TextGrid_Sound_draw ((TextGrid) my data, nullptr, my pictureGraphics, my startWindow, my endWindow, true, my p_useTextStyles,
 			my pref_picture_garnish ());
@@ -225,17 +225,17 @@ static void menu_cb_DrawVisibleSoundAndTextGrid (TextGridEditor me, EDITOR_ARGS_
 		my v_form_pictureWindow (cmd);
 		my v_form_pictureMargins (cmd);
 		my v_form_pictureSelection (cmd);
-		BOOLEAN (U"Garnish", my default_picture_garnish ());
+		BOOLEAN (garnish, U"Garnish", my default_picture_garnish ())
 	EDITOR_OK
 		my v_ok_pictureWindow (cmd);
 		my v_ok_pictureMargins (cmd);
 		my v_ok_pictureSelection (cmd);
-		SET_INTEGER (U"Garnish", my pref_picture_garnish ());
+		SET_BOOLEAN (garnish, my pref_picture_garnish ())
 	EDITOR_DO
 		my v_do_pictureWindow (cmd);
 		my v_do_pictureMargins (cmd);
 		my v_do_pictureSelection (cmd);
-		my pref_picture_garnish () = GET_INTEGER (U"Garnish");
+		my pref_picture_garnish () = garnish;
 		Editor_openPraatPicture (me);
 		{// scope
 			autoSound sound = my d_longSound.data ?
@@ -479,27 +479,27 @@ static void menu_cb_MoveEtoZero (TextGridEditor me, EDITOR_ARGS_DIRECT) {
 static void menu_cb_DrawTextGridAndPitch (TextGridEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Draw TextGrid and Pitch separately", nullptr)
 		my v_form_pictureWindow (cmd);
-		LABEL (U"", U"TextGrid:")
-		BOOLEAN (U"Show boundaries and points", my default_picture_showBoundaries ());
-		LABEL (U"", U"Pitch:")
-		BOOLEAN (U"Speckle", my default_picture_pitch_speckle ());
+		LABEL (U"TextGrid:")
+		BOOLEAN (showBoundariesAndPoints, U"Show boundaries and points", my default_picture_showBoundaries ());
+		LABEL (U"Pitch:")
+		BOOLEAN (speckle, U"Speckle", my default_picture_pitch_speckle ());
 		my v_form_pictureMargins (cmd);
 		my v_form_pictureSelection (cmd);
-		BOOLEAN (U"Garnish", my default_picture_garnish ());
+		BOOLEAN (garnish, U"Garnish", my default_picture_garnish ());
 	EDITOR_OK
 		my v_ok_pictureWindow (cmd);
-		SET_INTEGER (U"Show boundaries and points", my pref_picture_showBoundaries ());
-		SET_INTEGER (U"Speckle", my pref_picture_pitch_speckle ());
+		SET_BOOLEAN (showBoundariesAndPoints, my pref_picture_showBoundaries ())
+		SET_BOOLEAN (speckle, my pref_picture_pitch_speckle ())
 		my v_ok_pictureMargins (cmd);
 		my v_ok_pictureSelection (cmd);
-		SET_INTEGER (U"Garnish", my pref_picture_garnish ());
+		SET_BOOLEAN (garnish, my pref_picture_garnish ())
 	EDITOR_DO
 		my v_do_pictureWindow (cmd);
-		my pref_picture_showBoundaries () = GET_INTEGER (U"Show boundaries and points");
-		my pref_picture_pitch_speckle () = GET_INTEGER (U"Speckle");
+		my pref_picture_showBoundaries () = showBoundariesAndPoints;
+		my pref_picture_pitch_speckle () = speckle;
 		my v_do_pictureMargins (cmd);
 		my v_do_pictureSelection (cmd);
-		my pref_picture_garnish () = GET_INTEGER (U"Garnish");
+		my pref_picture_garnish () = garnish;
 		if (! my p_pitch_show)
 			Melder_throw (U"No pitch contour is visible.\nFirst choose \"Show pitch\" from the Pitch menu.");
 		if (! my d_pitch) {
@@ -514,8 +514,8 @@ static void menu_cb_DrawTextGridAndPitch (TextGridEditor me, EDITOR_ARGS_FORM) {
 		double pitchViewFrom_overt = ( my p_pitch_viewFrom < my p_pitch_viewTo ? my p_pitch_viewFrom : pitchFloor_overt );
 		double pitchViewTo_overt = ( my p_pitch_viewFrom < my p_pitch_viewTo ? my p_pitch_viewTo : pitchCeiling_overt );
 		TextGrid_Pitch_drawSeparately ((TextGrid) my data, my d_pitch.get(), my pictureGraphics, my startWindow, my endWindow,
-			pitchViewFrom_overt, pitchViewTo_overt, GET_INTEGER (U"Show boundaries and points"), my p_useTextStyles, GET_INTEGER (U"Garnish"),
-			GET_INTEGER (U"Speckle"), my p_pitch_unit);
+			pitchViewFrom_overt, pitchViewTo_overt, showBoundariesAndPoints, my p_useTextStyles, garnish,
+			speckle, my p_pitch_unit);
 		FunctionEditor_garnish (me);
 		Editor_closePraatPicture (me);
 	EDITOR_END
@@ -562,7 +562,7 @@ static void insertBoundaryOrPoint (TextGridEditor me, int itier, double t1, doub
 			/*
 			 * Divide up the label text into left, mid and right, depending on where the text selection is.
 			 */
-			long left, right;
+			integer left, right;
 			char32 *text = GuiText_getStringAndSelectionPosition (my text, & left, & right);
 			bool wholeTextIsSelected = right - left == str32len (text);
 			rightNewInterval = TextInterval_create (t2, interval -> xmax, text + right);
@@ -679,26 +679,25 @@ static void menu_cb_AlignInterval (TextGridEditor me, EDITOR_ARGS_DIRECT) {
 
 static void menu_cb_AlignmentSettings (TextGridEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Alignment settings", nullptr)
-		OPTIONMENU (U"Language", Strings_findString (espeakdata_voices_names.get(), U"English"))
+		OPTIONMENU (language, U"Language", (int) Strings_findString (espeakdata_voices_names.get(), U"English"))
 		for (long i = 1; i <= espeakdata_voices_names -> numberOfStrings; i ++) {
 			OPTION ((const char32 *) espeakdata_voices_names -> strings [i]);
 		}
-		BOOLEAN (U"Include words", my default_align_includeWords ())
-		BOOLEAN (U"Include phonemes", my default_align_includePhonemes ())
-		BOOLEAN (U"Allow silences", my default_align_allowSilences ())
+		BOOLEAN (includeWords,    U"Include words",    my default_align_includeWords ())
+		BOOLEAN (includePhonemes, U"Include phonemes", my default_align_includePhonemes ())
+		BOOLEAN (allowSilences,   U"Allow silences",   my default_align_allowSilences ())
 	EDITOR_OK
-		long prefVoice = Strings_findString (espeakdata_voices_names.get(), my p_align_language);
-		if (prefVoice == 0) prefVoice = Strings_findString (espeakdata_voices_names.get(), U"English");
-		SET_INTEGER (U"Language", prefVoice);
-		SET_INTEGER (U"Include words", my p_align_includeWords)
-		SET_INTEGER (U"Include phonemes", my p_align_includePhonemes)
-		SET_INTEGER (U"Allow silences", my p_align_allowSilences)
+		int prefVoice = (int) Strings_findString (espeakdata_voices_names.get(), my p_align_language);
+		if (prefVoice == 0) prefVoice = (int) Strings_findString (espeakdata_voices_names.get(), U"English");
+		SET_OPTION (language, prefVoice)
+		SET_BOOLEAN (includeWords, my p_align_includeWords)
+		SET_BOOLEAN (includePhonemes, my p_align_includePhonemes)
+		SET_BOOLEAN (allowSilences, my p_align_allowSilences)
 	EDITOR_DO
-		//my pref_align_language () = my p_align_language = GET_ENUM (kTextGrid_language, U"Language");
-		pref_str32cpy2 (my pref_align_language (), my p_align_language, GET_STRING (U"Language"));
-		my pref_align_includeWords    () = my p_align_includeWords    = GET_INTEGER (U"Include words");
-		my pref_align_includePhonemes () = my p_align_includePhonemes = GET_INTEGER (U"Include phonemes");
-		my pref_align_allowSilences   () = my p_align_allowSilences   = GET_INTEGER (U"Allow silences");
+		pref_str32cpy2 (my pref_align_language (), my p_align_language, espeakdata_voices_names -> strings [language]);
+		my pref_align_includeWords    () = my p_align_includeWords    = includeWords;
+		my pref_align_includePhonemes () = my p_align_includePhonemes = includePhonemes;
+		my pref_align_allowSilences   () = my p_align_allowSilences   = allowSilences;
 	EDITOR_END
 }
 
@@ -872,7 +871,7 @@ static void findInTier (TextGridEditor me) {
 
 static void do_find (TextGridEditor me) {
 	if (my findString) {
-		long left, right;
+		integer left, right;
 		autostring32 label = GuiText_getStringAndSelectionPosition (my text, & left, & right);
 		char32 *position = str32str (label.peek() + right, my findString);   // CRLF BUG?
 		if (position) {
@@ -885,12 +884,11 @@ static void do_find (TextGridEditor me) {
 
 static void menu_cb_Find (TextGridEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Find text", nullptr)
-		LABEL (U"", U"Text:")
-		TEXTFIELD (U"string", U"")
+		TEXTFIELD (findString, U"Text:", U"")
 	EDITOR_OK
 	EDITOR_DO
 		Melder_free (my findString);
-		my findString = Melder_dup_f (GET_STRING (U"string"));
+		my findString = Melder_dup_f (findString);
 		do_find (me);
 	EDITOR_END
 }
@@ -910,7 +908,7 @@ static void checkSpellingInTier (TextGridEditor me) {
 			TextInterval interval = tier -> intervals.at [iinterval];
 			char32 *text = interval -> text;
 			if (text) {
-				long position = 0;
+				integer position = 0;
 				char32 *notAllowed = SpellingChecker_nextNotAllowedWord (my spellingChecker, text, & position);
 				if (notAllowed) {
 					my startSelection = interval -> xmin;
@@ -931,7 +929,7 @@ static void checkSpellingInTier (TextGridEditor me) {
 			TextPoint point = tier -> points.at [ipoint];
 			char32 *text = point -> mark;
 			if (text) {
-				long position = 0;
+				integer position = 0;
 				char32 *notAllowed = SpellingChecker_nextNotAllowedWord (my spellingChecker, text, & position);
 				if (notAllowed) {
 					my startSelection = my endSelection = point -> number;
@@ -949,9 +947,9 @@ static void checkSpellingInTier (TextGridEditor me) {
 
 static void menu_cb_CheckSpelling (TextGridEditor me, EDITOR_ARGS_DIRECT) {
 	if (my spellingChecker) {
-		long left, right;
+		integer left, right;
 		autostring32 label = GuiText_getStringAndSelectionPosition (my text, & left, & right);
-		long position = right;
+		integer position = right;
 		char32 *notAllowed = SpellingChecker_nextNotAllowedWord (my spellingChecker, label.peek(), & position);
 		if (notAllowed) {
 			GuiText_setSelection (my text, position, position + str32len (notAllowed));
@@ -963,9 +961,9 @@ static void menu_cb_CheckSpelling (TextGridEditor me, EDITOR_ARGS_DIRECT) {
 
 static void menu_cb_CheckSpellingInInterval (TextGridEditor me, EDITOR_ARGS_DIRECT) {
 	if (my spellingChecker) {
-		long left, right;
+		integer left, right;
 		autostring32 label = GuiText_getStringAndSelectionPosition (my text, & left, & right);
-		long position = right;
+		integer position = right;
 		char32 *notAllowed = SpellingChecker_nextNotAllowedWord (my spellingChecker, label.peek(), & position);
 		if (notAllowed) {
 			GuiText_setSelection (my text, position, position + str32len (notAllowed));
@@ -985,12 +983,12 @@ static void menu_cb_AddToUserDictionary (TextGridEditor me, EDITOR_ARGS_DIRECT)
 
 static void menu_cb_RenameTier (TextGridEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Rename tier", nullptr)
-		SENTENCE (U"Name", U"");
+		SENTENCE (newName, U"New name", U"");
 	EDITOR_OK
 		TextGrid grid = (TextGrid) my data;
 		checkTierSelection (me, U"rename a tier");
 		Daata tier = grid -> tiers->at [my selectedTier];
-		SET_STRING (U"Name", tier -> name ? tier -> name : U"")
+		SET_STRING (newName, tier -> name ? tier -> name : U"")
 	EDITOR_DO
 		TextGrid grid = (TextGrid) my data;
 		checkTierSelection (me, U"rename a tier");
@@ -998,7 +996,6 @@ static void menu_cb_RenameTier (TextGridEditor me, EDITOR_ARGS_FORM) {
 
 		Editor_save (me, U"Rename tier");
 
-		char32 *newName = GET_STRING (U"Name");
 		Thing_setName (tier, newName);
 
 		FunctionEditor_redraw (me);
@@ -1053,16 +1050,14 @@ static void menu_cb_RemoveTier (TextGridEditor me, EDITOR_ARGS_DIRECT) {
 
 static void menu_cb_AddIntervalTier (TextGridEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Add interval tier", nullptr)
-		NATURAL (U"Position", U"1 (= at top)")
-		SENTENCE (U"Name", U"")
+		NATURAL (position, U"Position", U"1 (= at top)")
+		SENTENCE (name, U"Name", U"")
 	EDITOR_OK
 		TextGrid grid = (TextGrid) my data;
-		SET_STRING (U"Position", Melder_cat (grid -> tiers->size + 1, U" (= at bottom)"))
-		SET_STRING (U"Name", U"")
+		SET_INTEGER_AS_STRING (position, Melder_cat (grid -> tiers->size + 1, U" (= at bottom)"))
+		SET_STRING (name, U"")
 	EDITOR_DO
 		TextGrid grid = (TextGrid) my data;
-		int position = GET_INTEGER (U"Position");
-		char32 *name = GET_STRING (U"Name");
 		{// scope
 			autoIntervalTier tier = IntervalTier_create (grid -> xmin, grid -> xmax);
 			if (position > grid -> tiers->size) position = grid -> tiers->size + 1;
@@ -1081,16 +1076,14 @@ static void menu_cb_AddIntervalTier (TextGridEditor me, EDITOR_ARGS_FORM) {
 
 static void menu_cb_AddPointTier (TextGridEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Add point tier", nullptr)
-		NATURAL (U"Position", U"1 (= at top)")
-		SENTENCE (U"Name", U"");
+		NATURAL (position, U"Position", U"1 (= at top)")
+		SENTENCE (name, U"Name", U"");
 	EDITOR_OK
 		TextGrid grid = (TextGrid) my data;
-		SET_STRING (U"Position", Melder_cat (grid -> tiers->size + 1, U" (= at bottom)"))
-		SET_STRING (U"Name", U"")
+		SET_INTEGER_AS_STRING (position, Melder_cat (grid -> tiers->size + 1, U" (= at bottom)"))
+		SET_STRING (name, U"")
 	EDITOR_DO
 		TextGrid grid = (TextGrid) my data;
-		int position = GET_INTEGER (U"Position");
-		char32 *name = GET_STRING (U"Name");
 		{// scope
 			autoTextTier tier = TextTier_create (grid -> xmin, grid -> xmax);
 			if (position > grid -> tiers->size) position = grid -> tiers->size + 1;
@@ -1109,18 +1102,16 @@ static void menu_cb_AddPointTier (TextGridEditor me, EDITOR_ARGS_FORM) {
 
 static void menu_cb_DuplicateTier (TextGridEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Duplicate tier", nullptr)
-		NATURAL (U"Position", U"1 (= at top)")
-		SENTENCE (U"Name", U"")
+		NATURAL (position, U"Position", U"1 (= at top)")
+		SENTENCE (name, U"Name", U"")
 	EDITOR_OK
 		TextGrid grid = (TextGrid) my data;
 		if (my selectedTier) {
-			SET_STRING (U"Position", Melder_integer (my selectedTier + 1))
-			SET_STRING (U"Name", grid -> tiers->at [my selectedTier] -> name)
+			SET_INTEGER (position, my selectedTier + 1)
+			SET_STRING (name, grid -> tiers->at [my selectedTier] -> name)
 		}
 	EDITOR_DO
 		TextGrid grid = (TextGrid) my data;
-		int position = GET_INTEGER (U"Position");
-		char32 *name = GET_STRING (U"Name");
 		checkTierSelection (me, U"duplicate a tier");
 		Function tier = grid -> tiers->at [my selectedTier];
 		{// scope
@@ -1327,7 +1318,7 @@ static void do_drawIntervalTier (TextGridEditor me, IntervalTier tier, int itier
 	#else
 		bool platformUsesAntiAliasing = false;
 	#endif
-	long x1DC, x2DC, yDC;
+	integer x1DC, x2DC, yDC;
 	int selectedInterval = itier == my selectedTier ? getSelectedInterval (me) : 0, iinterval, ninterval = tier -> intervals.size;
 	Graphics_WCtoDC (my graphics.get(), my startWindow, 0.0, & x1DC, & yDC);
 	Graphics_WCtoDC (my graphics.get(), my endWindow, 0.0, & x2DC, & yDC);
@@ -2068,7 +2059,7 @@ void structTextGridEditor :: v_clickSelectionViewer (double xWC, double yWC) {
 	const char32 *character = characters [rowNumber-1] [columnNumber-1];
 	character += str32len (character) - 1;
 	if (our text) {
-		long first = 0, last = 0;
+		integer first = 0, last = 0;
 		char32 *oldText = GuiText_getStringAndSelectionPosition (our text, & first, & last);
 		static MelderString newText { };
 		MelderString_empty (& newText);
@@ -2188,37 +2179,47 @@ void structTextGridEditor :: v_updateText () {
 	}
 }
 
+NATURAL_VARIABLE (v_prefs_addFields_fontSize)
+OPTIONMENU_ENUM_VARIABLE (kGraphics_horizontalAlignment, v_prefs_addFields_textAlignmentInIntervals)
+OPTIONMENU_VARIABLE (v_prefs_addFields_useTextStyles)
+OPTIONMENU_VARIABLE (v_prefs_addFields_shiftDragMultiple)
+OPTIONMENU_ENUM_VARIABLE (kTextGridEditor_showNumberOf, v_prefs_addFields_showNumberOf)
+OPTIONMENU_ENUM_VARIABLE (kMelder_string, v_prefs_addFields_paintIntervalsGreenWhoseLabel)
+SENTENCE_VARIABLE (v_prefs_addFields_theText)
 void structTextGridEditor :: v_prefs_addFields (EditorCommand cmd) {
 	UiField _radio_;
-	NATURAL (U"Font size (points)", default_fontSize ())
-	OPTIONMENU_ENUM (U"Text alignment in intervals", kGraphics_horizontalAlignment, kGraphics_horizontalAlignment::DEFAULT)
-	OPTIONMENU (U"The symbols %#_^ in labels", default_useTextStyles () + 1)
+	NATURAL_FIELD (v_prefs_addFields_fontSize, U"Font size (points)", our default_fontSize ())
+	OPTIONMENU_ENUM_FIELD (v_prefs_addFields_textAlignmentInIntervals, U"Text alignment in intervals",
+		kGraphics_horizontalAlignment, kGraphics_horizontalAlignment::DEFAULT)
+	OPTIONMENU_FIELD (v_prefs_addFields_useTextStyles, U"The symbols %#_^ in labels", our default_useTextStyles () + 1)
 		OPTION (U"are shown as typed")
 		OPTION (U"mean italic/bold/sub/super")
-	OPTIONMENU (U"With the shift key, you drag", default_shiftDragMultiple () + 1)
+	OPTIONMENU_FIELD (v_prefs_addFields_shiftDragMultiple, U"With the shift key, you drag", our default_shiftDragMultiple () + 1)
 		OPTION (U"a single boundary")
 		OPTION (U"multiple boundaries")
-	OPTIONMENU_ENUM (U"Show number of", kTextGridEditor_showNumberOf, kTextGridEditor_showNumberOf::DEFAULT)
-	OPTIONMENU_ENUM (U"Paint intervals green whose label...", kMelder_string, kMelder_string::DEFAULT)
-	SENTENCE (U"...the text", default_greenString ())
+	OPTIONMENU_ENUM_FIELD (v_prefs_addFields_showNumberOf, U"Show number of",
+		kTextGridEditor_showNumberOf, kTextGridEditor_showNumberOf::DEFAULT)
+	OPTIONMENU_ENUM_FIELD (v_prefs_addFields_paintIntervalsGreenWhoseLabel, U"Paint intervals green whose label...",
+		kMelder_string, kMelder_string::DEFAULT)
+	SENTENCE_FIELD (v_prefs_addFields_theText, U"...the text", our default_greenString ())
 }
 void structTextGridEditor :: v_prefs_setValues (EditorCommand cmd) {
-	SET_INTEGER (U"The symbols %#_^ in labels", p_useTextStyles + 1)
-	SET_INTEGER (U"Font size", p_fontSize)
-	SET_ENUM (U"Text alignment in intervals", kGraphics_horizontalAlignment, p_alignment)
-	SET_INTEGER (U"With the shift key, you drag", p_shiftDragMultiple + 1)
-	SET_ENUM (U"Show number of", kTextGridEditor_showNumberOf, p_showNumberOf)
-	SET_ENUM (U"Paint intervals green whose label...", kMelder_string, p_greenMethod)
-	SET_STRING (U"...the text", p_greenString)
+	SET_OPTION (v_prefs_addFields_useTextStyles, our p_useTextStyles + 1)
+	SET_INTEGER (v_prefs_addFields_fontSize, our p_fontSize)
+	SET_ENUM (v_prefs_addFields_textAlignmentInIntervals, kGraphics_horizontalAlignment, our p_alignment)
+	SET_OPTION (v_prefs_addFields_shiftDragMultiple, our p_shiftDragMultiple + 1)
+	SET_ENUM (v_prefs_addFields_showNumberOf, kTextGridEditor_showNumberOf, our p_showNumberOf)
+	SET_ENUM (v_prefs_addFields_paintIntervalsGreenWhoseLabel, kMelder_string, our p_greenMethod)
+	SET_STRING (v_prefs_addFields_theText, our p_greenString)
 }
 void structTextGridEditor :: v_prefs_getValues (EditorCommand cmd) {
-	pref_useTextStyles () = p_useTextStyles = GET_INTEGER (U"The symbols %#_^ in labels") - 1;
-	pref_fontSize () = p_fontSize = GET_INTEGER (U"Font size");
-	pref_alignment () = p_alignment = GET_ENUM (kGraphics_horizontalAlignment, U"Text alignment in intervals");
-	pref_shiftDragMultiple () = p_shiftDragMultiple = GET_INTEGER (U"With the shift key, you drag") - 1;
-	pref_showNumberOf () = p_showNumberOf = GET_ENUM (kTextGridEditor_showNumberOf, U"Show number of");
-	pref_greenMethod () = p_greenMethod = GET_ENUM (kMelder_string, U"Paint intervals green whose label...");
-	pref_str32cpy2 (pref_greenString (), p_greenString, GET_STRING (U"...the text"));
+	our pref_useTextStyles () = our p_useTextStyles = v_prefs_addFields_useTextStyles - 1;
+	our pref_fontSize () = our p_fontSize = v_prefs_addFields_fontSize;
+	our pref_alignment () = our p_alignment = v_prefs_addFields_textAlignmentInIntervals;
+	our pref_shiftDragMultiple () = our p_shiftDragMultiple = v_prefs_addFields_shiftDragMultiple - 1;
+	our pref_showNumberOf () = our p_showNumberOf = v_prefs_addFields_showNumberOf;
+	our pref_greenMethod () = our p_greenMethod = v_prefs_addFields_paintIntervalsGreenWhoseLabel;
+	pref_str32cpy2 (our pref_greenString (), our p_greenString, v_prefs_addFields_theText);
 	FunctionEditor_redraw (this);
 }
 
diff --git a/fon/TimeSoundAnalysisEditor.cpp b/fon/TimeSoundAnalysisEditor.cpp
index add7506..5e5d386 100644
--- a/fon/TimeSoundAnalysisEditor.cpp
+++ b/fon/TimeSoundAnalysisEditor.cpp
@@ -172,46 +172,40 @@ static int makeQueriable (TimeSoundAnalysisEditor me, int allowCursor, double *t
 
 static void menu_cb_logSettings (TimeSoundAnalysisEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Log settings", U"Log files")
-		OPTIONMENU (U"Write log 1 to", 3)
+		OPTIONMENU (writeLog1To, U"Write log 1 to", 3)
 			OPTION (U"Log file only")
 			OPTION (U"Info window only")
 			OPTION (U"Log file and Info window")
-		LABEL (U"", U"Log file 1:")
-		TEXTFIELD (U"Log file 1",   my default_log1_fileName ())
-		LABEL (U"", U"Log 1 format:")
-		TEXTFIELD (U"Log 1 format", my default_log1_format   ())
-		OPTIONMENU (U"Write log 2 to", 3)
+		TEXTFIELD (logFile1,   U"Log file 1:",   my default_log1_fileName ())
+		TEXTFIELD (log1format, U"Log 1 format:", my default_log1_format   ())
+		OPTIONMENU (writeLog2To, U"Write log 2 to", 3)
 			OPTION (U"Log file only")
 			OPTION (U"Info window only")
 			OPTION (U"Log file and Info window")
-		LABEL (U"", U"Log file 2:")
-		TEXTFIELD (U"Log file 2",   my default_log2_fileName ())
-		LABEL (U"", U"Log 2 format:")
-		TEXTFIELD (U"Log 2 format", my default_log2_format   ())
-		LABEL (U"", U"Log script 3:")
-		TEXTFIELD (U"Log script 3", my default_logScript3    ())
-		LABEL (U"", U"Log script 4:")
-		TEXTFIELD (U"Log script 4", my default_logScript4    ())
+		TEXTFIELD (logFile2,   U"Log file 2:",   my default_log2_fileName ())
+		TEXTFIELD (log2format, U"Log 2 format:", my default_log2_format   ())
+		TEXTFIELD (logScript3, U"Log script 3:", my default_logScript3    ())
+		TEXTFIELD (logScript4, U"Log script 4:", my default_logScript4    ())
 	EDITOR_OK
-		SET_INTEGER (U"Write log 1 to", my p_log1_toLogFile + 2 * my p_log1_toInfoWindow)
-		SET_STRING (U"Log file 1",      my p_log1_fileName)
-		SET_STRING (U"Log 1 format",    my p_log1_format)
-		SET_INTEGER (U"Write log 2 to", my p_log2_toLogFile + 2 * my p_log2_toInfoWindow)
-		SET_STRING (U"Log file 2",      my p_log2_fileName)
-		SET_STRING (U"Log 2 format",    my p_log2_format)
-		SET_STRING (U"Log script 3",    my p_logScript3)
-		SET_STRING (U"Log script 4",    my p_logScript4)
+		SET_OPTION (writeLog1To,   my p_log1_toLogFile + 2 * my p_log1_toInfoWindow)
+		SET_STRING (logFile1,      my p_log1_fileName)
+		SET_STRING (log1format,    my p_log1_format)
+		SET_OPTION (writeLog2To,   my p_log2_toLogFile + 2 * my p_log2_toInfoWindow)
+		SET_STRING (logFile2,      my p_log2_fileName)
+		SET_STRING (log2format,    my p_log2_format)
+		SET_STRING (logScript3,    my p_logScript3)
+		SET_STRING (logScript4,    my p_logScript4)
 	EDITOR_DO
-		my pref_log1_toLogFile    () = my p_log1_toLogFile    = (GET_INTEGER (U"Write log 1 to") & 1) != 0;
-		my pref_log1_toInfoWindow () = my p_log1_toInfoWindow = (GET_INTEGER (U"Write log 1 to") & 2) != 0;
-		pref_str32cpy2 (my pref_log1_fileName (), my p_log1_fileName, GET_STRING (U"Log file 1"));
-		pref_str32cpy2 (my pref_log1_format   (), my p_log1_format,   GET_STRING (U"Log 1 format"));
-		my pref_log2_toLogFile    () = my p_log2_toLogFile    = (GET_INTEGER (U"Write log 2 to") & 1) != 0;
-		my pref_log2_toInfoWindow () = my p_log2_toInfoWindow = (GET_INTEGER (U"Write log 2 to") & 2) != 0;
-		pref_str32cpy2 (my pref_log2_fileName (), my p_log2_fileName, GET_STRING (U"Log file 2"));
-		pref_str32cpy2 (my pref_log2_format   (), my p_log2_format,   GET_STRING (U"Log 2 format"));
-		pref_str32cpy2 (my pref_logScript3    (), my p_logScript3,    GET_STRING (U"Log script 3"));
-		pref_str32cpy2 (my pref_logScript4    (), my p_logScript4,    GET_STRING (U"Log script 4"));
+		my pref_log1_toLogFile    () = my p_log1_toLogFile    = (writeLog1To & 1) != 0;
+		my pref_log1_toInfoWindow () = my p_log1_toInfoWindow = (writeLog1To & 2) != 0;
+		pref_str32cpy2 (my pref_log1_fileName (), my p_log1_fileName, logFile1);
+		pref_str32cpy2 (my pref_log1_format   (), my p_log1_format,   log1format);
+		my pref_log2_toLogFile    () = my p_log2_toLogFile    = (writeLog2To & 1) != 0;
+		my pref_log2_toInfoWindow () = my p_log2_toInfoWindow = (writeLog2To & 2) != 0;
+		pref_str32cpy2 (my pref_log2_fileName (), my p_log2_fileName, logFile2);
+		pref_str32cpy2 (my pref_log2_format   (), my p_log2_format,   log2format);
+		pref_str32cpy2 (my pref_logScript3    (), my p_logScript3,    logScript3);
+		pref_str32cpy2 (my pref_logScript4    (), my p_logScript4,    logScript4);
 	EDITOR_END
 }
 
@@ -285,9 +279,9 @@ static void do_log (TimeSoundAnalysisEditor me, int which) {
 				Melder_throw (theMessage_Cannot_compute_formant);
 			}
 			if (part == TimeSoundAnalysisEditor_PART_CURSOR) {
-				value = Formant_getValueAtTime (my d_formant.get(), (int) (varName [1] - U'0'), tmin, 0);
+				value = Formant_getValueAtTime (my d_formant.get(), (int) (varName [1] - U'0'), tmin, kFormant_unit::HERTZ);
 			} else {
-				value = Formant_getMean (my d_formant.get(), (int) (varName [1] - U'0'), tmin, tmax, 0);
+				value = Formant_getMean (my d_formant.get(), (int) (varName [1] - U'0'), tmin, tmax, kFormant_unit::HERTZ);
 			}
 		} else if (varName [0] == U'b' && varName [1] >= U'1' && varName [1] <= U'5' && varName [2] == U'\0') {
 			if (! my p_formant_show)
@@ -295,7 +289,7 @@ static void do_log (TimeSoundAnalysisEditor me, int which) {
 			if (! my d_formant) {
 				Melder_throw (theMessage_Cannot_compute_formant);
 			}
-			value = Formant_getBandwidthAtTime (my d_formant.get(), (int) (varName [1] - U'0'), 0.5 * (tmin + tmax), 0);
+			value = Formant_getBandwidthAtTime (my d_formant.get(), (int) (varName [1] - U'0'), 0.5 * (tmin + tmax), kFormant_unit::HERTZ);
 		} else if (str32equ (varName, U"intensity")) {
 			if (! my p_intensity_show)
 				Melder_throw (U"No intensity contour is visible.\nFirst choose \"Show intensity\" from the Intensity menu.");
@@ -365,47 +359,47 @@ static void menu_cb_logScript4 (TimeSoundAnalysisEditor me, EDITOR_ARGS_DIRECT)
 
 static void menu_cb_showAnalyses (TimeSoundAnalysisEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Show analyses", nullptr)
-		BOOLEAN  (U"Show spectrogram",     my default_spectrogram_show ())
-		BOOLEAN  (U"Show pitch",           my default_pitch_show       ())
-		BOOLEAN  (U"Show intensity",       my default_intensity_show   ())
-		BOOLEAN  (U"Show formants",        my default_formant_show     ())
-		BOOLEAN  (U"Show pulses",          my default_pulses_show      ())
-		POSITIVE (U"Longest analysis (s)", my default_longestAnalysis  ())
+		BOOLEAN  (showSpectrogram, U"Show spectrogram",     my default_spectrogram_show ())
+		BOOLEAN  (showPitch,       U"Show pitch",           my default_pitch_show       ())
+		BOOLEAN  (showIntensity,   U"Show intensity",       my default_intensity_show   ())
+		BOOLEAN  (showFormants,    U"Show formants",        my default_formant_show     ())
+		BOOLEAN  (showPulses,      U"Show pulses",          my default_pulses_show      ())
+		POSITIVE (longestAnalysis, U"Longest analysis (s)", my default_longestAnalysis  ())
 	EDITOR_OK
-		SET_INTEGER (U"Show spectrogram", my p_spectrogram_show)
-		SET_INTEGER (U"Show pitch",       my p_pitch_show)
-		SET_INTEGER (U"Show intensity",   my p_intensity_show)
-		SET_INTEGER (U"Show formants",    my p_formant_show)
-		SET_INTEGER (U"Show pulses",      my p_pulses_show)
-		SET_REAL    (U"Longest analysis", my p_longestAnalysis)
+		SET_BOOLEAN (showSpectrogram, my p_spectrogram_show)
+		SET_BOOLEAN (showPitch,       my p_pitch_show)
+		SET_BOOLEAN (showIntensity,   my p_intensity_show)
+		SET_BOOLEAN (showFormants,    my p_formant_show)
+		SET_BOOLEAN (showPulses,      my p_pulses_show)
+		SET_REAL    (longestAnalysis, my p_longestAnalysis)
 	EDITOR_DO
-		GuiMenuItem_check (my spectrogramToggle , my pref_spectrogram_show () = my p_spectrogram_show = GET_INTEGER (U"Show spectrogram"));
-		GuiMenuItem_check (my pitchToggle       , my pref_pitch_show       () = my p_pitch_show       = GET_INTEGER (U"Show pitch"));
-		GuiMenuItem_check (my intensityToggle   , my pref_intensity_show   () = my p_intensity_show   = GET_INTEGER (U"Show intensity"));
-		GuiMenuItem_check (my formantToggle     , my pref_formant_show     () = my p_formant_show     = GET_INTEGER (U"Show formants"));
-		GuiMenuItem_check (my pulsesToggle      , my pref_pulses_show      () = my p_pulses_show      = GET_INTEGER (U"Show pulses"));
-		my pref_longestAnalysis () = my p_longestAnalysis = GET_REAL (U"Longest analysis");
+		GuiMenuItem_check (my spectrogramToggle, my pref_spectrogram_show () = my p_spectrogram_show = showSpectrogram);
+		GuiMenuItem_check (my pitchToggle,       my pref_pitch_show       () = my p_pitch_show       = showPitch);
+		GuiMenuItem_check (my intensityToggle,   my pref_intensity_show   () = my p_intensity_show   = showIntensity);
+		GuiMenuItem_check (my formantToggle,     my pref_formant_show     () = my p_formant_show     = showFormants);
+		GuiMenuItem_check (my pulsesToggle,      my pref_pulses_show      () = my p_pulses_show      = showPulses);
+		my pref_longestAnalysis () = my p_longestAnalysis = longestAnalysis;
 		FunctionEditor_redraw (me);
 	EDITOR_END
 }
 
 static void menu_cb_timeStepSettings (TimeSoundAnalysisEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Time step settings", U"Time step settings...")
-		OPTIONMENU_ENUM (U"Time step strategy", kTimeSoundAnalysisEditor_timeStepStrategy, my default_timeStepStrategy ())
-		LABEL (U"", U"")
-		LABEL (U"", U"If the time step strategy is \"fixed\":")
-		POSITIVE (U"Fixed time step (s)", my default_fixedTimeStep ())
-		LABEL (U"", U"")
-		LABEL (U"", U"If the time step strategy is \"view-dependent\":")
-		NATURAL (U"Number of time steps per view", my default_numberOfTimeStepsPerView ())
+		OPTIONMENU_ENUM (timeStepStrategy, U"Time step strategy", kTimeSoundAnalysisEditor_timeStepStrategy, my default_timeStepStrategy ())
+		LABEL (U"")
+		LABEL (U"If the time step strategy is \"fixed\":")
+		POSITIVE (fixedTimeStep, U"Fixed time step (s)", my default_fixedTimeStep ())
+		LABEL (U"")
+		LABEL (U"If the time step strategy is \"view-dependent\":")
+		NATURAL (numberOfTimeStepsPerView, U"Number of time steps per view", my default_numberOfTimeStepsPerView ())
 	EDITOR_OK
-		SET_ENUM (U"Time step strategy", kTimeSoundAnalysisEditor_timeStepStrategy, my p_timeStepStrategy)
-		SET_REAL (U"Fixed time step", my p_fixedTimeStep)
-		SET_INTEGER (U"Number of time steps per view", my p_numberOfTimeStepsPerView)
+		SET_ENUM (timeStepStrategy, kTimeSoundAnalysisEditor_timeStepStrategy, my p_timeStepStrategy)
+		SET_REAL (fixedTimeStep, my p_fixedTimeStep)
+		SET_INTEGER (numberOfTimeStepsPerView, my p_numberOfTimeStepsPerView)
 	EDITOR_DO
-		my pref_timeStepStrategy         () = my p_timeStepStrategy         = GET_ENUM    (kTimeSoundAnalysisEditor_timeStepStrategy, U"Time step strategy");
-		my pref_fixedTimeStep            () = my p_fixedTimeStep            = GET_REAL    (U"Fixed time step");
-		my pref_numberOfTimeStepsPerView () = my p_numberOfTimeStepsPerView = GET_INTEGER (U"Number of time steps per view");
+		my pref_timeStepStrategy         () = my p_timeStepStrategy         = timeStepStrategy;
+		my pref_fixedTimeStep            () = my p_fixedTimeStep            = fixedTimeStep;
+		my pref_numberOfTimeStepsPerView () = my p_numberOfTimeStepsPerView = numberOfTimeStepsPerView;
 		my d_pitch. reset();
 		my d_formant. reset();
 		my d_intensity. reset();
@@ -424,17 +418,17 @@ static void menu_cb_showSpectrogram (TimeSoundAnalysisEditor me, EDITOR_ARGS_DIR
 
 static void menu_cb_spectrogramSettings (TimeSoundAnalysisEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Spectrogram settings", U"Intro 3.2. Configuring the spectrogram")
-		REAL     (U"left View range (Hz)",  my default_spectrogram_viewFrom     ())
-		POSITIVE (U"right View range (Hz)", my default_spectrogram_viewTo       ())
-		POSITIVE (U"Window length (s)",     my default_spectrogram_windowLength ())
-		POSITIVE (U"Dynamic range (dB)",    my default_spectrogram_dynamicRange ())
-		LABEL    (U"note1", U"")
-		LABEL    (U"note2", U"")
+		REAL     (viewFrom,     U"left View range (Hz)",  my default_spectrogram_viewFrom     ())
+		POSITIVE (viewTo,       U"right View range (Hz)", my default_spectrogram_viewTo       ())
+		POSITIVE (windowLength, U"Window length (s)",     my default_spectrogram_windowLength ())
+		POSITIVE (dynamicRange, U"Dynamic range (dB)",    my default_spectrogram_dynamicRange ())
+		MUTABLE_LABEL (note1, U"")
+		MUTABLE_LABEL (note2, U"")
 	EDITOR_OK
-		SET_REAL (U"left View range",  my p_spectrogram_viewFrom)
-		SET_REAL (U"right View range", my p_spectrogram_viewTo)
-		SET_REAL (U"Window length",    my p_spectrogram_windowLength)
-		SET_REAL (U"Dynamic range",    my p_spectrogram_dynamicRange)
+		SET_REAL (viewFrom,     my p_spectrogram_viewFrom)
+		SET_REAL (viewTo,       my p_spectrogram_viewTo)
+		SET_REAL (windowLength, my p_spectrogram_windowLength)
+		SET_REAL (dynamicRange, my p_spectrogram_dynamicRange)
 		if (my p_spectrogram_timeSteps          != Melder_atof (my default_spectrogram_timeSteps ()) ||
 			my p_spectrogram_frequencySteps     != Melder_atof (my default_spectrogram_frequencySteps ()) ||
 			my p_spectrogram_method             != my default_spectrogram_method () ||
@@ -444,20 +438,20 @@ static void menu_cb_spectrogramSettings (TimeSoundAnalysisEditor me, EDITOR_ARGS
 			my p_spectrogram_preemphasis        != Melder_atof (my default_spectrogram_preemphasis ()) ||
 			my p_spectrogram_dynamicCompression != Melder_atof (my default_spectrogram_dynamicCompression ()))
 		{
-			SET_STRING (U"note1", U"Warning: you have non-standard \"advanced settings\".")
+			SET_STRING (note1, U"Warning: you have non-standard \"advanced settings\".")
 		} else {
-			SET_STRING (U"note1", U"(all of your \"advanced settings\" have their standard values)")
+			SET_STRING (note1, U"(all of your \"advanced settings\" have their standard values)")
 		}
 		if (my p_timeStepStrategy != my default_timeStepStrategy ()) {
-			SET_STRING (U"note2", U"Warning: you have a non-standard \"time step strategy\".")
+			SET_STRING (note2, U"Warning: you have a non-standard \"time step strategy\".")
 		} else {
-			SET_STRING (U"note2", U"(your \"time step strategy\" has its standard value: automatic)")
+			SET_STRING (note2, U"(your \"time step strategy\" has its standard value: automatic)")
 		}
 	EDITOR_DO
-		my pref_spectrogram_viewFrom     () = my p_spectrogram_viewFrom     = GET_REAL (U"left View range");
-		my pref_spectrogram_viewTo       () = my p_spectrogram_viewTo       = GET_REAL (U"right View range");
-		my pref_spectrogram_windowLength () = my p_spectrogram_windowLength = GET_REAL (U"Window length");
-		my pref_spectrogram_dynamicRange () = my p_spectrogram_dynamicRange = GET_REAL (U"Dynamic range");
+		my pref_spectrogram_viewFrom     () = my p_spectrogram_viewFrom     = viewFrom;
+		my pref_spectrogram_viewTo       () = my p_spectrogram_viewTo       = viewTo;
+		my pref_spectrogram_windowLength () = my p_spectrogram_windowLength = windowLength;
+		my pref_spectrogram_dynamicRange () = my p_spectrogram_dynamicRange = dynamicRange;
 		my d_spectrogram. reset();
 		FunctionEditor_redraw (me);
 	EDITOR_END
@@ -465,35 +459,35 @@ static void menu_cb_spectrogramSettings (TimeSoundAnalysisEditor me, EDITOR_ARGS
 
 static void menu_cb_advancedSpectrogramSettings (TimeSoundAnalysisEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Advanced spectrogram settings", U"Advanced spectrogram settings...")
-		LABEL (U"", U"Time and frequency resolutions:")
-		NATURAL (U"Number of time steps",      my default_spectrogram_timeSteps          ())
-		NATURAL (U"Number of frequency steps", my default_spectrogram_frequencySteps     ())
-		LABEL (U"", U"Spectrogram analysis settings:")
-		OPTIONMENU_ENUM (U"Method",       kSound_to_Spectrogram_method,      my default_spectrogram_method ())
-		OPTIONMENU_ENUM (U"Window shape", kSound_to_Spectrogram_windowShape, my default_spectrogram_windowShape ())
-		LABEL (U"", U"Spectrogram view settings:")
-		BOOLEAN (U"Autoscaling",               my default_spectrogram_autoscaling        ())
-		REAL    (U"Maximum (dB/Hz)",           my default_spectrogram_maximum            ())
-		REAL    (U"Pre-emphasis (dB/oct)",     my default_spectrogram_preemphasis        ())
-		REAL    (U"Dynamic compression (0-1)", my default_spectrogram_dynamicCompression ())
+		LABEL (U"Time and frequency resolutions:")
+		NATURAL (numberOfTimeSteps,      U"Number of time steps",      my default_spectrogram_timeSteps          ())
+		NATURAL (numberOfFrequencySteps, U"Number of frequency steps", my default_spectrogram_frequencySteps     ())
+		LABEL (U"Spectrogram analysis settings:")
+		OPTIONMENU_ENUM (method,      U"Method",       kSound_to_Spectrogram_method,      my default_spectrogram_method ())
+		OPTIONMENU_ENUM (windowShape, U"Window shape", kSound_to_Spectrogram_windowShape, my default_spectrogram_windowShape ())
+		LABEL (U"Spectrogram view settings:")
+		BOOLEAN (autoscaling, U"Autoscaling", my default_spectrogram_autoscaling ())
+		REAL (maximum, U"Maximum (dB/Hz)", my default_spectrogram_maximum ())
+		REAL (preemphasis, U"Pre-emphasis (dB/oct)", my default_spectrogram_preemphasis ())
+		REAL (dynamicCompression, U"Dynamic compression (0-1)", my default_spectrogram_dynamicCompression ())
 	EDITOR_OK
-		SET_INTEGER (U"Number of time steps",      my p_spectrogram_timeSteps)
-		SET_INTEGER (U"Number of frequency steps", my p_spectrogram_frequencySteps)
-		SET_ENUM    (U"Method",       kSound_to_Spectrogram_method,      my p_spectrogram_method)
-		SET_ENUM    (U"Window shape", kSound_to_Spectrogram_windowShape, my p_spectrogram_windowShape)
-		SET_INTEGER (U"Autoscaling",               my p_spectrogram_autoscaling)
-		SET_REAL    (U"Maximum",                   my p_spectrogram_maximum)
-		SET_REAL    (U"Pre-emphasis",              my p_spectrogram_preemphasis)
-		SET_REAL    (U"Dynamic compression",       my p_spectrogram_dynamicCompression)
+		SET_INTEGER (numberOfTimeSteps,      my p_spectrogram_timeSteps)
+		SET_INTEGER (numberOfFrequencySteps, my p_spectrogram_frequencySteps)
+		SET_ENUM    (method,      kSound_to_Spectrogram_method,      my p_spectrogram_method)
+		SET_ENUM    (windowShape, kSound_to_Spectrogram_windowShape, my p_spectrogram_windowShape)
+		SET_BOOLEAN (autoscaling,              my p_spectrogram_autoscaling)
+		SET_REAL    (maximum,                  my p_spectrogram_maximum)
+		SET_REAL    (preemphasis,              my p_spectrogram_preemphasis)
+		SET_REAL    (dynamicCompression,       my p_spectrogram_dynamicCompression)
 	EDITOR_DO
-		my pref_spectrogram_timeSteps          () = my p_spectrogram_timeSteps          = GET_INTEGER (U"Number of time steps");
-		my pref_spectrogram_frequencySteps     () = my p_spectrogram_frequencySteps     = GET_INTEGER (U"Number of frequency steps");
-		my pref_spectrogram_method             () = my p_spectrogram_method             = GET_ENUM (kSound_to_Spectrogram_method, U"Method");
-		my pref_spectrogram_windowShape        () = my p_spectrogram_windowShape        = GET_ENUM (kSound_to_Spectrogram_windowShape, U"Window shape");
-		my pref_spectrogram_autoscaling        () = my p_spectrogram_autoscaling        = GET_INTEGER (U"Autoscaling");
-		my pref_spectrogram_maximum            () = my p_spectrogram_maximum            = GET_REAL (U"Maximum");
-		my pref_spectrogram_preemphasis        () = my p_spectrogram_preemphasis        = GET_REAL (U"Pre-emphasis");
-		my pref_spectrogram_dynamicCompression () = my p_spectrogram_dynamicCompression = GET_REAL (U"Dynamic compression");
+		my pref_spectrogram_timeSteps          () = my p_spectrogram_timeSteps          = numberOfTimeSteps;
+		my pref_spectrogram_frequencySteps     () = my p_spectrogram_frequencySteps     = numberOfFrequencySteps;
+		my pref_spectrogram_method             () = my p_spectrogram_method             = method;
+		my pref_spectrogram_windowShape        () = my p_spectrogram_windowShape        = windowShape;
+		my pref_spectrogram_autoscaling        () = my p_spectrogram_autoscaling        = autoscaling;
+		my pref_spectrogram_maximum            () = my p_spectrogram_maximum            = maximum;
+		my pref_spectrogram_preemphasis        () = my p_spectrogram_preemphasis        = preemphasis;
+		my pref_spectrogram_dynamicCompression () = my p_spectrogram_dynamicCompression = dynamicCompression;
 		my d_spectrogram. reset();
 		FunctionEditor_redraw (me);
 	EDITOR_END
@@ -523,11 +517,10 @@ static void menu_cb_moveFrequencyCursorTo (TimeSoundAnalysisEditor me, EDITOR_AR
 	if (! my p_spectrogram_show)
 		Melder_throw (U"No spectrogram is visible.\nFirst choose \"Show spectrogram\" from the Spectrum menu.");
 	EDITOR_FORM (U"Move frequency cursor to", nullptr)
-		REAL (U"Frequency (Hz)", U"0.0")
+		REAL (frequency, U"Frequency (Hz)", U"0.0")
 	EDITOR_OK
-		SET_REAL (U"Frequency", my d_spectrogram_cursor)
+		SET_REAL (frequency, my d_spectrogram_cursor)
 	EDITOR_DO
-		double frequency = GET_REAL (U"Frequency");
 		my d_spectrogram_cursor = frequency;
 		FunctionEditor_redraw (me);
 	EDITOR_END
@@ -584,17 +577,17 @@ static void menu_cb_paintVisibleSpectrogram (TimeSoundAnalysisEditor me, EDITOR_
 		my v_form_pictureWindow (cmd);
 		my v_form_pictureMargins (cmd);
 		my v_form_pictureSelection (cmd);
-		BOOLEAN (U"Garnish", true);
+		BOOLEAN (garnish, U"Garnish", true)
 	EDITOR_OK
 		my v_ok_pictureWindow (cmd);
 		my v_ok_pictureMargins (cmd);
 		my v_ok_pictureSelection (cmd);
-		SET_INTEGER (U"Garnish", my p_spectrogram_picture_garnish);
+		SET_BOOLEAN (garnish, my p_spectrogram_picture_garnish)
 	EDITOR_DO
 		my v_do_pictureWindow (cmd);
 		my v_do_pictureMargins (cmd);
 		my v_do_pictureSelection (cmd);
-		my pref_spectrogram_picture_garnish () = my p_spectrogram_picture_garnish = GET_INTEGER (U"Garnish");
+		my pref_spectrogram_picture_garnish () = my p_spectrogram_picture_garnish = garnish;
 		if (! my p_spectrogram_show)
 			Melder_throw (U"No spectrogram is visible.\nFirst choose \"Show spectrogram\" from the Spectrum menu.");
 		if (! my d_spectrogram) {
@@ -620,21 +613,21 @@ static void menu_cb_showPitch (TimeSoundAnalysisEditor me, EDITOR_ARGS_DIRECT) {
 
 static void menu_cb_pitchSettings (TimeSoundAnalysisEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Pitch settings", U"Intro 4.2. Configuring the pitch contour")
-		POSITIVE (U"left Pitch range (Hz)", my default_pitch_floor ())
-		POSITIVE (U"right Pitch range (Hz)", my default_pitch_ceiling ())
-		OPTIONMENU_ENUM (U"Unit", kPitch_unit, my default_pitch_unit ())
-		LABEL (U"opt1", U"The autocorrelation method optimizes for intonation research;")
-		LABEL (U"opt2", U"and the cross-correlation method optimizes for voice research:")
-		RADIO_ENUM (U"Analysis method", kTimeSoundAnalysisEditor_pitch_analysisMethod, my default_pitch_method ())
-		OPTIONMENU_ENUM (U"Drawing method", kTimeSoundAnalysisEditor_pitch_drawingMethod, my default_pitch_drawingMethod ())
-		LABEL (U"note1", U"")
-		LABEL (U"note2", U"")
+		POSITIVE (pitchFloor,   U"left Pitch range (Hz)",  my default_pitch_floor ())
+		POSITIVE (pitchCeiling, U"right Pitch range (Hz)", my default_pitch_ceiling ())
+		OPTIONMENU_ENUM (unit, U"Unit", kPitch_unit, my default_pitch_unit ())
+		LABEL (U"The autocorrelation method optimizes for intonation research;")
+		LABEL (U"and the cross-correlation method optimizes for voice research:")
+		RADIO_ENUM (analysisMethod, U"Analysis method", kTimeSoundAnalysisEditor_pitch_analysisMethod, my default_pitch_method ())
+		OPTIONMENU_ENUM (drawingMethod, U"Drawing method", kTimeSoundAnalysisEditor_pitch_drawingMethod, my default_pitch_drawingMethod ())
+		MUTABLE_LABEL (note1, U"")
+		MUTABLE_LABEL (note2, U"")
 	EDITOR_OK
-		SET_REAL (U"left Pitch range", my p_pitch_floor)
-		SET_REAL (U"right Pitch range", my p_pitch_ceiling)
-		SET_ENUM (U"Unit", kPitch_unit, my p_pitch_unit)
-		SET_ENUM (U"Analysis method", kTimeSoundAnalysisEditor_pitch_analysisMethod, my p_pitch_method)
-		SET_ENUM (U"Drawing method", kTimeSoundAnalysisEditor_pitch_drawingMethod, my p_pitch_drawingMethod)
+		SET_REAL (pitchFloor,   my p_pitch_floor)
+		SET_REAL (pitchCeiling, my p_pitch_ceiling)
+		SET_ENUM (unit, kPitch_unit, my p_pitch_unit)
+		SET_ENUM (analysisMethod, kTimeSoundAnalysisEditor_pitch_analysisMethod, my p_pitch_method)
+		SET_ENUM (drawingMethod, kTimeSoundAnalysisEditor_pitch_drawingMethod, my p_pitch_drawingMethod)
 		if (my p_pitch_viewFrom                  != Melder_atof (my default_pitch_viewFrom ()) ||
 			my p_pitch_viewTo                    != Melder_atof (my default_pitch_viewTo ()) ||
 			my p_pitch_veryAccurate              != my default_pitch_veryAccurate () ||
@@ -645,21 +638,21 @@ static void menu_cb_pitchSettings (TimeSoundAnalysisEditor me, EDITOR_ARGS_FORM)
 			my p_pitch_octaveJumpCost            != Melder_atof (my default_pitch_octaveJumpCost ()) ||
 			my p_pitch_voicedUnvoicedCost        != Melder_atof (my default_pitch_voicedUnvoicedCost ()))
 		{
-			SET_STRING (U"note1", U"Warning: you have some non-standard \"advanced settings\".")
+			SET_STRING (note1, U"Warning: you have some non-standard \"advanced settings\".")
 		} else {
-			SET_STRING (U"note1", U"(all of your \"advanced settings\" have their standard values)")
+			SET_STRING (note1, U"(all of your \"advanced settings\" have their standard values)")
 		}
 		if (my p_timeStepStrategy != my default_timeStepStrategy ()) {
-			SET_STRING (U"note2", U"Warning: you have a non-standard \"time step strategy\".")
+			SET_STRING (note2, U"Warning: you have a non-standard \"time step strategy\".")
 		} else {
-			SET_STRING (U"note2", U"(your \"time step strategy\" has its standard value: automatic)")
+			SET_STRING (note2, U"(your \"time step strategy\" has its standard value: automatic)")
 		}
 	EDITOR_DO
-		my pref_pitch_floor         () = my p_pitch_floor         = GET_REAL (U"left Pitch range");
-		my pref_pitch_ceiling       () = my p_pitch_ceiling       = GET_REAL (U"right Pitch range");
-		my pref_pitch_unit          () = my p_pitch_unit          = GET_ENUM (kPitch_unit, U"Unit");
-		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 pref_pitch_floor         () = my p_pitch_floor         = pitchFloor;
+		my pref_pitch_ceiling       () = my p_pitch_ceiling       = pitchCeiling;
+		my pref_pitch_unit          () = my p_pitch_unit          = unit;
+		my pref_pitch_method        () = my p_pitch_method        = analysisMethod;
+		my pref_pitch_drawingMethod () = my p_pitch_drawingMethod = drawingMethod;
 		my d_pitch. reset();
 		my d_intensity. reset();
 		my d_pulses. reset();
@@ -669,42 +662,42 @@ static void menu_cb_pitchSettings (TimeSoundAnalysisEditor me, EDITOR_ARGS_FORM)
 
 static void menu_cb_advancedPitchSettings (TimeSoundAnalysisEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Advanced pitch settings", U"Advanced pitch settings...")
-		LABEL   (U"", U"Make view range different from analysis range:")
-		REAL    (U"left View range (units)",   my default_pitch_viewFrom                  ())
-		REAL    (U"right View range (units)",  my default_pitch_viewTo                    ())
-		LABEL   (U"", U"Analysis settings:")
-		BOOLEAN (U"Very accurate", 0)
-		NATURAL (U"Max. number of candidates", my default_pitch_maximumNumberOfCandidates ())
-		REAL    (U"Silence threshold",         my default_pitch_silenceThreshold          ())
-		REAL    (U"Voicing threshold",         my default_pitch_voicingThreshold          ())
-		REAL    (U"Octave cost",               my default_pitch_octaveCost                ())
-		REAL    (U"Octave-jump cost",          my default_pitch_octaveJumpCost            ())
-		REAL    (U"Voiced / unvoiced cost",    my default_pitch_voicedUnvoicedCost        ())
+		LABEL   (U"Make view range different from analysis range:")
+		REAL    (viewFrom,                  U"left View range (units)",   my default_pitch_viewFrom                  ())
+		REAL    (viewTo,                    U"right View range (units)",  my default_pitch_viewTo                    ())
+		LABEL   (U"Analysis settings:")
+		BOOLEAN (veryAccurate,              U"Very accurate", false)
+		NATURAL (maximumNumberOfCandidates, U"Max. number of candidates", my default_pitch_maximumNumberOfCandidates ())
+		REAL    (silenceThreshold,          U"Silence threshold",         my default_pitch_silenceThreshold          ())
+		REAL    (voicingThreshold,          U"Voicing threshold",         my default_pitch_voicingThreshold          ())
+		REAL    (octaveCost,                U"Octave cost",               my default_pitch_octaveCost                ())
+		REAL    (octaveJumpCost,            U"Octave-jump cost",          my default_pitch_octaveJumpCost            ())
+		REAL    (voicedUnvoicedCost,        U"Voiced / unvoiced cost",    my default_pitch_voicedUnvoicedCost        ())
 	EDITOR_OK
-		SET_REAL    (U"left View range",           my p_pitch_viewFrom)
-		SET_REAL    (U"right View range",          my p_pitch_viewTo)
-		SET_INTEGER (U"Very accurate",             my p_pitch_veryAccurate)
-		SET_INTEGER (U"Max. number of candidates", my p_pitch_maximumNumberOfCandidates)
-		SET_REAL    (U"Silence threshold",         my p_pitch_silenceThreshold)
-		SET_REAL    (U"Voicing threshold",         my p_pitch_voicingThreshold)
-		SET_REAL    (U"Octave cost",               my p_pitch_octaveCost)
-		SET_REAL    (U"Octave-jump cost",          my p_pitch_octaveJumpCost)
-		SET_REAL    (U"Voiced / unvoiced cost",    my p_pitch_voicedUnvoicedCost)
+		SET_REAL    (viewFrom,                  my p_pitch_viewFrom)
+		SET_REAL    (viewTo,                    my p_pitch_viewTo)
+		SET_BOOLEAN (veryAccurate,              my p_pitch_veryAccurate)
+		SET_INTEGER (maximumNumberOfCandidates, my p_pitch_maximumNumberOfCandidates)
+		SET_REAL    (silenceThreshold,          my p_pitch_silenceThreshold)
+		SET_REAL    (voicingThreshold,          my p_pitch_voicingThreshold)
+		SET_REAL    (octaveCost,                my p_pitch_octaveCost)
+		SET_REAL    (octaveJumpCost,            my p_pitch_octaveJumpCost)
+		SET_REAL    (voicedUnvoicedCost,        my p_pitch_voicedUnvoicedCost)
 	EDITOR_DO
-		long maxnCandidates = GET_INTEGER (U"Max. number of candidates");
-		if (maxnCandidates < 2) Melder_throw (U"Maximum number of candidates must be greater than 1.");
-		my pref_pitch_viewFrom                  () = my p_pitch_viewFrom                  = GET_REAL    (U"left View range");
-		my pref_pitch_viewTo                    () = my p_pitch_viewTo                    = GET_REAL    (U"right View range");
-		my pref_pitch_veryAccurate              () = my p_pitch_veryAccurate              = GET_INTEGER (U"Very accurate");
-		my pref_pitch_maximumNumberOfCandidates () = my p_pitch_maximumNumberOfCandidates = GET_INTEGER (U"Max. number of candidates");
-		my pref_pitch_silenceThreshold          () = my p_pitch_silenceThreshold          = GET_REAL    (U"Silence threshold");
-		my pref_pitch_voicingThreshold          () = my p_pitch_voicingThreshold          = GET_REAL    (U"Voicing threshold");
-		my pref_pitch_octaveCost                () = my p_pitch_octaveCost                = GET_REAL    (U"Octave cost");
-		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();
+		if (maximumNumberOfCandidates < 2)
+			Melder_throw (U"Your maximum number of candidates should be greater than 1.");
+		my pref_pitch_viewFrom                  () = my p_pitch_viewFrom                  = viewFrom;
+		my pref_pitch_viewTo                    () = my p_pitch_viewTo                    = viewTo;
+		my pref_pitch_veryAccurate              () = my p_pitch_veryAccurate              = veryAccurate;
+		my pref_pitch_maximumNumberOfCandidates () = my p_pitch_maximumNumberOfCandidates = maximumNumberOfCandidates;
+		my pref_pitch_silenceThreshold          () = my p_pitch_silenceThreshold          = silenceThreshold;
+		my pref_pitch_voicingThreshold          () = my p_pitch_voicingThreshold          = voicingThreshold;
+		my pref_pitch_octaveCost                () = my p_pitch_octaveCost                = octaveCost;
+		my pref_pitch_octaveJumpCost            () = my p_pitch_octaveJumpCost            = octaveJumpCost;
+		my pref_pitch_voicedUnvoicedCost        () = my p_pitch_voicedUnvoicedCost        = voicedUnvoicedCost;
+		my d_pitch.     reset();
 		my d_intensity. reset();
-		my d_pulses. reset();
+		my d_pulses.    reset();
 		FunctionEditor_redraw (me);
 	EDITOR_END
 }
@@ -843,23 +836,23 @@ static void menu_cb_extractVisiblePitchContour (TimeSoundAnalysisEditor me, EDIT
 static void menu_cb_drawVisiblePitchContour (TimeSoundAnalysisEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Draw visible pitch contour", nullptr)
 		my v_form_pictureWindow (cmd);
-		LABEL (U"", U"Pitch:")
-		BOOLEAN (U"Speckle", false);
+		LABEL (U"Pitch:")
+		BOOLEAN (speckle, U"Speckle", false)
 		my v_form_pictureMargins (cmd);
 		my v_form_pictureSelection (cmd);
-		BOOLEAN (U"Garnish", true);
+		BOOLEAN (garnish, U"Garnish", true)
 	EDITOR_OK
 		my v_ok_pictureWindow (cmd);
-		SET_INTEGER (U"Speckle", my p_pitch_picture_speckle);
+		SET_BOOLEAN (speckle, my p_pitch_picture_speckle)
 		my v_ok_pictureMargins (cmd);
 		my v_ok_pictureSelection (cmd);
-		SET_INTEGER (U"Garnish", my p_pitch_picture_garnish);
+		SET_BOOLEAN (garnish, my p_pitch_picture_garnish)
 	EDITOR_DO
 		my v_do_pictureWindow (cmd);
-		my pref_pitch_picture_speckle () = my p_pitch_picture_speckle = GET_INTEGER (U"Speckle");
+		my pref_pitch_picture_speckle () = my p_pitch_picture_speckle = speckle;
 		my v_do_pictureMargins (cmd);
 		my v_do_pictureSelection (cmd);
-		my pref_pitch_picture_garnish () = my p_pitch_picture_garnish = GET_INTEGER (U"Garnish");
+		my pref_pitch_picture_garnish () = my p_pitch_picture_garnish = garnish;
 		if (! my p_pitch_show)
 			Melder_throw (U"No pitch contour is visible.\nFirst choose \"Show pitch\" from the Pitch menu.");
 		if (! my d_pitch) {
@@ -890,27 +883,27 @@ static void menu_cb_showIntensity (TimeSoundAnalysisEditor me, EDITOR_ARGS_DIREC
 
 static void menu_cb_intensitySettings (TimeSoundAnalysisEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Intensity settings", U"Intro 6.2. Configuring the intensity contour")
-		REAL (U"left View range (dB)",  my default_intensity_viewFrom ())
-		REAL (U"right View range (dB)", my default_intensity_viewTo   ())
-		RADIO_ENUM (U"Averaging method", kTimeSoundAnalysisEditor_intensity_averagingMethod, my default_intensity_averagingMethod ())
-		BOOLEAN (U"Subtract mean pressure", my default_intensity_subtractMeanPressure ())
-		LABEL (U"", U"Note: the pitch floor is taken from the pitch settings.")
-		LABEL (U"note2", U"")
+		REAL (viewFrom, U"left View range (dB)",  my default_intensity_viewFrom ())
+		REAL (viewTo,   U"right View range (dB)", my default_intensity_viewTo   ())
+		RADIO_ENUM (averagingMethod, U"Averaging method", kTimeSoundAnalysisEditor_intensity_averagingMethod, my default_intensity_averagingMethod ())
+		BOOLEAN (subtractMeanPressure, U"Subtract mean pressure", my default_intensity_subtractMeanPressure ())
+		LABEL (U"Note: the pitch floor is taken from the pitch settings.")
+		MUTABLE_LABEL (note2, U"")
 	EDITOR_OK
-		SET_REAL (U"left View range",  my p_intensity_viewFrom)
-		SET_REAL (U"right View range", my p_intensity_viewTo)
-		SET_ENUM (U"Averaging method", kTimeSoundAnalysisEditor_intensity_averagingMethod, my p_intensity_averagingMethod)
-		SET_INTEGER (U"Subtract mean pressure", my p_intensity_subtractMeanPressure)
+		SET_REAL (viewFrom,  my p_intensity_viewFrom)
+		SET_REAL (viewTo,    my p_intensity_viewTo)
+		SET_ENUM (averagingMethod, kTimeSoundAnalysisEditor_intensity_averagingMethod, my p_intensity_averagingMethod)
+		SET_BOOLEAN (subtractMeanPressure, my p_intensity_subtractMeanPressure)
 		if (my p_timeStepStrategy != my default_timeStepStrategy ()) {
-			SET_STRING (U"note2", U"Warning: you have a non-standard \"time step strategy\".")
+			SET_STRING (note2, U"Warning: you have a non-standard \"time step strategy\".")
 		} else {
-			SET_STRING (U"note2", U"(your \"time step strategy\" has its standard value: automatic)")
+			SET_STRING (note2, U"(your \"time step strategy\" has its standard value: automatic)")
 		}
 	EDITOR_DO
-		my pref_intensity_viewFrom             () = my p_intensity_viewFrom             = GET_REAL    (U"left View range");
-		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");
+		my pref_intensity_viewFrom             () = my p_intensity_viewFrom             = viewFrom;
+		my pref_intensity_viewTo               () = my p_intensity_viewTo               = viewTo;
+		my pref_intensity_averagingMethod      () = my p_intensity_averagingMethod      = averagingMethod;
+		my pref_intensity_subtractMeanPressure () = my p_intensity_subtractMeanPressure = subtractMeanPressure;
 		my d_intensity. reset();
 		FunctionEditor_redraw (me);
 	EDITOR_END
@@ -932,17 +925,17 @@ static void menu_cb_drawVisibleIntensityContour (TimeSoundAnalysisEditor me, EDI
 		my v_form_pictureWindow (cmd);
 		my v_form_pictureMargins (cmd);
 		my v_form_pictureSelection (cmd);
-		BOOLEAN (U"Garnish", true);
+		BOOLEAN (garnish, U"Garnish", true)
 	EDITOR_OK
 		my v_ok_pictureWindow (cmd);
 		my v_ok_pictureMargins (cmd);
 		my v_ok_pictureSelection (cmd);
-		SET_INTEGER (U"Garnish", my p_intensity_picture_garnish);
+		SET_BOOLEAN (garnish, my p_intensity_picture_garnish)
 	EDITOR_DO
 		my v_do_pictureWindow (cmd);
 		my v_do_pictureMargins (cmd);
 		my v_do_pictureSelection (cmd);
-		my pref_intensity_picture_garnish () = my p_intensity_picture_garnish = GET_INTEGER (U"Garnish");
+		my pref_intensity_picture_garnish () = my p_intensity_picture_garnish = garnish;
 		if (! my p_intensity_show)
 			Melder_throw (U"No intensity contour is visible.\nFirst choose \"Show intensity\" from the Intensity menu.");
 		if (! my d_intensity) {
@@ -1037,35 +1030,35 @@ static void menu_cb_showFormants (TimeSoundAnalysisEditor me, EDITOR_ARGS_DIRECT
 
 static void menu_cb_formantSettings (TimeSoundAnalysisEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Formant settings", U"Intro 5.2. Configuring the formant contours")
-		POSITIVE (U"Maximum formant (Hz)", my default_formant_maximumFormant   ())
-		POSITIVE (U"Number of formants",   my default_formant_numberOfFormants ())
-		POSITIVE (U"Window length (s)",    my default_formant_windowLength     ())
-		REAL     (U"Dynamic range (dB)",   my default_formant_dynamicRange     ())
-		POSITIVE (U"Dot size (mm)",        my default_formant_dotSize          ())
-		LABEL    (U"note1", U"")
-		LABEL    (U"note2", U"")
+		POSITIVE (maximumFormant, U"Maximum formant (Hz)",  my default_formant_maximumFormant   ())
+		POSITIVE (numberOfFormants, U"Number of formants",  my default_formant_numberOfFormants ())
+		POSITIVE (windowLength, U"Window length (s)",       my default_formant_windowLength     ())
+		REAL     (dynamicRange, U"Dynamic range (dB)",      my default_formant_dynamicRange     ())
+		POSITIVE (dotSize, U"Dot size (mm)",                my default_formant_dotSize          ())
+		MUTABLE_LABEL (note1, U"")
+		MUTABLE_LABEL (note2, U"")
 	EDITOR_OK
-		SET_REAL (U"Maximum formant",    my p_formant_maximumFormant)
-		SET_REAL (U"Number of formants", my p_formant_numberOfFormants)
-		SET_REAL (U"Window length",      my p_formant_windowLength)
-		SET_REAL (U"Dynamic range",      my p_formant_dynamicRange)
-		SET_REAL (U"Dot size",           my p_formant_dotSize)
+		SET_REAL (maximumFormant,    my p_formant_maximumFormant)
+		SET_REAL (numberOfFormants,  my p_formant_numberOfFormants)
+		SET_REAL (windowLength,      my p_formant_windowLength)
+		SET_REAL (dynamicRange,      my p_formant_dynamicRange)
+		SET_REAL (dotSize,           my p_formant_dotSize)
 		if (my p_formant_method != my default_formant_method () || my p_formant_preemphasisFrom != Melder_atof (my default_formant_preemphasisFrom ())) {
-			SET_STRING (U"note1", U"Warning: you have non-standard \"advanced settings\".")
+			SET_STRING (note1, U"Warning: you have non-standard \"advanced settings\".")
 		} else {
-			SET_STRING (U"note1", U"(all of your \"advanced settings\" have their standard values)")
+			SET_STRING (note1, U"(all of your \"advanced settings\" have their standard values)")
 		}
 		if (my p_timeStepStrategy != my default_timeStepStrategy ()) {
-			SET_STRING (U"note2", U"Warning: you have a non-standard \"time step strategy\".")
+			SET_STRING (note2, U"Warning: you have a non-standard \"time step strategy\".")
 		} else {
-			SET_STRING (U"note2", U"(your \"time step strategy\" has its standard value: automatic)")
+			SET_STRING (note2, U"(your \"time step strategy\" has its standard value: automatic)")
 		}
 	EDITOR_DO
-		my pref_formant_maximumFormant   () = my p_formant_maximumFormant   = GET_REAL (U"Maximum formant");
-		my pref_formant_numberOfFormants () = my p_formant_numberOfFormants = GET_REAL (U"Number of formants");
-		my pref_formant_windowLength     () = my p_formant_windowLength     = GET_REAL (U"Window length");
-		my pref_formant_dynamicRange     () = my p_formant_dynamicRange     = GET_REAL (U"Dynamic range");
-		my pref_formant_dotSize          () = my p_formant_dotSize          = GET_REAL (U"Dot size");
+		my pref_formant_maximumFormant   () = my p_formant_maximumFormant   = maximumFormant;
+		my pref_formant_numberOfFormants () = my p_formant_numberOfFormants = numberOfFormants;
+		my pref_formant_windowLength     () = my p_formant_windowLength     = windowLength;
+		my pref_formant_dynamicRange     () = my p_formant_dynamicRange     = dynamicRange;
+		my pref_formant_dotSize          () = my p_formant_dotSize          = dotSize;
 		my d_formant. reset();
 		FunctionEditor_redraw (me);
 	EDITOR_END
@@ -1073,14 +1066,14 @@ static void menu_cb_formantSettings (TimeSoundAnalysisEditor me, EDITOR_ARGS_FOR
 
 static void menu_cb_advancedFormantSettings (TimeSoundAnalysisEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Advanced formant settings", U"Advanced formant settings...")
-		RADIO_ENUM (U"Method", kTimeSoundAnalysisEditor_formant_analysisMethod, my default_formant_method ())
-		POSITIVE (U"Pre-emphasis from (Hz)", my default_formant_preemphasisFrom ())
+		RADIO_ENUM (method, U"Method", kTimeSoundAnalysisEditor_formant_analysisMethod, my default_formant_method ())
+		POSITIVE (preemphasisFrom, U"Pre-emphasis from (Hz)", my default_formant_preemphasisFrom ())
 	EDITOR_OK
-		SET_ENUM (U"Method", kTimeSoundAnalysisEditor_formant_analysisMethod, my p_formant_method)
-		SET_REAL (U"Pre-emphasis from", my p_formant_preemphasisFrom)
+		SET_ENUM (method, kTimeSoundAnalysisEditor_formant_analysisMethod, my p_formant_method)
+		SET_REAL (preemphasisFrom, my p_formant_preemphasisFrom)
 	EDITOR_DO
-		my pref_formant_method          () = my p_formant_method          = GET_ENUM (kTimeSoundAnalysisEditor_formant_analysisMethod, U"Method");
-		my pref_formant_preemphasisFrom () = my p_formant_preemphasisFrom = GET_REAL (U"Pre-emphasis from");
+		my pref_formant_method          () = my p_formant_method          = method;
+		my pref_formant_preemphasisFrom () = my p_formant_preemphasisFrom = preemphasisFrom;
 		my d_formant. reset();
 		FunctionEditor_redraw (me);
 	EDITOR_END
@@ -1102,17 +1095,17 @@ static void menu_cb_drawVisibleFormantContour (TimeSoundAnalysisEditor me, EDITO
 		my v_form_pictureWindow (cmd);
 		my v_form_pictureMargins (cmd);
 		my v_form_pictureSelection (cmd);
-		BOOLEAN (U"Garnish", true);
+		BOOLEAN (garnish, U"Garnish", true)
 	EDITOR_OK
 		my v_ok_pictureWindow (cmd);
 		my v_ok_pictureMargins (cmd);
 		my v_ok_pictureSelection (cmd);
-		SET_INTEGER (U"Garnish", my p_formant_picture_garnish);
+		SET_BOOLEAN (garnish, my p_formant_picture_garnish)
 	EDITOR_DO
 		my v_do_pictureWindow (cmd);
 		my v_do_pictureMargins (cmd);
 		my v_do_pictureSelection (cmd);
-		my pref_formant_picture_garnish () = my p_formant_picture_garnish = GET_INTEGER (U"Garnish");
+		my pref_formant_picture_garnish () = my p_formant_picture_garnish = garnish;
 		if (! my p_formant_show)
 			Melder_throw (U"No formant contour is visible.\nFirst choose \"Show formant\" from the Formant menu.");
 		if (! my d_formant) {
@@ -1140,20 +1133,20 @@ static void menu_cb_formantListing (TimeSoundAnalysisEditor me, EDITOR_ARGS_DIRE
 	MelderInfo_open ();
 	MelderInfo_writeLine (U"Time_s   F1_Hz   F2_Hz   F3_Hz   F4_Hz");
 	if (part == TimeSoundAnalysisEditor_PART_CURSOR) {
-		double f1 = Formant_getValueAtTime (my d_formant.get(), 1, tmin, 0);
-		double f2 = Formant_getValueAtTime (my d_formant.get(), 2, tmin, 0);
-		double f3 = Formant_getValueAtTime (my d_formant.get(), 3, tmin, 0);
-		double f4 = Formant_getValueAtTime (my d_formant.get(), 4, tmin, 0);
+		double f1 = Formant_getValueAtTime (my d_formant.get(), 1, tmin, kFormant_unit::HERTZ);
+		double f2 = Formant_getValueAtTime (my d_formant.get(), 2, tmin, kFormant_unit::HERTZ);
+		double f3 = Formant_getValueAtTime (my d_formant.get(), 3, tmin, kFormant_unit::HERTZ);
+		double f4 = Formant_getValueAtTime (my d_formant.get(), 4, tmin, kFormant_unit::HERTZ);
 		MelderInfo_writeLine (Melder_fixed (tmin, 6), U"   ", Melder_fixed (f1, 6), U"   ", Melder_fixed (f2, 6), U"   ", Melder_fixed (f3, 6), U"   ", Melder_fixed (f4, 6));
 	} else {
 		integer i1, i2;
 		Sampled_getWindowSamples (my d_formant.get(), tmin, tmax, & i1, & i2);
 		for (integer i = i1; i <= i2; i ++) {
 			double t = Sampled_indexToX (my d_formant.get(), i);
-			double f1 = Formant_getValueAtTime (my d_formant.get(), 1, t, 0);
-			double f2 = Formant_getValueAtTime (my d_formant.get(), 2, t, 0);
-			double f3 = Formant_getValueAtTime (my d_formant.get(), 3, t, 0);
-			double f4 = Formant_getValueAtTime (my d_formant.get(), 4, t, 0);
+			double f1 = Formant_getValueAtTime (my d_formant.get(), 1, t, kFormant_unit::HERTZ);
+			double f2 = Formant_getValueAtTime (my d_formant.get(), 2, t, kFormant_unit::HERTZ);
+			double f3 = Formant_getValueAtTime (my d_formant.get(), 3, t, kFormant_unit::HERTZ);
+			double f4 = Formant_getValueAtTime (my d_formant.get(), 4, t, kFormant_unit::HERTZ);
 			MelderInfo_writeLine (Melder_fixed (t, 6), U"   ", Melder_fixed (f1, 6), U"   ", Melder_fixed (f2, 6), U"   ", Melder_fixed (f3, 6), U"   ", Melder_fixed (f4, 6));
 		}
 	}
@@ -1170,10 +1163,10 @@ static void do_getFormant (TimeSoundAnalysisEditor me, int iformant) {
 		if (! my d_formant) Melder_throw (theMessage_Cannot_compute_formant);
 	}
 	if (part == TimeSoundAnalysisEditor_PART_CURSOR) {
-		Melder_information (Formant_getValueAtTime (my d_formant.get(), iformant, tmin, 0),
+		Melder_information (Formant_getValueAtTime (my d_formant.get(), iformant, tmin, kFormant_unit::HERTZ),
 			U" Hz (nearest F", iformant, U" to CURSOR)");
 	} else {
-		Melder_information (Formant_getMean (my d_formant.get(), iformant, tmin, tmax, 0),
+		Melder_information (Formant_getMean (my d_formant.get(), iformant, tmin, tmax, kFormant_unit::HERTZ),
 			U" Hz (mean F", iformant, U" ", TimeSoundAnalysisEditor_partString_locative (part), U")");
 	}
 }
@@ -1187,10 +1180,10 @@ static void do_getBandwidth (TimeSoundAnalysisEditor me, int iformant) {
 		if (! my d_formant) Melder_throw (theMessage_Cannot_compute_formant);
 	}
 	if (part == TimeSoundAnalysisEditor_PART_CURSOR) {
-		Melder_information (Formant_getBandwidthAtTime (my d_formant.get(), iformant, tmin, 0),
+		Melder_information (Formant_getBandwidthAtTime (my d_formant.get(), iformant, tmin, kFormant_unit::HERTZ),
 			U" Hz (nearest B", iformant, U" to CURSOR)");
 	} else {
-		Melder_information (Formant_getBandwidthAtTime (my d_formant.get(), iformant, 0.5 * (tmin + tmax), 0),
+		Melder_information (Formant_getBandwidthAtTime (my d_formant.get(), iformant, 0.5 * (tmin + tmax), kFormant_unit::HERTZ),
 			U" Hz (B", iformant, U" in centre of ", TimeSoundAnalysisEditor_partString (part), U")");
 	}
 }
@@ -1213,19 +1206,19 @@ static void menu_cb_getFourthBandwidth (TimeSoundAnalysisEditor me, EDITOR_ARGS_
 
 static void menu_cb_getFormant (TimeSoundAnalysisEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Get formant", nullptr)
-		NATURAL (U"Formant number", U"5")
+		NATURAL (formantNumber, U"Formant number", U"5")
 	EDITOR_OK
 	EDITOR_DO
-		do_getFormant (me, GET_INTEGER (U"Formant number"));
+		do_getFormant (me, formantNumber);
 	EDITOR_END
 }
 
 static void menu_cb_getBandwidth (TimeSoundAnalysisEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Get bandwidth", nullptr)
-		NATURAL (U"Formant number", U"5")
+		NATURAL (formantNumber, U"Formant number", U"5")
 	EDITOR_OK
 	EDITOR_DO
-		do_getBandwidth (me, GET_INTEGER (U"Formant number"));
+		do_getBandwidth (me, formantNumber);
 	EDITOR_END
 }
 
@@ -1239,14 +1232,14 @@ static void menu_cb_showPulses (TimeSoundAnalysisEditor me, EDITOR_ARGS_DIRECT)
 
 static void menu_cb_advancedPulsesSettings (TimeSoundAnalysisEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Advanced pulses settings", U"Advanced pulses settings...")
-		POSITIVE (U"Maximum period factor",    my default_pulses_maximumPeriodFactor    ())
-		POSITIVE (U"Maximum amplitude factor", my default_pulses_maximumAmplitudeFactor ())
+		POSITIVE (maximumPeriodFactor,    U"Maximum period factor",    my default_pulses_maximumPeriodFactor    ())
+		POSITIVE (maximumAmplitudeFactor, U"Maximum amplitude factor", my default_pulses_maximumAmplitudeFactor ())
 	EDITOR_OK
-		SET_REAL (U"Maximum period factor",    my p_pulses_maximumPeriodFactor)
-		SET_REAL (U"Maximum amplitude factor", my p_pulses_maximumAmplitudeFactor)
+		SET_REAL (maximumPeriodFactor,    my p_pulses_maximumPeriodFactor)
+		SET_REAL (maximumAmplitudeFactor, my p_pulses_maximumAmplitudeFactor)
 	EDITOR_DO
-		my pref_pulses_maximumPeriodFactor    () = my p_pulses_maximumPeriodFactor    = GET_REAL (U"Maximum period factor");
-		my pref_pulses_maximumAmplitudeFactor () = my p_pulses_maximumAmplitudeFactor = GET_REAL (U"Maximum amplitude factor");
+		my pref_pulses_maximumPeriodFactor    () = my p_pulses_maximumPeriodFactor    = maximumPeriodFactor;
+		my pref_pulses_maximumAmplitudeFactor () = my p_pulses_maximumAmplitudeFactor = maximumAmplitudeFactor;
 		my d_pulses. reset();
 		FunctionEditor_redraw (me);
 	EDITOR_END
@@ -1268,17 +1261,17 @@ static void menu_cb_drawVisiblePulses (TimeSoundAnalysisEditor me, EDITOR_ARGS_F
 		my v_form_pictureWindow (cmd);
 		my v_form_pictureMargins (cmd);
 		my v_form_pictureSelection (cmd);
-		BOOLEAN (U"Garnish", true);
+		BOOLEAN (garnish, U"Garnish", true)
 	EDITOR_OK
 		my v_ok_pictureWindow (cmd);
 		my v_ok_pictureMargins (cmd);
 		my v_ok_pictureSelection (cmd);
-		SET_INTEGER (U"Garnish", my p_pulses_picture_garnish);
+		SET_BOOLEAN (garnish, my p_pulses_picture_garnish)
 	EDITOR_DO
 		my v_do_pictureWindow (cmd);
 		my v_do_pictureMargins (cmd);
 		my v_do_pictureSelection (cmd);
-		my pref_pulses_picture_garnish () = my p_pulses_picture_garnish = GET_INTEGER (U"Garnish");
+		my pref_pulses_picture_garnish () = my p_pulses_picture_garnish = garnish;
 		if (! my p_pulses_show)
 			Melder_throw (U"No pulses are visible.\nFirst choose \"Show pulses\" from the Pulses menu.");
 		if (! my d_pulses) {
diff --git a/fon/TimeSoundAnalysisEditor_prefs.h b/fon/TimeSoundAnalysisEditor_prefs.h
index 36ca171..a482147 100644
--- a/fon/TimeSoundAnalysisEditor_prefs.h
+++ b/fon/TimeSoundAnalysisEditor_prefs.h
@@ -18,64 +18,64 @@
 
 prefs_begin (TimeSoundAnalysisEditor)
 
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, longestAnalysis,                 1, U"10.0")   // seconds
-	prefs_add_enum_with_data   (TimeSoundAnalysisEditor, timeStepStrategy,                1, kTimeSoundAnalysisEditor_timeStepStrategy, DEFAULT)
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, fixedTimeStep,                   1, U"0.01")   // seconds
-	prefs_add_long_with_data   (TimeSoundAnalysisEditor, numberOfTimeStepsPerView,        1, U"100")
-	prefs_add_bool_with_data   (TimeSoundAnalysisEditor, spectrogram_show,                1, true)
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, spectrogram_viewFrom,            2, U"0.0")   // Hz
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, spectrogram_viewTo,              2, U"5000.0")   // Hz
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, spectrogram_windowLength,        2, U"0.005")   // seconds
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, spectrogram_dynamicRange,        2, U"70.0")   // dB
-	prefs_add_long_with_data   (TimeSoundAnalysisEditor, spectrogram_timeSteps,           2, U"1000")
-	prefs_add_long_with_data   (TimeSoundAnalysisEditor, spectrogram_frequencySteps,      2, U"250")
-	prefs_add_enum_with_data   (TimeSoundAnalysisEditor, spectrogram_method,              2, kSound_to_Spectrogram_method, DEFAULT)
-	prefs_add_enum_with_data   (TimeSoundAnalysisEditor, spectrogram_windowShape,         2, kSound_to_Spectrogram_windowShape, DEFAULT)
-	prefs_add_bool_with_data   (TimeSoundAnalysisEditor, spectrogram_autoscaling,         2, true)
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, spectrogram_maximum,             2, U"100.0")   // dB/Hz
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, spectrogram_preemphasis,         2, U"6.0")   // dB/octave
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, spectrogram_dynamicCompression,  2, U"0.0")   // 0..1
-	prefs_add_bool_with_data   (TimeSoundAnalysisEditor, spectrogram_picture_garnish,     1, true)
-	prefs_add_bool_with_data   (TimeSoundAnalysisEditor, pitch_show,                      1, true)
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, pitch_floor,                     1, U"75.0")
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, pitch_ceiling,                   1, U"500.0")
-	prefs_add_enum_with_data   (TimeSoundAnalysisEditor, pitch_unit,                      1, kPitch_unit, DEFAULT)
-	prefs_add_enum_with_data   (TimeSoundAnalysisEditor, pitch_drawingMethod,             1, kTimeSoundAnalysisEditor_pitch_drawingMethod, DEFAULT)
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, pitch_viewFrom,                  1, U"0.0 (= auto)")
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, pitch_viewTo,                    1, U"0.0 (= auto)")
-	prefs_add_enum_with_data   (TimeSoundAnalysisEditor, pitch_method,                    1, kTimeSoundAnalysisEditor_pitch_analysisMethod, DEFAULT)
-	prefs_add_bool_with_data   (TimeSoundAnalysisEditor, pitch_veryAccurate,              1, false)
-	prefs_add_long_with_data   (TimeSoundAnalysisEditor, pitch_maximumNumberOfCandidates, 1, U"15")
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, pitch_silenceThreshold,          1, U"0.03")
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, pitch_voicingThreshold,          1, U"0.45")
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, pitch_octaveCost,                1, U"0.01")
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, pitch_octaveJumpCost,            1, U"0.35")
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, pitch_voicedUnvoicedCost,        1, U"0.14")
-	prefs_add_bool_with_data   (TimeSoundAnalysisEditor, pitch_picture_speckle,           1, false)
-	prefs_add_bool_with_data   (TimeSoundAnalysisEditor, pitch_picture_garnish,           1, true)
-	prefs_add_bool_with_data   (TimeSoundAnalysisEditor, intensity_show,                  1, false)
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, intensity_viewFrom,              1, U"50.0")   // dB
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, intensity_viewTo,                1, U"100.0")   // dB
-	prefs_add_enum_with_data   (TimeSoundAnalysisEditor, intensity_averagingMethod,       1, kTimeSoundAnalysisEditor_intensity_averagingMethod, DEFAULT)
-	prefs_add_bool_with_data   (TimeSoundAnalysisEditor, intensity_subtractMeanPressure,  1, true)
-	prefs_add_bool_with_data   (TimeSoundAnalysisEditor, intensity_picture_garnish,       1, true)
-	prefs_add_bool_with_data   (TimeSoundAnalysisEditor, formant_show,                    1, false)
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, formant_maximumFormant,          1, U"5500.0")   // Hz
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, formant_numberOfFormants,        1, U"5.0")
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, formant_windowLength,            1, U"0.025")   // seconds
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, formant_dynamicRange,            1, U"30.0")   // dB
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, formant_dotSize,                 1, U"1.0")   // mm
-	prefs_add_enum_with_data   (TimeSoundAnalysisEditor, formant_method,                  1, kTimeSoundAnalysisEditor_formant_analysisMethod, BURG)
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, formant_preemphasisFrom,         1, U"50.0")   // Hz
-	prefs_add_bool_with_data   (TimeSoundAnalysisEditor, formant_picture_garnish,         1, true)
-	prefs_add_bool_with_data   (TimeSoundAnalysisEditor, pulses_show,                     1, false)
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, pulses_maximumPeriodFactor,      1, U"1.3")
-	prefs_add_double_with_data (TimeSoundAnalysisEditor, pulses_maximumAmplitudeFactor,   1, U"1.6")
-	prefs_add_bool_with_data   (TimeSoundAnalysisEditor, pulses_picture_garnish,          1, true)
-	prefs_add_bool_with_data   (TimeSoundAnalysisEditor, log1_toInfoWindow,               1, true)
-	prefs_add_bool_with_data   (TimeSoundAnalysisEditor, log1_toLogFile,                  1, true)
-	prefs_add_bool_with_data   (TimeSoundAnalysisEditor, log2_toInfoWindow,               1, true)
-	prefs_add_bool_with_data   (TimeSoundAnalysisEditor, log2_toLogFile,                  1, true)
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, longestAnalysis,                 1, U"10.0")   // seconds
+	prefs_add_enum_with_data    (TimeSoundAnalysisEditor, timeStepStrategy,                1, kTimeSoundAnalysisEditor_timeStepStrategy, DEFAULT)
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, fixedTimeStep,                   1, U"0.01")   // seconds
+	prefs_add_integer_with_data (TimeSoundAnalysisEditor, numberOfTimeStepsPerView,        1, U"100")
+	prefs_add_bool_with_data    (TimeSoundAnalysisEditor, spectrogram_show,                1, true)
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, spectrogram_viewFrom,            2, U"0.0")   // Hz
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, spectrogram_viewTo,              2, U"5000.0")   // Hz
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, spectrogram_windowLength,        2, U"0.005")   // seconds
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, spectrogram_dynamicRange,        2, U"70.0")   // dB
+	prefs_add_integer_with_data (TimeSoundAnalysisEditor, spectrogram_timeSteps,           2, U"1000")
+	prefs_add_integer_with_data (TimeSoundAnalysisEditor, spectrogram_frequencySteps,      2, U"250")
+	prefs_add_enum_with_data    (TimeSoundAnalysisEditor, spectrogram_method,              2, kSound_to_Spectrogram_method, DEFAULT)
+	prefs_add_enum_with_data    (TimeSoundAnalysisEditor, spectrogram_windowShape,         2, kSound_to_Spectrogram_windowShape, DEFAULT)
+	prefs_add_bool_with_data    (TimeSoundAnalysisEditor, spectrogram_autoscaling,         2, true)
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, spectrogram_maximum,             2, U"100.0")   // dB/Hz
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, spectrogram_preemphasis,         2, U"6.0")   // dB/octave
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, spectrogram_dynamicCompression,  2, U"0.0")   // 0..1
+	prefs_add_bool_with_data    (TimeSoundAnalysisEditor, spectrogram_picture_garnish,     1, true)
+	prefs_add_bool_with_data    (TimeSoundAnalysisEditor, pitch_show,                      1, true)
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, pitch_floor,                     1, U"75.0")
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, pitch_ceiling,                   1, U"500.0")
+	prefs_add_enum_with_data    (TimeSoundAnalysisEditor, pitch_unit,                      1, kPitch_unit, DEFAULT)
+	prefs_add_enum_with_data    (TimeSoundAnalysisEditor, pitch_drawingMethod,             1, kTimeSoundAnalysisEditor_pitch_drawingMethod, DEFAULT)
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, pitch_viewFrom,                  1, U"0.0 (= auto)")
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, pitch_viewTo,                    1, U"0.0 (= auto)")
+	prefs_add_enum_with_data    (TimeSoundAnalysisEditor, pitch_method,                    1, kTimeSoundAnalysisEditor_pitch_analysisMethod, DEFAULT)
+	prefs_add_bool_with_data    (TimeSoundAnalysisEditor, pitch_veryAccurate,              1, false)
+	prefs_add_integer_with_data (TimeSoundAnalysisEditor, pitch_maximumNumberOfCandidates, 1, U"15")
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, pitch_silenceThreshold,          1, U"0.03")
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, pitch_voicingThreshold,          1, U"0.45")
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, pitch_octaveCost,                1, U"0.01")
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, pitch_octaveJumpCost,            1, U"0.35")
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, pitch_voicedUnvoicedCost,        1, U"0.14")
+	prefs_add_bool_with_data    (TimeSoundAnalysisEditor, pitch_picture_speckle,           1, false)
+	prefs_add_bool_with_data    (TimeSoundAnalysisEditor, pitch_picture_garnish,           1, true)
+	prefs_add_bool_with_data    (TimeSoundAnalysisEditor, intensity_show,                  1, false)
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, intensity_viewFrom,              1, U"50.0")   // dB
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, intensity_viewTo,                1, U"100.0")   // dB
+	prefs_add_enum_with_data    (TimeSoundAnalysisEditor, intensity_averagingMethod,       1, kTimeSoundAnalysisEditor_intensity_averagingMethod, DEFAULT)
+	prefs_add_bool_with_data    (TimeSoundAnalysisEditor, intensity_subtractMeanPressure,  1, true)
+	prefs_add_bool_with_data    (TimeSoundAnalysisEditor, intensity_picture_garnish,       1, true)
+	prefs_add_bool_with_data    (TimeSoundAnalysisEditor, formant_show,                    1, false)
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, formant_maximumFormant,          1, U"5500.0")   // Hz
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, formant_numberOfFormants,        1, U"5.0")
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, formant_windowLength,            1, U"0.025")   // seconds
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, formant_dynamicRange,            1, U"30.0")   // dB
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, formant_dotSize,                 1, U"1.0")   // mm
+	prefs_add_enum_with_data    (TimeSoundAnalysisEditor, formant_method,                  1, kTimeSoundAnalysisEditor_formant_analysisMethod, BURG)
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, formant_preemphasisFrom,         1, U"50.0")   // Hz
+	prefs_add_bool_with_data    (TimeSoundAnalysisEditor, formant_picture_garnish,         1, true)
+	prefs_add_bool_with_data    (TimeSoundAnalysisEditor, pulses_show,                     1, false)
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, pulses_maximumPeriodFactor,      1, U"1.3")
+	prefs_add_double_with_data  (TimeSoundAnalysisEditor, pulses_maximumAmplitudeFactor,   1, U"1.6")
+	prefs_add_bool_with_data    (TimeSoundAnalysisEditor, pulses_picture_garnish,          1, true)
+	prefs_add_bool_with_data    (TimeSoundAnalysisEditor, log1_toInfoWindow,               1, true)
+	prefs_add_bool_with_data    (TimeSoundAnalysisEditor, log1_toLogFile,                  1, true)
+	prefs_add_bool_with_data    (TimeSoundAnalysisEditor, log2_toInfoWindow,               1, true)
+	prefs_add_bool_with_data    (TimeSoundAnalysisEditor, log2_toLogFile,                  1, true)
 	#if defined (macintosh)
 		prefs_add_string_with_data (TimeSoundAnalysisEditor, log1_fileName,               1, U"~/Desktop/Pitch Log")
 		prefs_add_string_with_data (TimeSoundAnalysisEditor, log2_fileName,               1, U"~/Desktop/Formant Log")
@@ -92,8 +92,8 @@ prefs_begin (TimeSoundAnalysisEditor)
 		prefs_add_string_with_data (TimeSoundAnalysisEditor, logScript3,                  1, U"~/log_script3")
 		prefs_add_string_with_data (TimeSoundAnalysisEditor, logScript4,                  1, U"~/log_script4")
 	#endif
-	prefs_add_string_with_data (TimeSoundAnalysisEditor, log1_format,                     1, U"Time 'time:6' seconds, pitch 'f0:2' Hz")
-	prefs_add_string_with_data (TimeSoundAnalysisEditor, log2_format,                     1, U"'t1:4''tab$''t2:4''tab$''f1:0''tab$''f2:0''tab$''f3:0'")
+	prefs_add_string_with_data  (TimeSoundAnalysisEditor, log1_format,                     1, U"Time 'time:6' seconds, pitch 'f0:2' Hz")
+	prefs_add_string_with_data  (TimeSoundAnalysisEditor, log2_format,                     1, U"'t1:4''tab$''t2:4''tab$''f1:0''tab$''f2:0''tab$''f3:0'")
 
 prefs_end (TimeSoundAnalysisEditor)
 
diff --git a/fon/TimeSoundEditor.cpp b/fon/TimeSoundEditor.cpp
index 0a01289..bc1d0d8 100644
--- a/fon/TimeSoundEditor.cpp
+++ b/fon/TimeSoundEditor.cpp
@@ -55,29 +55,29 @@ void structTimeSoundEditor :: v_info () {
 static void menu_cb_DrawVisibleSound (TimeSoundEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Draw visible sound", nullptr)
 		my v_form_pictureWindow (cmd);
-		LABEL (U"", U"Sound:")
-		BOOLEAN (U"Preserve times", my default_picture_preserveTimes ());
-		REAL (U"left Vertical range", my default_picture_bottom ())
-		REAL (U"right Vertical range", my default_picture_top ())
+		LABEL (U"Sound:")
+		BOOLEAN (preserveTimes, U"Preserve times", my default_picture_preserveTimes ());
+		REAL (bottom, U"left Vertical range", my default_picture_bottom ())
+		REAL (top, U"right Vertical range", my default_picture_top ())
 		my v_form_pictureMargins (cmd);
 		my v_form_pictureSelection (cmd);
-		BOOLEAN (U"Garnish", my default_picture_garnish ());
+		BOOLEAN (garnish, U"Garnish", my default_picture_garnish ());
 	EDITOR_OK
 		my v_ok_pictureWindow (cmd);
-		SET_INTEGER (U"Preserve times", my pref_picture_preserveTimes ());
-		SET_REAL (U"left Vertical range", my pref_picture_bottom ());
-		SET_REAL (U"right Vertical range", my pref_picture_top ());
+		SET_BOOLEAN (preserveTimes, my pref_picture_preserveTimes ())
+		SET_REAL (bottom,  my pref_picture_bottom ())
+		SET_REAL (top,     my pref_picture_top ())
 		my v_ok_pictureMargins (cmd);
 		my v_ok_pictureSelection (cmd);
-		SET_INTEGER (U"Garnish", my pref_picture_garnish ());
+		SET_BOOLEAN (garnish, my pref_picture_garnish ())
 	EDITOR_DO
 		my v_do_pictureWindow (cmd);
-		my pref_picture_preserveTimes () = GET_INTEGER (U"Preserve times");
-		my pref_picture_bottom () = GET_REAL (U"left Vertical range");
-		my pref_picture_top () = GET_REAL (U"right Vertical range");
+		my pref_picture_preserveTimes () = preserveTimes;
+		my pref_picture_bottom () = bottom;
+		my pref_picture_top () = top;
 		my v_do_pictureMargins (cmd);
 		my v_do_pictureSelection (cmd);
-		my pref_picture_garnish () = GET_INTEGER (U"Garnish");
+		my pref_picture_garnish () = garnish;
 		if (! my d_longSound.data && ! my d_sound.data)
 			Melder_throw (U"There is no sound to draw.");
 		autoSound publish = my d_longSound.data ?
@@ -94,26 +94,26 @@ static void menu_cb_DrawVisibleSound (TimeSoundEditor me, EDITOR_ARGS_FORM) {
 static void menu_cb_DrawSelectedSound (TimeSoundEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Draw selected sound", nullptr)
 		my v_form_pictureWindow (cmd);
-		LABEL (U"", U"Sound:")
-		BOOLEAN (U"Preserve times", my default_picture_preserveTimes ());
-		REAL (U"left Vertical range", my default_picture_bottom ());
-		REAL (U"right Vertical range", my default_picture_top ());
+		LABEL (U"Sound:")
+		BOOLEAN (preserveTimes, U"Preserve times",       my default_picture_preserveTimes ());
+		REAL    (bottom,        U"left Vertical range",  my default_picture_bottom ());
+		REAL    (top,           U"right Vertical range", my default_picture_top ());
 		my v_form_pictureMargins (cmd);
-		BOOLEAN (U"Garnish", my default_picture_garnish ());
+		BOOLEAN (garnish, U"Garnish", my default_picture_garnish ());
 	EDITOR_OK
 		my v_ok_pictureWindow (cmd);
-		SET_INTEGER (U"Preserve times", my pref_picture_preserveTimes ());
-		SET_REAL (U"left Vertical range", my pref_picture_bottom ());
-		SET_REAL (U"right Vertical range", my pref_picture_top ());
+		SET_BOOLEAN (preserveTimes, my pref_picture_preserveTimes ());
+		SET_REAL (bottom, my pref_picture_bottom ());
+		SET_REAL (top,    my pref_picture_top ());
 		my v_ok_pictureMargins (cmd);
-		SET_INTEGER (U"Garnish", my pref_picture_garnish ());
+		SET_BOOLEAN (garnish, my pref_picture_garnish ());
 	EDITOR_DO
 		my v_do_pictureWindow (cmd);
-		my pref_picture_preserveTimes () = GET_INTEGER (U"Preserve times");
-		my pref_picture_bottom () = GET_REAL (U"left Vertical range");
-		my pref_picture_top () = GET_REAL (U"right Vertical range");
+		my pref_picture_preserveTimes () = preserveTimes;
+		my pref_picture_bottom () = bottom;
+		my pref_picture_top () = top;
 		my v_do_pictureMargins (cmd);
-		my pref_picture_garnish () = GET_INTEGER (U"Garnish");
+		my pref_picture_garnish () = garnish;
 		if (! my d_longSound.data && ! my d_sound.data)
 			Melder_throw (U"There is no sound to draw.");
 		autoSound publish = my d_longSound.data ?
@@ -148,40 +148,40 @@ static void menu_cb_ExtractSelectedSound_preserveTimes (TimeSoundEditor me, EDIT
 
 static void menu_cb_ExtractSelectedSound_windowed (TimeSoundEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Extract selected sound (windowed)", nullptr)
-		WORD (U"Name", U"slice")
-		OPTIONMENU_ENUM (U"Window shape", kSound_windowShape, my default_extract_windowShape ())
-		POSITIVE (U"Relative width", my default_extract_relativeWidth ())
-		BOOLEAN (U"Preserve times", my default_extract_preserveTimes ())
+		WORD (name, U"Name", U"slice")
+		OPTIONMENU_ENUM (windowShape, U"Window shape", kSound_windowShape, my default_extract_windowShape ())
+		POSITIVE (relativeWidth, U"Relative width", my default_extract_relativeWidth ())
+		BOOLEAN (preserveTimes, U"Preserve times", my default_extract_preserveTimes ())
 	EDITOR_OK
-		SET_ENUM (U"Window shape", kSound_windowShape, my pref_extract_windowShape ())
-		SET_REAL (U"Relative width", my pref_extract_relativeWidth ())
-		SET_INTEGER (U"Preserve times", my pref_extract_preserveTimes ())
+		SET_ENUM (windowShape, kSound_windowShape, my pref_extract_windowShape ())
+		SET_REAL (relativeWidth, my pref_extract_relativeWidth ())
+		SET_BOOLEAN (preserveTimes, my pref_extract_preserveTimes ())
 	EDITOR_DO
 		Sound sound = my d_sound.data;
 		Melder_assert (sound);
-		my pref_extract_windowShape () = GET_ENUM (kSound_windowShape, U"Window shape");
-		my pref_extract_relativeWidth () = GET_REAL (U"Relative width");
-		my pref_extract_preserveTimes () = GET_INTEGER (U"Preserve times");
+		my pref_extract_windowShape () = windowShape;
+		my pref_extract_relativeWidth () = relativeWidth;
+		my pref_extract_preserveTimes () = preserveTimes;
 		autoSound extract = Sound_extractPart (sound, my startSelection, my endSelection, my pref_extract_windowShape (),
 			my pref_extract_relativeWidth (), my pref_extract_preserveTimes ());
-		Thing_setName (extract.get(), GET_STRING (U"Name"));
+		Thing_setName (extract.get(), name);
 		Editor_broadcastPublication (me, extract.move());
 	EDITOR_END
 }
 
 static void menu_cb_ExtractSelectedSoundForOverlap (TimeSoundEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Extract selected sound for overlap)", nullptr)
-		WORD (U"Name", U"slice")
-		POSITIVE (U"Overlap (s)", my default_extract_overlap ())
+		WORD (name, U"Name", U"slice")
+		POSITIVE (overlap, U"Overlap (s)", my default_extract_overlap ())
 	EDITOR_OK
-		SET_REAL (U"Overlap", my pref_extract_overlap ())
+		SET_REAL (overlap, my pref_extract_overlap ())
 	EDITOR_DO
 		Sound sound = my d_sound.data;
 		Melder_assert (sound);
-		my pref_extract_overlap () = GET_REAL (U"Overlap");
+		my pref_extract_overlap () = overlap;
 		autoSound extract = Sound_extractPartForOverlap (sound, my startSelection, my endSelection,
 			my pref_extract_overlap ());
-		Thing_setName (extract.get(), GET_STRING (U"Name"));
+		Thing_setName (extract.get(), name);
 		Editor_broadcastPublication (me, extract.move());
 	EDITOR_END
 }
@@ -373,40 +373,39 @@ void structTimeSoundEditor :: v_createMenuItems_query_info (EditorMenu menu) {
 
 static void menu_cb_soundScaling (TimeSoundEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Sound scaling", nullptr)
-		OPTIONMENU_ENUM (U"Scaling strategy", kTimeSoundEditor_scalingStrategy, my default_sound_scalingStrategy ())
-		LABEL (U"", U"For \"fixed height\":");
-		POSITIVE (U"Height", my default_sound_scaling_height ())
-		LABEL (U"", U"For \"fixed range\":");
-		REAL (U"Minimum", my default_sound_scaling_minimum ())
-		REAL (U"Maximum", my default_sound_scaling_maximum ())
+		OPTIONMENU_ENUM (scalingStrategy, U"Scaling strategy", kTimeSoundEditor_scalingStrategy, my default_sound_scalingStrategy ())
+		LABEL (U"For \"fixed height\":")
+		POSITIVE (height, U"Height", my default_sound_scaling_height ())
+		LABEL (U"For \"fixed range\":")
+		REAL (minimum, U"Minimum", my default_sound_scaling_minimum ())
+		REAL (maximum, U"Maximum", my default_sound_scaling_maximum ())
 	EDITOR_OK
-		SET_ENUM (U"Scaling strategy", kTimeSoundEditor_scalingStrategy, my p_sound_scalingStrategy)
-		SET_REAL (U"Height", my p_sound_scaling_height)
-		SET_REAL (U"Minimum", my p_sound_scaling_minimum)
-		SET_REAL (U"Maximum", my p_sound_scaling_maximum)
+		SET_ENUM (scalingStrategy, kTimeSoundEditor_scalingStrategy, my p_sound_scalingStrategy)
+		SET_REAL (height,  my p_sound_scaling_height)
+		SET_REAL (minimum, my p_sound_scaling_minimum)
+		SET_REAL (maximum, my p_sound_scaling_maximum)
 	EDITOR_DO
-		my pref_sound_scalingStrategy () = my p_sound_scalingStrategy = GET_ENUM (kTimeSoundEditor_scalingStrategy, U"Scaling strategy");
-		my pref_sound_scaling_height  () = my p_sound_scaling_height  = GET_REAL (U"Height");
-		my pref_sound_scaling_minimum () = my p_sound_scaling_minimum = GET_REAL (U"Minimum");
-		my pref_sound_scaling_maximum () = my p_sound_scaling_maximum = GET_REAL (U"Maximum");
+		my pref_sound_scalingStrategy () = my p_sound_scalingStrategy = scalingStrategy;
+		my pref_sound_scaling_height  () = my p_sound_scaling_height  = height;
+		my pref_sound_scaling_minimum () = my p_sound_scaling_minimum = minimum;
+		my pref_sound_scaling_maximum () = my p_sound_scaling_maximum = maximum;
 		FunctionEditor_redraw (me);
 	EDITOR_END
 }
 
 static void menu_cb_soundMuteChannels (TimeSoundEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Mute channels", nullptr)
-		TEXTFIELD (U"Channels", U"2")
+		TEXTFIELD (channels_string, U"Channels", U"2")
 	EDITOR_OK
 	EDITOR_DO
-		long numberOfChannels = my d_longSound.data ? my d_longSound.data -> numberOfChannels : my d_sound.data -> ny;
-		char32 *channels_string = GET_STRING (U"Channels");
-		long numberOfElements;
-		autoNUMvector<long> channelNumber (NUMstring_getElementsOfRanges (channels_string, 5 * numberOfChannels, & numberOfElements, nullptr, U"channel", false), 1);
+		integer numberOfChannels = my d_longSound.data ? my d_longSound.data -> numberOfChannels : my d_sound.data -> ny;
+		integer numberOfElements;
+		autoNUMvector<integer> channelNumber (NUMstring_getElementsOfRanges (channels_string, 5 * numberOfChannels, & numberOfElements, nullptr, U"channel", false), 1);
 		bool *muteChannels = my d_sound.muteChannels;
-		for (long i = 1; i <= numberOfChannels; i ++) {
+		for (integer i = 1; i <= numberOfChannels; i ++) {
 			muteChannels [i] = false;
 		}
-		for (long i = 1; i <= numberOfElements; i++) {
+		for (integer i = 1; i <= numberOfElements; i++) {
 			if (channelNumber [i] > 0 && channelNumber [i] <= numberOfChannels) {
 				muteChannels [channelNumber [i]] = true;
 			}
diff --git a/fon/TimeSoundEditor.h b/fon/TimeSoundEditor.h
index db04218..bb58bf0 100644
--- a/fon/TimeSoundEditor.h
+++ b/fon/TimeSoundEditor.h
@@ -2,7 +2,7 @@
 #define _TimeSoundEditor_h_
 /* TimeSoundEditor.h
  *
- * Copyright (C) 1992-2012,2013,2014,2015 Paul Boersma
+ * Copyright (C) 1992-2012,2013,2014,2015,2017 Paul Boersma
  *
  * This code 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 @@
 struct TimeSoundEditor_sound {
 	Sound data;
 	double minimum, maximum;
-	long channelOffset;
+	integer channelOffset;
 	bool *muteChannels;
 };
 
@@ -61,7 +61,7 @@ Thing_define (TimeSoundEditor, FunctionEditor) {
 
 	virtual void v_createMenuItems_view_sound (EditorMenu menu);
 	virtual void v_updateMenuItems_file ();
-	virtual const char32 * v_getChannelName (long /* channelNumber */) { return nullptr; }
+	virtual const char32 * v_getChannelName (integer /* channelNumber */) { return nullptr; }
 
 	#include "TimeSoundEditor_prefs.h"
 };
diff --git a/fon/Transition_def.h b/fon/Transition_def.h
index 857bca9..fd4f2a5 100644
--- a/fon/Transition_def.h
+++ b/fon/Transition_def.h
@@ -1,6 +1,6 @@
 /* Transition_def.h
  *
- * Copyright (C) 1997-2011,2015 Paul Boersma
+ * Copyright (C) 1997-2011,2015,2017 Paul Boersma
  *
  * This code 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 @@
 #define ooSTRUCT Transition
 oo_DEFINE_CLASS (Transition, Daata)
 
-	oo_LONG (numberOfStates)
+	oo_INTEGER (numberOfStates)
 	oo_STRING_VECTOR (stateLabels, numberOfStates)
 	oo_DOUBLE_MATRIX (data, numberOfStates, numberOfStates)
 
diff --git a/fon/Vector.cpp b/fon/Vector.cpp
index da30fbd..95e5b20 100644
--- a/fon/Vector.cpp
+++ b/fon/Vector.cpp
@@ -21,13 +21,13 @@
 //
 // Vector::getVector () returns a channel or the average of all the channels.
 //
-double structVector :: v_getVector (long irow, long icol) {
+double structVector :: v_getVector (integer irow, integer icol) {
 	if (icol < 1 || icol > nx) return 0.0;
 	if (ny == 1) return z [1] [icol];   // optimization
 	if (irow == 0) {
 		if (ny == 2) return 0.5 * (z [1] [icol] + z [2] [icol]);   // optimization
 		real80 sum = 0.0;
-		for (long channel = 1; channel <= ny; channel ++) {
+		for (integer channel = 1; channel <= ny; channel ++) {
 			sum += z [channel] [icol];
 		}
 		return real (sum / ny);
@@ -39,7 +39,7 @@ double structVector :: v_getVector (long irow, long icol) {
 //
 // Vector::getFunction1 () returns a channel or the average of all the channels.
 //
-double structVector :: v_getFunction1 (long irow, double x) {
+double structVector :: v_getFunction1 (integer irow, double x) {
 	double rcol = (x - x1) / dx + 1.0;
 	integer icol = (integer) floor (rcol);
 	double dcol = rcol - icol;
@@ -72,7 +72,7 @@ double structVector :: v_getFunction1 (long irow, double x) {
 			z2 = 0.5 * (z [1] [icol + 1] + z [2] [icol + 1]);   // optimization
 		} else {
 			real80 sum = 0.0;
-			for (long channel = 1; channel <= ny; channel ++) {
+			for (integer channel = 1; channel <= ny; channel ++) {
 				sum += z [channel] [icol + 1];
 			}
 			z2 = real (sum / ny);
@@ -84,7 +84,7 @@ double structVector :: v_getFunction1 (long irow, double x) {
 	return (1.0 - dcol) * z1 + dcol * z2;
 }
 
-double structVector :: v_getValueAtSample (long isamp, long ilevel, int unit) {
+double structVector :: v_getValueAtSample (integer isamp, integer ilevel, int unit) {
 // Preconditions:
 //    1 <= isamp <= my nx
 //    0 <= ilevel <= my ny
@@ -97,7 +97,7 @@ double structVector :: v_getValueAtSample (long isamp, long ilevel, int unit) {
 		value = 0.5 * (z [1] [isamp] + z [2] [isamp]);   // optimization
 	} else {
 		real80 sum = 0.0;
-		for (long channel = 1; channel <= ny; channel ++) {
+		for (integer channel = 1; channel <= ny; channel ++) {
 			sum += z [channel] [isamp];
 		}
 		value = real (sum / ny);
@@ -112,7 +112,7 @@ Thing_implement (Vector, Matrix, 2);
 //
 // Vector_getValueAtX () returns the average of all the interpolated channels.
 //
-double Vector_getValueAtX (Vector me, double x, long ilevel, int interpolation) {
+double Vector_getValueAtX (Vector me, double x, integer ilevel, int interpolation) {
 	double leftEdge = my x1 - 0.5 * my dx, rightEdge = leftEdge + my nx * my dx;
 	if (x <  leftEdge || x > rightEdge) return undefined;
 	if (ilevel > Vector_CHANNEL_AVERAGE) {
@@ -123,7 +123,7 @@ double Vector_getValueAtX (Vector me, double x, long ilevel, int interpolation)
 			interpolation);
 	}
 	double sum = 0.0;
-	for (long channel = 1; channel <= my ny; channel ++) {
+	for (integer channel = 1; channel <= my ny; channel ++) {
 		sum += NUM_interpolate_sinc (my z [channel], my nx, Sampled_xToIndex (me, x),
 			interpolation == Vector_VALUE_INTERPOLATION_SINC70 ? NUM_VALUE_INTERPOLATE_SINC70 :
 			interpolation == Vector_VALUE_INTERPOLATION_SINC700 ? NUM_VALUE_INTERPOLATE_SINC700 :
@@ -134,7 +134,7 @@ double Vector_getValueAtX (Vector me, double x, long ilevel, int interpolation)
 
 /***** Get shape. *****/
 
-void Vector_getMinimumAndX (Vector me, double xmin, double xmax, long channel, int interpolation,
+void Vector_getMinimumAndX (Vector me, double xmin, double xmax, integer channel, int interpolation,
 	double *return_minimum, double *return_xOfMinimum)
 {
 	integer imin, imax, n = my nx;
@@ -144,9 +144,9 @@ void Vector_getMinimumAndX (Vector me, double xmin, double xmax, long channel, i
 	if (xmax <= xmin) { xmin = my xmin; xmax = my xmax; }
 	if (! Sampled_getWindowSamples (me, xmin, xmax, & imin, & imax)) {
 		/*
-		 * No samples between xmin and xmax.
-		 * Try to return the lesser of the values at these two points.
-		 */
+			No samples between xmin and xmax.
+			Try to return the lesser of the values at these two points.
+		*/
 		double yleft = Vector_getValueAtX (me, xmin, channel,
 			interpolation > Vector_VALUE_INTERPOLATION_NEAREST ? Vector_VALUE_INTERPOLATION_LINEAR : Vector_VALUE_INTERPOLATION_NEAREST);
 		double yright = Vector_getValueAtX (me, xmax, channel,
@@ -164,7 +164,7 @@ void Vector_getMinimumAndX (Vector me, double xmin, double xmax, long channel, i
 				if (localMinimum < minimum) minimum = localMinimum, x = i_real;
 			}
 		}
-		x = my x1 + (x - 1) * my dx;   /* Convert sample to x. */
+		x = my x1 + (x - 1) * my dx;   // convert sample to x
 		if (x < xmin) x = xmin; else if (x > xmax) x = xmax;
 	}
 	if (return_minimum) *return_minimum = minimum;
@@ -172,12 +172,12 @@ void Vector_getMinimumAndX (Vector me, double xmin, double xmax, long channel, i
 }
 
 void Vector_getMinimumAndXAndChannel (Vector me, double xmin, double xmax, int interpolation,
-	double *return_minimum, double *return_xOfMinimum, long *return_channelOfMinimum)
+	double *return_minimum, double *return_xOfMinimum, integer *return_channelOfMinimum)
 {
 	double minimum, xOfMinimum;
-	long channelOfMinimum = 1;
+	integer channelOfMinimum = 1;
 	Vector_getMinimumAndX (me, xmin, xmax, 1, interpolation, & minimum, & xOfMinimum);
-	for (long channel = 2; channel <= my ny; channel ++) {
+	for (integer channel = 2; channel <= my ny; channel ++) {
 		double minimumOfChannel, xOfMinimumOfChannel;
 		Vector_getMinimumAndX (me, xmin, xmax, channel, interpolation, & minimumOfChannel, & xOfMinimumOfChannel);
 		if (minimumOfChannel < minimum) {
@@ -203,13 +203,13 @@ double Vector_getXOfMinimum (Vector me, double xmin, double xmax, int interpolat
 	return xOfMinimum;
 }
 
-long Vector_getChannelOfMinimum (Vector me, double xmin, double xmax, int interpolation) {
-	long channelOfMinimum;
+integer Vector_getChannelOfMinimum (Vector me, double xmin, double xmax, int interpolation) {
+	integer channelOfMinimum;
 	Vector_getMinimumAndXAndChannel (me, xmin, xmax, interpolation, nullptr, nullptr, & channelOfMinimum);
 	return channelOfMinimum;
 }
 
-void Vector_getMaximumAndX (Vector me, double xmin, double xmax, long channel, int interpolation,
+void Vector_getMaximumAndX (Vector me, double xmin, double xmax, integer channel, int interpolation,
 	double *return_maximum, double *return_xOfMaximum)
 {
 	integer imin, imax, i, n = my nx;
@@ -219,9 +219,9 @@ void Vector_getMaximumAndX (Vector me, double xmin, double xmax, long channel, i
 	if (xmax <= xmin) { xmin = my xmin; xmax = my xmax; }
 	if (! Sampled_getWindowSamples (me, xmin, xmax, & imin, & imax)) {
 		/*
-		 * No samples between xmin and xmax.
-		 * Try to return the greater of the values at these two points.
-		 */
+			No samples between xmin and xmax.
+			Try to return the greater of the values at these two points.
+		*/
 		double yleft = Vector_getValueAtX (me, xmin, channel,
 			interpolation > Vector_VALUE_INTERPOLATION_NEAREST ? Vector_VALUE_INTERPOLATION_LINEAR : Vector_VALUE_INTERPOLATION_NEAREST);
 		double yright = Vector_getValueAtX (me, xmax, channel,
@@ -239,7 +239,7 @@ void Vector_getMaximumAndX (Vector me, double xmin, double xmax, long channel, i
 				if (localMaximum > maximum) maximum = localMaximum, x = i_real;
 			}
 		}
-		x = my x1 + (x - 1) * my dx;   /* Convert sample to x. */
+		x = my x1 + (x - 1) * my dx;   // convert sample to x
 		if (x < xmin) x = xmin; else if (x > xmax) x = xmax;
 	}
 	if (return_maximum) *return_maximum = maximum;
@@ -247,12 +247,12 @@ void Vector_getMaximumAndX (Vector me, double xmin, double xmax, long channel, i
 }
 
 void Vector_getMaximumAndXAndChannel (Vector me, double xmin, double xmax, int interpolation,
-	double *return_maximum, double *return_xOfMaximum, long *return_channelOfMaximum)
+	double *return_maximum, double *return_xOfMaximum, integer *return_channelOfMaximum)
 {
 	double maximum, xOfMaximum;
-	long channelOfMaximum = 1;
+	integer channelOfMaximum = 1;
 	Vector_getMaximumAndX (me, xmin, xmax, 1, interpolation, & maximum, & xOfMaximum);
-	for (long channel = 2; channel <= my ny; channel ++) {
+	for (integer channel = 2; channel <= my ny; channel ++) {
 		double maximumOfChannel, xOfMaximumOfChannel;
 		Vector_getMaximumAndX (me, xmin, xmax, channel, interpolation, & maximumOfChannel, & xOfMaximumOfChannel);
 		if (maximumOfChannel > maximum) {
@@ -278,8 +278,8 @@ double Vector_getXOfMaximum (Vector me, double xmin, double xmax, int interpolat
 	return xOfMaximum;
 }
 
-long Vector_getChannelOfMaximum (Vector me, double xmin, double xmax, int interpolation) {
-	long channelOfMaximum;
+integer Vector_getChannelOfMaximum (Vector me, double xmin, double xmax, int interpolation) {
+	integer channelOfMaximum;
 	Vector_getMaximumAndXAndChannel (me, xmin, xmax, interpolation, nullptr, nullptr, & channelOfMaximum);
 	return channelOfMaximum;
 }
@@ -292,11 +292,11 @@ double Vector_getAbsoluteExtremum (Vector me, double xmin, double xmax, int inte
 
 /***** Get statistics. *****/
 
-double Vector_getMean (Vector me, double xmin, double xmax, long channel) {
+double Vector_getMean (Vector me, double xmin, double xmax, integer channel) {
 	return Sampled_getMean (me, xmin, xmax, channel, 0, true);
 }
 
-double Vector_getStandardDeviation (Vector me, double xmin, double xmax, long ilevel) {
+double Vector_getStandardDeviation (Vector me, double xmin, double xmax, integer ilevel) {
 	if (xmax <= xmin) { xmin = my xmin; xmax = my xmax; }
 	integer imin, imax, n = Sampled_getWindowSamples (me, xmin, xmax, & imin, & imax);
 	if (n < 2) return undefined;
@@ -315,7 +315,7 @@ double Vector_getStandardDeviation (Vector me, double xmin, double xmax, long il
 	}
 	double mean = Vector_getMean (me, xmin, xmax, ilevel);
 	double sum2 = 0.0;
-	for (long i = imin; i <= imax; i ++) {
+	for (integer i = imin; i <= imax; i ++) {
 		double diff = my z [ilevel] [i] - mean;
 		sum2 += diff * diff;
 	}
@@ -325,29 +325,29 @@ double Vector_getStandardDeviation (Vector me, double xmin, double xmax, long il
 /***** Modify. *****/
 
 void Vector_addScalar (Vector me, double scalar) {
-	for (long channel = 1; channel <= my ny; channel ++) {
-		for (long i = 1; i <= my nx; i ++) {
+	for (integer channel = 1; channel <= my ny; channel ++) {
+		for (integer i = 1; i <= my nx; i ++) {
 			my z [channel] [i] += scalar;
 		}
 	}
 }
 
 void Vector_subtractMean (Vector me) {
-	for (long channel = 1; channel <= my ny; channel ++) {
+	for (integer channel = 1; channel <= my ny; channel ++) {
 		double sum = 0.0;
-		for (long i = 1; i <= my nx; i ++) {
+		for (integer i = 1; i <= my nx; i ++) {
 			sum += my z [channel] [i];
 		}
 		double mean = sum / my nx;
-		for (long i = 1; i <= my nx; i ++) {
+		for (integer i = 1; i <= my nx; i ++) {
 			my z [channel] [i] -= mean;
 		}
 	}
 }
 
 void Vector_multiplyByScalar (Vector me, double scalar) {
-	for (long channel = 1; channel <= my ny; channel ++) {
-		for (long i = 1; i <= my nx; i ++) {
+	for (integer channel = 1; channel <= my ny; channel ++) {
+		for (integer i = 1; i <= my nx; i ++) {
 			my z [channel] [i] *= scalar;
 		}
 	}
@@ -355,8 +355,8 @@ void Vector_multiplyByScalar (Vector me, double scalar) {
 
 void Vector_scale (Vector me, double scale) {
 	double extremum = 0.0;
-	for (long channel = 1; channel <= my ny; channel ++) {
-		for (long i = 1; i <= my nx; i ++) {
+	for (integer channel = 1; channel <= my ny; channel ++) {
+		for (integer i = 1; i <= my nx; i ++) {
 			if (fabs (my z [channel] [i]) > extremum) extremum = fabs (my z [channel] [i]);
 		}
 	}
diff --git a/fon/Vector.h b/fon/Vector.h
index 3e906ea..c4d4489 100644
--- a/fon/Vector.h
+++ b/fon/Vector.h
@@ -2,7 +2,7 @@
 #define _Vector_h_
 /* Vector.h
  *
- * Copyright (C) 1992-2011,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -26,17 +26,17 @@
 Thing_define (Vector, Matrix) {
 	bool v_hasGetVector ()
 		override { return true; }
-	double v_getVector (long irow, long icol)
+	double v_getVector (integer irow, integer icol)
 		override;
 	bool v_hasGetFunction1 ()
 		override { return true; }
-	double v_getFunction1 (long irow, double x)
+	double v_getFunction1 (integer irow, double x)
 		override;
 	bool v_hasGetMatrix ()
 		override { return false; }
 	bool v_hasGetFunction2 ()
 		override { return false; }
-	double v_getValueAtSample (long isamp, long ilevel, int unit)
+	double v_getValueAtSample (integer isamp, integer ilevel, int unit)
 		override;
 };
 
@@ -48,26 +48,26 @@ Thing_define (Vector, Matrix) {
 #define Vector_VALUE_INTERPOLATION_CUBIC  2
 #define Vector_VALUE_INTERPOLATION_SINC70  3
 #define Vector_VALUE_INTERPOLATION_SINC700  4
-double Vector_getValueAtX (Vector me, double x, long channel, int interpolation);
+double Vector_getValueAtX (Vector me, double x, integer channel, int interpolation);
 
-void Vector_getMinimumAndX (Vector me, double xmin, double xmax, long channel, int interpolation,
+void Vector_getMinimumAndX (Vector me, double xmin, double xmax, integer channel, int interpolation,
 	double *return_minimum, double *return_xOfMinimum);
 void Vector_getMinimumAndXAndChannel (Vector me, double xmin, double xmax, int interpolation,
-	double *return_minimum, double *return_xOfMinimum, long *return_channelOfMinimum);
-void Vector_getMaximumAndX (Vector me, double xmin, double xmax, long channel, int interpolation,
+	double *return_minimum, double *return_xOfMinimum, integer *return_channelOfMinimum);
+void Vector_getMaximumAndX (Vector me, double xmin, double xmax, integer channel, int interpolation,
 	double *return_maximum, double *return_xOfMaximum);
 void Vector_getMaximumAndXAndChannel (Vector me, double xmin, double xmax, int interpolation,
-	double *return_maximum, double *return_xOfMaximum, long *return_channelOfMaximum);
+	double *return_maximum, double *return_xOfMaximum, integer *return_channelOfMaximum);
 double Vector_getMinimum (Vector me, double xmin, double xmax, int interpolation);
 double Vector_getMaximum (Vector me, double xmin, double xmax, int interpolation);
 double Vector_getAbsoluteExtremum (Vector me, double xmin, double xmax, int interpolation);
 double Vector_getXOfMinimum (Vector me, double xmin, double xmax, int interpolation);
 double Vector_getXOfMaximum (Vector me, double xmin, double xmax, int interpolation);
-long Vector_getChannelOfMinimum (Vector me, double xmin, double xmax, int interpolation);
-long Vector_getChannelOfMaximum (Vector me, double xmin, double xmax, int interpolation);
+integer Vector_getChannelOfMinimum (Vector me, double xmin, double xmax, int interpolation);
+integer Vector_getChannelOfMaximum (Vector me, double xmin, double xmax, int interpolation);
 
-double Vector_getMean (Vector me, double xmin, double xmax, long channel);
-double Vector_getStandardDeviation (Vector me, double xmin, double xmax, long channel);
+double Vector_getMean (Vector me, double xmin, double xmax, integer channel);
+double Vector_getStandardDeviation (Vector me, double xmin, double xmax, integer channel);
 
 void Vector_addScalar (Vector me, double scalar);
 void Vector_subtractMean (Vector me);
diff --git a/fon/WordList_def.h b/fon/WordList_def.h
index 23bcadb..473f763 100644
--- a/fon/WordList_def.h
+++ b/fon/WordList_def.h
@@ -1,6 +1,6 @@
 /* WordList_def.h
  *
- * Copyright (C) 1999-2011 Paul Boersma
+ * Copyright (C) 1999-2011,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ oo_DEFINE_CLASS (WordList, Daata)
 	#endif
 
 	#if oo_DECLARING
-		oo_LONG (length)
+		oo_INTEGER (length)
 
 		void v_info ()
 			override;
diff --git a/fon/manual_Script.cpp b/fon/manual_Script.cpp
index e8484ca..dc4cfee 100644
--- a/fon/manual_Script.cpp
+++ b/fon/manual_Script.cpp
@@ -664,14 +664,20 @@ NORMAL (U"In formulas you can use the numerical and logical operators that are d
 NORMAL (U"The operators with the highest precedence are #negation (-) and #exponentation (\\^ ):")
 CODE (U"--6 \\-> 6")
 CODE (U"2\\^ 6 \\-> 64")
+/*@praat
+	# Tests for the manual page "Operators".
+
+	assert --6 = 6
+	assert 2^6 = 64
+@*/
 NORMAL (U"Sequences of negation and exponentiation are evaluated from right to left:")
-CODE (U"2\\^ -6 \\-> 0.015625")
-CODE (U"-(1+1)\\^ 6 \\-> -64")
-CODE (U"4\\^ 3\\^ 2 \\-> 4\\^ 9 \\-> 262144")
+CODE (U"2\\^ -6 \\-> 0.015625")                       //@praat assert 2^-6 = 0.015625
+CODE (U"-(1+1)\\^ 6 \\-> -64")                        //@praat assert -(1+1)^6 = -64
+CODE (U"4\\^ 3\\^ 2 \\-> 4\\^ 9 \\-> 262144")         //@praat assert 4^3^2 = 262144
 NORMAL (U"Note that changing the spacing does not change the meaning:")
-CODE (U"4\\^ 3 \\^  2 \\-> 262144")
+CODE (U"4\\^ 3 \\^  2 \\-> 262144")                   //@praat assert 4^3 ^ 2 = 262144
 NORMAL (U"To change the order of evaluation, you have to use parentheses:")
-CODE (U"(4 \\^  3) \\^  2 \\-> 4096")
+CODE (U"(4 \\^  3) \\^  2 \\-> 4096")                 //@praat assert (4 ^ 3) ^ 2 = 4096
 NORMAL (U"The following construction is not allowed because of an ambiguity between a negative number "
 	"and negation of a positive number:")
 CODE (U"-2\\^ 6 \\-> ?")
@@ -684,27 +690,37 @@ NORMAL (U"The operators with the next highest precedence are #multiplication (*)
 CODE (U"1/4*5 \\-> 1.25        (from left to right)")
 CODE (U"1 / 4*5 \\-> 1.25      (spacing does not help)")
 CODE (U"1 / (4*5) \\-> 0.05    (use parentheses to change the order)")
+/*@praat
+	assert 1/4*5 = 1.25
+	assert 1 / 4*5 = 1.25
+	assert 1 / (4*5) = 0.05
+@*/
 CODE (U"3 * 2 \\^  4 \\-> 48      (exponentiation before multiplication)")
 CODE (U"3*2 \\^  4 \\-> 48        (this spacing does not matter and is misleading)")
 CODE (U"(3 * 2) \\^  4 \\-> 1296  (use parentheses to change the order)")
+/*@praat
+	assert 3 * 2 ^ 4 = 48
+	assert 3*2 ^ 4 = 48
+	assert (3 * 2) ^ 4 = 1296
+@*/
 NORMAL (U"##Integer division# operators (#div and #mod) have the same precedence as * and /, "
 	"and are likewise evaluated from left to right:")
-CODE (U"54 div 5 \\-> 10       (division rounded down)")
-CODE (U"54 mod 5 \\-> 4        (the remainder)")
-CODE (U"54.3 div 5.1 \\-> 10   (works for real numbers as well)")
-CODE (U"54.3 mod 5.1 \\-> 3.3  (the remainder)")
-CODE (U"-54 div 5 \\-> -11     (division rounded down; negation before division)")
-CODE (U"-54 mod 5 \\-> 1       (the remainder)")
-CODE (U"-(54 div 5) \\-> -10   (use parentheses to change the order)")
-CODE (U"-(54 mod 5) \\-> -4")
-CODE (U"3 * 18 div 5 \\-> 10   (from left to right)")
-CODE (U"3 * (18 div 5) \\-> 9")
-CODE (U"3 * 18 mod 5 \\-> 4")
-CODE (U"3 * (18 mod 5) \\-> 9")
-CODE (U"54 div 5 * 3 \\-> 30   (from left to right)")
-CODE (U"54 div (5 * 3) \\-> 3")
-CODE (U"54 mod 5 * 3 \\-> 12")
-CODE (U"54 mod (5 * 3) \\-> 9")
+CODE (U"54 div 5 \\-> 10       (division rounded down)")                             //@praat assert 54 div 5 = 10
+CODE (U"54 mod 5 \\-> 4        (the remainder)")                                     //@praat assert 54 mod 5 = 4
+CODE (U"54.3 div 5.1 \\-> 10   (works for real numbers as well)")                    //@praat assert 54.3 div 5.1 = 10
+CODE (U"54.3 mod 5.1 \\-> 3.3  (the remainder)")                                     //@praat assert 54.3 mod 5.1 = 3.3
+CODE (U"-54 div 5 \\-> -11     (division rounded down; negation before division)")   //@praat assert -54 div 5 = -11
+CODE (U"-54 mod 5 \\-> 1       (the remainder)")                                     //@praat assert -54 mod 5 = 1
+CODE (U"-(54 div 5) \\-> -10   (use parentheses to change the order)")               //@praat assert -(54 div 5) = -10
+CODE (U"-(54 mod 5) \\-> -4")                                                        //@praat assert -(54 mod 5) = -4
+CODE (U"3 * 18 div 5 \\-> 10   (from left to right)")                                //@praat assert 3 * 18 div 5 = 10
+CODE (U"3 * (18 div 5) \\-> 9")                                                      //@praat assert 3 * (18 div 5) = 9
+CODE (U"3 * 18 mod 5 \\-> 4")                                                        //@praat assert 3 * 18 mod 5 = 4
+CODE (U"3 * (18 mod 5) \\-> 9")                                                      //@praat assert 3 * (18 mod 5) = 9
+CODE (U"54 div 5 * 3 \\-> 30   (from left to right)")                                //@praat assert 54 div 5 * 3 = 30
+CODE (U"54 div (5 * 3) \\-> 3")                                                      //@praat assert 54 div (5 * 3) = 3
+CODE (U"54 mod 5 * 3 \\-> 12")                                                       //@praat assert 54 mod 5 * 3 = 12
+CODE (U"54 mod (5 * 3) \\-> 9")                                                      //@praat assert 54 mod (5 * 3) = 9
 NORMAL (U"The operators with the next highest precedence are #addition (+) and #subtraction (-), "
 	"evaluated from left to right:")
 CODE (U"3 - 8 + 7 \\-> 2       (from left to right)")
@@ -1562,7 +1578,7 @@ NORMAL (U"It advisable to use$$ .praat $as the extension for script file names.
 	"On the Mac and on Windows, if you drag a$$ .praat $file on the Praat icon, Praat will also start up and show the script.")
 MAN_END
 
-MAN_BEGIN (U"Scripting 2. How to script settings windows", U"ppgb", 20170828)
+MAN_BEGIN (U"Scripting 2. How to script settings windows", U"ppgb", 20170926)
 INTRO (U"Not all menu commands are as simple as those on the @@Scripting 1. Your first scripts|previous page@, "
 	"which act immediately once you choose them from a menu (e.g. ##Play#, ##Erase all#). "
 	"Most commands in Praat require the user to supply additional information; "
@@ -1657,7 +1673,7 @@ CODE (U"Formula: \"correct\", ~ self\\$  [\"response\"] = self\\$  [\"stimulus\"
 NORMAL (U"This means that you can write the example of section 4 in an analogous way:")
 CODE (U"Create Sound from formula: \"sine\", 1, 0.0, 1.0, 44100, ~ 1/2 * sin(2*pi*377*x)")
 NORMAL (U"The tilde is probably the preferred way to write formula arguments. "
-	"You should remember, however, that the result is still a string, "
+	"You should remember, however, that the result is still a string (i.e. text), "
 	"and you can treat it as a string with the string methods described later on in this tutorial.")
 ENTRY (U"6. File arguments")
 NORMAL (U"The commands from the Open and Save menus, and several other commands whose names "
@@ -2356,28 +2372,50 @@ CODE (U"root = sqrt (x)")
 CODE (U"#writeInfoLine: \"The square root of \", x, \" is \", root, \".\"")
 NORMAL (U"This will write the following text to the Info window:")
 CODE (U"The square root of 2 is 1.4142135623730951.")
+/*@praat
+	assert string$ (sqrt (2)) = "1.4142135623730951"
+@*/
 NORMAL (U"You can fix the number of digits after the decimal point by use of the ##fixed\\$ # function:")
 CODE (U"x = 2.0")
 CODE (U"root = sqrt (x)")
 CODE (U"writeInfoLine: \"The square root of \", ##fixed\\$ # (x, 3), \" is approximately \", ##fixed\\$ # (root, 3), \".\"")
 NORMAL (U"This will write the following text to the Info window:")
 CODE (U"The square root of 2.000 is approximately 1.414.")
+/*@praat
+	assert fixed$ (sqrt (2), 3) = "1.414"
+@*/
 NORMAL (U"By using 0 decimal digits, you round to whole values:")
 CODE (U"root = sqrt (2)")
 CODE (U"writeInfoLine: \"The square root of 2 is very approximately \", ##fixed\\$ # (root, #0), \".\"")
 NORMAL (U"This will write the following text to the Info window:")
 CODE (U"The square root of 2 is very approximately 1.")
+/*@praat
+	assert fixed$ (sqrt (2), 0) = "1"
+@*/
 NORMAL (U"By using the ##percent\\$ # function, you give the result in a percent format:")
 CODE (U"jitter = 0.0156789")
 CODE (U"writeInfoLine: \"The jitter is \", ##percent\\$ # (jitter, 3), \".\"")
 NORMAL (U"This will write the following text to the Info window:")
 CODE (U"The jitter is 1.568\\% .")
+/*@praat
+	jitter = 0.0156789
+	assert percent$ (jitter, 3) = "1.568%"
+	jitter = -0.0156789
+	assert percent$ (jitter, 3) = "-1.568%"
+@*/
 NORMAL (U"The number 0, however, will always be written as 0, and for small numbers the number of "
 	"significant digits will never be less than 1:")
 CODE (U"jitter = 0.000000156789")
 CODE (U"writeInfoLine: \"The jitter is \", percent\\$  (jitter, 3), \".\"")
 NORMAL (U"This will write the following text to the Info window:")
 CODE (U"The jitter is 0.00002\\% .")
+/*@praat
+	assert percent$ (0, 3) = "0"
+	jitter = 0.000000156789
+	assert percent$ (jitter, 3) = "0.00002%"
+	jitter *= -1
+	assert percent$ (jitter, 3) = "-0.00002%"
+@*/
 ENTRY (U"Predefined variables")
 NORMAL (U"All of the variables you saw earlier in this tutorial were defined at the first moment a value was assigned to them. "
 	"Some variables, however, are already defined implicitly at the start of your script.")
@@ -2398,6 +2436,11 @@ NORMAL (U"Some ##predefined string variables# are $$newline\\$ $,  $$tab\\$ $, a
 ENTRY (U"Functions that handle variables")
 NORMAL (U"To check whether a variable exists, you can use the function")
 CODE (U"%variableExists (%%variableName\\$ %)")
+/*@praat
+	fgh = 567
+	assert variableExists ("fgh")
+	assert not variableExists ("jhfwbfejfgcds")
+@*/
 MAN_END
 /*
 form Convert from WAV to AIFF
diff --git a/fon/manual_tutorials.cpp b/fon/manual_tutorials.cpp
index 32b38ea..ef63776 100644
--- a/fon/manual_tutorials.cpp
+++ b/fon/manual_tutorials.cpp
@@ -22,10 +22,13 @@
 void manual_tutorials_init (ManPages me);
 void manual_tutorials_init (ManPages me) {
 
-MAN_BEGIN (U"What's new?", U"ppgb", 20170926)
+MAN_BEGIN (U"What's new?", U"ppgb", 20171010)
 INTRO (U"Latest changes in Praat.")
 //LIST_ITEM (U"• Manual page about @@drawing a vowel triangle at .")
 
+NORMAL (U"##6.0.34# (10 October 2017)")
+LIST_ITEM (U"• Scripting: arrays in menu commands in scripts.")
+LIST_ITEM (U"• #Inspect: made a button visible that had disappeared in 6.0.33.")
 NORMAL (U"##6.0.33# (26 September 2017)")
 LIST_ITEM (U"• #Pitch: Subtract linear fit...#: correct a bug that prevented computation in the ERB domain.")
 LIST_ITEM (U"• Scripting: made object[xx].xmin work again.")
diff --git a/fon/praat_ExperimentMFC.cpp b/fon/praat_ExperimentMFC.cpp
index 72b7b46..172e198 100644
--- a/fon/praat_ExperimentMFC.cpp
+++ b/fon/praat_ExperimentMFC.cpp
@@ -81,7 +81,7 @@ DIRECT (NEW_ExperimentMFC_extractResults) {
 
 DIRECT (INTEGER_ResultsMFC_getNumberOfTrials) {
 	NUMBER_ONE (ResultsMFC)
-		long result = my numberOfTrials;
+		integer result = my numberOfTrials;
 	NUMBER_ONE_END (U" trials")
 }
 
diff --git a/fon/praat_Fon.cpp b/fon/praat_Fon.cpp
index 31f43a2..2406c6e 100644
--- a/fon/praat_Fon.cpp
+++ b/fon/praat_Fon.cpp
@@ -124,10 +124,10 @@ DO
 // MARK: Modify
 
 FORM (MODIFY_Cochleagram_formula, U"Cochleagram Formula", U"Cochleagram: Formula...") {
-	LABEL (U"label", U"`x' is time in seconds, `y' is place in Bark")
-	LABEL (U"label", U"y := y1; for row := 1 to nrow do { x := x1; "
-		"for col := 1 to ncol do { self [row, col] := `formula' ; x := x + dx } y := y + dy }")
-	TEXTFIELD (formula, U"formula", U"self")
+	LABEL (U"`x` is time in seconds, `y` is place in Bark")
+	LABEL (U"y := y1; for row := 1 to nrow do { x := x1; "
+		"for col := 1 to ncol do { self [row, col] := `formula` ; x := x + dx } y := y + dy }")
+	TEXTFIELD (formula, U"Formula:", U"self")
 	OK
 DO
 	MODIFY_EACH_WEAK (Cochleagram)
@@ -160,10 +160,8 @@ DIRECT (NEW_Cochleagram_to_Matrix) {
 
 FORM (NEW1_Corpus_create, U"Create Corpus", U"Create Corpus...") {
 	WORD (name, U"Name", U"myCorpus")
-	LABEL (U"", U"Folder with sound files:")
-	TEXTFIELD (folderWithSoundFiles, U"folderWithSoundFiles", U"")
-	LABEL (U"", U"Folder with annotation files:")
-	TEXTFIELD (folderWithAnnotationFiles, U"folderWithAnnotationFiles", U"")
+	TEXTFIELD (folderWithSoundFiles, U"Folder with sound files:", U"")
+	TEXTFIELD (folderWithAnnotationFiles, U"Folder with annotation files:", U"")
 	OK
 DO
 END }
@@ -263,9 +261,9 @@ DIRECT (REAL_Excitation_getLoudness) {
 // MARK: Modify
 
 FORM (MODIFY_Excitation_formula, U"Excitation Formula", U"Excitation: Formula...") {
-	LABEL (U"label", U"`x' is the place in Bark, `col' is the bin number")
-	LABEL (U"label", U"x := 0;   for col := 1 to ncol do { self [1, col] := `formula' ; x := x + dx }")
-	TEXTFIELD (formula, U"formula", U"self")
+	LABEL (U"`x` is the place in Bark, `col` is the bin number")
+	LABEL (U"x := 0;   for col := 1 to ncol do { self [1, col] := `formula` ; x := x + dx }")
+	TEXTFIELD (formula, U"Formula:", U"self")
 	OK
 DO
 	MODIFY_EACH_WEAK (Excitation)
@@ -386,39 +384,33 @@ DO
 FORM (REAL_Formant_getValueAtTime, U"Formant: Get value", U"Formant: Get value at time...") {
 	NATURAL (formantNumber, U"Formant number", U"1")
 	REAL (time, U"Time (s)", U"0.5")
-	RADIOx (unit, U"Unit", 1, 0)
-		RADIOBUTTON (U"Hertz")
-		RADIOBUTTON (U"Bark")
+	RADIO_ENUM (unit, U"Unit", kFormant_unit, HERTZ)
 	RADIO (interpolation, U"Interpolation", 1)   // ignored
 		RADIOBUTTON (U"Linear")
 	OK
 DO
 	NUMBER_ONE (Formant)
 		double result = Formant_getValueAtTime (me, formantNumber, time, unit);
-	NUMBER_ONE_END (U" ", GET_STRING (U"Unit"))
+	NUMBER_ONE_END (U" ", kFormant_unit_getText (unit))
 }
 
 FORM (REAL_Formant_getBandwidthAtTime, U"Formant: Get bandwidth", U"Formant: Get bandwidth at time...") {
 	NATURAL (formantNumber, U"Formant number", U"1")
 	REAL (time, U"Time (s)", U"0.5")
-	RADIOx (unit, U"Unit", 1, 0)
-		RADIOBUTTON (U"Hertz")
-		RADIOBUTTON (U"Bark")
+	RADIO_ENUM (unit, U"Unit", kFormant_unit, HERTZ)
 	RADIO (interpolation, U"Interpolation", 1)   // ignored
 		RADIOBUTTON (U"Linear")
 	OK
 DO
 	NUMBER_ONE (Formant)
 		double result = Formant_getBandwidthAtTime (me, formantNumber, time, unit);
-	NUMBER_ONE_END (U" ", GET_STRING (U"Unit"))
+	NUMBER_ONE_END (U" ", kFormant_unit_getText (unit))
 }
 
 FORM (REAL_Formant_getMinimum, U"Formant: Get minimum", U"Formant: Get minimum...") {
 	NATURAL (formantNumber, U"Formant number", U"1")
 	praat_TimeFunction_RANGE (fromTime, toTime)
-	RADIOx (unit, U"Unit", 1, 0)
-		RADIOBUTTON (U"Hertz")
-		RADIOBUTTON (U"Bark")
+	RADIO_ENUM (unit, U"Unit", kFormant_unit, HERTZ)
 	RADIOx (interpolation, U"Interpolation", 2, 0)
 		RADIOBUTTON (U"None")
 		RADIOBUTTON (U"Parabolic")
@@ -426,15 +418,13 @@ FORM (REAL_Formant_getMinimum, U"Formant: Get minimum", U"Formant: Get minimum..
 DO
 	NUMBER_ONE (Formant)
 		double result = Formant_getMinimum (me, formantNumber, fromTime, toTime, unit, interpolation);
-	NUMBER_ONE_END (U" ", GET_STRING (U"Unit"))
+	NUMBER_ONE_END (U" ", kFormant_unit_getText (unit))
 }
 
 FORM (REAL_Formant_getMaximum, U"Formant: Get maximum", U"Formant: Get maximum...") {
 	NATURAL (formantNumber, U"Formant number", U"1")
 	praat_TimeFunction_RANGE (fromTime, toTime)
-	RADIOx (unit, U"Unit", 1, 0)
-		RADIOBUTTON (U"Hertz")
-		RADIOBUTTON (U"Bark")
+	RADIO_ENUM (unit, U"Unit", kFormant_unit, HERTZ)
 	RADIOx (interpolation, U"Interpolation", 2, 0)
 		RADIOBUTTON (U"None")
 		RADIOBUTTON (U"Parabolic")
@@ -442,15 +432,13 @@ FORM (REAL_Formant_getMaximum, U"Formant: Get maximum", U"Formant: Get maximum..
 DO
 	NUMBER_ONE (Formant)
 		double result = Formant_getMaximum (me, formantNumber, fromTime, toTime, unit, interpolation);
-	NUMBER_ONE_END (U" ", GET_STRING (U"Unit"))
+	NUMBER_ONE_END (U" ", kFormant_unit_getText (unit))
 }
 
 FORM (REAL_Formant_getTimeOfMinimum, U"Formant: Get time of minimum", U"Formant: Get time of minimum...") {
 	NATURAL (formantNumber, U"Formant number", U"1")
 	praat_TimeFunction_RANGE (fromTime, toTime)
-	RADIOx (unit, U"Unit", 1, 0)
-		RADIOBUTTON (U"Hertz")
-		RADIOBUTTON (U"Bark")
+	RADIO_ENUM (unit, U"Unit", kFormant_unit, HERTZ)
 	RADIOx (interpolation, U"Interpolation", 2, 0)
 		RADIOBUTTON (U"None")
 		RADIOBUTTON (U"Parabolic")
@@ -464,9 +452,7 @@ DO
 FORM (REAL_Formant_getTimeOfMaximum, U"Formant: Get time of maximum", U"Formant: Get time of maximum...") {
 	NATURAL (formantNumber, U"Formant number", U"1")
 	praat_TimeFunction_RANGE (fromTime, toTime)
-	RADIOx (unit, U"Unit", 1, 0)
-		RADIOBUTTON (U"Hertz")
-		RADIOBUTTON (U"Bark")
+	RADIO_ENUM (unit, U"Unit", kFormant_unit, HERTZ)
 	RADIOx (interpolation, U"Interpolation", 2, 0)
 		RADIOBUTTON (U"None")
 		RADIOBUTTON (U"Parabolic")
@@ -486,14 +472,12 @@ DIRECT (INTEGER_Formant_getMaximumNumberOfFormants) {
 FORM (REAL_Formant_getMean, U"Formant: Get mean", U"Formant: Get mean...") {
 	NATURAL (formantNumber, U"Formant number", U"1")
 	praat_TimeFunction_RANGE (fromTime, toTime)
-	RADIOx (unit, U"Unit", 1, 0)
-		RADIOBUTTON (U"Hertz")
-		RADIOBUTTON (U"Bark")
+	RADIO_ENUM (unit, U"Unit", kFormant_unit, HERTZ)
 	OK
 DO
 	NUMBER_ONE (Formant)
 		double result = Formant_getMean (me, formantNumber, fromTime, toTime, unit);
-	NUMBER_ONE_END (U" ", GET_STRING (U"Unit"))
+	NUMBER_ONE_END (U" ", kFormant_unit_getText (unit))
 }
 
 DIRECT (INTEGER_Formant_getMinimumNumberOfFormants) {
@@ -516,42 +500,36 @@ DO
 FORM (REAL_Formant_getQuantile, U"Formant: Get quantile", nullptr) {
 	NATURAL (formantNumber, U"Formant number", U"1")
 	praat_TimeFunction_RANGE (fromTime, toTime)
-	RADIO (unit, U"Unit", 1)
-		RADIOBUTTON (U"Hertz")
-		RADIOBUTTON (U"Bark")
+	RADIO_ENUM (unit, U"Unit", kFormant_unit, HERTZ)
 	REAL (quantile, U"Quantile", U"0.50 (= median)")
 	OK
 DO
 	NUMBER_ONE (Formant)
-		double result = Formant_getQuantile (me, formantNumber, quantile, fromTime, toTime, unit - 1);
-	NUMBER_ONE_END (U" ", GET_STRING (U"Unit"))
+		double result = Formant_getQuantile (me, formantNumber, quantile, fromTime, toTime, unit);
+	NUMBER_ONE_END (U" ", kFormant_unit_getText (unit))
 }
 
 FORM (REAL_Formant_getQuantileOfBandwidth, U"Formant: Get quantile of bandwidth", nullptr) {
 	NATURAL (formantNumber, U"Formant number", U"1")
 	praat_TimeFunction_RANGE (fromTime, toTime)
-	RADIO (unit, U"Unit", 1)
-		RADIOBUTTON (U"Hertz")
-		RADIOBUTTON (U"Bark")
+	RADIO_ENUM (unit, U"Unit", kFormant_unit, HERTZ)
 	REAL (quantile, U"Quantile", U"0.50 (= median)")
 	OK
 DO
 	NUMBER_ONE (Formant)
-		double result = Formant_getQuantileOfBandwidth (me, formantNumber, quantile, fromTime, toTime, unit - 1);
-	NUMBER_ONE_END (U" ", GET_STRING (U"Unit"))
+		double result = Formant_getQuantileOfBandwidth (me, formantNumber, quantile, fromTime, toTime, unit);
+	NUMBER_ONE_END (U" ", kFormant_unit_getText (unit))
 }
 
 FORM (REAL_Formant_getStandardDeviation, U"Formant: Get standard deviation", nullptr) {
 	NATURAL (formantNumber, U"Formant number", U"1")
 	praat_TimeFunction_RANGE (fromTime, toTime)
-	RADIO (unit, U"Unit", 1)
-		RADIOBUTTON (U"Hertz")
-		RADIOBUTTON (U"Bark")
+	RADIO_ENUM (unit, U"Unit", kFormant_unit, HERTZ)
 	OK
 DO
 	NUMBER_ONE (Formant)
-		double result = Formant_getStandardDeviation (me, formantNumber, fromTime, toTime, unit - 1);
-	NUMBER_ONE_END (U" ", GET_STRING (U"Unit"))
+		double result = Formant_getStandardDeviation (me, formantNumber, fromTime, toTime, unit);
+	NUMBER_ONE_END (U" ", kFormant_unit_getText (unit))
 }
 
 // MARK: Modify
@@ -563,8 +541,8 @@ DIRECT (MODIFY_Formant_sort) {
 }
 
 FORM (MODIFY_Formant_formula_frequencies, U"Formant: Formula (frequencies)", U"Formant: Formula (frequencies)...") {
-	LABEL (U"", U"row is formant number, col is frame number: for row from 1 to nrow do for col from 1 to ncol do F (row, col) :=")
-	TEXTFIELD (formula, U"formula", U"if row = 2 then self + 200 else self fi")
+	LABEL (U"row is formant number, col is frame number: for row from 1 to nrow do for col from 1 to ncol do F (row, col) :=")
+	TEXTFIELD (formula, U"Formula:", U"if row = 2 then self + 200 else self fi")
 	OK
 DO
 	MODIFY_EACH_WEAK (Formant)
@@ -573,8 +551,8 @@ DO
 }
 
 FORM (MODIFY_Formant_formula_bandwidths, U"Formant: Formula (bandwidths)", U"Formant: Formula (bandwidths)...") {
-	LABEL (U"", U"row is formant number, col is frame number: for row from 1 to nrow do for col from 1 to ncol do B (row, col) :=")
-	TEXTFIELD (formula, U"formula", U"self / 2 ; sharpen all peaks")
+	LABEL (U"row is formant number, col is frame number: for row from 1 to nrow do for col from 1 to ncol do B (row, col) :=")
+	TEXTFIELD (formula, U"Formula:", U"self / 2 ; sharpen all peaks")
 	OK
 DO
 	MODIFY_EACH_WEAK (Formant)
@@ -747,9 +725,9 @@ DO
 // MARK: Modify
 
 FORM (MODIFY_Harmonicity_formula, U"Harmonicity Formula", U"Harmonicity: Formula...") {
-	LABEL (U"label", U"x is time")
-	LABEL (U"label", U"for col := 1 to ncol do { self [col] := `formula' ; x := x + dx }")
-	TEXTFIELD (formula, U"formula", U"self")
+	LABEL (U"`x` is time")
+	LABEL (U"for col := 1 to ncol do { self [col] := `formula` ; x := x + dx }")
+	TEXTFIELD (formula, U"Formula:", U"self")
 	OK
 DO
 	MODIFY_EACH_WEAK (Harmonicity)
@@ -887,9 +865,9 @@ DO
 // MARK: Modify
 
 FORM (MODIFY_Intensity_formula, U"Intensity Formula", nullptr) {
-	LABEL (U"label", U"`x' is the time in seconds, `col' is the frame number, `self' is in dB")
-	LABEL (U"label", U"x := x1;   for col := 1 to ncol do { self [col] := `formula' ; x := x + dx }")
-	TEXTFIELD (formula, U"formula", U"0")
+	LABEL (U"`x` is the time in seconds, `col` is the frame number, `self` is in dB")
+	LABEL (U"x := x1;   for col := 1 to ncol do { self [col] := `formula` ; x := x + dx }")
+	TEXTFIELD (formula, U"Formula:", U"0")
 	OK
 DO
 	MODIFY_EACH_WEAK (Intensity)
@@ -1010,7 +988,7 @@ FORM (GRAPHICS_Ltas_draw, U"Ltas: Draw", nullptr) {
 	REAL (fromPower, U"left Power range (dB/Hz)", U"-20.0")
 	REAL (toPower, U"right Power range (dB/Hz)", U"80.0")
 	BOOLEAN (garnish, U"Garnish", true)
-	LABEL (U"", U"")
+	LABEL (U"")
 	OPTIONMENUSTR (drawingMethod, U"Drawing method", 2)
 		OPTION (U"Curve")
 		OPTION (U"Bars")
@@ -1024,9 +1002,9 @@ DO_ALTERNATIVE (GRAPHICS_old_Ltas_draw)
 }
 
 FORM (MODIFY_Ltas_formula, U"Ltas Formula", nullptr) {
-	LABEL (U"label", U"`x' is the frequency in hertz, `col' is the bin number")
-	LABEL (U"label", U"x := x1;   for col := 1 to ncol do { self [1, col] := `formula' ; x := x + dx }")
-	TEXTFIELD (formula, U"formula", U"0")
+	LABEL (U"`x` is the frequency in hertz, `col` is the bin number")
+	LABEL (U"x := x1;   for col := 1 to ncol do { self [1, col] := `formula` ; x := x + dx }")
+	TEXTFIELD (formula, U"Formula:", U"0")
 	OK
 DO
 	MODIFY_EACH_WEAK (Ltas)
@@ -1508,7 +1486,7 @@ DO
 
 FORM (GRAPHICS_Pitch_drawSemitones100, U"Pitch: Draw semitones (re 100 Hz)", U"Pitch: Draw...") {
 	praat_TimeFunction_RANGE (fromTime, toTime)
-	LABEL (U"", U"Range in semitones re 100 Hz:")
+	LABEL (U"Range in semitones re 100 Hz:")
 	REAL (fromFrequency, U"left Frequency range (st)", U"-12.0")
 	REAL (toFrequency, U"right Frequency range (st)", U"30.0")
 	BOOLEAN (garnish, U"Garnish", true)
@@ -1522,7 +1500,7 @@ DO
 
 FORM (GRAPHICS_Pitch_drawSemitones200, U"Pitch: Draw semitones (re 200 Hz)", U"Pitch: Draw...") {
 	praat_TimeFunction_RANGE (fromTime, toTime)
-	LABEL (U"", U"Range in semitones re 200 Hz:")
+	LABEL (U"Range in semitones re 200 Hz:")
 	REAL (fromFrequency, U"left Frequency range (st)", U"-24.0")
 	REAL (toFrequency, U"right Frequency range (st)", U"18.0")
 	BOOLEAN (garnish, U"Garnish", true)
@@ -1536,7 +1514,7 @@ DO
 
 FORM (GRAPHICS_Pitch_drawSemitones440, U"Pitch: Draw semitones (re 440 Hz)", U"Pitch: Draw...") {
 	praat_TimeFunction_RANGE (fromTime, toTime)
-	LABEL (U"", U"Range in semitones re 440 Hz:")
+	LABEL (U"Range in semitones re 440 Hz:")
 	REAL (fromFrequency, U"left Frequency range (st)", U"-36.0")
 	REAL (toFrequency, U"right Frequency range (st)", U"6.0")
 	BOOLEAN (garnish, U"Garnish", true)
@@ -1558,8 +1536,8 @@ DIRECT (WINDOW_Pitch_viewAndEdit) {
 }
 
 FORM (MODIFY_Pitch_formula, U"Pitch: Formula", U"Formula...") {
-	LABEL (U"", U"x = time; col = frame; row = candidate (1 = current path); frequency (time, candidate) :=")
-	TEXTFIELD (formula, U"formula", U"self*2; Example: octave jump up")
+	LABEL (U"`x` is time; `col` is frame number; `row` = candidate (1 = current path); frequency (time, candidate) :=")
+	TEXTFIELD (formula, U"Formula:", U"self*2 ; example: octave jump up")
 	OK
 DO
 	MODIFY_EACH_WEAK (Pitch)
@@ -1621,7 +1599,9 @@ DO
 		if (nVoiced < 2) {
 			Melder_information (U"--undefined--");
 		} else {
-			Melder_information (slope, U" ", GET_STRING (U"Unit"), U"/s");
+			Melder_information (slope, U" ",
+				(unit == 1 ? U"Hz" : unit == 2 ? U"mel" : unit == 3 ? U"semitones" : U"ERB"),
+				U"/s");
 		}
 	END
 }
@@ -1812,7 +1792,7 @@ DO
 
 FORM (GRAPHICS_Pitch_speckleSemitones100, U"Pitch: Speckle semitones (re 100 Hz)", U"Pitch: Draw...") {
 	praat_TimeFunction_RANGE (fromTime, toTime)
-	LABEL (U"", U"Range in semitones re 100 hertz:")
+	LABEL (U"Range in semitones re 100 hertz:")
 	REAL (fromFrequency, U"left Frequency range (st)", U"-12.0")
 	REAL (toFrequency, U"right Frequency range (st)", U"30.0")
 	BOOLEAN (garnish, U"Garnish", true)
@@ -1825,7 +1805,7 @@ DO
 
 FORM (GRAPHICS_Pitch_speckleSemitones200, U"Pitch: Speckle semitones (re 200 Hz)", U"Pitch: Draw...") {
 	praat_TimeFunction_RANGE (fromTime, toTime)
-	LABEL (U"", U"Range in semitones re 200 hertz:")
+	LABEL (U"Range in semitones re 200 hertz:")
 	REAL (fromFrequency, U"left Frequency range (st)", U"-24.0")
 	REAL (toFrequency, U"right Frequency range (st)", U"18.0")
 	BOOLEAN (garnish, U"Garnish", true)
@@ -1838,7 +1818,7 @@ DO
 
 FORM (GRAPHICS_Pitch_speckleSemitones440, U"Pitch: Speckle semitones (re 440 Hz)", U"Pitch: Draw...") {
 	praat_TimeFunction_RANGE (fromTime, toTime)
-	LABEL (U"", U"Range in semitones re 440 hertz:")
+	LABEL (U"Range in semitones re 440 hertz:")
 	REAL (fromFrequency, U"left Frequency range (st)", U"-36.0")
 	REAL (toFrequency, U"right Frequency range (st)", U"6.0")
 	BOOLEAN (garnish, U"Garnish", true)
@@ -1961,7 +1941,7 @@ FORM (GRAPHICS_PitchTier_Pitch_draw, U"PitchTier & Pitch: Draw", nullptr) {
 		RADIOBUTTON (U"Dotted")
 		RADIOBUTTON (U"Blank")
 	BOOLEAN (garnish, U"Garnish", true)
-	LABEL (U"", U"")
+	LABEL (U"")
 	OPTIONMENUSTR (drawingMethod, U"Drawing method", 1)
 		OPTION (U"lines")
 		OPTION (U"speckles")
@@ -2070,7 +2050,7 @@ DIRECT (HELP_Polygon_help) {
 }
 
 FORM (GRAPHICS_Polygon_paint, U"Polygon: Paint", nullptr) {
-	COLOUR (U"Colour (0-1, name, or {r,g,b})", U"0.5")
+	COLOUR (colour, U"Colour (0-1, name, or {r,g,b})", U"0.5")
 	REAL (xmin, U"Xmin", U"0.0")
 	REAL (xmax, U"Xmax", U"0.0 (= all)")
 	REAL (ymin, U"Ymin", U"0.0")
@@ -2078,7 +2058,7 @@ FORM (GRAPHICS_Polygon_paint, U"Polygon: Paint", nullptr) {
 	OK
 DO
 	GRAPHICS_EACH (Polygon)
-		Polygon_paint (me, GRAPHICS, GET_COLOUR (U"Colour"), xmin, xmax, ymin, ymax);
+		Polygon_paint (me, GRAPHICS, colour, xmin, xmax, ymin, ymax);
 	GRAPHICS_EACH_END
 }
 
@@ -2168,12 +2148,11 @@ DO
 }
 
 FORM (MODIFY_Spectrogram_formula, U"Spectrogram: Formula", U"Spectrogram: Formula...") {
-	LABEL (U"label", U"Do for all times and frequencies:")
-	LABEL (U"label", U"   `x' is the time in seconds")
-	LABEL (U"label", U"   `y' is the frequency in hertz")
-	LABEL (U"label", U"   `self' is the current value in Pa\u00B2/Hz")
-	LABEL (U"label", U"   Replace all values with:")
-	TEXTFIELD (formula, U"formula", U"self * exp (- x / 0.1)")
+	LABEL (U"Do for all times and frequencies:")
+	LABEL (U"   `x` is the time in seconds")
+	LABEL (U"   `y` is the frequency in hertz")
+	LABEL (U"   `self` is the current value in Pa\u00B2/Hz")
+	TEXTFIELD (formula, U"   Replace all values with:", U"self * exp (- x / 0.1)")
 	OK
 DO
 	MODIFY_EACH_WEAK (Spectrogram)
@@ -2457,13 +2436,13 @@ DO
 // MARK: Modify
 
 FORM (MODIFY_Spectrum_formula, U"Spectrum: Formula", U"Spectrum: Formula...") {
-	LABEL (U"label", U"`x' is the frequency in hertz, `col' is the bin number;   "
+	LABEL (U"`x` is the frequency in hertz, `col` is the bin number;   "
 		"`y' = `row' is 1 (real part) or 2 (imaginary part)")
-	LABEL (U"label", U"y := 1;   row := 1;   "
-		"x := 0;   for col := 1 to ncol do { self [1, col] := `formula' ; x := x + dx }")
-	LABEL (U"label", U"y := 2;   row := 2;   "
-		"x := 0;   for col := 1 to ncol do { self [2, col] := `formula' ; x := x + dx }")
-	TEXTFIELD (formula, U"formula", U"0")
+	LABEL (U"y := 1;   row := 1;   "
+		"x := 0;   for col := 1 to ncol do { self [1, col] := `formula` ; x := x + dx }")
+	LABEL (U"y := 2;   row := 2;   "
+		"x := 0;   for col := 1 to ncol do { self [2, col] := `formula` ; x := x + dx }")
+	TEXTFIELD (formula, U"Formula:", U"0")
 	OK
 DO
 	MODIFY_EACH_WEAK (Spectrum)
@@ -2524,7 +2503,7 @@ DO
 }
 
 FORM (NEW_Spectrum_to_Formant_peaks, U"Spectrum: To Formant (peaks)", nullptr) {
-	LABEL (U"", U"Warning: this simply picks peaks from 0 Hz up!")
+	LABEL (U"Warning: this simply picks peaks from 0 Hz up!")
 	NATURAL (maximumNumberOfFormants, U"Maximum number of formants", U"1000")
 	OK
 DO
@@ -2578,7 +2557,6 @@ DIRECT (NEW_Spectrum_to_SpectrumTier_peaks) {
 
 FORM (NEW1_Strings_createAsFileList, U"Create Strings as file list", U"Create Strings as file list...") {
 	SENTENCE (name, U"Name", U"fileList")
-	LABEL (U"", U"File path:")
 	static structMelderDir defaultDir { };
 	Melder_getHomeDir (& defaultDir);
 	static const char32 *homeDirectory = Melder_dirToPath (& defaultDir);
@@ -2593,7 +2571,7 @@ FORM (NEW1_Strings_createAsFileList, U"Create Strings as file list", U"Create St
 	#else
 		Melder_sprint (defaultPath,kMelder_MAXPATH+1, homeDirectory, U"/*.wav");
 	#endif
-	TEXTFIELD (path, U"path", defaultPath)
+	TEXTFIELD (path, U"File path:", defaultPath)
 	OK
 DO
 	CREATE_ONE
@@ -2603,7 +2581,6 @@ DO
 
 FORM (NEW1_Strings_createAsDirectoryList, U"Create Strings as directory list", U"Create Strings as directory list...") {
 	SENTENCE (name, U"Name", U"directoryList")
-	LABEL (U"", U"Path:")
 	static structMelderDir defaultDir { };
 	Melder_getHomeDir (& defaultDir);
 	static const char32 *homeDirectory = Melder_dirToPath (& defaultDir);
@@ -2618,7 +2595,7 @@ FORM (NEW1_Strings_createAsDirectoryList, U"Create Strings as directory list", U
 	#else
 		Melder_sprint (defaultPath,kMelder_MAXPATH+1, homeDirectory, U"/*");
 	#endif
-	TEXTFIELD (path, U"path", defaultPath)
+	TEXTFIELD (path, U"Path:", defaultPath)
 	OK
 DO
 	CREATE_ONE
@@ -2686,8 +2663,7 @@ DO
 
 FORM (MODIFY_Strings_insertString, U"Strings: Insert string", nullptr) {
 	INTEGER (atPosition, U"At position", U"0 (= at end)")
-	LABEL (U"", U"String:")
-	TEXTFIELD (string, U"string", U"")
+	TEXTFIELD (string, U"String:", U"")
 	OK
 DO
 	MODIFY_EACH (Strings)
@@ -2724,8 +2700,7 @@ DO
 
 FORM (MODIFY_Strings_setString, U"Strings: Set string", nullptr) {
 	NATURAL (position, U"Position", U"1")
-	LABEL (U"", U"New string:")
-	TEXTFIELD (newString, U"newString", U"")
+	TEXTFIELD (newString, U"New string:", U"")
 	OK
 DO
 	MODIFY_EACH (Strings)
@@ -2751,7 +2726,7 @@ FORM (NEW_Strings_replaceAll, U"Strings: Replace all", nullptr) {
 	OK
 DO
 	CONVERT_EACH (Strings)
-		long numberOfMatches, numberOfStringMatches;
+		integer numberOfMatches, numberOfStringMatches;
 		autoStrings result = Strings_change (me, find, replaceWith,
 			replaceLimitPerString, & numberOfMatches, & numberOfStringMatches, findAndReplaceStringsAre);   // FIXME: boolean inappropriate
 	CONVERT_EACH_END (my name, U"_replaced")
@@ -2780,8 +2755,8 @@ DIRECT (NEW_Table_to_Matrix) {
 // MARK: - TEXTGRID; the remainder is in praat_TextGrid_init.cpp
 
 FORM (NEW1_TextGrid_create, U"Create TextGrid", U"Create TextGrid...") {
-	LABEL (U"", U"Hint: to label or segment an existing Sound,")
-	LABEL (U"", U"select that Sound and choose \"To TextGrid...\".")
+	LABEL (U"Hint: to label or segment an existing Sound,")
+	LABEL (U"select that Sound and choose \"To TextGrid...\".")
 	REAL (startTime, U"Start time (s)", U"0.0")
 	REAL (endTime, U"End time (s)", U"1.0")
 	SENTENCE (allTierNames, U"All tier names", U"Mary John bell")
diff --git a/fon/praat_Matrix.cpp b/fon/praat_Matrix.cpp
index 05d7509..a6e90f9 100644
--- a/fon/praat_Matrix.cpp
+++ b/fon/praat_Matrix.cpp
@@ -37,21 +37,6 @@
 #undef iam
 #define iam iam_LOOP
 
-int praat_Matrix_formula (UiForm dia, Interpreter interpreter) {
-	int IOBJECT;
-	LOOP {
-		iam (Matrix);
-		try {
-			Matrix_formula (me, GET_STRING (U"formula"), interpreter, nullptr);
-			praat_dataChanged (me);
-		} catch (MelderError) {
-			praat_dataChanged (me);
-			throw;
-		}
-	}
-	return 1;
-}
-
 // MARK: - MATRIX
 
 // MARK: New
@@ -68,8 +53,7 @@ FORM (NEW1_Matrix_create, U"Create Matrix", U"Create Matrix...") {
 	NATURAL (numberOfRows, U"Number of rows", U"1")
 	POSITIVE (dy, U"dy", U"1.0")
 	REAL (y1, U"y1", U"1.0")
-	LABEL (U"", U"Formula:")
-	TEXTFIELD (formula, U"formula", U"x*y")
+	TEXTFIELD (formula, U"Formula:", U"x*y")
 	OK
 DO
 	if (xmax < xmin) Melder_throw (U"Your xmax (", Melder_single (xmax), U") should not be less than your xmin (", Melder_single (xmin), U").");
@@ -86,8 +70,7 @@ FORM (NEW1_Matrix_createSimple, U"Create simple Matrix", U"Create simple Matrix.
 	WORD (name, U"Name", U"xy")
 	NATURAL (numberOfRows, U"Number of rows", U"10")
 	NATURAL (numberOfColumns, U"Number of columns", U"10")
-	LABEL (U"", U"Formula:")
-	TEXTFIELD (formula, U"formula", U"x*y")
+	TEXTFIELD (formula, U"Formula:", U"x*y")
 	OK
 DO
 	CREATE_ONE
@@ -375,9 +358,9 @@ DIRECT (REAL_Matrix_getSum) {
 // MARK: Modify
 
 FORM (MODIFY_Matrix_formula, U"Matrix Formula", U"Formula...") {
-	LABEL (U"label", U"y := y1; for row := 1 to nrow do { x := x1; "
-		"for col := 1 to ncol do { self [row, col] := `formula' ; x := x + dx } y := y + dy }")
-	TEXTFIELD (formula, U"formula", U"self")
+	LABEL (U"y := y1; for row := 1 to nrow do { x := x1; "
+		"for col := 1 to ncol do { self [row, col] := `formula` ; x := x + dx } y := y + dy }")
+	TEXTFIELD (formula, U"Formula:", U"self")
 	OK
 DO
 	MODIFY_EACH_WEAK (Matrix)
@@ -489,7 +472,7 @@ DIRECT (NEW_Matrix_to_Sound) {
 
 FORM (NEW_Matrix_to_Sound_mono, U"Matrix: To Sound (mono)", 0) {
 	INTEGER (rowNumber, U"Row number", U"1")
-	LABEL (U"", U"(negative values count from last row)")
+	LABEL (U"(negative values count from last row)")
 	OK
 DO
 	CONVERT_EACH (Matrix)
@@ -550,12 +533,9 @@ FORM (NEW1_Photo_create, U"Create Photo", U"Create Photo...") {
 	NATURAL (numberOfRows, U"Number of rows", U"1")
 	POSITIVE (dy, U"dy", U"1.0")
 	REAL (y1, U"y1", U"1.0")
-	LABEL (U"", U"Red formula:")
-	TEXTFIELD (redFormula, U"redFormula", U"x*y/100")
-	LABEL (U"", U"Green formula:")
-	TEXTFIELD (greenFormula, U"greenFormula", U"x*y/1000")
-	LABEL (U"", U"Blue formula:")
-	TEXTFIELD (blueFormula, U"blueFormula", U"x*y/100")
+	TEXTFIELD (redFormula, U"Red formula:", U"x*y/100")
+	TEXTFIELD (greenFormula, U"Green formula:", U"x*y/1000")
+	TEXTFIELD (blueFormula, U"Blue formula:", U"x*y/100")
 	OK
 DO
 	if (xmax < xmin)
@@ -576,12 +556,9 @@ FORM (NEW1_Photo_createSimple, U"Create simple Photo", U"Create simple Photo..."
 	WORD (name, U"Name", U"xy")
 	NATURAL (numberOfRows, U"Number of rows", U"10")
 	NATURAL (numberOfColumns, U"Number of columns", U"10")
-	LABEL (U"", U"Red formula:")
-	TEXTFIELD (redFormula, U"redFormula", U"x*y/100")
-	LABEL (U"", U"Green formula:")
-	TEXTFIELD (greenFormula, U"greenFormula", U"x*y/1000")
-	LABEL (U"", U"Blue formula:")
-	TEXTFIELD (blueFormula, U"blueFormula", U"x*y/100")
+	TEXTFIELD (redFormula, U"Red formula:", U"x*y/100")
+	TEXTFIELD (greenFormula, U"Green formula:", U"x*y/1000")
+	TEXTFIELD (blueFormula, U"Blue formula:", U"x*y/100")
 	OK
 DO
 	CREATE_ONE
@@ -617,9 +594,9 @@ DIRECT (NEW_Photo_extractTransparency) {
 }
 
 FORM (MODIFY_Photo_formula_red, U"Photo Formula (red)", U"Formula (red)...") {
-	LABEL (U"label", U"y := y1; for row := 1 to nrow do { x := x1; "
-		"for col := 1 to ncol do { self [row, col] := `formula' ; x := x + dx } y := y + dy }")
-	TEXTFIELD (formula, U"formula", U"self")
+	LABEL (U"y := y1; for row := 1 to nrow do { x := x1; "
+		"for col := 1 to ncol do { self [row, col] := `formula` ; x := x + dx } y := y + dy }")
+	TEXTFIELD (formula, U"Formula:", U"self")
 	OK
 DO
 	MODIFY_EACH_WEAK (Photo)
@@ -628,9 +605,9 @@ DO
 }
 
 FORM (MODIFY_Photo_formula_green, U"Photo Formula (green)", U"Formula (green)...") {
-	LABEL (U"label", U"y := y1; for row := 1 to nrow do { x := x1; "
-		"for col := 1 to ncol do { self [row, col] := `formula' ; x := x + dx } y := y + dy }")
-	TEXTFIELD (formula, U"formula", U"self")
+	LABEL (U"y := y1; for row := 1 to nrow do { x := x1; "
+		"for col := 1 to ncol do { self [row, col] := `formula` ; x := x + dx } y := y + dy }")
+	TEXTFIELD (formula, U"Formula:", U"self")
 	OK
 DO
 	MODIFY_EACH_WEAK (Photo)
@@ -639,9 +616,9 @@ DO
 }
 
 FORM (MODIFY_Photo_formula_blue, U"Photo Formula (blue)", U"Formula (blue)...") {
-	LABEL (U"label", U"y := y1; for row := 1 to nrow do { x := x1; "
-		"for col := 1 to ncol do { self [row, col] := `formula' ; x := x + dx } y := y + dy }")
-	TEXTFIELD (formula, U"formula", U"self")
+	LABEL (U"y := y1; for row := 1 to nrow do { x := x1; "
+		"for col := 1 to ncol do { self [row, col] := `formula` ; x := x + dx } y := y + dy }")
+	TEXTFIELD (formula, U"Formula:", U"self")
 	OK
 DO
 	MODIFY_EACH_WEAK (Photo)
@@ -650,9 +627,9 @@ DO
 }
 
 FORM (MODIFY_Photo_formula_transparency, U"Photo Formula (transparency)", U"Formula (transparency)...") {
-	LABEL (U"label", U"y := y1; for row := 1 to nrow do { x := x1; "
-		"for col := 1 to ncol do { self [row, col] := `formula' ; x := x + dx } y := y + dy }")
-	TEXTFIELD (formula, U"formula", U"self")
+	LABEL (U"y := y1; for row := 1 to nrow do { x := x1; "
+		"for col := 1 to ncol do { self [row, col] := `formula` ; x := x + dx } y := y + dy }")
+	TEXTFIELD (formula, U"Formula:", U"self")
 	OK
 DO
 	MODIFY_EACH_WEAK (Photo)
diff --git a/fon/praat_Sound.cpp b/fon/praat_Sound.cpp
index 336e88d..536db48 100644
--- a/fon/praat_Sound.cpp
+++ b/fon/praat_Sound.cpp
@@ -129,8 +129,7 @@ DO
 END }
 
 FORM (SAVE_LongSound_savePartAsAudioFile, U"LongSound: Save part as audio file", nullptr) {
-	LABEL (U"", U"Audio file:")
-	TEXTFIELD (audioFile, U"Audio file", U"")
+	TEXTFIELD (audioFile, U"Audio file:", U"")
 	RADIO (type, U"Type", 3)
 	{ int i; for (i = 1; i <= Melder_NUMBER_OF_AUDIO_FILE_TYPES; i ++) {
 		RADIOBUTTON (Melder_audioFileTypeString (i))
@@ -274,14 +273,14 @@ FORM_SAVE (SAVE_LongSound_saveRightChannelAsWavFile, U"Save right channel as WAV
 }
 
 FORM (PREFS_LongSoundPrefs, U"LongSound preferences", U"LongSound") {
-	LABEL (U"", U"This setting determines the maximum number of seconds")
-	LABEL (U"", U"for viewing the waveform and playing a sound in the LongSound window.")
-	LABEL (U"", U"The LongSound window can become very slow if you set it too high.")
+	LABEL (U"This setting determines the maximum number of seconds")
+	LABEL (U"for viewing the waveform and playing a sound in the LongSound window.")
+	LABEL (U"The LongSound window can become very slow if you set it too high.")
 	NATURAL (maximumViewablePart, U"Maximum viewable part (seconds)", U"60")
-	LABEL (U"", U"Note: this setting works for the next long sound file that you open,")
-	LABEL (U"", U"not for currently existing LongSound objects.")
+	LABEL (U"Note: this setting works for the next long sound file that you open,")
+	LABEL (U"not for currently existing LongSound objects.")
 OK
-	SET_INTEGER (U"Maximum viewable part", LongSound_getBufferSizePref_seconds ())
+	SET_INTEGER (maximumViewablePart, LongSound_getBufferSizePref_seconds ())
 DO
 	LongSound_setBufferSizePref_seconds (maximumViewablePart);
 END }
@@ -327,8 +326,8 @@ FORM_SAVE (SAVE_LongSound_Sound_saveAsWavFile, U"Save as WAV file", nullptr, U"w
 /********** SOUND **********/
 
 FORM (MODIFY_Sound_add, U"Sound: Add", nullptr) {
-	LABEL (U"", U"The following number will be added to the amplitudes of ")
-	LABEL (U"", U"all samples of the sound.")
+	LABEL (U"The following number will be added to the amplitudes of ")
+	LABEL (U"all samples of the sound.")
 	REAL (number, U"Number", U"0.1")
 	OK
 DO
@@ -502,8 +501,7 @@ FORM (NEW1_Sound_create, U"Create mono Sound", U"Create Sound from formula...")
 	REAL (startTime, U"Start time (s)", U"0.0")
 	REAL (endTime, U"End time (s)", U"1.0")
 	REAL (samplingFrequency, U"Sampling frequency (Hz)", U"44100")
-	LABEL (U"", U"Formula:")
-	TEXTFIELD (formula, U"formula", U"1/2 * sin(2*pi*377*x) + randomGauss(0,0.1)")
+	TEXTFIELD (formula, U"Formula:", U"1/2 * sin(2*pi*377*x) + randomGauss(0,0.1)")
 	OK
 DO
 	common_Sound_create (name, 1, startTime, endTime, samplingFrequency, formula, interpreter);
@@ -515,8 +513,7 @@ FORM (NEW1_Sound_createFromFormula, U"Create Sound from formula", U"Create Sound
 	REAL (startTime, U"Start time (s)", U"0.0")
 	REAL (endTime, U"End time (s)", U"1.0")
 	REAL (samplingFrequency, U"Sampling frequency (Hz)", U"44100")
-	LABEL (U"", U"Formula:")
-	TEXTFIELD (formula, U"formula", U"1/2 * sin(2*pi*377*x) + randomGauss(0,0.1)")
+	TEXTFIELD (formula, U"Formula:", U"1/2 * sin(2*pi*377*x) + randomGauss(0,0.1)")
 	OK
 DO
 	common_Sound_create (name, numberOfChannels, startTime, endTime, samplingFrequency, formula, interpreter);
@@ -628,7 +625,7 @@ FORM (GRAPHICS_Sound_draw, U"Sound: Draw", nullptr) {
 	REAL (fromAmplitude, U"left Amplitude range", U"0.0")
 	REAL (toAmplitude, U"right Amplitude range", U"0.0 (= auto)")
 	BOOLEAN (garnish, U"Garnish", true)
-	LABEL (U"", U"")
+	LABEL (U"")
 	OPTIONMENUSTR (drawingMethod, U"Drawing method", 1)
 		OPTION (U"Curve")
 		OPTION (U"Bars")
@@ -738,8 +735,8 @@ DO
 }
 
 FORM (NEW_Sound_filter_formula, U"Sound: Filter (formula)...", U"Formula...") {
-	LABEL (U"", U"Frequency-domain filtering with a formula (uses Sound-to-Spectrum and Spectrum-to-Sound): x is frequency in hertz")
-	TEXTFIELD (formula, U"formula", U"if x<500 or x>1000 then 0 else self fi; rectangular band filter")
+	LABEL (U"Frequency-domain filtering with a formula (uses Sound-to-Spectrum and Spectrum-to-Sound): x is frequency in hertz")
+	TEXTFIELD (formula, U"Formula:", U"if x<500 or x>1000 then 0 else self fi; rectangular band filter")
 	OK
 DO
 	CONVERT_EACH (Sound)
@@ -799,13 +796,13 @@ DO
 }
 
 FORM (MODIFY_Sound_formula, U"Sound: Formula", U"Sound: Formula...") {
-	LABEL (U"label1", U"! `x' is the time in seconds, `col' is the sample number.")
-	LABEL (U"label2", U"x = x1   ! time associated with first sample")
-	LABEL (U"label3", U"for col from 1 to ncol")
-	LABEL (U"label4", U"   self [col] = ...")
-	TEXTFIELD (formula, U"formula", U"self")
-	LABEL (U"label5", U"   x = x + dx")
-	LABEL (U"label6", U"endfor")
+	LABEL (U"# `x` is the time in seconds, `col` is the sample number.")
+	LABEL (U"x = x1   ! time associated with first sample")
+	LABEL (U"for col from 1 to ncol")
+	LABEL (U"   self [col] = ...")
+	TEXTFIELD (formula, nullptr, U"self")
+	LABEL (U"   x = x + dx")
+	LABEL (U"endfor")
 	OK
 DO
 	MODIFY_EACH_WEAK (Sound)
@@ -818,7 +815,7 @@ FORM (MODIFY_Sound_formula_part, U"Sound: Formula (part)", U"Sound: Formula...")
 	REAL (toTime, U"To time", U"0.0 (= all)")
 	NATURAL (fromChannel, U"From channel", U"1")
 	NATURAL (toChannel, U"To channel", U"2")
-	TEXTFIELD (formula, U"formula", U"2 * self")
+	TEXTFIELD (formula, U"Formula:", U"2 * self")
 	OK
 DO
 	MODIFY_EACH_WEAK (Sound)
@@ -1448,7 +1445,7 @@ FORM (NEW_Sound_to_Cochleagram_edb, U"Sound: To Cochleagram (De Boer, Meddis & H
 	POSITIVE (timeStep, U"Time step (s)", U"0.01")
 	POSITIVE (frequencyResolution, U"Frequency resolution (Bark)", U"0.1")
 	BOOLEAN (hasSynapse, U"Has synapse", true)
-	LABEL (U"", U"Meddis synapse properties")
+	LABEL (U"Meddis synapse properties")
 	POSITIVE (replenishmentRate, U"   replenishment rate (/sec)", U"5.05")
 	POSITIVE (lossRate, U"   loss rate (/sec)", U"2500.0")
 	POSITIVE (returnRate, U"   return rate (/sec)", U"6580.0")
@@ -1638,12 +1635,12 @@ DO
 }
 
 FORM (NEW_Sound_to_Pitch_ac, U"Sound: To Pitch (ac)", U"Sound: To Pitch (ac)...") {
-	LABEL (U"", U"Finding the candidates")
+	LABEL (U"Finding the candidates")
 	REAL (timeStep, U"Time step (s)", U"0.0 (= auto)")
 	POSITIVE (pitchFloor, U"Pitch floor (Hz)", U"75.0")
 	NATURAL (maximumNumberOfCandidates, U"Max. number of candidates", U"15")
 	BOOLEAN (veryAccurate, U"Very accurate", false)
-	LABEL (U"", U"Finding a path")
+	LABEL (U"Finding a path")
 	REAL (silenceThreshold, U"Silence threshold", U"0.03")
 	REAL (voicingThreshold, U"Voicing threshold", U"0.45")
 	REAL (octaveCost, U"Octave cost", U"0.01")
@@ -1662,12 +1659,12 @@ DO
 }
 
 FORM (NEW_Sound_to_Pitch_cc, U"Sound: To Pitch (cc)", U"Sound: To Pitch (cc)...") {
-	LABEL (U"", U"Finding the candidates")
+	LABEL (U"Finding the candidates")
 	REAL (timeStep, U"Time step (s)", U"0.0 (= auto)")
 	POSITIVE (pitchFloor, U"Pitch floor (Hz)", U"75.0")
 	NATURAL (maximumNumberOfCandidates, U"Max. number of candidates", U"15")
 	BOOLEAN (veryAccurate, U"Very accurate", false)
-	LABEL (U"", U"Finding a path")
+	LABEL (U"Finding a path")
 	REAL (silenceThreshold, U"Silence threshold", U"0.03")
 	REAL (voicingThreshold, U"Voicing threshold", U"0.45")
 	REAL (octaveCost, U"Octave cost", U"0.01")
@@ -1676,8 +1673,7 @@ FORM (NEW_Sound_to_Pitch_cc, U"Sound: To Pitch (cc)", U"Sound: To Pitch (cc)..."
 	POSITIVE (pitchCeiling, U"Pitch ceiling (Hz)", U"600.0")
 	OK
 DO
-	long maxnCandidates = GET_INTEGER (U"Max. number of candidates");
-	if (maxnCandidates <= 1) Melder_throw (U"Maximum number of candidates must be greater than 1.");
+	if (maximumNumberOfCandidates <= 1) Melder_throw (U"Youraximum number of candidates should be greater than 1.");
 	CONVERT_EACH (Sound)
 		autoPitch result = Sound_to_Pitch_cc (me, timeStep,
 			pitchFloor, 1.0, maximumNumberOfCandidates, veryAccurate,
@@ -1798,8 +1794,8 @@ FORM (PREFS_SoundInputPrefs, U"Sound recording preferences", U"SoundRecorder") {
 	NATURAL (bufferSize, U"Buffer size (MB)", U"60")
 	OPTIONMENU_ENUM (inputSoundSystem, U"Input sound system", kMelder_inputSoundSystem, DEFAULT)
 OK
-	SET_INTEGER (U"Buffer size", SoundRecorder_getBufferSizePref_MB ())
-	SET_ENUM (U"Input sound system", kMelder_inputSoundSystem, MelderAudio_getInputSoundSystem())
+	SET_INTEGER (bufferSize, SoundRecorder_getBufferSizePref_MB ())
+	SET_ENUM (inputSoundSystem, kMelder_inputSoundSystem, MelderAudio_getInputSoundSystem())
 DO
 	if (bufferSize > 1000) Melder_throw (U"Buffer size cannot exceed 1000 megabytes.");
 	SoundRecorder_setBufferSizePref_MB (bufferSize);
@@ -1807,9 +1803,9 @@ DO
 END }
 
 FORM (PREFS_SoundOutputPrefs, U"Sound playing preferences", nullptr) {
-	LABEL (U"", U"The following determines how sounds are played.")
-	LABEL (U"", U"Between parentheses, you find what you can do simultaneously.")
-	LABEL (U"", U"Decrease asynchronicity if sound plays with discontinuities.")
+	LABEL (U"The following determines how sounds are played.")
+	LABEL (U"Between parentheses, you find what you can do simultaneously.")
+	LABEL (U"Decrease asynchronicity if sound plays with discontinuities.")
 	OPTIONMENU_ENUM (maximumAsynchronicity, U"Maximum asynchronicity", kMelder_asynchronicityLevel, DEFAULT)
 	#define xstr(s) str(s)
 	#define str(s) #s
@@ -1817,10 +1813,10 @@ FORM (PREFS_SoundOutputPrefs, U"Sound playing preferences", nullptr) {
 	REAL (silenceAfter, U"Silence after (s)", U"" xstr (kMelderAudio_outputSilenceAfter_DEFAULT))
 	OPTIONMENU_ENUM (outputSoundSystem, U"Output sound system", kMelder_outputSoundSystem, DEFAULT)
 OK
-	SET_ENUM (U"Maximum asynchronicity", kMelder_asynchronicityLevel, MelderAudio_getOutputMaximumAsynchronicity ())
-	SET_REAL (U"Silence before", MelderAudio_getOutputSilenceBefore ())
-	SET_REAL (U"Silence after", MelderAudio_getOutputSilenceAfter ())
-	SET_ENUM (U"Output sound system", kMelder_outputSoundSystem, MelderAudio_getOutputSoundSystem())
+	SET_ENUM (maximumAsynchronicity, kMelder_asynchronicityLevel, MelderAudio_getOutputMaximumAsynchronicity ())
+	SET_REAL (silenceBefore, MelderAudio_getOutputSilenceBefore ())
+	SET_REAL (silenceAfter, MelderAudio_getOutputSilenceAfter ())
+	SET_ENUM (outputSoundSystem, kMelder_outputSoundSystem, MelderAudio_getOutputSoundSystem())
 DO
 	MelderAudio_stopPlaying (MelderAudio_IMPLICIT);
 	MelderAudio_setOutputMaximumAsynchronicity ((kMelder_asynchronicityLevel) maximumAsynchronicity);
diff --git a/fon/praat_TextGrid_init.cpp b/fon/praat_TextGrid_init.cpp
index b6abdf8..506d60e 100644
--- a/fon/praat_TextGrid_init.cpp
+++ b/fon/praat_TextGrid_init.cpp
@@ -1,6 +1,6 @@
 /* praat_TextGrid_init.cpp
  *
- * Copyright (C) 1992-2012,2014,2015,2016 Paul Boersma
+ * Copyright (C) 1992-2012,2014,2015,2016,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -209,7 +209,7 @@ DO
 FORM (GRAPHICS_TextGrid_Pitch_drawSemitones, U"TextGrid & Pitch: Draw semitones", nullptr) {
 	INTEGER (tierNumber, STRING_TIER_NUMBER, U"1")
 	praat_TimeFunction_RANGE (fromTime, toTime)
-	LABEL (U"", U"Range in semitones re 100 hertz:")
+	LABEL (U"Range in semitones re 100 hertz:")
 	REAL (fromFrequency, U"left Frequency range (st)", U"-12.0")
 	REAL (toFrequency, U"right Frequency range (st)", U"30.0")
 	INTEGER (fontSize, U"Font size (points)", U"18")
@@ -286,7 +286,7 @@ DO
 
 FORM (GRAPHICS_TextGrid_Pitch_drawSeparatelySemitones, U"TextGrid & Pitch: Draw separately semitones", nullptr) {
 	praat_TimeFunction_RANGE (fromTime, toTime)
-	LABEL (U"", U"Range in semitones re 100 hertz:")
+	LABEL (U"Range in semitones re 100 hertz:")
 	REAL (fromFrequency, U"left Frequency range (st)", U"-12.0")
 	REAL (toFrequency, U"right Frequency range (st)", U"30.0")
 	BOOLEAN (showBoundaries, U"Show boundaries", true)
@@ -367,7 +367,7 @@ DO
 FORM (GRAPHICS_TextGrid_Pitch_speckleSemitones, U"TextGrid & Pitch: Speckle semitones", nullptr) {
 	INTEGER (tierNumber, STRING_TIER_NUMBER, U"1")
 	praat_TimeFunction_RANGE (fromTime, toTime)
-	LABEL (U"", U"Range in semitones re 100 hertz:")
+	LABEL (U"Range in semitones re 100 hertz:")
 	REAL (fromFrequency, U"left Frequency range (st)", U"-12.0")
 	REAL (toFrequency, U"right Frequency range (st)", U"30.0")
 	BOOLEAN (showBoundaries, U"Show boundaries", true)
@@ -443,7 +443,7 @@ DO
 
 FORM (GRAPHICS_TextGrid_Pitch_speckleSeparatelySemitones, U"TextGrid & Pitch: Speckle separately semitones", nullptr) {
 	praat_TimeFunction_RANGE (fromTime, toTime)
-	LABEL (U"", U"Range in semitones re 100 hertz:")
+	LABEL (U"Range in semitones re 100 hertz:")
 	REAL (fromFrequency, U"left Frequency range (st)", U"-12.0")
 	REAL (toFrequency, U"right Frequency range (st)", U"30.0")
 	BOOLEAN (showBoundaries, U"Show boundaries", true)
@@ -560,36 +560,36 @@ DO
 }
 
 FORM (WINDOW_SpellingChecker_viewAndEdit, U"Edit spelling checker", U"SpellingChecker") {
-	LABEL (U"", U"-- Syntax --")
+	LABEL (U"-- Syntax --")
 	SENTENCE (forbiddenStrings, U"Forbidden strings", U"")
 	BOOLEAN (checkMatchingParentheses, U"Check matching parentheses", false)
 	SENTENCE (separatingCharacters, U"Separating characters", U"")
 	BOOLEAN (allowAllParenthesized, U"Allow all parenthesized", false)
-	LABEL (U"", U"-- Capitals --")
+	LABEL (U"-- Capitals --")
 	BOOLEAN (allowAllNames, U"Allow all names", false)
 	SENTENCE (namePrefixes, U"Name prefixes", U"")
 	BOOLEAN (allowAllAbbreviations, U"Allow all abbreviations", false)
-	LABEL (U"", U"-- Capitalization --")
+	LABEL (U"-- Capitalization --")
 	BOOLEAN (allowCapsSentenceInitially, U"Allow caps sentence-initially", false)
 	BOOLEAN (allowCapsAfterColon, U"Allow caps after colon", false)
-	LABEL (U"", U"-- Word parts --")
+	LABEL (U"-- Word parts --")
 	SENTENCE (allowAllWordsContaining, U"Allow all words containing", U"")
 	SENTENCE (allowAllWordsStartingWith, U"Allow all words starting with", U"")
 	SENTENCE (allowAllWordsEndingIn, U"Allow all words ending in", U"")
 OK
 	FIND_ONE (SpellingChecker)
-		SET_STRING (U"Forbidden strings", my forbiddenStrings)
-		SET_INTEGER (U"Check matching parentheses", my checkMatchingParentheses)
-		SET_STRING (U"Separating characters", my separatingCharacters)
-		SET_INTEGER (U"Allow all parenthesized", my allowAllParenthesized)
-		SET_INTEGER (U"Allow all names", my allowAllNames)
-		SET_STRING (U"Name prefixes", my namePrefixes)
-		SET_INTEGER (U"Allow all abbreviations", my allowAllAbbreviations)
-		SET_INTEGER (U"Allow caps sentence-initially", my allowCapsSentenceInitially)
-		SET_INTEGER (U"Allow caps after colon", my allowCapsAfterColon)
-		SET_STRING (U"Allow all words containing", my allowAllWordsContaining)
-		SET_STRING (U"Allow all words starting with", my allowAllWordsStartingWith)
-		SET_STRING (U"Allow all words ending in", my allowAllWordsEndingIn)
+		SET_STRING (forbiddenStrings, my forbiddenStrings)
+		SET_BOOLEAN (checkMatchingParentheses, my checkMatchingParentheses)
+		SET_STRING (separatingCharacters, my separatingCharacters)
+		SET_BOOLEAN (allowAllParenthesized, my allowAllParenthesized)
+		SET_BOOLEAN (allowAllNames, my allowAllNames)
+		SET_STRING (namePrefixes, my namePrefixes)
+		SET_BOOLEAN (allowAllAbbreviations, my allowAllAbbreviations)
+		SET_BOOLEAN (allowCapsSentenceInitially, my allowCapsSentenceInitially)
+		SET_BOOLEAN (allowCapsAfterColon, my allowCapsAfterColon)
+		SET_STRING (allowAllWordsContaining, my allowAllWordsContaining)
+		SET_STRING (allowAllWordsStartingWith, my allowAllWordsStartingWith)
+		SET_STRING (allowAllWordsEndingIn, my allowAllWordsEndingIn)
 DO
 	MODIFY_EACH (SpellingChecker)
 		Melder_free (my forbiddenStrings); my forbiddenStrings = Melder_dup_f (forbiddenStrings);
@@ -629,8 +629,7 @@ DO
 }
 
 FORM (STRING_SpellingChecker_nextNotAllowedWord, U"Next not allowed word?", U"SpellingChecker") {
-	LABEL (U"", U"Sentence:")
-	TEXTFIELD (sentence, U"sentence", U"")
+	TEXTFIELD (sentence, U"Sentence:", U"")
 	INTEGER (startingCharacter, U"Starting character", U"0")
 	OK
 DO
@@ -1240,8 +1239,7 @@ DO
 FORM (MODIFY_TextGrid_setIntervalText, U"TextGrid: Set interval text", nullptr) {
 	NATURAL (tierNumber, STRING_TIER_NUMBER, U"1")
 	NATURAL (intervalNumber, STRING_INTERVAL_NUMBER, U"1")
-	LABEL (U"", U"Text:")
-	TEXTFIELD (text, U"text", U"")
+	TEXTFIELD (text, U"Text:", U"")
 	OK
 DO
 	MODIFY_EACH (TextGrid)
@@ -1252,8 +1250,7 @@ DO
 FORM (MODIFY_TextGrid_insertPoint, U"TextGrid: Insert point", nullptr) {
 	NATURAL (tierNumber, STRING_TIER_NUMBER, U"1")
 	REAL (time, U"Time (s)", U"0.5")
-	LABEL (U"", U"Text:")
-	TEXTFIELD (text, U"text", U"")
+	TEXTFIELD (text, U"Text:", U"")
 	OK
 DO
 	MODIFY_EACH (TextGrid)
@@ -1296,8 +1293,7 @@ DO
 FORM (MODIFY_TextGrid_setPointText, U"TextGrid: Set point text", nullptr) {
 	NATURAL (tierNumber, STRING_TIER_NUMBER, U"1")
 	NATURAL (pointNumber, STRING_POINT_NUMBER, U"1")
-	LABEL (U"", U"Text:")
-	TEXTFIELD (text, U"text", U"")
+	TEXTFIELD (text, U"Text:", U"")
 	OK
 DO
 	MODIFY_EACH (TextGrid)
diff --git a/fon/praat_Tiers.cpp b/fon/praat_Tiers.cpp
index 425ad6d..810aedd 100644
--- a/fon/praat_Tiers.cpp
+++ b/fon/praat_Tiers.cpp
@@ -169,13 +169,13 @@ DO
 }
 
 FORM (MODIFY_AmplitudeTier_formula, U"AmplitudeTier: Formula", U"AmplitudeTier: Formula...") {
-	LABEL (U"", U"# ncol = the number of points")
-	LABEL (U"", U"for col from 1 to ncol")
-	LABEL (U"", U"   # x = the time of the colth point, in seconds")
-	LABEL (U"", U"   # self = the value of the colth point, in Pascal")
-	LABEL (U"", U"   self = `formula'")
-	LABEL (U"", U"endfor")
-	TEXTFIELD (formula, U"formula", U"- self ; upside down")
+	LABEL (U"# ncol = the number of points")
+	LABEL (U"for col from 1 to ncol")
+	LABEL (U"   # x = the time of the colth point, in seconds")
+	LABEL (U"   # self = the value of the colth point, in Pascal")
+	LABEL (U"   self = `formula'")
+	LABEL (U"endfor")
+	TEXTFIELD (formula, U"Formula:", U"- self ; upside down")
 	OK
 DO
 	MODIFY_EACH_WEAK (AmplitudeTier)
@@ -316,13 +316,13 @@ DO
 }
 
 FORM (MODIFY_DurationTier_formula, U"DurationTier: Formula", U"DurationTier: Formula...") {
-	LABEL (U"", U"# ncol = the number of points")
-	LABEL (U"", U"for col from 1 to ncol")
-	LABEL (U"", U"   # x = the time of the colth point, in seconds")
-	LABEL (U"", U"   # self = the value of the colth point, in relative units")
-	LABEL (U"", U"   self = `formula'")
-	LABEL (U"", U"endfor")
-	TEXTFIELD (formula, U"formula", U"self * 1.5 ; slow down")
+	LABEL (U"# ncol = the number of points")
+	LABEL (U"for col from 1 to ncol")
+	LABEL (U"   # x = the time of the colth point, in seconds")
+	LABEL (U"   # self = the value of the colth point, in relative units")
+	LABEL (U"   self = `formula'")
+	LABEL (U"endfor")
+	TEXTFIELD (formula, U"Formula:", U"self * 1.5 ; slow down")
 	OK
 DO
 	MODIFY_EACH_WEAK (DurationTier)
@@ -392,8 +392,9 @@ DIRECT (WINDOW_FormantGrid_edit) {
 // MARK: Modify
 
 FORM (MODIFY_FormantGrid_formula_frequencies, U"FormantGrid: Formula (frequencies)", U"Formant: Formula (frequencies)...") {
-	LABEL (U"", U"row is formant number, col is point number: for row from 1 to nrow do for col from 1 to ncol do F (row, col) :=")
-	TEXTFIELD (formula, U"formula", U"if row = 2 then self + 200 else self fi")
+	LABEL (U"row is formant number, col is point number:")
+	LABEL (U"   for row from 1 to nrow do for col from 1 to ncol do F (row, col) :=")
+	TEXTFIELD (formula, U"Formula:", U"if row = 2 then self + 200 else self fi")
 	OK
 DO
 	MODIFY_EACH_WEAK (FormantGrid)
@@ -402,9 +403,10 @@ DO
 }
 
 FORM (MODIFY_FormantGrid_formula_bandwidths, U"FormantGrid: Formula (bandwidths)", U"Formant: Formula (bandwidths)...") {
-	LABEL (U"", U"row is formant number, col is point number: for row from 1 to nrow do for col from 1 to ncol do B (row, col) :=")
-	LABEL (U"", U"self [] is the FormantGrid itself, so it returns frequencies, not bandwidths!")
-	TEXTFIELD (formula, U"formula", U"self / 10 ; one tenth of the formant frequency")
+	LABEL (U"row is formant number, col is point number:")
+	LABEL (U"   for row from 1 to nrow do for col from 1 to ncol do B (row, col) :=")
+	LABEL (U"self [] is the FormantGrid itself, so it returns frequencies, not bandwidths!")
+	TEXTFIELD (formula, U"Formula:", U"self / 10 ; one tenth of the formant frequency")
 	OK
 DO
 	MODIFY_EACH_WEAK (FormantGrid)
@@ -539,8 +541,7 @@ DO
 
 FORM (MODIFY_FormantTier_addPoint, U"Add one point", U"FormantTier: Add point...") {
 	REAL (time, U"Time (s)", U"0.5")
-	LABEL (U"", U"Frequencies and bandwidths (Hz):")
-	TEXTFIELD (formantBandwidthPairs, U"fb pairs", U"500 50 1500 100 2500 150 3500 200 4500 300")
+	TEXTFIELD (formantBandwidthPairs, U"Frequencies and bandwidths (Hz):", U"500 50 1500 100 2500 150 3500 200 4500 300")
 	OK
 DO
 	autoFormantPoint point = FormantPoint_create (time);
@@ -656,13 +657,13 @@ DO
 }
 
 FORM (MODIFY_IntensityTier_formula, U"IntensityTier: Formula", U"IntensityTier: Formula...") {
-	LABEL (U"", U"# ncol = the number of points")
-	LABEL (U"", U"for col from 1 to ncol")
-	LABEL (U"", U"   # x = the time of the colth point, in seconds")
-	LABEL (U"", U"   # self = the value of the colth point, in dB")
-	LABEL (U"", U"   self = `formula'")
-	LABEL (U"", U"endfor")
-	TEXTFIELD (formula, U"formula", U"self + 3.0")
+	LABEL (U"# ncol = the number of points")
+	LABEL (U"for col from 1 to ncol")
+	LABEL (U"   # x = the time of the colth point, in seconds")
+	LABEL (U"   # self = the value of the colth point, in dB")
+	LABEL (U"   self = `formula`")
+	LABEL (U"endfor")
+	TEXTFIELD (formula, U"Formula:", U"self + 3.0")
 	OK
 DO
 	MODIFY_EACH_WEAK (IntensityTier)
@@ -776,7 +777,7 @@ FORM (GRAPHICS_PitchTier_draw, U"PitchTier: Draw", nullptr) {
 	REAL (fromFrequency, U"left Frequency range (Hz)", U"0.0")
 	POSITIVE (toFrequency, U"right Frequency range (Hz)", U"500.0")
 	BOOLEAN (garnish, U"Garnish", true)
-	LABEL (U"", U"")
+	LABEL (U"")
 	OPTIONMENUSTR (drawingMethod, U"Drawing method", 1)
 		OPTION (U"lines")
 		OPTION (U"speckles")
@@ -800,13 +801,13 @@ DIRECT (WINDOW_PitchTier_viewAndEdit) {
 }
 
 FORM (MODIFY_PitchTier_formula, U"PitchTier: Formula", U"PitchTier: Formula...") {
-	LABEL (U"", U"# ncol = the number of points")
-	LABEL (U"", U"for col from 1 to ncol")
-	LABEL (U"", U"   # x = the time of the colth point, in seconds")
-	LABEL (U"", U"   # self = the value of the colth point, in hertz")
-	LABEL (U"", U"   self = `formula'")
-	LABEL (U"", U"endfor")
-	TEXTFIELD (formula, U"formula", U"self * 2 ; one octave up")
+	LABEL (U"# ncol = the number of points")
+	LABEL (U"for col from 1 to ncol")
+	LABEL (U"   # x = the time of the colth point, in seconds")
+	LABEL (U"   # self = the value of the colth point, in hertz")
+	LABEL (U"   self = `formula`")
+	LABEL (U"endfor")
+	TEXTFIELD (formula, U"Formula:", U"self * 2 ; one octave up")
 	OK
 DO
 	MODIFY_EACH_WEAK (PitchTier)
@@ -1038,12 +1039,11 @@ DO
 }
 
 FORM (MODIFY_PointProcess_addPoints, U"PointProcess: Add points", U"PointProcess: Add point...") {
-	LABEL (U"", U"Times:")
-	NUMVEC (times, U"times", U"{ 0.1, 0.2, 0.5 }")
+	NUMVEC (times, U"Times:", U"{ 0.1, 0.2, 0.5 }")
 	OK
 DO
 	MODIFY_EACH (PointProcess)
-		PointProcess_addPoints (me, times.get());
+		PointProcess_addPoints (me, times);
 	MODIFY_EACH_END
 }
 
@@ -1595,7 +1595,7 @@ FORM (GRAPHICS_SpectrumTier_draw, U"SpectrumTier: Draw", nullptr) {
 	REAL (fromPower, U"left Power range (dB)", U"20.0")
 	REAL (toPower, U"right Power range (dB)", U"80.0")
 	BOOLEAN (garnish, U"Garnish", true)
-	LABEL (U"", U"")
+	LABEL (U"")
 	OPTIONMENUSTR (drawingMethod, U"Drawing method", 1)
 		OPTION (U"lines")
 		OPTION (U"speckles")
diff --git a/gram/Network_def.h b/gram/Network_def.h
index d7c6daa..5365ed0 100644
--- a/gram/Network_def.h
+++ b/gram/Network_def.h
@@ -36,8 +36,8 @@ oo_END_STRUCT (NetworkNode)
 #define ooSTRUCT NetworkConnection
 oo_DEFINE_STRUCT (NetworkConnection)
 
-	oo_LONG (nodeFrom)
-	oo_LONG (nodeTo)
+	oo_INTEGER (nodeFrom)
+	oo_INTEGER (nodeTo)
 	oo_DOUBLE (weight)
 	oo_FROM (1)
 		oo_DOUBLE (plasticity)
@@ -95,9 +95,9 @@ oo_DEFINE_CLASS (Network, Daata)
 	oo_DOUBLE (xmax)
 	oo_DOUBLE (ymin)
 	oo_DOUBLE (ymax)
-	oo_LONG (numberOfNodes)
+	oo_INTEGER (numberOfNodes)
 	oo_STRUCT_VECTOR (NetworkNode, nodes, numberOfNodes)
-	oo_LONG (numberOfConnections)
+	oo_INTEGER (numberOfConnections)
 	oo_STRUCT_VECTOR (NetworkConnection, connections, numberOfConnections)
 
 	#if oo_DECLARING
diff --git a/gram/OTGrammar.cpp b/gram/OTGrammar.cpp
index 377c5ff..aa2825f 100644
--- a/gram/OTGrammar.cpp
+++ b/gram/OTGrammar.cpp
@@ -160,10 +160,9 @@ void structOTGrammar :: v_writeText (MelderFile file) {
 }
 
 void OTGrammar_checkIndex (OTGrammar me) {
-	int icons;
 	if (my index) return;
-	my index = NUMvector <long> (1, my numberOfConstraints);
-	for (icons = 1; icons <= my numberOfConstraints; icons ++) my index [icons] = icons;
+	my index = NUMvector <integer> (1, my numberOfConstraints);
+	for (integer icons = 1; icons <= my numberOfConstraints; icons ++) my index [icons] = icons;
 	OTGrammar_sort (me);
 }
 
@@ -302,7 +301,7 @@ static OTGrammar constraintCompare_grammar;
 
 static int constraintCompare (const void *first, const void *second) {
 	OTGrammar me = constraintCompare_grammar;
-	long icons = * (long *) first, jcons = * (long *) second;
+	integer icons = * (integer *) first, jcons = * (integer *) second;
 	OTGrammarConstraint ci = & my constraints [icons], cj = & my constraints [jcons];
 	/*
 	 * Sort primarily by disharmony.
@@ -317,7 +316,7 @@ static int constraintCompare (const void *first, const void *second) {
 
 void OTGrammar_sort (OTGrammar me) {
 	constraintCompare_grammar = me;
-	qsort (& my index [1], my numberOfConstraints, sizeof (long), constraintCompare);
+	qsort (& my index [1], my numberOfConstraints, sizeof (integer), constraintCompare);
 	for (long icons = 1; icons <= my numberOfConstraints; icons ++) {
 		OTGrammarConstraint constraint = & my constraints [my index [icons]];
 		constraint -> tiedToTheLeft = icons > 1 &&
diff --git a/gram/OTGrammar.h b/gram/OTGrammar.h
index 6c202dc..4b86847 100644
--- a/gram/OTGrammar.h
+++ b/gram/OTGrammar.h
@@ -125,8 +125,12 @@ void OTGrammar_checkIndex (OTGrammar me);
 autoOTGrammar OTGrammar_create_NoCoda_grammar ();
 autoOTGrammar OTGrammar_create_NPA_grammar ();
 autoPairDistribution OTGrammar_create_NPA_distribution ();
-autoOTGrammar OTGrammar_create_tongueRoot_grammar (int small_large, int equal_random_infant_Wolof);
-autoOTGrammar OTGrammar_create_metrics (int equal_footForm_wsp,
+autoOTGrammar OTGrammar_create_tongueRoot_grammar (
+	kOTGrammar_createTongueRootGrammar_constraintSet small_large,
+	kOTGrammar_createTongueRootGrammar_ranking equal_random_infant_Wolof
+);
+autoOTGrammar OTGrammar_create_metrics (
+	kOTGrammar_createMetricsGrammar_initialRanking equal_footForm_wsp,
 	int trochaicityConstraint, int includeFootBimoraic, int includeFootBisyllabic,
 	int includePeripheral, int nonfinalityConstraint, int overtFormsHaveSecondaryStress, int includeClashAndLapse, int includeCodas);
 	/* T&S: 1, false, false, false, 1, true, false, false */
diff --git a/gram/OTGrammarEditor.cpp b/gram/OTGrammarEditor.cpp
index 4510962..ba3055d 100644
--- a/gram/OTGrammarEditor.cpp
+++ b/gram/OTGrammarEditor.cpp
@@ -29,11 +29,11 @@ Thing_implement (OTGrammarEditor, HyperPage, 0);
 
 static void menu_cb_evaluate (OTGrammarEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Evaluate", nullptr)
-		REAL (U"Noise", U"2.0")
+		REAL (noise, U"Noise", U"2.0")
 	EDITOR_OK
 	EDITOR_DO
 		Editor_save (me, U"Evaluate");
-		OTGrammar_newDisharmonies ((OTGrammar) my data, GET_REAL (U"Noise"));
+		OTGrammar_newDisharmonies ((OTGrammar) my data, noise);
 		Graphics_updateWs (my graphics.get());
 		Editor_broadcastDataChanged (me);
 	EDITOR_END
@@ -62,27 +62,27 @@ static void menu_cb_evaluate_zeroNoise (OTGrammarEditor me, EDITOR_ARGS_DIRECT)
 
 static void menu_cb_editConstraint (OTGrammarEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Edit constraint", nullptr)
-		LABEL (U"constraint", U"");
-		REAL (U"Ranking value", U"100.0");
-		REAL (U"Disharmony", U"100.0");
-		REAL (U"Plasticity", U"1.0");
+		MUTABLE_LABEL (constraintLabel, U"");
+		REAL (rankingValue, U"Ranking value", U"100.0");
+		REAL (disharmony, U"Disharmony", U"100.0");
+		REAL (plasticity, U"Plasticity", U"1.0");
 	EDITOR_OK
 		OTGrammar ot = (OTGrammar) my data;
 		OTGrammarConstraint constraint;
 		if (my selected < 1 || my selected > ot -> numberOfConstraints)
 			Melder_throw (U"Select a constraint first.");
 		constraint = & ot -> constraints [ot -> index [my selected]];
-		SET_STRING (U"constraint", constraint -> name)
-		SET_REAL (U"Ranking value", constraint -> ranking)
-		SET_REAL (U"Disharmony", constraint -> disharmony)
-		SET_REAL (U"Plasticity", constraint -> plasticity)
+		SET_STRING (constraintLabel, constraint -> name)
+		SET_REAL (rankingValue, constraint -> ranking)
+		SET_REAL (disharmony, constraint -> disharmony)
+		SET_REAL (plasticity, constraint -> plasticity)
 	EDITOR_DO
 		OTGrammar ot = (OTGrammar) my data;
 		OTGrammarConstraint constraint = & ot -> constraints [ot -> index [my selected]];
 		Editor_save (me, U"Edit constraint");
-		constraint -> ranking = GET_REAL (U"Ranking value");
-		constraint -> disharmony = GET_REAL (U"Disharmony");
-		constraint -> plasticity = GET_REAL (U"Plasticity");
+		constraint -> ranking = rankingValue;
+		constraint -> disharmony = disharmony;
+		constraint -> plasticity = plasticity;
 		OTGrammar_sort (ot);
 		Graphics_updateWs (my graphics.get());
 		Editor_broadcastDataChanged (me);
@@ -91,21 +91,21 @@ static void menu_cb_editConstraint (OTGrammarEditor me, EDITOR_ARGS_FORM) {
 
 static void menu_cb_learnOne (OTGrammarEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Learn one", U"OTGrammar: Learn one...")
-		LABEL (U"", U"Underlying form:")
-		SENTENCE (U"Input string", U"")
-		LABEL (U"", U"Adult surface form:")
-		SENTENCE (U"Output string", U"")
-		REAL (U"Evaluation noise", U"2.0")
-		OPTIONMENU_ENUM (U"Update rule", kOTGrammar_rerankingStrategy, kOTGrammar_rerankingStrategy::SYMMETRIC_ALL)
-		REAL (U"Plasticity", U"0.1")
-		REAL (U"Rel. plasticity spreading", U"0.1")
-		BOOLEAN (U"Honour local rankings", 1)
+		LABEL (U"Underlying form:")
+		SENTENCE (inputString, U"Input string", U"")
+		LABEL (U"Adult surface form:")
+		SENTENCE (outputString, U"Output string", U"")
+		REAL (evaluationNoise, U"Evaluation noise", U"2.0")
+		OPTIONMENU_ENUM (updateRule, U"Update rule", kOTGrammar_rerankingStrategy, kOTGrammar_rerankingStrategy::SYMMETRIC_ALL)
+		REAL (plasticity, U"Plasticity", U"0.1")
+		REAL (relativePlasticitySpreading, U"Rel. plasticity spreading", U"0.1")
+		BOOLEAN (honourLocalRankings, U"Honour local rankings", true)
 	EDITOR_OK
 	EDITOR_DO
 		Editor_save (me, U"Learn one");
-		OTGrammar_learnOne ((OTGrammar) my data, GET_STRING (U"Input string"), GET_STRING (U"Output string"),
-			GET_REAL (U"Evaluation noise"), GET_ENUM (kOTGrammar_rerankingStrategy, U"Update rule"), GET_INTEGER (U"Honour local rankings"),
-			GET_REAL (U"Plasticity"), GET_REAL (U"Rel. plasticity spreading"), true, true, nullptr);
+		OTGrammar_learnOne ((OTGrammar) my data, inputString, outputString,
+			evaluationNoise, updateRule, honourLocalRankings,
+			plasticity, relativePlasticitySpreading, true, true, nullptr);
 		OTGrammar_sort ((OTGrammar) my data);
 		Graphics_updateWs (my graphics.get());
 		Editor_broadcastDataChanged (me);
@@ -114,20 +114,20 @@ static void menu_cb_learnOne (OTGrammarEditor me, EDITOR_ARGS_FORM) {
 
 static void menu_cb_learnOneFromPartialOutput (OTGrammarEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Learn one from partial adult output", nullptr)
-		LABEL (U"", U"Partial adult surface form (e.g. overt form):")
-		SENTENCE (U"Partial output", U"")
-		REAL (U"Evaluation noise", U"2.0")
-		OPTIONMENU_ENUM (U"Update rule", kOTGrammar_rerankingStrategy, kOTGrammar_rerankingStrategy::SYMMETRIC_ALL)
-		REAL (U"Plasticity", U"0.1")
-		REAL (U"Rel. plasticity spreading", U"0.1")
-		BOOLEAN (U"Honour local rankings", 1)
-		NATURAL (U"Number of chews", U"1")
+		LABEL (U"Partial adult surface form (e.g. overt form):")
+		SENTENCE (partialOutput, U"Partial output", U"")
+		REAL (evaluationNoise, U"Evaluation noise", U"2.0")
+		OPTIONMENU_ENUM (updateRule, U"Update rule", kOTGrammar_rerankingStrategy, kOTGrammar_rerankingStrategy::SYMMETRIC_ALL)
+		REAL (plasticity, U"Plasticity", U"0.1")
+		REAL (relativePlasticitySpreading, U"Rel. plasticity spreading", U"0.1")
+		BOOLEAN (honourLocalRankings, U"Honour local rankings", true)
+		NATURAL (numberOfChews, U"Number of chews", U"1")
 	EDITOR_OK
 	EDITOR_DO
 		Editor_save (me, U"Learn one from partial output");
-		OTGrammar_learnOneFromPartialOutput ((OTGrammar) my data, GET_STRING (U"Partial output"),
-			GET_REAL (U"Evaluation noise"), GET_ENUM (kOTGrammar_rerankingStrategy, U"Update rule"), GET_INTEGER (U"Honour local rankings"),
-			GET_REAL (U"Plasticity"), GET_REAL (U"Rel. plasticity spreading"), GET_INTEGER (U"Number of chews"), true);
+		OTGrammar_learnOneFromPartialOutput ((OTGrammar) my data, partialOutput,
+			evaluationNoise, updateRule, honourLocalRankings,
+			plasticity, relativePlasticitySpreading, numberOfChews, true);
 		OTGrammar_sort ((OTGrammar) my data);
 		Graphics_updateWs (my graphics.get());
 		Editor_broadcastDataChanged (me);
@@ -148,11 +148,11 @@ static void menu_cb_removeConstraint (OTGrammarEditor me, EDITOR_ARGS_DIRECT) {
 
 static void menu_cb_resetAllRankings (OTGrammarEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Reset all rankings", nullptr)
-		REAL (U"Ranking", U"100.0")
+		REAL (ranking, U"Ranking", U"100.0")
 	EDITOR_OK
 	EDITOR_DO
 		Editor_save (me, U"Reset all rankings");
-		OTGrammar_reset ((OTGrammar) my data, GET_REAL (U"Ranking"));
+		OTGrammar_reset ((OTGrammar) my data, ranking);
 		Graphics_updateWs (my graphics.get());
 		Editor_broadcastDataChanged (me);
 	EDITOR_END
diff --git a/gram/OTGrammar_def.h b/gram/OTGrammar_def.h
index 6c25453..766d564 100644
--- a/gram/OTGrammar_def.h
+++ b/gram/OTGrammar_def.h
@@ -45,8 +45,8 @@ oo_END_STRUCT (OTGrammarConstraint)
 #define ooSTRUCT OTGrammarFixedRanking
 oo_DEFINE_STRUCT (OTGrammarFixedRanking)
 
-	oo_LONG (higher)
-	oo_LONG (lower)
+	oo_INTEGER (higher)
+	oo_INTEGER (lower)
 
 oo_END_STRUCT (OTGrammarFixedRanking)
 #undef ooSTRUCT
@@ -56,13 +56,13 @@ oo_END_STRUCT (OTGrammarFixedRanking)
 oo_DEFINE_STRUCT (OTGrammarCandidate)
 
 	oo_STRING (output)
-	oo_LONG (numberOfConstraints)
+	oo_INTEGER (numberOfConstraints)
 	oo_INT_VECTOR (marks, numberOfConstraints)
 
 	#if !oo_READING && !oo_WRITING
 		oo_DOUBLE (harmony)
 		oo_DOUBLE (probability)
-		oo_LONG (numberOfPotentialPartialOutputsMatching)
+		oo_INTEGER (numberOfPotentialPartialOutputsMatching)
 		oo_BOOLEAN_VECTOR (partialOutputMatches, numberOfPotentialPartialOutputsMatching)
 	#endif
 
@@ -74,7 +74,7 @@ oo_END_STRUCT (OTGrammarCandidate)
 oo_DEFINE_STRUCT (OTGrammarTableau)
 
 	oo_STRING (input)
-	oo_LONG (numberOfCandidates)
+	oo_INTEGER (numberOfCandidates)
 	oo_STRUCT_VECTOR (OTGrammarCandidate, candidates, numberOfCandidates)
 
 oo_END_STRUCT (OTGrammarTableau)
@@ -90,12 +90,12 @@ oo_DEFINE_CLASS (OTGrammar, Daata)
 	oo_FROM (2)
 		oo_DOUBLE (leak)
 	oo_ENDFROM
-	oo_LONG (numberOfConstraints)
+	oo_INTEGER (numberOfConstraints)
 	oo_STRUCT_VECTOR (OTGrammarConstraint, constraints, numberOfConstraints)
-	oo_LONG_VECTOR (index, numberOfConstraints)   // not read or written in text files
-	oo_LONG (numberOfFixedRankings)
+	oo_INTEGER_VECTOR (index, numberOfConstraints)   // not read or written in text files
+	oo_INTEGER (numberOfFixedRankings)
 	oo_STRUCT_VECTOR (OTGrammarFixedRanking, fixedRankings, numberOfFixedRankings)
-	oo_LONG (numberOfTableaus)
+	oo_INTEGER (numberOfTableaus)
 	oo_STRUCT_VECTOR (OTGrammarTableau, tableaus, numberOfTableaus)
 
 	#if oo_READING
diff --git a/gram/OTGrammar_enums.h b/gram/OTGrammar_enums.h
index cbfcedd..9f1206e 100644
--- a/gram/OTGrammar_enums.h
+++ b/gram/OTGrammar_enums.h
@@ -44,4 +44,22 @@ enums_begin (kOTGrammar_rerankingStrategy, 0)
 	enums_add (kOTGrammar_rerankingStrategy, 11, WEIGHTED_ALL_UP_HIGH_DOWN_2012, U"Weighted all up, high down (2012)")
 enums_end (kOTGrammar_rerankingStrategy, 11, SYMMETRIC_ALL)
 
+enums_begin (kOTGrammar_createTongueRootGrammar_constraintSet, 1)
+	enums_add (kOTGrammar_createTongueRootGrammar_constraintSet, 1, FIVE, U"Five")
+	enums_add (kOTGrammar_createTongueRootGrammar_constraintSet, 2, NINE, U"Nine")
+enums_end (kOTGrammar_createTongueRootGrammar_constraintSet, 2, FIVE)
+
+enums_begin (kOTGrammar_createTongueRootGrammar_ranking, 1)
+	enums_add (kOTGrammar_createTongueRootGrammar_ranking, 1, EQUAL, U"equal")
+	enums_add (kOTGrammar_createTongueRootGrammar_ranking, 2, RANDOM, U"random")
+	enums_add (kOTGrammar_createTongueRootGrammar_ranking, 3, INFANT, U"infant")
+	enums_add (kOTGrammar_createTongueRootGrammar_ranking, 4, WOLOF, U"Wolof")
+enums_end (kOTGrammar_createTongueRootGrammar_ranking, 4, INFANT)
+
+enums_begin (kOTGrammar_createMetricsGrammar_initialRanking, 1)
+	enums_add (kOTGrammar_createMetricsGrammar_initialRanking, 1, EQUAL, U"equal")
+	enums_add (kOTGrammar_createMetricsGrammar_initialRanking, 2, FOOT_FORM_HIGH, U"foot form high")
+	enums_add (kOTGrammar_createMetricsGrammar_initialRanking, 3, WSP_HIGH, U"WSP high")
+enums_end (kOTGrammar_createMetricsGrammar_initialRanking, 3, EQUAL)
+
 /* End of file OTGrammar_enums.h */
diff --git a/gram/OTGrammar_ex_metrics.cpp b/gram/OTGrammar_ex_metrics.cpp
index 6c67064..2457b22 100644
--- a/gram/OTGrammar_ex_metrics.cpp
+++ b/gram/OTGrammar_ex_metrics.cpp
@@ -434,7 +434,9 @@ static void replaceOutput (OTGrammarCandidate me) {
 	my output = Melder_dup (newOutput);
 }
 
-autoOTGrammar OTGrammar_create_metrics (int equal_footForm_wsp, int trochaicityConstraint, int includeFootBimoraic, int includeFootBisyllabic,
+autoOTGrammar OTGrammar_create_metrics (
+	kOTGrammar_createMetricsGrammar_initialRanking equal_footForm_wsp,
+	int trochaicityConstraint, int includeFootBimoraic, int includeFootBisyllabic,
 	int includePeripheral, int nonfinalityConstraint, int overtFormsHaveSecondaryStress,
 	int includeClashAndLapse, int includeCodas)
 {
@@ -449,13 +451,13 @@ autoOTGrammar OTGrammar_create_metrics (int equal_footForm_wsp, int trochaicityC
 			constraint -> ranking = 100.0;
 			constraint -> plasticity = 1.0;
 		}
-		if (equal_footForm_wsp >= 2) {
+		if (equal_footForm_wsp >= kOTGrammar_createMetricsGrammar_initialRanking::FOOT_FORM_HIGH) {
 			/* Foot form constraints high. */
 			my constraints [FtNonfinal]. ranking = 101.0;
 			my constraints [Iambic]. ranking = 101.0;
 			my constraints [Trochaic]. ranking = -1e9;
 		}
-		if (equal_footForm_wsp == 3) {
+		if (equal_footForm_wsp == kOTGrammar_createMetricsGrammar_initialRanking::WSP_HIGH) {
 			/* Quantity sensitivity high, foot form constraints in the second stratum. */
 			my constraints [WSP]. ranking = 102.0;
 		}
diff --git a/gram/OTGrammar_ex_tongueRoot.cpp b/gram/OTGrammar_ex_tongueRoot.cpp
index 3cf2cab..93921c4 100644
--- a/gram/OTGrammar_ex_tongueRoot.cpp
+++ b/gram/OTGrammar_ex_tongueRoot.cpp
@@ -1,6 +1,6 @@
 /* OTGrammar_ex_tongueRoot.cpp
  *
- * Copyright (C) 1997-2011,2013,2015,2016 Paul Boersma
+ * Copyright (C) 1997-2011,2013,2015,2016,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -55,9 +55,12 @@ static void OTGrammarCandidate_init (OTGrammarCandidate me, int ncons, int v1, i
 	if (isatr (v1) != isatr (v2)) my marks [5] ++;
 }
 
-autoOTGrammar OTGrammar_create_tongueRoot_grammar (int small_large, int equal_random_infant_Wolof) {
+autoOTGrammar OTGrammar_create_tongueRoot_grammar (
+	kOTGrammar_createTongueRootGrammar_constraintSet small_large,
+	kOTGrammar_createTongueRootGrammar_ranking equal_random_infant_Wolof)
+{
 	try {
-		int ncons = small_large == 1 ? 5 : 9, itab, v1, v2;
+		int ncons = small_large == kOTGrammar_createTongueRootGrammar_constraintSet::FIVE ? 5 : 9, itab, v1, v2;
 		autoOTGrammar me = Thing_new (OTGrammar);
 		my constraints = NUMvector <structOTGrammarConstraint> (1, my numberOfConstraints = ncons);
 		my constraints [1]. name = Melder_dup (U"*[rtr / hi]");
@@ -71,18 +74,19 @@ autoOTGrammar OTGrammar_create_tongueRoot_grammar (int small_large, int equal_ra
 			my constraints [8]. name = Melder_dup (U"*[atr / mid]");
 			my constraints [9]. name = Melder_dup (U"*[atr / hi]");
 		}
-		if (equal_random_infant_Wolof == 1) {   // equal?
+		if (equal_random_infant_Wolof == kOTGrammar_createTongueRootGrammar_ranking::EQUAL) {
 			for (long icons = 1; icons <= ncons; icons ++)
 				my constraints [icons]. ranking = 100.0;
-		} else if (equal_random_infant_Wolof == 2) {   // random?
+		} else if (equal_random_infant_Wolof == kOTGrammar_createTongueRootGrammar_ranking::RANDOM) {
 			for (long icons = 1; icons <= ncons; icons ++)
 				my constraints [icons]. ranking = NUMrandomGauss (100.0, 10.0);
-		} else if (equal_random_infant_Wolof == 3) {   // infant (= cannot speak) ?
+		} else if (equal_random_infant_Wolof == kOTGrammar_createTongueRootGrammar_ranking::INFANT) {
 			for (long icons = 1; icons <= ncons; icons ++)
 				my constraints [icons]. ranking = 100.0;   // structural constraints
 			my constraints [3]. ranking = 50.0;   // faithfulness constraints
 			my constraints [4]. ranking = 50.0;
-		} else {   // adult Wolof
+		} else {
+			Melder_assert (equal_random_infant_Wolof == kOTGrammar_createTongueRootGrammar_ranking::WOLOF);
 			my constraints [1]. ranking = 100.0;
 			my constraints [2]. ranking =  10.0;
 			my constraints [3]. ranking =  50.0;
diff --git a/gram/OTMulti.cpp b/gram/OTMulti.cpp
index d3d0612..3672e53 100644
--- a/gram/OTMulti.cpp
+++ b/gram/OTMulti.cpp
@@ -72,7 +72,7 @@ void structOTMulti :: v_writeText (MelderFile file) {
 	for (long icons = 1; icons <= numberOfConstraints; icons ++) {
 		OTConstraint constraint = & constraints [icons];
 		MelderFile_write (file, U"\n\t\"");
-		for (const char32 *p = & constraint -> name [0]; *p; p ++) {
+		for (const char32 *p = & constraint -> name [0]; *p != U'\0'; p ++) {
 			if (*p == U'\"') MelderFile_writeCharacter (file, U'\"');   // double any quotes within quotes
 			MelderFile_writeCharacter (file, *p);
 		}
@@ -83,7 +83,7 @@ void structOTMulti :: v_writeText (MelderFile file) {
 	for (long icand = 1; icand <= numberOfCandidates; icand ++) {
 		OTCandidate candidate = & candidates [icand];
 		MelderFile_write (file, U"\n\t\"");
-		for (const char32 *p = & candidate -> string [0]; *p; p ++) {
+		for (const char32 *p = & candidate -> string [0]; *p != U'\0'; p ++) {
 			if (*p == U'\"') MelderFile_writeCharacter (file, U'\"');   // double any quotes within quotes
 			MelderFile_writeCharacter (file, *p);
 		}
@@ -96,8 +96,8 @@ void structOTMulti :: v_writeText (MelderFile file) {
 
 void OTMulti_checkIndex (OTMulti me) {
 	if (my index) return;
-	my index = NUMvector <long> (1, my numberOfConstraints);
-	for (long icons = 1; icons <= my numberOfConstraints; icons ++) my index [icons] = icons;
+	my index = NUMvector <integer> (1, my numberOfConstraints);
+	for (integer icons = 1; icons <= my numberOfConstraints; icons ++) my index [icons] = icons;
 	OTMulti_sort (me);
 }
 
@@ -163,7 +163,7 @@ static OTMulti constraintCompare_grammar;
 
 static int constraintCompare (const void *first, const void *second) {
 	OTMulti me = constraintCompare_grammar;
-	long icons = * (long *) first, jcons = * (long *) second;
+	integer icons = * (integer *) first, jcons = * (integer *) second;
 	OTConstraint ci = & my constraints [icons], cj = & my constraints [jcons];
 	/*
 	 * Sort primarily by disharmony.
@@ -178,7 +178,7 @@ static int constraintCompare (const void *first, const void *second) {
 
 void OTMulti_sort (OTMulti me) {
 	constraintCompare_grammar = me;
-	qsort (& my index [1], my numberOfConstraints, sizeof (long), constraintCompare);
+	qsort (& my index [1], my numberOfConstraints, sizeof (integer), constraintCompare);
 	for (long icons = 1; icons <= my numberOfConstraints; icons ++) {
 		OTConstraint constraint = & my constraints [my index [icons]];
 		constraint -> tiedToTheLeft = icons > 1 &&
diff --git a/gram/OTMulti.h b/gram/OTMulti.h
index 8a5a004..292ef1a 100644
--- a/gram/OTMulti.h
+++ b/gram/OTMulti.h
@@ -2,7 +2,7 @@
 #define _OTMulti_h_
 /* OTMulti.h
  *
- * Copyright (C) 2005-2011,2014,2015 Paul Boersma
+ * Copyright (C) 2005-2011,2014,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -54,7 +54,9 @@ void OTMulti_PairDistribution_learn (OTMulti me, PairDistribution thee,
 
 void OTMulti_drawTableau (OTMulti me, Graphics g, const char32 *form1, const char32 *form2, bool vertical, bool showDisharmonies);
 
-autoOTMulti OTMulti_create_metrics (int equal_footForm_wsp, int trochaicityConstraint, int includeFootBimoraic, int includeFootBisyllabic,
+autoOTMulti OTMulti_create_metrics (
+	kOTGrammar_createMetricsGrammar_initialRanking equal_footForm_wsp,
+	int trochaicityConstraint, int includeFootBimoraic, int includeFootBisyllabic,
 	int includePeripheral, int nonfinalityConstraint, int overtFormsHaveSecondaryStress,
 	int includeClashAndLapse, int includeCodas);
 
diff --git a/gram/OTMultiEditor.cpp b/gram/OTMultiEditor.cpp
index ea028a3..1798ede 100644
--- a/gram/OTMultiEditor.cpp
+++ b/gram/OTMultiEditor.cpp
@@ -31,11 +31,11 @@ Thing_implement (OTMultiEditor, HyperPage, 0);
 
 static void menu_cb_evaluate (OTMultiEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Evaluate", nullptr)
-		REAL (U"Evaluation noise", U"2.0")
+		REAL (evaluationNoise, U"Evaluation noise", U"2.0")
 	EDITOR_OK
 	EDITOR_DO
 		Editor_save (me, U"Evaluate");
-		OTMulti_newDisharmonies ((OTMulti) my data, GET_REAL (U"Evaluation noise"));
+		OTMulti_newDisharmonies ((OTMulti) my data, evaluationNoise);
 		Graphics_updateWs (my graphics.get());
 		Editor_broadcastDataChanged (me);
 	EDITOR_END
@@ -57,24 +57,24 @@ static void menu_cb_evaluate_tinyNoise (OTMultiEditor me, EDITOR_ARGS_DIRECT) {
 
 static void menu_cb_editRanking (OTMultiEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Edit ranking", nullptr)
-		LABEL (U"constraint", U"");
-		REAL (U"Ranking value", U"100.0");
-		REAL (U"Disharmony", U"100.0");
+		MUTABLE_LABEL (constraintLabel, U"")
+		REAL (rankingValue, U"Ranking value", U"100.0")
+		REAL (disharmony, U"Disharmony", U"100.0")
 	EDITOR_OK
 		OTMulti grammar = (OTMulti) my data;
 		OTConstraint constraint;
 		if (my selectedConstraint < 1 || my selectedConstraint > grammar -> numberOfConstraints)
 			Melder_throw (U"Select a constraint first.");
 		constraint = & grammar -> constraints [grammar -> index [my selectedConstraint]];
-		SET_STRING (U"constraint", constraint -> name)
-		SET_REAL (U"Ranking value", constraint -> ranking)
-		SET_REAL (U"Disharmony", constraint -> disharmony)
+		SET_STRING (constraintLabel, constraint -> name)
+		SET_REAL (rankingValue, constraint -> ranking)
+		SET_REAL (disharmony, constraint -> disharmony)
 	EDITOR_DO
 		OTMulti grammar = (OTMulti) my data;
 		OTConstraint constraint = & grammar -> constraints [grammar -> index [my selectedConstraint]];
 		Editor_save (me, U"Edit ranking");
-		constraint -> ranking = GET_REAL (U"Ranking value");
-		constraint -> disharmony = GET_REAL (U"Disharmony");
+		constraint -> ranking = rankingValue;
+		constraint -> disharmony = disharmony;
 		OTMulti_sort (grammar);
 		Graphics_updateWs (my graphics.get());
 		Editor_broadcastDataChanged (me);
@@ -83,13 +83,13 @@ static void menu_cb_editRanking (OTMultiEditor me, EDITOR_ARGS_FORM) {
 
 static void menu_cb_learnOne (OTMultiEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Learn one", U"OTGrammar: Learn one...")
-		OPTIONMENU_ENUM (U"Update rule", kOTGrammar_rerankingStrategy, kOTGrammar_rerankingStrategy::SYMMETRIC_ALL)
-		OPTIONMENU (U"Direction", 3)
+		OPTIONMENU_ENUM (updateRule, U"Update rule", kOTGrammar_rerankingStrategy, kOTGrammar_rerankingStrategy::SYMMETRIC_ALL)
+		OPTIONMENU (direction, U"Direction", 3)
 			OPTION (U"forward")
 			OPTION (U"backward")
 			OPTION (U"bidirectionally")
-		REAL (U"Plasticity", U"0.1")
-		REAL (U"Rel. plasticity spreading", U"0.1")
+		REAL (plasticity, U"Plasticity", U"0.1")
+		REAL (relativePlasticitySpreading, U"Rel. plasticity spreading", U"0.1")
 	EDITOR_OK
 	EDITOR_DO
 		Editor_save (me, U"Learn one");
@@ -98,8 +98,8 @@ static void menu_cb_learnOne (OTMultiEditor me, EDITOR_ARGS_FORM) {
 		my form1 = GuiText_getString (my form1Text);
 		my form2 = GuiText_getString (my form2Text);
 		OTMulti_learnOne ((OTMulti) my data, my form1, my form2,
-			GET_ENUM (kOTGrammar_rerankingStrategy, U"Update rule"), GET_INTEGER (U"Direction"),
-			GET_REAL (U"Plasticity"), GET_REAL (U"Rel. plasticity spreading"));
+			updateRule, direction,
+			plasticity, relativePlasticitySpreading);
 		Graphics_updateWs (my graphics.get());
 		Editor_broadcastDataChanged (me);
 	EDITOR_END
@@ -118,11 +118,11 @@ static void menu_cb_removeConstraint (OTMultiEditor me, EDITOR_ARGS_DIRECT) {
 
 static void menu_cb_resetAllRankings (OTMultiEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Reset all rankings", nullptr)
-		REAL (U"Ranking", U"100.0")
+		REAL (ranking, U"Ranking", U"100.0")
 	EDITOR_OK
 	EDITOR_DO
 		Editor_save (me, U"Reset all rankings");
-		OTMulti_reset ((OTMulti) my data, GET_REAL (U"Ranking"));
+		OTMulti_reset ((OTMulti) my data, ranking);
 		Graphics_updateWs (my graphics.get());
 		Editor_broadcastDataChanged (me);
 	EDITOR_END
diff --git a/gram/OTMulti_def.h b/gram/OTMulti_def.h
index 6e7fefc..bdb2ad3 100644
--- a/gram/OTMulti_def.h
+++ b/gram/OTMulti_def.h
@@ -46,7 +46,7 @@ oo_END_STRUCT (OTConstraint)
 oo_DEFINE_STRUCT (OTCandidate)
 
 	oo_STRING (string)
-	oo_LONG (numberOfConstraints)
+	oo_INTEGER (numberOfConstraints)
 	oo_INT_VECTOR (marks, numberOfConstraints)
 
 	#if !oo_READING && !oo_WRITING
@@ -67,10 +67,10 @@ oo_DEFINE_CLASS (OTMulti, Daata)
 	oo_FROM (2)
 		oo_DOUBLE (leak)
 	oo_ENDFROM
-	oo_LONG (numberOfConstraints)
+	oo_INTEGER (numberOfConstraints)
 	oo_STRUCT_VECTOR (OTConstraint, constraints, numberOfConstraints)
-	oo_LONG_VECTOR (index, numberOfConstraints)
-	oo_LONG (numberOfCandidates)
+	oo_INTEGER_VECTOR (index, numberOfConstraints)
+	oo_INTEGER (numberOfCandidates)
 	oo_STRUCT_VECTOR (OTCandidate, candidates, numberOfCandidates)
 
 	#if oo_READING
diff --git a/gram/OTMulti_ex_metrics.cpp b/gram/OTMulti_ex_metrics.cpp
index 5ffa425..f12b42a 100644
--- a/gram/OTMulti_ex_metrics.cpp
+++ b/gram/OTMulti_ex_metrics.cpp
@@ -419,7 +419,9 @@ static void replaceOutput (OTCandidate me) {
 	my string = Melder_dup (newString);
 }
 
-autoOTMulti OTMulti_create_metrics (int equal_footForm_wsp, int trochaicityConstraint, int includeFootBimoraic, int includeFootBisyllabic,
+autoOTMulti OTMulti_create_metrics (
+	kOTGrammar_createMetricsGrammar_initialRanking equal_footForm_wsp,
+	int trochaicityConstraint, int includeFootBimoraic, int includeFootBisyllabic,
 	int includePeripheral, int nonfinalityConstraint, int overtFormsHaveSecondaryStress,
 	int includeClashAndLapse, int includeCodas)
 {
@@ -433,13 +435,13 @@ autoOTMulti OTMulti_create_metrics (int equal_footForm_wsp, int trochaicityConst
 			constraint -> ranking = 100.0;
 			constraint -> plasticity = 1.0;
 		}
-		if (equal_footForm_wsp >= 2) {
+		if (equal_footForm_wsp >= kOTGrammar_createMetricsGrammar_initialRanking::FOOT_FORM_HIGH) {
 			/* Foot form constraints high. */
 			my constraints [FtNonfinal]. ranking = 101.0;
 			my constraints [Iambic]. ranking = 101.0;
 			my constraints [Trochaic]. ranking = -1e9;
 		}
-		if (equal_footForm_wsp == 3) {
+		if (equal_footForm_wsp == kOTGrammar_createMetricsGrammar_initialRanking::WSP_HIGH) {
 			/* Quantity sensitivity high, foot form constraints in the second stratum. */
 			my constraints [WSP]. ranking = 102.0;
 		}
diff --git a/gram/RBM_def.h b/gram/RBM_def.h
index dbba3ba..9d466a8 100644
--- a/gram/RBM_def.h
+++ b/gram/RBM_def.h
@@ -21,8 +21,8 @@
 oo_DEFINE_CLASS (RBM, Daata)
 
 	oo_QUESTION (inputsAreBinary)
-	oo_LONG (numberOfInputNodes)
-	oo_LONG (numberOfOutputNodes)
+	oo_INTEGER (numberOfInputNodes)
+	oo_INTEGER (numberOfOutputNodes)
 	oo_DOUBLE_MATRIX (weights, numberOfInputNodes, numberOfOutputNodes)
 	oo_DOUBLE_VECTOR (inputBiases, numberOfInputNodes)
 	oo_DOUBLE_VECTOR (outputBiases, numberOfOutputNodes)
diff --git a/gram/manual_gram.cpp b/gram/manual_gram.cpp
index d159d12..d8359c7 100644
--- a/gram/manual_gram.cpp
+++ b/gram/manual_gram.cpp
@@ -1,6 +1,6 @@
 /* manual_gram.cpp
  *
- * Copyright (C) 1997-2011,2014,2015 Paul Boersma
+ * Copyright (C) 1997-2011,2014,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -62,23 +62,28 @@ static void draw_NPA_faithful_atma (Graphics g) {
 	OTGrammar_drawTableau (ot.get(), g, false, U"at+ma");
 }
 static void draw_Wolof_ItI (Graphics g) {
-	autoOTGrammar ot = OTGrammar_create_tongueRoot_grammar (1, 4);
+	autoOTGrammar ot = OTGrammar_create_tongueRoot_grammar
+		(kOTGrammar_createTongueRootGrammar_constraintSet::FIVE, kOTGrammar_createTongueRootGrammar_ranking::WOLOF);
 	OTGrammar_drawTableau (ot.get(), g, false, U"\\ict\\ic");
 }
 static void draw_Wolof_itE (Graphics g) {
-	autoOTGrammar ot = OTGrammar_create_tongueRoot_grammar (1, 4);
+	autoOTGrammar ot = OTGrammar_create_tongueRoot_grammar
+		(kOTGrammar_createTongueRootGrammar_constraintSet::FIVE, kOTGrammar_createTongueRootGrammar_ranking::WOLOF);
 	OTGrammar_drawTableau (ot.get(), g, false, U"it\\ef");
 }
 static void draw_Wolof_etE (Graphics g) {
-	autoOTGrammar ot = OTGrammar_create_tongueRoot_grammar (1, 4);
+	autoOTGrammar ot = OTGrammar_create_tongueRoot_grammar
+		(kOTGrammar_createTongueRootGrammar_constraintSet::FIVE, kOTGrammar_createTongueRootGrammar_ranking::WOLOF);
 	OTGrammar_drawTableau (ot.get(), g, false, U"et\\ef");
 }
 static void draw_Wolof_schwatschwa (Graphics g) {
-	autoOTGrammar ot = OTGrammar_create_tongueRoot_grammar (1, 4);
+	autoOTGrammar ot = OTGrammar_create_tongueRoot_grammar
+		(kOTGrammar_createTongueRootGrammar_constraintSet::FIVE, kOTGrammar_createTongueRootGrammar_ranking::WOLOF);
 	OTGrammar_drawTableau (ot.get(), g, false, U"\\swt\\sw");
 }
 static void draw_Infant_swtI (Graphics g) {
-	autoOTGrammar ot = OTGrammar_create_tongueRoot_grammar (1, 3);
+	autoOTGrammar ot = OTGrammar_create_tongueRoot_grammar
+		(kOTGrammar_createTongueRootGrammar_constraintSet::FIVE, kOTGrammar_createTongueRootGrammar_ranking::INFANT);
 	ot -> constraints [1]. disharmony = 3;
 	ot -> constraints [2]. disharmony = 4;
 	ot -> constraints [3]. disharmony = 2;
diff --git a/gram/praat_gram.cpp b/gram/praat_gram.cpp
index fb8e5d6..720e27e 100644
--- a/gram/praat_gram.cpp
+++ b/gram/praat_gram.cpp
@@ -33,13 +33,13 @@
 // MARK: New
 
 #define UiForm_addNetworkFields  \
-	LABEL (U"", U"Activity spreading settings:") \
+	LABEL (U"Activity spreading settings:") \
 	REAL (spreadingRate, U"Spreading rate", U"0.01") \
 	OPTIONMENU_ENUM (activityClippingRule, U"Activity clipping rule", kNetwork_activityClippingRule, DEFAULT) \
 	REAL (minimumActivity, U"left Activity range", U"0.0") \
 	REAL (maximumActivity, U"right Activity range", U"1.0") \
 	REAL (activityLeak, U"Activity leak", U"1.0") \
-	LABEL (U"", U"Weight update settings:") \
+	LABEL (U"Weight update settings:") \
 	REAL (learningRate, U"Learning rate", U"0.1") \
 	REAL (minimumWeight, U"left Weight range", U"-1.0") \
 	REAL (maximumWeight, U"right Weight range", U"1.0") \
@@ -48,7 +48,7 @@
 FORM (NEW1_Create_empty_Network, U"Create empty Network", nullptr) {
 	WORD (name, U"Name", U"network")
 	UiForm_addNetworkFields
-	LABEL (U"", U"World coordinates:")
+	LABEL (U"World coordinates:")
 	REAL (fromX, U"left x range", U"0.0")
 	REAL (toX, U"right x range", U"10.0")
 	REAL (fromY, U"left y range", U"0.0")
@@ -65,11 +65,11 @@ DO
 
 FORM (NEW1_Create_rectangular_Network, U"Create rectangular Network", nullptr) {
 	UiForm_addNetworkFields
-	LABEL (U"", U"Structure settings:")
+	LABEL (U"Structure settings:")
 	NATURAL (numberOfRows, U"Number of rows", U"10")
 	NATURAL (numberOfColumns, U"Number of columns", U"10")
 	BOOLEAN (bottomRowClamped, U"Bottom row clamped", 1)
-	LABEL (U"", U"Initial state settings:")
+	LABEL (U"Initial state settings:")
 	REAL (minimumInitialWeight, U"left Initial weight range", U"-0.1")
 	REAL (maximumInitialWeight, U"right Initial weight range", U"0.1")
 	OK
@@ -84,11 +84,11 @@ DO
 
 FORM (NEW1_Create_rectangular_Network_vertical, U"Create rectangular Network (vertical)", nullptr) {
 	UiForm_addNetworkFields
-	LABEL (U"", U"Structure settings:")
+	LABEL (U"Structure settings:")
 	NATURAL (numberOfRows, U"Number of rows", U"10")
 	NATURAL (numberOfColumns, U"Number of columns", U"10")
 	BOOLEAN (bottomRowClamped, U"Bottom row clamped", 1)
-	LABEL (U"", U"Initial state settings:")
+	LABEL (U"Initial state settings:")
 	REAL (minimumInitialWeight, U"left Initial weight range", U"-0.1")
 	REAL (maximumInitialWeight, U"right Initial weight range", U"0.1")
 	OK
@@ -359,26 +359,17 @@ DIRECT (NEW1_Create_NPA_distribution) {
 }
 
 FORM (NEW1_Create_tongue_root_grammar, U"Create tongue-root grammar", U"Create tongue-root grammar...") {
-	RADIO (constraintSet, U"Constraint set", 1)
-		RADIOBUTTON (U"Five")
-		RADIOBUTTON (U"Nine")
-	RADIO (ranking, U"Ranking", 3)
-		RADIOBUTTON (U"Equal")
-		RADIOBUTTON (U"Random")
-		RADIOBUTTON (U"Infant")
-		RADIOBUTTON (U"Wolof")
+	RADIO_ENUM (constraintSet, U"Constraint set", kOTGrammar_createTongueRootGrammar_constraintSet, DEFAULT)
+	RADIO_ENUM (ranking, U"Ranking", kOTGrammar_createTongueRootGrammar_ranking, DEFAULT)
 	OK
 DO
 	CREATE_ONE
 		autoOTGrammar result = OTGrammar_create_tongueRoot_grammar (constraintSet, ranking);
-	CREATE_ONE_END (GET_STRING (U"Ranking"))
+	CREATE_ONE_END (kOTGrammar_createTongueRootGrammar_ranking_getText (ranking))
 }
 
 FORM (NEW1_Create_metrics_grammar, U"Create metrics grammar", nullptr) {
-	OPTIONMENU (initialRanking, U"Initial ranking", 1)
-		OPTION (U"Equal")
-		OPTION (U"Foot form high")
-		OPTION (U"WSP high")
+	OPTIONMENU_ENUM (initialRanking, U"Initial ranking", kOTGrammar_createMetricsGrammar_initialRanking, DEFAULT)
 	OPTIONMENU (trochaicityConstraint, U"Trochaicity constraint", 1)
 		OPTION (U"FtNonfinal")
 		OPTION (U"Trochaic")
@@ -398,7 +389,7 @@ DO
 		autoOTGrammar result = OTGrammar_create_metrics (initialRanking, trochaicityConstraint,
 			includeFootBimoraic, includeFootBisyllabic, includePeripheral, nonfinalityConstraint,
 			overtFormsHaveSecondaryStress, includeClashAndLapse, includeCodas);
-	CREATE_ONE_END (GET_STRING (U"Initial ranking"))
+	CREATE_ONE_END (kOTGrammar_createMetricsGrammar_initialRanking_getText (initialRanking))
 }
 
 // MARK: Save
@@ -810,7 +801,7 @@ DO
 }
 
 FORM (MODIFY_OTGrammar_learnOneFromPartialOutput, U"OTGrammar: Learn one from partial adult output", nullptr) {
-	LABEL (U"", U"Partial adult surface form (e.g. overt form):")
+	LABEL (U"Partial adult surface form (e.g. overt form):")
 	SENTENCE (partialOutput, U"Partial output", U"")
 	REAL (evaluationNoise, U"Evaluation noise", U"2.0")
 	OPTIONMENU_ENUM (updateRule, U"Update rule", kOTGrammar_rerankingStrategy, SYMMETRIC_ALL)
@@ -833,7 +824,7 @@ FORM (MODIFY_OTGrammar_setDecisionStrategy, U"OTGrammar: Set decision strategy",
 	RADIO_ENUM (decisionStrategy, U"Decision strategy", kOTGrammar_decisionStrategy, DEFAULT)
 OK
 	FIND_ONE (OTGrammar)
-		SET_ENUM (U"Decision strategy", kOTGrammar_decisionStrategy, my decisionStrategy);
+		SET_ENUM (decisionStrategy, kOTGrammar_decisionStrategy, my decisionStrategy);
 DO
 	MODIFY_EACH (OTGrammar)
 		my decisionStrategy = decisionStrategy;
@@ -844,7 +835,7 @@ FORM (MODIFY_OTGrammar_setLeak, U"OTGrammar: Set leak", nullptr) {
 	REAL (leak, U"Leak", U"0.0")
 OK
 	FIND_ONE (OTGrammar)
-		SET_REAL (U"Leak", my leak);
+		SET_REAL (leak, my leak)
 DO
 	MODIFY_EACH (OTGrammar)
 		my leak = leak;
@@ -1172,10 +1163,7 @@ DIRECT (LIST_OTGrammar_PairDistribution_listObligatoryRankings) {
 // MARK: New
 
 FORM (NEW1_Create_multi_level_metrics_grammar, U"Create multi-level metrics grammar", nullptr) {
-	OPTIONMENU (initialRanking, U"Initial ranking", 1)
-		OPTION (U"Equal")
-		OPTION (U"Foot form high")
-		OPTION (U"WSP high")
+	OPTIONMENU_ENUM (initialRanking, U"Initial ranking", kOTGrammar_createMetricsGrammar_initialRanking, DEFAULT)
 	OPTIONMENU (trochaicityConstraint, U"Trochaicity constraint", 1)
 		OPTION (U"FtNonfinal")
 		OPTION (U"Trochaic")
@@ -1195,7 +1183,7 @@ DO
 		autoOTMulti result = OTMulti_create_metrics (initialRanking, trochaicityConstraint,
 			includeFootBimoraic, includeFootBisyllabic, includePeripheral, nonfinalityConstraint,
 			overtFormsHaveSecondaryStress, includeClashAndLapse, includeCodas);
-	CREATE_ONE_END (GET_STRING (U"Initial ranking"))
+	CREATE_ONE_END (kOTGrammar_createMetricsGrammar_initialRanking_getText (initialRanking))
 }
 
 // MARK: Draw
@@ -1431,7 +1419,7 @@ FORM (MODIFY_OTMulti_setDecisionStrategy, U"OTMulti: Set decision strategy", nul
 	RADIO_ENUM (decisionStrategy, U"Decision strategy", kOTGrammar_decisionStrategy, DEFAULT)
 OK
 	FIND_ONE (OTMulti)
-		SET_ENUM (U"Decision strategy", kOTGrammar_decisionStrategy, my decisionStrategy);
+		SET_ENUM (decisionStrategy, kOTGrammar_decisionStrategy, my decisionStrategy);
 DO
 	MODIFY_EACH (OTMulti)
 		my decisionStrategy = decisionStrategy;
@@ -1442,7 +1430,7 @@ FORM (MODIFY_OTMulti_setLeak, U"OTGrammar: Set leak", nullptr) {
 	REAL (leak, U"Leak", U"0.0")
 OK
 	FIND_ONE (OTMulti)
-		SET_REAL (U"Leak", my leak);
+		SET_REAL (leak, my leak)
 DO
 	MODIFY_EACH (OTMulti)
 		my leak = leak;
diff --git a/kar/Makefile b/kar/Makefile
index e8956d3..dc89a5e6 100644
--- a/kar/Makefile
+++ b/kar/Makefile
@@ -1,10 +1,12 @@
 # Makefile of the library "kar"
-# Paul Boersma, 16 July 2015
+# Paul Boersma, 5 October 2017
 
 include ../makefile.defs
 
 OBJECTS = ipaSerifRegularPS.o longchar.o
 
+CPPFLAGS = -I ../sys
+
 .PHONY: all clean
 
 all: libkar.a
@@ -19,4 +21,4 @@ libkar.a: $(OBJECTS)
 	$(AR) cq libkar.a $(OBJECTS)
 	$(RANLIB) libkar.a
 
-$(OBJECTS): *.h
+$(OBJECTS): *.h ../sys/*.h
diff --git a/kar/longchar.cpp b/kar/longchar.cpp
index 15c49c7..acb0e1b 100644
--- a/kar/longchar.cpp
+++ b/kar/longchar.cpp
@@ -637,7 +637,7 @@ static void init () {
 }
 
 char32_t * Longchar_nativize32 (const char32_t *generic, char32_t *native, int educateQuotes) {
-	long nquote = 0;
+	integer nquote = 0;
 	char32_t kar, kar1, kar2;
 	if (! inited) init ();
 	while ((kar = *generic++) != U'\0') {
@@ -654,7 +654,7 @@ char32_t * Longchar_nativize32 (const char32_t *generic, char32_t *native, int e
 			}
 		}
 		if (kar == U'\\' && (kar1 = generic [0]) >= 32 && kar1 <= 126 && (kar2 = generic [1]) >= 32 && kar2 <= 126) {
-			long location = where [kar1 - 32] [kar2 - 32];
+			integer location = where [kar1 - 32] [kar2 - 32];
 			if (location == 0) {
 				*native++ = kar;
 				*native++ = kar1;   /* Even if this is a backslash itself... */
diff --git a/kar/longchar.h b/kar/longchar.h
index 1745cea..fb6eed4 100644
--- a/kar/longchar.h
+++ b/kar/longchar.h
@@ -19,6 +19,7 @@
  */
 
 #include <wchar.h>
+#include "melder.h"
 
 /********** NON-ASCII CHARACTERS **********/
 
@@ -79,7 +80,7 @@ typedef struct structLongchar_Info {
 	unsigned short winEncoding;   /* The one-byte encoding for Windows (ISO8859-1 for Roman; SILDoulosIPA 1993). */
 	unsigned short macEncoding;   /* The one-byte encoding for Macintosh (Mac for Roman; SILDoulosIPA 1993). */
 	unsigned short psEncoding;   /* The one-byte encoding for PostScript (Mac-Praat, TeX-xipa-Praat). */
-	unsigned long unicode;   /* The four-byte encoding for Unicode. */
+	char32 unicode;   /* The four-byte encoding for Unicode. */
 	unsigned short unicodeDecomposition [6];   /* Diacritics decoupled from the base character. */
 }
 	*Longchar_Info;
diff --git a/num/NUM.cpp b/num/NUM.cpp
index be656f1..fcdeacb 100644
--- a/num/NUM.cpp
+++ b/num/NUM.cpp
@@ -64,13 +64,13 @@ void NUMfbtoa (double formant, double bandwidth, double dt, double *a1, double *
 	*a2 = exp (- 2 * NUMpi * bandwidth * dt);
 }
 
-void NUMfilterSecondOrderSection_a (double x [], long n, double a1, double a2) {
+void NUMfilterSecondOrderSection_a (double x [], integer n, double a1, double a2) {
 	x [2] += a1 * x [1];
-	for (long i = 3; i <= n; i ++)
+	for (integer i = 3; i <= n; i ++)
 		x [i] += a1 * x [i - 1] - a2 * x [i - 2];
 }
 
-void NUMfilterSecondOrderSection_fb (double x [], long n, double dt, double formant, double bandwidth) {
+void NUMfilterSecondOrderSection_fb (double x [], integer n, double dt, double formant, double bandwidth) {
 	double a1, a2;
 	NUMfbtoa (formant, bandwidth, dt, & a1, & a2);
 	NUMfilterSecondOrderSection_a (x, n, a1, a2);
@@ -80,32 +80,31 @@ double NUMftopreemphasis (double f, double dt) {
 	return exp (- 2.0 * NUMpi * f * dt);
 }
 
-void NUMpreemphasize_a (double x [], long n, double preemphasis) {
-	for (long i = n; i >= 2; i --)
+void NUMpreemphasize_a (double x [], integer n, double preemphasis) {
+	for (integer i = n; i >= 2; i --)
 		x [i] -= preemphasis * x [i - 1];
 }
 
-void NUMdeemphasize_a (double x [], long n, double preemphasis) {
-	long i;
-	for (i = 2; i <= n; i ++)
+void NUMdeemphasize_a (double x [], integer n, double preemphasis) {
+	for (integer i = 2; i <= n; i ++)
 		x [i] += preemphasis * x [i - 1];
 }
 
-void NUMpreemphasize_f (double x [], long n, double dt, double frequency) {
+void NUMpreemphasize_f (double x [], integer n, double dt, double frequency) {
 	NUMpreemphasize_a (x, n, NUMftopreemphasis (frequency, dt));
 }
 
-void NUMdeemphasize_f (double x [], long n, double dt, double frequency) {
+void NUMdeemphasize_f (double x [], integer n, double dt, double frequency) {
 	NUMdeemphasize_a (x, n, NUMftopreemphasis (frequency, dt));
 }
 
-void NUMautoscale (double x [], long n, double scale) {
+void NUMautoscale (double x [], integer n, double scale) {
 	double maximum = 0.0;
-	for (long i = 1; i <= n; i ++)
+	for (integer i = 1; i <= n; i ++)
 		if (fabs (x [i]) > maximum) maximum = fabs (x [i]);
 	if (maximum > 0.0) {
 		double factor = scale / maximum;
-		for (long i = 1; i <= n; i ++)
+		for (integer i = 1; i <= n; i ++)
 			x [i] *= factor;
 	}
 }
@@ -220,7 +219,7 @@ double NUMbessel_i1_f (double x) {
 		+ t * (-0.00420059)))))))));
 }
 
-double NUMbesselI (long n, double x) {
+double NUMbesselI (integer n, double x) {
 	gsl_sf_result result;
 	int status = gsl_sf_bessel_In_e (n, x, & result);
 	return ( status == GSL_SUCCESS ? result. val : undefined );
@@ -266,7 +265,7 @@ double NUMbessel_k1_f (double x) {
 			 + t * (0.00325614 + t * (-0.00068245)))))));
 }
 
-double NUMbesselK_f (long n, double x) {
+double NUMbesselK_f (integer n, double x) {
 	double besselK = undefined;
 	Melder_assert (n >= 0 && x > 0);
 	double besselK_min2 = NUMbessel_k0_f (x);
@@ -278,7 +277,7 @@ double NUMbesselK_f (long n, double x) {
 	/*
 		Recursion formula.
 	*/
-	for (long i = 1; i < n; i ++) {
+	for (integer i = 1; i < n; i ++) {
 		besselK = besselK_min2 + twoByX * i * besselK_min1;
 		besselK_min2 = besselK_min1;
 		besselK_min1 = besselK;
@@ -287,9 +286,9 @@ double NUMbesselK_f (long n, double x) {
 	return besselK;
 }
 
-double NUMbesselK (long n, double x) {
+double NUMbesselK (integer n, double x) {
 	gsl_sf_result result;
-	int status = gsl_sf_bessel_Kn_e (n, x, & result);
+	int status = gsl_sf_bessel_Kn_e ((int) n, x, & result);
 	return ( status == GSL_SUCCESS ? result. val : undefined );
 }
 
@@ -335,13 +334,12 @@ double NUMchiSquareQ (double chiSquare, double degreesOfFreedom) {
 	return NUMincompleteGammaQ (0.5 * degreesOfFreedom, 0.5 * chiSquare);
 }
 
-double NUMcombinations (long n, long k) {
-	double result = 1.0;
-	long i;
+double NUMcombinations (integer n, integer k) {
+	real80 result = 1.0;
 	if (k > n / 2) k = n - k;
-	for (i = 1; i <= k; i ++) result *= n - i + 1;
-	for (i = 2; i <= k; i ++) result /= i;
-	return result;
+	for (integer i = 1; i <= k; i ++) result *= n - i + 1;
+	for (integer i = 2; i <= k; i ++) result /= i;
+	return (real) result;
 }
 
 #define NUM_interpolate_simple_cases \
@@ -352,7 +350,7 @@ double NUMcombinations (long n, long k) {
 	/* 1 < x < nx && x not integer: interpolate. */ \
 	if (maxDepth > midright - 1) maxDepth = midright - 1; \
 	if (maxDepth > nx - midleft) maxDepth = nx - midleft; \
-	if (maxDepth <= NUM_VALUE_INTERPOLATE_NEAREST) return y [(long) floor (x + 0.5)]; \
+	if (maxDepth <= NUM_VALUE_INTERPOLATE_NEAREST) return y [(integer) floor (x + 0.5)]; \
 	if (maxDepth == NUM_VALUE_INTERPOLATE_LINEAR) return y [midleft] + (x - midleft) * (y [midright] - y [midleft]); \
 	if (maxDepth == NUM_VALUE_INTERPOLATE_CUBIC) { \
 		double yl = y [midleft], yr = y [midright]; \
@@ -362,8 +360,8 @@ double NUMcombinations (long n, long k) {
 	}
 
 #if defined (__POWERPC__)
-double NUM_interpolate_sinc (double y [], long nx, double x, long maxDepth) {
-	long ix, midleft = floor (x), midright = midleft + 1, left, right;
+double NUM_interpolate_sinc (double y [], integer nx, double x, integer maxDepth) {
+	integer ix, midleft = floor (x), midright = midleft + 1, left, right;
 	double result = 0.0, a, halfsina, aa, daa, cosaa, sinaa, cosdaa, sindaa;
 	NUM_interpolate_simple_cases
 	left = midright - maxDepth, right = midleft + maxDepth;
@@ -396,8 +394,8 @@ double NUM_interpolate_sinc (double y [], long nx, double x, long maxDepth) {
 	return result;
 }
 #else
-double NUM_interpolate_sinc (double y [], long nx, double x, long maxDepth) {
-	long ix, midleft = (long) floor (x), midright = midleft + 1, left, right;
+double NUM_interpolate_sinc (double y [], integer nx, double x, integer maxDepth) {
+	integer ix, midleft = (integer) floor (x), midright = midleft + 1, left, right;
 	double result = 0.0, a, halfsina, aa, daa;
 	NUM_interpolate_simple_cases
 	left = midright - maxDepth, right = midleft + maxDepth;
@@ -433,7 +431,7 @@ double NUM_interpolate_sinc (double y [], long nx, double x, long maxDepth) {
 struct improve_params {
 	int depth;
 	double *y;
-	long ixmax;
+	integer ixmax;
 	int isMaximum;
 };
 
@@ -443,7 +441,7 @@ static double improve_evaluate (double x, void *closure) {
 	return my isMaximum ? - y : y;
 }
 
-double NUMimproveExtremum (double *y, long nx, long ixmid, int interpolation, double *ixmid_real, int isMaximum) {
+double NUMimproveExtremum (double *y, integer nx, integer ixmid, int interpolation, double *ixmid_real, int isMaximum) {
 	struct improve_params params;
 	double result;
 	if (ixmid <= 1) { *ixmid_real = 1; return y [1]; }
@@ -467,34 +465,34 @@ double NUMimproveExtremum (double *y, long nx, long ixmid, int interpolation, do
 	return isMaximum ? - result : result;
 }
 
-double NUMimproveMaximum (double *y, long nx, long ixmid, int interpolation, double *ixmid_real)
+double NUMimproveMaximum (double *y, integer nx, integer ixmid, int interpolation, double *ixmid_real)
 	{ return NUMimproveExtremum (y, nx, ixmid, interpolation, ixmid_real, 1); }
-double NUMimproveMinimum (double *y, long nx, long ixmid, int interpolation, double *ixmid_real)
+double NUMimproveMinimum (double *y, integer nx, integer ixmid, int interpolation, double *ixmid_real)
 	{ return NUMimproveExtremum (y, nx, ixmid, interpolation, ixmid_real, 0); }
 
 /********** Viterbi **********/
 
 void NUM_viterbi (
-	long numberOfFrames, long maxnCandidates,
-	long (*getNumberOfCandidates) (long iframe, void *closure),
-	double (*getLocalCost) (long iframe, long icand, void *closure),
-	double (*getTransitionCost) (long iframe, long icand1, long icand2, void *closure),
-	void (*putResult) (long iframe, long place, void *closure),
+	integer numberOfFrames, integer maxnCandidates,
+	integer (*getNumberOfCandidates) (integer iframe, void *closure),
+	double (*getLocalCost) (integer iframe, integer icand, void *closure),
+	double (*getTransitionCost) (integer iframe, integer icand1, integer icand2, void *closure),
+	void (*putResult) (integer iframe, integer place, void *closure),
 	void *closure)
 {
 	autoNUMmatrix <double> delta (1, numberOfFrames, 1, maxnCandidates);
-	autoNUMmatrix <long> psi (1, numberOfFrames, 1, maxnCandidates);
-	autoNUMvector <long> numberOfCandidates (1, numberOfFrames);
-	for (long iframe = 1; iframe <= numberOfFrames; iframe ++) {
+	autoNUMmatrix <integer> psi (1, numberOfFrames, 1, maxnCandidates);
+	autoNUMvector <integer> numberOfCandidates (1, numberOfFrames);
+	for (integer iframe = 1; iframe <= numberOfFrames; iframe ++) {
 		numberOfCandidates [iframe] = getNumberOfCandidates (iframe, closure);
-		for (long icand = 1; icand <= numberOfCandidates [iframe]; icand ++)
+		for (integer icand = 1; icand <= numberOfCandidates [iframe]; icand ++)
 			delta [iframe] [icand] = - getLocalCost (iframe, icand, closure);
 	}
-	for (long iframe = 2; iframe <= numberOfFrames; iframe ++) {
-		for (long icand2 = 1; icand2 <= numberOfCandidates [iframe]; icand2 ++) {
+	for (integer iframe = 2; iframe <= numberOfFrames; iframe ++) {
+		for (integer icand2 = 1; icand2 <= numberOfCandidates [iframe]; icand2 ++) {
 			double maximum = -1e308;
-			long place = 0;
-			for (long icand1 = 1; icand1 <= numberOfCandidates [iframe - 1]; icand1 ++) {
+			integer place = 0;
+			for (integer icand1 = 1; icand1 <= numberOfCandidates [iframe - 1]; icand1 ++) {
 				double value = delta [iframe - 1] [icand1] + delta [iframe] [icand2]
 					- getTransitionCost (iframe, icand1, icand2, closure);
 				if (value > maximum) { maximum = value; place = icand1; }
@@ -508,15 +506,15 @@ void NUM_viterbi (
 	/*
 	 * Find the end of the most probable path.
 	 */
-	long place;
+	integer place;
 	double maximum = delta [numberOfFrames] [place = 1];
-	for (long icand = 2; icand <= numberOfCandidates [numberOfFrames]; icand ++)
+	for (integer icand = 2; icand <= numberOfCandidates [numberOfFrames]; icand ++)
 		if (delta [numberOfFrames] [icand] > maximum)
 			maximum = delta [numberOfFrames] [place = icand];
 	/*
 	 * Backtrack.
 	 */
-	for (long iframe = numberOfFrames; iframe >= 1; iframe --) {
+	for (integer iframe = numberOfFrames; iframe >= 1; iframe --) {
 		putResult (iframe, place, closure);
 		place = psi [iframe] [place];
 	}
@@ -525,46 +523,46 @@ void NUM_viterbi (
 /******************/
 
 struct parm2 {
-	int ntrack;
-	long ncomb;
-	long **indices;
-	double (*getLocalCost) (long iframe, long icand, int itrack, void *closure);
-	double (*getTransitionCost) (long iframe, long icand1, long icand2, int itrack, void *closure);
-	void (*putResult) (long iframe, long place, int itrack, void *closure);
+	integer ntrack;
+	integer ncomb;
+	integer **indices;
+	double (*getLocalCost) (integer iframe, integer icand, integer itrack, void *closure);
+	double (*getTransitionCost) (integer iframe, integer icand1, integer icand2, integer itrack, void *closure);
+	void (*putResult) (integer iframe, integer place, integer itrack, void *closure);
 	void *closure;
 };
 
-static long getNumberOfCandidates_n (long iframe, void *closure) {
+static integer getNumberOfCandidates_n (integer iframe, void *closure) {
 	struct parm2 *me = (struct parm2 *) closure;
 	(void) iframe;
 	return my ncomb;
 }
-static double getLocalCost_n (long iframe, long jcand, void *closure) {
+static double getLocalCost_n (integer iframe, integer jcand, void *closure) {
 	struct parm2 *me = (struct parm2 *) closure;
 	double localCost = 0.0;
-	for (int itrack = 1; itrack <= my ntrack; itrack ++)
+	for (integer itrack = 1; itrack <= my ntrack; itrack ++)
 		localCost += my getLocalCost (iframe, my indices [jcand] [itrack], itrack, my closure);
 	return localCost;
 }
-static double getTransitionCost_n (long iframe, long jcand1, long jcand2, void *closure) {
+static double getTransitionCost_n (integer iframe, integer jcand1, integer jcand2, void *closure) {
 	struct parm2 *me = (struct parm2 *) closure;
 	double transitionCost = 0.0;
-	for (int itrack = 1; itrack <= my ntrack; itrack ++)
+	for (integer itrack = 1; itrack <= my ntrack; itrack ++)
 		transitionCost += my getTransitionCost (iframe,
 			my indices [jcand1] [itrack], my indices [jcand2] [itrack], itrack, my closure);
 	return transitionCost;
 }
-static void putResult_n (long iframe, long jplace, void *closure) {
+static void putResult_n (integer iframe, integer jplace, void *closure) {
 	struct parm2 *me = (struct parm2 *) closure;
-	for (int itrack = 1; itrack <= my ntrack; itrack ++)
+	for (integer itrack = 1; itrack <= my ntrack; itrack ++)
 		my putResult (iframe, my indices [jplace] [itrack], itrack, my closure);
 }
 
 void NUM_viterbi_multi (
-	long nframe, long ncand, int ntrack,
-	double (*getLocalCost) (long iframe, long icand, int itrack, void *closure),
-	double (*getTransitionCost) (long iframe, long icand1, long icand2, int itrack, void *closure),
-	void (*putResult) (long iframe, long place, int itrack, void *closure),
+	integer nframe, integer ncand, integer ntrack,
+	double (*getLocalCost) (integer iframe, integer icand, integer itrack, void *closure),
+	double (*getTransitionCost) (integer iframe, integer icand1, integer icand2, integer itrack, void *closure),
+	void (*putResult) (integer iframe, integer place, integer itrack, void *closure),
 	void *closure)
 {
 	struct parm2 parm;
@@ -572,7 +570,7 @@ void NUM_viterbi_multi (
 
 	if (ntrack > ncand) Melder_throw (U"(NUM_viterbi_multi:) "
 		U"Number of tracks (", ntrack, U") should not exceed number of candidates (", ncand, U").");
-	double ncomb = NUMcombinations (ncand, ntrack);
+	integer ncomb = lround (NUMcombinations (ncand, ntrack));
 	if (ncomb > 10000000) Melder_throw (U"(NUM_viterbi_multi:) "
 		U"Unrealistically high number of combinations (", ncomb, U").");
 	parm. ntrack = ntrack;
@@ -591,20 +589,20 @@ void NUM_viterbi_multi (
 	 *   2 4 5
 	 *   3 4 5
 	 */
-	autoNUMmatrix <long> indices (1, parm. ncomb, 1, ntrack);
+	autoNUMmatrix <integer> indices (1, parm. ncomb, 1, ntrack);
 	parm.indices = indices.peek();
-	autoNUMvector <long> icand (1, ntrack);
-	for (int itrack = 1; itrack <= ntrack; itrack ++)
+	autoNUMvector <integer> icand (1, ntrack);
+	for (integer itrack = 1; itrack <= ntrack; itrack ++)
 		icand [itrack] = itrack;   // start out with "1 2 3"
-	long jcomb = 0;
+	integer jcomb = 0;
 	for (;;) {
 		jcomb ++;
-		for (int itrack = 1; itrack <= ntrack; itrack ++)
+		for (integer itrack = 1; itrack <= ntrack; itrack ++)
 			parm. indices [jcomb] [itrack] = icand [itrack];
-		int itrack = ntrack;
+		integer itrack = ntrack;
 		for (; itrack >= 1; itrack --) {
 			if (++ icand [itrack] <= ncand - (ntrack - itrack)) {
-				for (int jtrack = itrack + 1; jtrack <= ntrack; jtrack ++)
+				for (integer jtrack = itrack + 1; jtrack <= ntrack; jtrack ++)
 					icand [jtrack] = icand [itrack] + jtrack - itrack;
 				break;
 			}
@@ -619,11 +617,11 @@ void NUM_viterbi_multi (
 	NUM_viterbi (nframe, ncomb, getNumberOfCandidates_n, getLocalCost_n, getTransitionCost_n, putResult_n, & parm);
 }
 
-int NUMrotationsPointInPolygon (double x0, double y0, long n, double x [], double y []) {
-	long nup = 0, i;
+int NUMrotationsPointInPolygon (double x0, double y0, integer n, double x [], double y []) {
+	integer nup = 0, i;
 	int upold = y [n] > y0, upnew;
 	for (i = 1; i <= n; i ++) if ((upnew = y [i] > y0) != upold) {
-		long j = i == 1 ? n : i - 1;
+		integer j = i == 1 ? n : i - 1;
 		if (x0 < x [i] + (x [j] - x [i]) * (y0 - y [i]) / (y [j] - y [i])) {
 			if (upnew) nup ++; else nup --;
 		}
diff --git a/num/NUMarrays.cpp b/num/NUMarrays.cpp
index 36cffff..2d84833 100644
--- a/num/NUMarrays.cpp
+++ b/num/NUMarrays.cpp
@@ -301,6 +301,7 @@ bool NUMmatrix_equal (integer elementSize, void *m1, void *m2, integer row1, int
 FUNCTION (signed char, i8)
 FUNCTION (int, i16)
 FUNCTION (long, i32)
+FUNCTION (integer, integer)
 FUNCTION (unsigned char, u8)
 FUNCTION (unsigned int, u16)
 FUNCTION (unsigned long, u32)
diff --git a/num/NUMlinprog.cpp b/num/NUMlinprog.cpp
index d65324e..07c6f45 100644
--- a/num/NUMlinprog.cpp
+++ b/num/NUMlinprog.cpp
@@ -21,7 +21,7 @@
 
 struct structNUMlinprog {
 	glp_prob *linearProgram;
-	long numberOfConstraints, ivar, numberOfVariables;
+	integer numberOfConstraints, ivar, numberOfVariables;
 	int *ind;
 	double *val;
 	int status;
@@ -127,8 +127,8 @@ void NUMlinprog_run (NUMlinprog me) {
 	}
 }
 
-double NUMlinprog_getPrimalValue (NUMlinprog me, long ivar) {
-	return glp_get_col_prim (my linearProgram, ivar);
+double NUMlinprog_getPrimalValue (NUMlinprog me, integer ivar) {
+	return glp_get_col_prim (my linearProgram, (int) ivar);
 }
 
 /* End of file NUMlinprog.cpp */
diff --git a/num/NUMrandom.cpp b/num/NUMrandom.cpp
index 036c924..bec738e 100644
--- a/num/NUMrandom.cpp
+++ b/num/NUMrandom.cpp
@@ -265,8 +265,8 @@ double NUMrandomUniform (double lowest, double highest) {
 	return lowest + (highest - lowest) * NUMrandomFraction ();
 }
 
-long NUMrandomInteger (long lowest, long highest) {
-	return lowest + (long) ((highest - lowest + 1) * NUMrandomFraction ());   // round down by truncation, because positive
+integer NUMrandomInteger (integer lowest, integer highest) {
+	return lowest + (integer) ((highest - lowest + 1) * NUMrandomFraction ());   // round down by truncation, because positive
 }
 
 bool NUMrandomBernoulli (double probability) {
@@ -366,7 +366,7 @@ double NUMrandomPoisson (double mean) {
 	if (mean < 8.0) {
 		static double expMean;
 		double product = 1.0;
-		long result = -1;
+		integer result = -1;
 		if (mean != previousMean) {
 			previousMean = mean;
 			expMean = exp (- mean);
diff --git a/num/NUMsort.cpp b/num/NUMsort.cpp
index f8b2ab1..fcc9087 100644
--- a/num/NUMsort.cpp
+++ b/num/NUMsort.cpp
@@ -81,20 +81,20 @@
 		} \
 	}
 
-void NUMsort_d (long n, double a []) {
+void NUMsort_d (integer n, double a []) {
 	MACRO_NUMsort (double, a, integer, n)
 }
 
-void NUMsort_i (long n, int a []) {
+void NUMsort_i (integer n, int a []) {
 	MACRO_NUMsort (int, a, integer, n)
 }
 
-void NUMsort_l (long n, long a []) {
-	MACRO_NUMsort (long, a, integer, n)
+void NUMsort_integer (integer n, integer a []) {
+	MACRO_NUMsort (integer, a, integer, n)
 }
 
-void NUMsort_str (long n, char32 *a []) {
-	long l, r, j, i;
+void NUMsort_str (integer n, char32 *a []) {
+	integer l, r, j, i;
 	char32 *k;
 	if (n < 2) return;
 	l = (n >> 1) + 1;
@@ -122,8 +122,8 @@ void NUMsort_str (long n, char32 *a []) {
 	}
 }
 
-void NUMsort_p (long n, void *a [], int (*compare) (const void *, const void *)) {
-	long l, r, j, i;
+void NUMsort_p (integer n, void *a [], int (*compare) (const void *, const void *)) {
+	integer l, r, j, i;
 	void *k;
 	if (n < 2) return;
 	l = (n >> 1) + 1;
@@ -151,9 +151,9 @@ void NUMsort_p (long n, void *a [], int (*compare) (const void *, const void *))
 	}
 }
 
-double NUMquantile (long n, double a [], double factor) {
+double NUMquantile (integer n, double a [], double factor) {
 	double place = factor * n + 0.5;
-	long left = (long) floor (place);
+	integer left = (integer) floor (place);
 	if (n < 1) return 0.0;
 	if (n == 1) return a [1];
 	if (left < 1) left = 1;
diff --git a/stat/Regression_def.h b/stat/Regression_def.h
index 8de51d2..ae24de7 100644
--- a/stat/Regression_def.h
+++ b/stat/Regression_def.h
@@ -1,6 +1,6 @@
 /* Regression_def.h
  *
- * Copyright (C) 2005-2007,2015,2016 Paul Boersma
+ * Copyright (C) 2005-2007,2015,2016,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ oo_DEFINE_CLASS (RegressionParameter, Daata)
 	oo_DOUBLE (value)
 
 	#if oo_DECLARING || oo_COPYING
-		oo_LONG (tableColumnIndex)
+		oo_INTEGER (tableColumnIndex)
 	#endif
 
 oo_END_CLASS (RegressionParameter)
diff --git a/stat/Table.cpp b/stat/Table.cpp
index 2cfbb76..11ae486 100644
--- a/stat/Table.cpp
+++ b/stat/Table.cpp
@@ -51,19 +51,19 @@ void structTable :: v_info () {
 	MelderInfo_writeLine (U"Number of columns: ", our numberOfColumns);
 }
 
-const char32 * structTable :: v_getColStr (long columnNumber) {
+const char32 * structTable :: v_getColStr (integer columnNumber) {
 	if (columnNumber < 1 || columnNumber > our numberOfColumns) return nullptr;
 	return our columnHeaders [columnNumber]. label ? our columnHeaders [columnNumber]. label : U"";
 }
 
-double structTable :: v_getMatrix (long rowNumber, long columnNumber) {
+double structTable :: v_getMatrix (integer rowNumber, integer columnNumber) {
 	if (rowNumber < 1 || rowNumber > our rows.size) return undefined;
 	if (columnNumber < 1 || columnNumber > our numberOfColumns) return undefined;
 	char32 *stringValue = our rows.at [rowNumber] -> cells [columnNumber]. string;
 	return stringValue ? Melder_atof (stringValue) : undefined;
 }
 
-const char32 * structTable :: v_getMatrixStr (long rowNumber, long columnNumber) {
+const char32 * structTable :: v_getMatrixStr (integer rowNumber, integer columnNumber) {
 	if (rowNumber < 1 || rowNumber > our rows.size) return U"";
 	if (columnNumber < 1 || columnNumber > our numberOfColumns) return U"";
 	char32 *stringValue = our rows.at [rowNumber] -> cells [columnNumber]. string;
diff --git a/stat/TableEditor.cpp b/stat/TableEditor.cpp
index 3d26e03..3b8f6cf 100644
--- a/stat/TableEditor.cpp
+++ b/stat/TableEditor.cpp
@@ -66,13 +66,13 @@ void structTableEditor :: v_dataChanged () {
 
 static void menu_cb_preferences (TableEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"TableEditor preferences", nullptr);
-		OPTIONMENU (U"The symbols %#_^ in labels", my default_useTextStyles () + 1)
+		OPTIONMENU (useTextStyles, U"The symbols %#_^ in labels", my default_useTextStyles () + 1)
 			OPTION (U"are shown as typed")
 			OPTION (U"mean italic/bold/sub/super")
 	EDITOR_OK
-		SET_INTEGER (U"The symbols %#_^ in labels", my p_useTextStyles + 1)
+		SET_OPTION (useTextStyles, my p_useTextStyles + 1)
 	EDITOR_DO
-		my pref_useTextStyles () = my p_useTextStyles = GET_INTEGER (U"The symbols %#_^ in labels") - 1;
+		my pref_useTextStyles () = my p_useTextStyles = useTextStyles - 1;
 		Graphics_updateWs (my graphics.get());
 	EDITOR_END
 }
diff --git a/stat/TableOfReal.cpp b/stat/TableOfReal.cpp
index 81046e5..e6da8a7 100644
--- a/stat/TableOfReal.cpp
+++ b/stat/TableOfReal.cpp
@@ -93,15 +93,15 @@ void structTableOfReal :: v_info () {
 	MelderInfo_writeLine (U"Number of columns: ", numberOfColumns);
 }
 
-const char32 * structTableOfReal :: v_getRowStr (long irow) {
+const char32 * structTableOfReal :: v_getRowStr (integer irow) {
 	if (irow < 1 || irow > numberOfRows) return nullptr;
 	return rowLabels [irow] ? rowLabels [irow] : U"";
 }
-const char32 * structTableOfReal :: v_getColStr (long icol) {
+const char32 * structTableOfReal :: v_getColStr (integer icol) {
 	if (icol < 1 || icol > numberOfColumns) return nullptr;
 	return columnLabels [icol] ? columnLabels [icol] : U"";
 }
-double structTableOfReal :: v_getMatrix (long irow, long icol) {
+double structTableOfReal :: v_getMatrix (integer irow, integer icol) {
 	if (irow < 1 || irow > numberOfRows) return undefined;
 	if (icol < 1 || icol > numberOfColumns) return undefined;
 	return data [irow] [icol];
diff --git a/stat/TableOfReal_def.h b/stat/TableOfReal_def.h
index 0cdfa30..f777f0d 100644
--- a/stat/TableOfReal_def.h
+++ b/stat/TableOfReal_def.h
@@ -1,6 +1,6 @@
 /* TableOfReal_def.h
  *
- * Copyright (C) 1992-2011,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -20,8 +20,8 @@
 #define ooSTRUCT TableOfReal
 oo_DEFINE_CLASS (TableOfReal, Daata)
 
-	oo_LONG (numberOfRows)
-	oo_LONG (numberOfColumns)
+	oo_INTEGER (numberOfRows)
+	oo_INTEGER (numberOfColumns)
 	oo_STRING_VECTOR (rowLabels, numberOfRows)
 	oo_STRING_VECTOR (columnLabels, numberOfColumns)
 	oo_DOUBLE_MATRIX (data, numberOfRows, numberOfColumns)
@@ -39,15 +39,15 @@ oo_DEFINE_CLASS (TableOfReal, Daata)
 			override { return numberOfColumns; }
 		bool v_hasGetRowStr ()
 			override { return true; }
-		const char32 * v_getRowStr (long irow)
+		const char32 * v_getRowStr (integer irow)
 			override;
 		bool v_hasGetColStr ()
 			override { return true; }
-		const char32 * v_getColStr (long icol)
+		const char32 * v_getColStr (integer icol)
 			override;
 		bool v_hasGetMatrix ()
 			override { return true; }
-		double v_getMatrix (long irow, long icol)
+		double v_getMatrix (integer irow, integer icol)
 			override;
 		bool v_hasGetRowIndex ()
 			override { return true; }
diff --git a/stat/Table_def.h b/stat/Table_def.h
index 75cbd19..270631b 100644
--- a/stat/Table_def.h
+++ b/stat/Table_def.h
@@ -1,6 +1,6 @@
 /* Table_def.h
  *
- * Copyright (C) 2002-2012,2015,2016 Paul Boersma
+ * Copyright (C) 2002-2012,2015,2016,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -33,11 +33,11 @@ oo_END_STRUCT (TableCell)
 #define ooSTRUCT TableRow
 oo_DEFINE_CLASS (TableRow, Daata)
 
-	oo_LONG (numberOfColumns)
+	oo_INTEGER (numberOfColumns)
 	oo_STRUCT_VECTOR (TableCell, cells, numberOfColumns)
 
 	#if oo_DECLARING || oo_COPYING
-		oo_LONG (sortingIndex)
+		oo_INTEGER (sortingIndex)
 	#endif
 
 oo_END_CLASS (TableRow)
@@ -60,7 +60,7 @@ oo_END_STRUCT (TableColumnHeader)
 #define ooSTRUCT Table
 oo_DEFINE_CLASS (Table, Daata)
 
-	oo_LONG (numberOfColumns)
+	oo_INTEGER (numberOfColumns)
 	oo_STRUCT_VECTOR (TableColumnHeader, columnHeaders, numberOfColumns)
 	oo_COLLECTION_OF (OrderedOf, rows, TableRow, 0)
 
@@ -77,15 +77,15 @@ oo_DEFINE_CLASS (Table, Daata)
 			override { return numberOfColumns; }
 		bool v_hasGetColStr ()
 			override { return true; }
-		const char32 * v_getColStr (long columnNumber)
+		const char32 * v_getColStr (integer columnNumber)
 			override;
 		bool v_hasGetMatrix ()
 			override { return true; }
-		double v_getMatrix (long rowNumber, long columnNumber)
+		double v_getMatrix (integer rowNumber, integer columnNumber)
 			override;
 		bool v_hasGetMatrixStr ()
 			override { return true; }
-		const char32 * v_getMatrixStr (long rowNumber, long columnNumber)
+		const char32 * v_getMatrixStr (integer rowNumber, integer columnNumber)
 			override;
 		bool v_hasGetColIndex ()
 			override { return true; }
diff --git a/stat/praat_Stat.cpp b/stat/praat_Stat.cpp
index 1e00a99..cd1a109 100644
--- a/stat/praat_Stat.cpp
+++ b/stat/praat_Stat.cpp
@@ -228,8 +228,7 @@ DO
 FORM (NEW1_Table_createWithColumnNames, U"Create Table with column names", nullptr) {
 	WORD (name, U"Name", U"table")
 	INTEGER (numberOfRows, U"Number of rows", U"10")
-	LABEL (U"", U"Column names:")
-	TEXTFIELD (columnNames, U"columnNames", U"speaker dialect age vowel F0 F1 F2")
+	TEXTFIELD (columnNames, U"Column names:", U"speaker dialect age vowel F0 F1 F2")
 	OK
 DO
 	CREATE_ONE
@@ -766,7 +765,7 @@ DIRECT (MODIFY_Table_appendRow) {
 
 FORM (MODIFY_Table_formula, U"Table: Formula", U"Table: Formula...") {
 	SENTENCE (columnLabel, U"Column (label)", U"")
-	TEXTFIELD (formula, U"formula", U"abs (self)")
+	TEXTFIELD (formula, U"Formula:", U"abs (self)")
 	OK
 DO
 	MODIFY_EACH_WEAK (Table)
@@ -778,7 +777,7 @@ DO
 FORM (MODIFY_Table_formula_columnRange, U"Table: Formula (column range)", U"Table: Formula...") {
 	SENTENCE (fromColumn, U"From column (label)", U"")
 	SENTENCE (toColumn, U"To column (label)", U"")
-	TEXTFIELD (formula, U"formula", U"log10 (self)")
+	TEXTFIELD (formula, U"Formula:", U"log10 (self)")
 	OK
 DO
 	MODIFY_EACH_WEAK (Table)
@@ -884,8 +883,7 @@ DIRECT (MODIFY_Table_reflectRows) {
 }
 
 FORM (MODIFY_Table_sortRows, U"Table: Sort rows", nullptr) {
-	LABEL (U"", U"One or more column labels for sorting:")
-	TEXTFIELD (columnLabels, U"columnLabels", U"dialect gender name")
+	TEXTFIELD (columnLabels, U"One or more column labels for sorting:", U"dialect gender name")
 	OK
 DO
 	MODIFY_EACH (Table)
@@ -896,19 +894,13 @@ DO
 // MARK: Convert
 
 FORM (NEW_Table_collapseRows, U"Table: Collapse rows", nullptr) {
-	LABEL (U"", U"Columns with factors (independent variables):")
-	TEXTFIELD (factors, U"factors", U"speaker dialect age vowel")
-	LABEL (U"", U"Columns to sum:")
-	TEXTFIELD (columnsToSum, U"columnsToSum", U"number cost")
-	LABEL (U"", U"Columns to average:")
-	TEXTFIELD (columnsToAverage, U"columnsToAverage", U"price")
-	LABEL (U"", U"Columns to medianize:")
-	TEXTFIELD (columnsToMedianize, U"columnsToMedianize", U"vot")
-	LABEL (U"", U"Columns to average logarithmically:")
-	TEXTFIELD (columnsToAverageLogarithmically, U"columnsToAverageLogarithmically", U"duration")
-	LABEL (U"", U"Columns to medianize logarithmically:")
-	TEXTFIELD (columnsToMedianizeLogarithmically, U"columnsToMedianizeLogarithmically", U"F0 F1 F2 F3")
-	LABEL (U"", U"Columns not mentioned above will be ignored.")
+	TEXTFIELD (factors, U"Columns with factors (independent variables):", U"speaker dialect age vowel")
+	TEXTFIELD (columnsToSum, U"Columns to sum:", U"number cost")
+	TEXTFIELD (columnsToAverage, U"Columns to average:", U"price")
+	TEXTFIELD (columnsToMedianize, U"Columns to medianize:", U"vot")
+	TEXTFIELD (columnsToAverageLogarithmically, U"olumns to average logarithmically:", U"duration")
+	TEXTFIELD (columnsToMedianizeLogarithmically, U"Columns to medianize logarithmically:", U"F0 F1 F2 F3")
+	LABEL (U"Columns not mentioned above will be ignored.")
 	OK
 DO
 	CONVERT_EACH (Table)
@@ -955,12 +947,10 @@ DIRECT (NEW_Table_transpose) {
 }
 
 FORM (NEW_Table_rowsToColumns, U"Table: Rows to columns", nullptr) {
-	LABEL (U"", U"Columns with factors (independent variables):")
-	TEXTFIELD (factors, U"factors", U"dialect gender speaker")
+	TEXTFIELD (factors, U"Columns with factors (independent variables):", U"dialect gender speaker")
 	SENTENCE (columnToTranspose, U"Column to transpose", U"vowel")
-	LABEL (U"", U"Columns to expand:")
-	TEXTFIELD (columnsToExpand, U"columnsToExpand", U"duration F0 F1 F2 F3")
-	LABEL (U"", U"Columns not mentioned above will be ignored.")
+	TEXTFIELD (columnsToExpand, U"Columns to expand:", U"duration F0 F1 F2 F3")
+	LABEL (U"Columns not mentioned above will be ignored.")
 	OK
 DO
 	CONVERT_EACH (Table)
@@ -976,8 +966,7 @@ DIRECT (NEW_Table_to_LinearRegression) {
 }
 
 FORM (NEW_Table_to_LogisticRegression, U"Table: To LogisticRegression", nullptr) {
-	LABEL (U"", U"Factors (column names):")
-	TEXTFIELD (factors, U"factors", U"F0 F1 duration")
+	TEXTFIELD (factors, U"Factors (column names):", U"F0 F1 duration")
 	SENTENCE (dependent1, U"Dependent 1 (column name)", U"e")
 	SENTENCE (dependent2, U"Dependent 2 (column name)", U"i")
 	OK
diff --git a/stat/praat_TableOfReal.cpp b/stat/praat_TableOfReal.cpp
index 6e78a1e..bfcb083 100644
--- a/stat/praat_TableOfReal.cpp
+++ b/stat/praat_TableOfReal.cpp
@@ -57,8 +57,7 @@ FORM (GRAPHICS_TableOfReal_drawAsNumbers_if, U"Draw as numbers if...", nullptr)
 		RADIOBUTTON (U"free")
 		RADIOBUTTON (U"rational")
 	NATURAL (precision, U"Precision", U"5")
-	LABEL (U"", U"Condition:")
-	TEXTFIELD (condition, U"condition", U"self <> 0")
+	TEXTFIELD (condition, U"Condition:", U"self <> 0")
 	OK
 DO
 	GRAPHICS_EACH (TableOfReal)
@@ -234,8 +233,8 @@ DO
 // MARK: Modify
 
 FORM (MODIFY_TableOfReal_formula, U"TableOfReal: Formula", U"Formula...") {
-	LABEL (U"", U"for row from 1 to nrow do for col from 1 to ncol do self [row, col] = ...")
-	TEXTFIELD (formula, U"formula", U"if col = 5 then self + self [6] else self fi")
+	LABEL (U"for row from 1 to nrow do for col from 1 to ncol do self [row, col] = ...")
+	TEXTFIELD (formula, U"Formula:", U"if col = 5 then self + self [6] else self fi")
 	OK
 DO
 	MODIFY_EACH_WEAK (TableOfReal)
@@ -347,7 +346,7 @@ DO
 }
 
 FORM (MODIFY_TableOfReal_sortByLabel, U"Sort rows by label", nullptr) {
-	LABEL (U"", U"Secondary sorting keys:")
+	LABEL (U"Secondary sorting keys:")
 	INTEGER (column1, U"Column1", U"1")
 	INTEGER (column2, U"Column2", U"0")
 	OK
@@ -366,9 +365,8 @@ DIRECT (NEW_TableOfReal_extractColumnLabelsAsStrings) {
 }
 
 FORM (NEW_TableOfReal_extractColumnRanges, U"Extract column ranges", nullptr) {
-	LABEL (U"", U"Create a new TableOfReal from the following columns:")
-	TEXTFIELD (ranges, U"ranges", U"1 2")
-	LABEL (U"", U"To supply rising or falling ranges, use e.g. 2:6 or 5:3.")
+	TEXTFIELD (ranges, U"Create a new TableOfReal from the following columns:", U"1 2")
+	LABEL (U"To supply rising or falling ranges, use e.g. 2:6 or 5:3.")
 	OK
 DO
 	CONVERT_EACH (TableOfReal)
@@ -377,8 +375,7 @@ DO
 }
 
 FORM (NEW_TableOfReal_extractColumnsWhere, U"Extract columns where", nullptr) {
-	LABEL (U"", U"Extract all columns with at least one cell where:")
-	TEXTFIELD (condition, U"condition", U"col mod 3 = 0 ; this example extracts every third column")
+	TEXTFIELD (condition, U"Extract all columns with at least one cell where:", U"col mod 3 = 0 ; this example extracts every third column")
 	OK
 DO
 	CONVERT_EACH (TableOfReal)
@@ -414,9 +411,8 @@ DIRECT (NEW_TableOfReal_extractRowLabelsAsStrings) {
 }
 
 FORM (NEW_TableOfReal_extractRowRanges, U"Extract row ranges", nullptr) {
-	LABEL (U"", U"Create a new TableOfReal from the following rows:")
-	TEXTFIELD (ranges, U"ranges", U"1 2")
-	LABEL (U"", U"To supply rising or falling ranges, use e.g. 2:6 or 5:3.")
+	TEXTFIELD (ranges, U"Create a new TableOfReal from the following rows:", U"1 2")
+	LABEL (U"To supply rising or falling ranges, use e.g. 2:6 or 5:3.")
 	OK
 DO
 	CONVERT_EACH (TableOfReal)
@@ -425,8 +421,7 @@ DO
 }
 
 FORM (NEW_TableOfReal_extractRowsWhere, U"Extract rows where", nullptr) {
-	LABEL (U"", U"Extract all rows with at least one cell where:")
-	TEXTFIELD (condition, U"condition", U"row mod 3 = 0 ; this example extracts every third row")
+	TEXTFIELD (condition, U"Extract all rows with at least one cell where:", U"row mod 3 = 0 ; this example extracts every third row")
 	OK
 DO
 	CONVERT_EACH (TableOfReal)
diff --git a/sys/ButtonEditor.cpp b/sys/ButtonEditor.cpp
index c18aab1..ba97f72 100644
--- a/sys/ButtonEditor.cpp
+++ b/sys/ButtonEditor.cpp
@@ -32,7 +32,7 @@ Thing_implement (ButtonEditor, HyperPage, 0);
 	#define BUTTON_WIDTH  96
 #endif
 
-static void drawMenuCommand (ButtonEditor me, Praat_Command cmd, long i) {
+static void drawMenuCommand (ButtonEditor me, Praat_Command cmd, integer i) {
 	static MelderString text { };
 	bool isAdded = cmd -> uniqueID != 0 || cmd -> script != nullptr;
 	bool isHidden = cmd -> hidden;
@@ -68,7 +68,7 @@ static void drawMenuCommand (ButtonEditor me, Praat_Command cmd, long i) {
 		cmd -> depth * 0.3, 0.4, 0.0, 0.0, 0);
 }
 
-static void drawAction (ButtonEditor me, Praat_Command cmd, long i) {
+static void drawAction (ButtonEditor me, Praat_Command cmd, integer i) {
 	static MelderString text { };
 	bool isAdded = cmd -> uniqueID != 0 || cmd -> script != nullptr;
 	bool isHidden = cmd -> hidden, isToggled = cmd -> toggled;
@@ -130,28 +130,28 @@ void structButtonEditor :: v_draw () {
 	Graphics_clearWs (our graphics.get());
 	switch (show) {
 		case 1:
-			for (long i = 1, n = praat_getNumberOfMenuCommands (); i <= n; i ++) {
+			for (integer i = 1, n = praat_getNumberOfMenuCommands (); i <= n; i ++) {
 				Praat_Command cmd = praat_getMenuCommand (i);
 				if (str32equ (cmd -> window, U"Objects"))
 					drawMenuCommand (this, praat_getMenuCommand (i), i);
 			}
 			break;
 		case 2:
-			for (long i = 1, n = praat_getNumberOfMenuCommands (); i <= n; i ++) {
+			for (integer i = 1, n = praat_getNumberOfMenuCommands (); i <= n; i ++) {
 				Praat_Command cmd = praat_getMenuCommand (i);
 				if (str32equ (cmd -> window, U"Picture"))
 					drawMenuCommand (this, praat_getMenuCommand (i), i);
 			}
 			break;
 		case 3:
-			for (long i = 1, n = praat_getNumberOfMenuCommands (); i <= n; i ++) {
+			for (integer i = 1, n = praat_getNumberOfMenuCommands (); i <= n; i ++) {
 				Praat_Command cmd = praat_getMenuCommand (i);
 				if (! str32equ (cmd -> window, U"Objects") && ! str32equ (cmd -> window, U"Picture"))
 					drawMenuCommand (this, praat_getMenuCommand (i), i);
 			}
 			break;
 		case 4:
-			for (long i = 1, n = praat_getNumberOfActions (); i <= n; i ++) {
+			for (integer i = 1, n = praat_getNumberOfActions (); i <= n; i ++) {
 				Praat_Command cmd = praat_getAction (i);
 				const char32 *klas = cmd -> class1 -> className;
 				if (str32cmp (klas, U"N") < 0)
@@ -159,7 +159,7 @@ void structButtonEditor :: v_draw () {
 			}
 			break;
 		case 5:
-			for (long i = 1, n = praat_getNumberOfActions (); i <= n; i ++) {
+			for (integer i = 1, n = praat_getNumberOfActions (); i <= n; i ++) {
 				Praat_Command cmd = praat_getAction (i);
 				const char32 *klas = cmd -> class1 -> className;
 				if (str32cmp (klas, U"N") >= 0)
@@ -174,7 +174,7 @@ int structButtonEditor :: v_goToPage (const char32 *title) {
 	if (str32equ (title, U"Buttons")) return 1;
 	switch (title [0]) {
 		case 'a': {   // toggle visibility of action
-			long i = Melder_atoi (& title [1]);
+			integer i = Melder_atoi (& title [1]);
 			Praat_Command action = praat_getAction (i);
 			if (! action) return 0;
 			if (action -> hidden)
@@ -183,7 +183,7 @@ int structButtonEditor :: v_goToPage (const char32 *title) {
 				praat_hideAction (action -> class1, action -> class2, action -> class3, action -> title);
 		} break;
 		case 'm': {   // toggle visibility of menu command
-			long i = Melder_atoi (& title [1]);
+			integer i = Melder_atoi (& title [1]);
 			Praat_Command menuCommand = praat_getMenuCommand (i);
 			if (! menuCommand) return 0;
 			if (menuCommand -> hidden)
@@ -192,7 +192,7 @@ int structButtonEditor :: v_goToPage (const char32 *title) {
 				praat_hideMenuCommand (menuCommand -> window, menuCommand -> menu, menuCommand -> title);
 		} break;
 		case 'e': {   // execute action
-			long i = Melder_atoi (& title [1]);
+			integer i = Melder_atoi (& title [1]);
 			Praat_Command action = praat_getAction (i);
 			if (! action || ! action -> callback) return 0;
 			if (action -> title) {
@@ -215,7 +215,7 @@ int structButtonEditor :: v_goToPage (const char32 *title) {
 			praat_updateSelection ();
 		} break;
 		case 'p': {   // perform menu command
-			long i = Melder_atoi (& title [1]);
+			integer i = Melder_atoi (& title [1]);
 			Praat_Command menuCommand = praat_getMenuCommand (i);
 			if (! menuCommand || ! menuCommand -> callback) return 0;
 			if (menuCommand -> title) {
diff --git a/sys/Collection.cpp b/sys/Collection.cpp
index d5fe4f0..a4c554e 100644
--- a/sys/Collection.cpp
+++ b/sys/Collection.cpp
@@ -32,7 +32,7 @@ void _CollectionOfDaata_v_copy (_CollectionOfDaata* me, _CollectionOfDaata* thee
 		thy at._elements = Melder_calloc (Daata, my _capacity);   // filled with null pointers
 		thy at._elements --;   // immediately turn from base-0 into base-1  // BUG use NUMvector
 	}
-	for (long i = 1; i <= my size; i ++) {
+	for (integer i = 1; i <= my size; i ++) {
 		Daata item = my at [i];
 		if (my _ownItems) {
 			if (! Thing_isa (item, classDaata))
@@ -47,7 +47,7 @@ void _CollectionOfDaata_v_copy (_CollectionOfDaata* me, _CollectionOfDaata* thee
 bool _CollectionOfDaata_v_equal (_CollectionOfDaata* me, _CollectionOfDaata* thee) {
 	if (! my structDaata :: v_equal (thee)) return false;
 	if (my size != thy size) return false;
-	for (long i = 1; i <= my size; i ++) {
+	for (integer i = 1; i <= my size; i ++) {
 		if (! Thing_isa (my at [i], classDaata))
 			Melder_throw (U"Collection::equal: "
 				U"cannot compare items of class ", Thing_className (my at [i]), U".");
@@ -64,7 +64,7 @@ bool _CollectionOfDaata_v_equal (_CollectionOfDaata* me, _CollectionOfDaata* the
 }
 
 bool _CollectionOfDaata_v_canWriteAsEncoding (_CollectionOfDaata* me, int encoding) {
-	for (long i = 1; i <= my size; i ++) {
+	for (integer i = 1; i <= my size; i ++) {
 		Daata data = my at [i];
 		if (data -> name && ! Melder_isEncodable (data -> name, encoding)) return false;
 		if (! Data_canWriteAsEncoding (data, encoding)) return false;
@@ -75,7 +75,7 @@ bool _CollectionOfDaata_v_canWriteAsEncoding (_CollectionOfDaata* me, int encodi
 void _CollectionOfDaata_v_writeText (_CollectionOfDaata* me, MelderFile file) {
 	texputi32 (file, my size, U"size", 0,0,0,0,0);
 	texputintro (file, U"item []: ", my size ? nullptr : U"(empty)", 0,0,0,0);
-	for (long i = 1; i <= my size; i ++) {
+	for (integer i = 1; i <= my size; i ++) {
 		Daata thing = my at [i];
 		ClassInfo classInfo = thing -> classInfo;
 		texputintro (file, U"item [", Melder_integer (i), U"]:", 0,0,0);
@@ -95,13 +95,13 @@ void _CollectionOfDaata_v_writeText (_CollectionOfDaata* me, MelderFile file) {
 
 void _CollectionOfDaata_v_readText (_CollectionOfDaata* me, MelderReadText text, int formatVersion) {
 	if (formatVersion < 0) {
-		long l_size;
+		integer l_size;
 		autostring8 line = Melder_32to8 (MelderReadText_readLine (text));
 		if (! line.peek() || ! sscanf (line.peek(), "%ld", & l_size) || l_size < 0)
 			Melder_throw (U"Collection::readText: cannot read size.");
 		my _grow (l_size);
-		for (long i = 1; i <= l_size; i ++) {
-			long itemNumberRead;
+		for (integer i = 1; i <= l_size; i ++) {
+			integer itemNumberRead;
 			int n = 0, length, stringsRead;
 			char klas [200], nameTag [2000];
 			do {
@@ -149,7 +149,7 @@ void _CollectionOfDaata_v_readText (_CollectionOfDaata* me, MelderReadText text,
 
 void _CollectionOfDaata_v_writeBinary (_CollectionOfDaata* me, FILE *f) {
 	binputi32 (my size, f);
-	for (long i = 1; i <= my size; i ++) {
+	for (integer i = 1; i <= my size; i ++) {
 		Daata thing = my at [i];
 		ClassInfo classInfo = thing -> classInfo;
 		if (! Thing_isa (thing, classDaata) || ! Data_canWriteBinary (thing))
@@ -205,9 +205,9 @@ void _CollectionOfDaata_v_readBinary (_CollectionOfDaata* me, FILE *f, int forma
 }
 
 struct structData_Description theCollectionOfDaata_v_description [] = {
-	{ U"size", longwa, Melder_offsetof (CollectionOf<structThing>*, size), sizeof (long) },
-	{ U"items", objectwa, Melder_offsetof (CollectionOf<structThing>*, at), sizeof (Daata), U"Daata", & theClassInfo_Daata, 1, 0, U"size" },
-	{ 0 }
+	{ U"size", integerwa, Melder_offsetof (CollectionOf<structThing>*, size), sizeof (integer), nullptr, nullptr, 0, nullptr, nullptr, nullptr, nullptr },
+	{ U"items", objectwa, Melder_offsetof (CollectionOf<structThing>*, at), sizeof (Daata), U"Daata", & theClassInfo_Daata, 1, nullptr, U"size", nullptr, nullptr },
+	{ }
 };
 
 #define _Collection_implement(klas,genericClass,itemClass,parentClass,version) \
diff --git a/sys/Collection.h b/sys/Collection.h
index b297cb7..90614a5 100644
--- a/sys/Collection.h
+++ b/sys/Collection.h
@@ -2,7 +2,7 @@
 #define _Collection_h_
 /* Collection.h
  *
- * Copyright (C) 1992-2011,2015,2016 Paul Boersma
+ * Copyright (C) 1992-2011,2015,2016,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -52,7 +52,7 @@ extern struct structData_Description theCollectionOfDaata_v_description [3];
 template <typename T   /*Melder_ENABLE_IF_ISA (T, structThing)*/>
 struct ArrayOf {
 	T** _elements { nullptr };
-	T*& operator[] (long i) const {
+	T*& operator[] (integer i) const {
 		return our _elements [i];
 	}
 };
@@ -60,8 +60,8 @@ struct ArrayOf {
 template <typename T   /*Melder_ENABLE_IF_ISA (T, structThing)*/>
 struct CollectionOf : structDaata {
 	ArrayOf <T> at;
-	long size { 0 };
-	long _capacity { 0 };
+	integer size { 0 };
+	integer _capacity { 0 };
 	bool _ownItems { true };
 	bool _ownershipInitialized { false };
 
@@ -82,7 +82,7 @@ struct CollectionOf : structDaata {
 		*/
 		if (our at._elements) {
 			if (our _ownItems) {
-				for (long i = 1; i <= our size; i ++) {
+				for (integer i = 1; i <= our size; i ++) {
 					_Thing_forget (our at [i]);
 				}
 			}
@@ -125,7 +125,7 @@ struct CollectionOf : structDaata {
 		if (other. at._elements != our at._elements) {
 			if (our at._elements) {
 				if (our _ownItems) {
-					for (long i = 1; i <= our size; i ++) {
+					for (integer i = 1; i <= our size; i ++) {
 						_Thing_forget (our at [i]);
 					}
 				}
@@ -149,7 +149,7 @@ struct CollectionOf : structDaata {
 		if (other. at_elements != our at_elements) {
 			if (our at._elements) {
 				if (our _ownItems) {
-					for (long i = 1; i <= our size; i ++) {
+					for (integer i = 1; i <= our size; i ++) {
 						_Thing_forget (our at [i]);
 					}
 				}
@@ -179,30 +179,30 @@ struct CollectionOf : structDaata {
 			our _ownershipInitialized = true;
 		}
 	}
-	void _grow (long newCapacity) {
+	void _grow (integer newCapacity) {
 		if (newCapacity <= our _capacity) return;
 		T** oldItem_base0 = ( our at._elements ? our at._elements + 1 : nullptr );   // convert from base-1 to base-0
 		T** newItem_base0 = (T**) Melder_realloc (oldItem_base0, newCapacity * (int64) sizeof (T*));
 		our at._elements = newItem_base0 - 1;   // convert from base-0 to base-1
 		our _capacity = newCapacity;
 	}
-	void _makeRoomForOneMoreItem (long pos) {
+	void _makeRoomForOneMoreItem (integer pos) {
 		if (our size >= our _capacity) {
-			long newCapacity = 2 * our _capacity + 30;   // enough room to guarantee space for one more item, if _capacity >= 0
+			integer newCapacity = 2 * our _capacity + 30;   // enough room to guarantee space for one more item, if _capacity >= 0
 			T** oldItem_base0 = ( our at._elements ? our at._elements + 1 : nullptr );   // convert from base-1 to base-0
 			T** newItem_base0 = (T**) Melder_realloc (oldItem_base0, newCapacity * (int64) sizeof (T*));
 			our at._elements = newItem_base0 - 1;   // convert from base-0 to base-1
 			our _capacity = newCapacity;
 		}
 		our size ++;
-		for (long i = our size; i > pos; i --) our at [i] = our at [i - 1];
+		for (integer i = our size; i > pos; i --) our at [i] = our at [i - 1];
 	}
-	T* _insertItem_move (_Thing_auto <T> data, long pos) {
+	T* _insertItem_move (_Thing_auto <T> data, integer pos) {
 		our _initializeOwnership (true);
 		our _makeRoomForOneMoreItem (pos);
 		return our at [pos] = data.releaseToAmbiguousOwner();
 	}
-	void _insertItem_ref (T* data, long pos) {
+	void _insertItem_ref (T* data, integer pos) {
 		our _initializeOwnership (false);
 		our _makeRoomForOneMoreItem (pos);
 		our at [pos] = data;
@@ -221,7 +221,7 @@ struct CollectionOf : structDaata {
 	*/
 	void addItem_ref (T* thing) {
 		Melder_assert (thing);
-		long index = our _v_position (thing);
+		integer index = our _v_position (thing);
 		if (index != 0) {
 			our _insertItem_ref (thing, index);
 		} else {
@@ -245,7 +245,7 @@ struct CollectionOf : structDaata {
 	*/
 	T* addItem_move (_Thing_auto<T> thing) {
 		T* thingRef = thing.get();
-		long index = our _v_position (thingRef);
+		integer index = our _v_position (thingRef);
 		if (index != 0) {
 			return our _insertItem_move (thing.move(), index);
 		} else {
@@ -265,9 +265,9 @@ struct CollectionOf : structDaata {
 			often used just before the item is destroyed, hence the name of this procedure.
 	*/
 	void undangleItem (Thing thing) {
-		for (long i = our size; i > 0; i --) {
+		for (integer i = our size; i > 0; i --) {
 			if (our at [i] == thing) {
-				for (long j = i; j < our size; j ++) {
+				for (integer j = i; j < our size; j ++) {
 					our at [j] = our at [j + 1];
 				}
 				our size --;
@@ -286,28 +286,28 @@ struct CollectionOf : structDaata {
 			my size == my old size - 1;
 			my _capacity not changed;
 	*/
-	_Thing_auto<T> subtractItem_move (long pos) {
+	_Thing_auto<T> subtractItem_move (integer pos) {
 		Melder_assert (pos >= 1 && pos <= our size);
 		Melder_assert (our _ownItems);
 		_Thing_auto<T> result (our at [pos]);
-		for (long i = pos; i < our size; i ++) our at [i] = our at [i + 1];
+		for (integer i = pos; i < our size; i ++) our at [i] = our at [i + 1];
 		our size --;
 		return result;
 	}
-	T* subtractItem_ref (long pos) {
+	T* subtractItem_ref (integer pos) {
 		Melder_assert (pos >= 1 && pos <= our size);
 		Melder_assert (! our _ownItems);
 		T* result = our at [pos];
-		for (long i = pos; i < our size; i ++) our at [i] = our at [i + 1];
+		for (integer i = pos; i < our size; i ++) our at [i] = our at [i + 1];
 		our size --;
 		return result;
 	}
-	void replaceItem_ref (T* data, long pos) {
+	void replaceItem_ref (T* data, integer pos) {
 		Melder_assert (pos >= 1 && pos <= our size);
 		Melder_assert (! our _ownItems);
 		our at [pos] = data;
 	}
-	T* replaceItem_move (_Thing_auto <T> data, long pos) {
+	T* replaceItem_move (_Thing_auto <T> data, integer pos) {
 		Melder_assert (pos >= 1 && pos <= our size);
 		Melder_assert (our _ownItems);
 		_Thing_forget (our at [pos]);
@@ -322,10 +322,10 @@ struct CollectionOf : structDaata {
 			my size == my old size - 1;
 			my _capacity not changed;
 	*/
-	void removeItem (long pos) {
+	void removeItem (integer pos) {
 		Melder_assert (pos >= 1 && pos <= our size);
 		if (our _ownItems) _Thing_forget (our at [pos]);
-		for (long i = pos; i < our size; i ++) our at [i] = our at [i + 1];
+		for (integer i = pos; i < our size; i ++) our at [i] = our at [i + 1];
 		our size --;
 	}
 
@@ -337,7 +337,7 @@ struct CollectionOf : structDaata {
 	*/
 	void removeAllItems () {
 		if (our _ownItems) {
-			for (long i = 1; i <= our size; i ++) {
+			for (integer i = 1; i <= our size; i ++) {
 				_Thing_forget (our at [i]);
 			}
 		}
@@ -356,10 +356,10 @@ struct CollectionOf : structDaata {
 		our at --;
 	}
 	void sort (int (*compare) (T*, T*)) {
-		long l, r, j, i;
+		integer l, r, j, i;
 		T* k;
 		T** a = our at._elements;
-		long n = our size;
+		integer n = our size;
 		if (n < 2) return;
 		l = (n >> 1) + 1;
 		r = n;
@@ -403,7 +403,7 @@ struct CollectionOf : structDaata {
 				return;
 			}
 			our _ownItems = ( our _ownershipInitialized ? our _ownItems : thy _ownItems );
-			for (long i = 1; i <= thy size; i ++) {
+			for (integer i = 1; i <= thy size; i ++) {
 				T* item = thy at [i];
 				if (our _ownItems) {
 					if (! Thing_isa (item, classDaata))
@@ -468,7 +468,7 @@ struct CollectionOf : structDaata {
 	/*
 		CollectionOf<> introduces one virtual method of its own (not counting the destructor).
 	*/
-	virtual long _v_position (T* /* data */) {
+	virtual integer _v_position (T* /* data */) {
 		return our size + 1;   // at end
 	};
 };
@@ -509,7 +509,7 @@ struct OrderedOf : CollectionOf <T   /*Melder_ENABLE_IF_ISA (T, structDaata)*/>
 			If 'position' is less than 1 or greater than the current 'size',
 			insert the item at the end.
 	*/
-	T* addItemAtPosition_move (_Thing_auto <T> data, long position) {
+	T* addItemAtPosition_move (_Thing_auto <T> data, integer position) {
 		Melder_assert (data);
 		if (position < 1 || position > our size)
 			position = our size + 1;
@@ -561,14 +561,14 @@ struct SortedOf : CollectionOf <T> {
 		our CollectionOf<T>::sort (our v_getCompareHook ());
 	}
 
-	long _v_position (T* data) override {
+	integer _v_position (T* data) override {
 		typename SortedOf<T>::CompareHook compare = our v_getCompareHook ();
 		if (our size == 0 || compare (data, our at [our size]) >= 0) return our size + 1;
 		if (compare (data, our at [1]) < 0) return 1;
 		/* Binary search. */
-		long left = 1, right = our size;
+		integer left = 1, right = our size;
 		while (left < right - 1) {
-			long mid = (left + right) / 2;
+			integer mid = (left + right) / 2;
 			if (compare (data, our at [mid]) >= 0) left = mid; else right = mid;
 		}
 		Melder_assert (right == left + 1);
@@ -603,16 +603,16 @@ struct SortedSetOf : SortedOf <T> {
 		@return
 			0 (refusal) if the key of `data` already occurs
 	*/
-	long _v_position (T* data) override {
+	integer _v_position (T* data) override {
 		typename SortedOf<T>::CompareHook compare = our v_getCompareHook ();
 		if (our size == 0) return 1;   // empty set? then 'data' is going to be the first item
 		int where = compare (data, our at [our size]);   // compare with last item
 		if (where > 0) return our size + 1;   // insert at end
 		if (where == 0) return 0;
 		if (compare (data, our at [1]) < 0) return 1;   // compare with first item
-		long left = 1, right = our size;
+		integer left = 1, right = our size;
 		while (left < right - 1) {
-			long mid = (left + right) / 2;
+			integer mid = (left + right) / 2;
 			if (compare (data, our at [mid]) >= 0)
 				left = mid;
 			else
@@ -635,15 +635,15 @@ struct SortedSetOf : SortedOf <T> {
 	*/
 	void unicize () {
 		typename SortedOf<T>::CompareHook compare = our v_getCompareHook ();
-		long n = 0, ifrom = 1;
-		for (long i = 1; i <= our size; i ++) {
+		integer n = 0, ifrom = 1;
+		for (integer i = 1; i <= our size; i ++) {
 			if (i == our size || compare (our at [i], our at [i + 1]))
 			{
 				/*
 				 * Detected a change.
 				 */
 				n ++;
-				long ito = i;
+				integer ito = i;
 				/*
 				 * Move item 'ifrom' to 'n'.
 				 */
@@ -657,7 +657,7 @@ struct SortedSetOf : SortedOf <T> {
 				/*
 				 * Purge items from 'ifrom'+1 to 'ito'.
 				 */
-				for (long j = ifrom + 1; j <= ito; j ++) {
+				for (integer j = ifrom + 1; j <= ito; j ++) {
 					_Thing_forget (our at [j]);
 				}
 				ifrom = ito + 1;
@@ -694,14 +694,14 @@ struct SortedSetOfIntOf : SortedSetOf <T> {
 };
 
 
-#pragma mark - class SortedSetOfLong
+#pragma mark - class SortedSetOfInteger
 
-template <typename T   Melder_ENABLE_IF_ISA (T, structSimpleLong)>
-struct SortedSetOfLongOf : SortedSetOf <T> {
-	SortedSetOfLongOf () {
+template <typename T   Melder_ENABLE_IF_ISA (T, structSimpleInteger)>
+struct SortedSetOfIntegerOf : SortedSetOf <T> {
+	SortedSetOfIntegerOf () {
 	}
-	SortedSetOfLongOf<T>&& move () noexcept { return static_cast <SortedSetOfLongOf<T>&&> (*this); }
-	static int s_compareHook (SimpleLong me, SimpleLong thee) noexcept {
+	SortedSetOfIntegerOf<T>&& move () noexcept { return static_cast <SortedSetOfIntegerOf<T>&&> (*this); }
+	static int s_compareHook (SimpleInteger me, SimpleInteger thee) noexcept {
 		if (my number < thy number) return -1;
 		if (my number > thy number) return +1;
 		return 0;
@@ -741,9 +741,9 @@ struct SortedSetOfStringOf : SortedSetOf <T> {
 	typename SortedOf<T>::CompareHook v_getCompareHook ()
 		override { return (typename SortedOf<T>::CompareHook) our s_compareHook; }
 
-	long lookUp (const char32 *string) {
-		long numberOfItems = our size;
-		long left = 1, right = numberOfItems;
+	integer lookUp (const char32 *string) {
+		integer numberOfItems = our size;
+		integer left = 1, right = numberOfItems;
 		int atStart, atEnd;
 		if (numberOfItems == 0) return 0;
 
@@ -756,7 +756,7 @@ struct SortedSetOfStringOf : SortedSetOf <T> {
 		if (atStart == 0) return 1;
 
 		while (left < right - 1) {
-			long mid = (left + right) / 2;
+			integer mid = (left + right) / 2;
 			int here = str32cmp (string, our at [mid] -> string);
 			if (here == 0) return mid;
 			if (here > 0) left = mid; else right = mid;
@@ -785,7 +785,7 @@ struct SortedSetOfStringOf : SortedSetOf <T> {
 			Melder_free (simp -> string);
 		}
 		simp -> string = (char32 *) string;   // reference copy
-		long index = our _v_position (simp.get());
+		integer index = our _v_position (simp.get());
 		simp -> string = nullptr;   // otherwise Praat will crash at shutdown
 		if (index == 0) return;   // OK: already there: do not add
 		autoSimpleString newSimp = SimpleString_create (string);
diff --git a/sys/Data.cpp b/sys/Data.cpp
index 0ed8fb6..55b2fd6 100644
--- a/sys/Data.cpp
+++ b/sys/Data.cpp
@@ -413,24 +413,24 @@ Data_Description Data_Description_findNumberUse (Data_Description structDescript
 
 int64 Data_Description_integer (void *address, Data_Description description) {
 	switch (description -> type) {
-		case bytewa:           return * (signed char *)    ((char *) address + description -> offset);
-		case int16wa:          return * (int16 *)          ((char *) address + description -> offset);
-		case intwa:            return * (int *)            ((char *) address + description -> offset);
-		case longwa:           return * (long *)           ((char *) address + description -> offset);
-		case ubytewa:          return * (unsigned char *)  ((char *) address + description -> offset);
-		case uintwa:           return * (unsigned int *)   ((char *) address + description -> offset);
-		case ulongwa:  return (int64) * (unsigned long *)  ((char *) address + description -> offset);   // ignore numbers above 2^63 - 1
-		case boolwa:           return * (bool *)           ((char *) address + description -> offset);
-		case objectwa:         return (* (Collection *)    ((char *) address + description -> offset))->size;
-		case autoobjectwa:     return (* (Collection *)    ((char *) address + description -> offset))->size;   // FIXME: alignment not guaranteed
-		case collectionofwa:   return (  (Collection)      ((char *) address + description -> offset))->size;   // FIXME: alignment not guaranteed
-		case autocollectionwa: return (* (Collection *)    ((char *) address + description -> offset))->size;   // FIXME: alignment not guaranteed
+		case bytewa:           return * (signed char *)      ((char *) address + description -> offset);
+		case int16wa:          return * (int16 *)            ((char *) address + description -> offset);
+		case intwa:            return * (int *)              ((char *) address + description -> offset);
+		case integerwa:        return * (integer *)          ((char *) address + description -> offset);
+		case ubytewa:          return * (unsigned char *)    ((char *) address + description -> offset);
+		case uintwa:           return * (unsigned int *)     ((char *) address + description -> offset);
+		case uintegerwa:       return (int64) * (uinteger *) ((char *) address + description -> offset);   // ignore numbers above 2^63 - 1
+		case questionwa:       return * (bool *)             ((char *) address + description -> offset);
+		case objectwa:         return (* (Collection *)      ((char *) address + description -> offset))->size;
+		case autoobjectwa:     return (* (Collection *)      ((char *) address + description -> offset))->size;   // FIXME: alignment not guaranteed
+		case collectionofwa:   return (  (Collection)        ((char *) address + description -> offset))->size;   // FIXME: alignment not guaranteed
+		case autocollectionwa: return (* (Collection *)      ((char *) address + description -> offset))->size;   // FIXME: alignment not guaranteed
 		default: return 0;
 	}
 }
 
 int Data_Description_evaluateInteger (void *structAddress, Data_Description structDescription,
-	const char32 *formula, long *result)
+	const char32 *formula, integer *result)
 {
 	if (! formula) {   // this was a VECTOR_FROM array
 		*result = 1;
diff --git a/sys/Data.h b/sys/Data.h
index d185240..cac188c 100644
--- a/sys/Data.h
+++ b/sys/Data.h
@@ -51,31 +51,31 @@ Thing_define (Daata, Thing) {
 	virtual void v_readBinary (FILE *f, int formatVersion);
 	virtual void v_repair () { }   // after reading Praat data files created by others
 	// methods for scripting:
-	virtual bool v_hasGetNrow      () { return false; }   virtual double        v_getNrow      ()                                 { return undefined; }
-	virtual bool v_hasGetNcol      () { return false; }   virtual double        v_getNcol      ()                                 { return undefined; }
-	virtual bool v_hasGetXmin      () { return false; }   virtual double        v_getXmin      ()                                 { return undefined; }
-	virtual bool v_hasGetXmax      () { return false; }   virtual double        v_getXmax      ()                                 { return undefined; }
-	virtual bool v_hasGetYmin      () { return false; }   virtual double        v_getYmin      ()                                 { return undefined; }
-	virtual bool v_hasGetYmax      () { return false; }   virtual double        v_getYmax      ()                                 { return undefined; }
-	virtual bool v_hasGetNx        () { return false; }   virtual double        v_getNx        ()                                 { return undefined; }
-	virtual bool v_hasGetNy        () { return false; }   virtual double        v_getNy        ()                                 { return undefined; }
-	virtual bool v_hasGetDx        () { return false; }   virtual double        v_getDx        ()                                 { return undefined; }
-	virtual bool v_hasGetDy        () { return false; }   virtual double        v_getDy        ()                                 { return undefined; }
-	virtual bool v_hasGetX         () { return false; }   virtual double        v_getX         (long /* ix */)                    { return undefined; }
-	virtual bool v_hasGetY         () { return false; }   virtual double        v_getY         (long /* iy */)                    { return undefined; }
-	virtual bool v_hasGetRowStr    () { return false; }   virtual const char32 *v_getRowStr    (long /* irow */)                  { return nullptr;      }
-	virtual bool v_hasGetColStr    () { return false; }   virtual const char32 *v_getColStr    (long /* icol */)                  { return nullptr;      }
-	virtual bool v_hasGetCell      () { return false; }   virtual double        v_getCell      ()                                 { return undefined; }
-	virtual bool v_hasGetCellStr   () { return false; }   virtual const char32 *v_getCellStr   ()                                 { return nullptr; }
-	virtual bool v_hasGetVector    () { return false; }   virtual double        v_getVector    (long /* irow */, long /* icol */) { return undefined; }
-	virtual bool v_hasGetVectorStr () { return false; }   virtual const char32 *v_getVectorStr (long /* icol */)                  { return nullptr;      }
-	virtual bool v_hasGetMatrix    () { return false; }   virtual double        v_getMatrix    (long /* irow */, long /* icol */) { return undefined; }
-	virtual bool v_hasGetMatrixStr () { return false; }   virtual const char32 *v_getMatrixStr (long /* irow */, long /* icol */) { return nullptr;      }
-	virtual bool v_hasGetFunction0 () { return false; }   virtual double        v_getFunction0 ()                                 { return undefined; }
-	virtual bool v_hasGetFunction1 () { return false; }   virtual double        v_getFunction1 (long /* irow */, double /* x */)  { return undefined; }
-	virtual bool v_hasGetFunction2 () { return false; }   virtual double        v_getFunction2 (double /* x */, double /* y */)   { return undefined; }
-	virtual bool v_hasGetRowIndex  () { return false; }   virtual double        v_getRowIndex  (const char32 * /* rowLabel */)    { return undefined; }
-	virtual bool v_hasGetColIndex  () { return false; }   virtual double        v_getColIndex  (const char32 * /* colLabel */)    { return undefined; }
+	virtual bool v_hasGetNrow      () { return false; }   virtual double        v_getNrow      ()                                       { return undefined; }
+	virtual bool v_hasGetNcol      () { return false; }   virtual double        v_getNcol      ()                                       { return undefined; }
+	virtual bool v_hasGetXmin      () { return false; }   virtual double        v_getXmin      ()                                       { return undefined; }
+	virtual bool v_hasGetXmax      () { return false; }   virtual double        v_getXmax      ()                                       { return undefined; }
+	virtual bool v_hasGetYmin      () { return false; }   virtual double        v_getYmin      ()                                       { return undefined; }
+	virtual bool v_hasGetYmax      () { return false; }   virtual double        v_getYmax      ()                                       { return undefined; }
+	virtual bool v_hasGetNx        () { return false; }   virtual double        v_getNx        ()                                       { return undefined; }
+	virtual bool v_hasGetNy        () { return false; }   virtual double        v_getNy        ()                                       { return undefined; }
+	virtual bool v_hasGetDx        () { return false; }   virtual double        v_getDx        ()                                       { return undefined; }
+	virtual bool v_hasGetDy        () { return false; }   virtual double        v_getDy        ()                                       { return undefined; }
+	virtual bool v_hasGetX         () { return false; }   virtual double        v_getX         (integer /* ix */)                       { return undefined; }
+	virtual bool v_hasGetY         () { return false; }   virtual double        v_getY         (integer /* iy */)                       { return undefined; }
+	virtual bool v_hasGetRowStr    () { return false; }   virtual const char32 *v_getRowStr    (integer /* irow */)                     { return nullptr;      }
+	virtual bool v_hasGetColStr    () { return false; }   virtual const char32 *v_getColStr    (integer /* icol */)                     { return nullptr;      }
+	virtual bool v_hasGetCell      () { return false; }   virtual double        v_getCell      ()                                       { return undefined; }
+	virtual bool v_hasGetCellStr   () { return false; }   virtual const char32 *v_getCellStr   ()                                       { return nullptr; }
+	virtual bool v_hasGetVector    () { return false; }   virtual double        v_getVector    (integer /* irow */, integer /* icol */) { return undefined; }
+	virtual bool v_hasGetVectorStr () { return false; }   virtual const char32 *v_getVectorStr (integer /* icol */)                     { return nullptr;      }
+	virtual bool v_hasGetMatrix    () { return false; }   virtual double        v_getMatrix    (integer /* irow */, integer /* icol */) { return undefined; }
+	virtual bool v_hasGetMatrixStr () { return false; }   virtual const char32 *v_getMatrixStr (integer /* irow */, integer /* icol */) { return nullptr;      }
+	virtual bool v_hasGetFunction0 () { return false; }   virtual double        v_getFunction0 ()                                       { return undefined; }
+	virtual bool v_hasGetFunction1 () { return false; }   virtual double        v_getFunction1 (integer /* irow */, double /* x */)     { return undefined; }
+	virtual bool v_hasGetFunction2 () { return false; }   virtual double        v_getFunction2 (double /* x */, double /* y */)         { return undefined; }
+	virtual bool v_hasGetRowIndex  () { return false; }   virtual double        v_getRowIndex  (const char32 * /* rowLabel */)          { return undefined; }
+	virtual bool v_hasGetColIndex  () { return false; }   virtual double        v_getColIndex  (const char32 * /* colLabel */)          { return undefined; }
 };
 
 template <class T> _Thing_auto<T> Data_copy (T* data) {
@@ -330,30 +330,28 @@ void Data_setPublishProc (int (*publish) (autoDaata));
 #define bytewa  1
 #define int16wa  2
 #define intwa  3
-#define longwa  4
-#define integerwa  5
-#define ubytewa  6
-#define uintwa  7
-#define ulongwa  8
-#define boolwa 9
-#define floatwa  10
-#define doublewa  11
-#define fcomplexwa  12
-#define dcomplexwa  13
-#define enumwa  14
-#define lenumwa  15
-#define booleanwa  16
-#define questionwa  17
-#define stringwa  18
-#define lstringwa  19
+#define integerwa  4
+#define ubytewa  5
+#define uintwa  6
+#define uintegerwa  7
+#define floatwa  8
+#define doublewa  9
+#define fcomplexwa  10
+#define dcomplexwa  11
+#define enumwa  12
+#define lenumwa  13
+#define booleanwa  14
+#define questionwa  15
+#define stringwa  16
+#define lstringwa  17
 #define maxsingletypewa lstringwa
-#define structwa  20
-#define widgetwa  21
-#define objectwa  22
-#define autoobjectwa  23
-#define collectionofwa  24
-#define autocollectionwa  25
-#define inheritwa  26
+#define structwa  18
+#define widgetwa  19
+#define objectwa  20
+#define autoobjectwa  21
+#define collectionofwa  22
+#define autocollectionwa  23
+#define inheritwa  24
 
 /* Recursive routines for working with struct members. */
 
@@ -373,7 +371,7 @@ int64 Data_Description_integer (void *structAddress, Data_Description descriptio
 /* Convert data found at a certain offset from 'address' to an integer, according to the given 'description'. */
 
 int Data_Description_evaluateInteger (void *structAddress, Data_Description structDescription,
-	const char32 *formula, long *result);
+	const char32 *formula, integer *result);
 /*
  * Translates a string like '100' or 'numberOfHorses' or 'numberOfCows - 1' to an integer.
  * The 'algorithm' does some wild guesses as to the meanings of the 'min1' and 'max1' strings.
diff --git a/sys/DataEditor.cpp b/sys/DataEditor.cpp
index ae70b08..4faba37 100644
--- a/sys/DataEditor.cpp
+++ b/sys/DataEditor.cpp
@@ -36,10 +36,10 @@ static Data_Description Class_getDescription (ClassInfo table) {
 }
 
 static void VectorEditor_create (DataEditor root, const char32 *title, void *address,
-	Data_Description description, long minimum, long maximum);
+	Data_Description description, integer minimum, integer maximum);
 
 static void MatrixEditor_create (DataEditor root, const char32 *title, void *address,
-	Data_Description description, long min1, long max1, long min2, long max2);
+	Data_Description description, integer min1, integer max1, integer min2, integer max2);
 
 static void StructEditor_create (DataEditor root, const char32 *title, void *address, Data_Description description);
 
@@ -155,18 +155,6 @@ static void gui_button_cb_change (DataSubEditor me, GuiButtonEvent /* event */)
 						}
 					}
 				} break;
-				case longwa: {
-					long oldValue = * (long *) my d_fieldData [irow]. address, newValue = Melder_atoi (text);
-					if (newValue != oldValue) {
-						Data_Description numberUse = DataSubEditor_findNumberUse (me, my d_fieldData [irow]. description -> name);
-						if (numberUse) {
-							Melder_flushError (U"Changing field \"", strip_d (my d_fieldData [irow]. description -> name),
-								U"\" would damage the array \"", strip_d (numberUse -> name), U"\".");
-						} else {
-							* (long *) my d_fieldData [irow]. address = newValue;
-						}
-					}
-				} break;
 				case integerwa: {
 					integer oldValue = * (integer *) my d_fieldData [irow]. address, newValue = Melder_atoi (text);
 					if (newValue != oldValue) {
@@ -181,8 +169,7 @@ static void gui_button_cb_change (DataSubEditor me, GuiButtonEvent /* event */)
 				} break;
 				case ubytewa: { * (unsigned char *) my d_fieldData [irow]. address = (uint8) Melder_atoi (text); } break;
 				case uintwa: { * (unsigned int *) my d_fieldData [irow]. address = Melder_atoi (text); } break;
-				case ulongwa: { * (unsigned long *) my d_fieldData [irow]. address = (unsigned long) Melder_atoi (text); } break;
-				case boolwa: { * (bool *) my d_fieldData [irow]. address = Melder_atoi (text); } break;
+				case uintegerwa: { * (uinteger *) my d_fieldData [irow]. address = (uinteger) Melder_atoi (text); } break;
 				case floatwa: { * (double *) my d_fieldData [irow]. address = Melder_atof (text); } break;
 				case doublewa: { * (double *) my d_fieldData [irow]. address = Melder_atof (text); } break;
 				case fcomplexwa: { dcomplex *x = (dcomplex *) my d_fieldData [irow]. address;
@@ -364,7 +351,7 @@ static void DataSubEditor_init (DataSubEditor me, DataEditor root, const char32
 
 Thing_implement (StructEditor, DataSubEditor, 0);
 
-long structStructEditor :: v_countFields () {
+integer structStructEditor :: v_countFields () {
 	return Data_Description_countMembers (d_description);
 }
 
@@ -373,12 +360,10 @@ static const char32 * singleTypeToText (void *address, int type, void *tagType,
 		case bytewa:     MelderString_append (buffer, Melder_integer  (* (signed char *)    address)); break;
 		case int16wa:    MelderString_append (buffer, Melder_integer  (* (int16 *)          address)); break;
 		case intwa:      MelderString_append (buffer, Melder_integer  (* (int *)            address)); break;
-		case longwa:     MelderString_append (buffer, Melder_integer  (* (long *)           address)); break;
 		case integerwa:  MelderString_append (buffer, Melder_integer  (* (integer *)        address)); break;
 		case ubytewa:    MelderString_append (buffer, Melder_integer  (* (unsigned char *)  address)); break;
 		case uintwa:     MelderString_append (buffer, Melder_integer  (* (unsigned int *)   address)); break;
-		case ulongwa:    MelderString_append (buffer, Melder_integer  (* (unsigned long *)  address)); break;
-		case boolwa:     MelderString_append (buffer, Melder_integer  (* (bool *)           address)); break;
+		case uintegerwa: MelderString_append (buffer, Melder_integer  (* (uinteger *)       address)); break;
 		case floatwa:    MelderString_append (buffer, Melder_single   (* (double *)         address)); break;
 		case doublewa:   MelderString_append (buffer, Melder_double   (* (double *)         address)); break;
 		case fcomplexwa: MelderString_append (buffer, Melder_scomplex (* (dcomplex *)       address)); break;
@@ -432,7 +417,7 @@ static void showStructMember (
 		fieldData -> rank = 0;
 	} else if (rank == 1) {
 		void *arrayAddress = * (void **) memberAddress;
-		long minimum, maximum;
+		integer minimum, maximum;
 		if (! arrayAddress) return;   // no button for empty fields
 		Data_Description_evaluateInteger (structAddress, structDescription,
 			memberDescription -> min1, & minimum);
@@ -450,7 +435,7 @@ static void showStructMember (
 		/*
 		 * This represents an in-line array.
 		 */
-		long maximum;   /* But: capacity = - rank */
+		integer maximum;   /* But: capacity = - rank */
 		Data_Description_evaluateInteger (structAddress, structDescription,
 			memberDescription -> max1, & maximum);
 		if (-- maximum < 0) return;   /* Subtract one for zero-based array; no button if no elements. */
@@ -474,7 +459,7 @@ static void showStructMember (
 		GuiThing_show (fieldData -> button);
 	} else if (rank == 2) {
 		void *arrayAddress = * (void **) memberAddress;
-		long min1, max1, min2, max2;
+		integer min1, max1, min2, max2;
 		if (! arrayAddress) return;   // no button for empty fields
 		Data_Description_evaluateInteger (structAddress, structDescription,
 			memberDescription -> min1,  & min1);
@@ -552,8 +537,8 @@ static void StructEditor_create (DataEditor root, const char32 *title, void *add
 
 Thing_implement (VectorEditor, DataSubEditor, 0);
 
-long structVectorEditor :: v_countFields () {
-	long numberOfElements = d_maximum - d_minimum + 1;
+integer structVectorEditor :: v_countFields () {
+	integer numberOfElements = d_maximum - d_minimum + 1;
 	if (d_description -> type == structwa)
 		return numberOfElements * (Data_Description_countMembers (* (Data_Description *) d_description -> tagType) + 1);
 	else
@@ -564,9 +549,9 @@ void structVectorEditor :: v_showMembers () {
 	int type = d_description -> type, isSingleType = type <= maxsingletypewa;
 	int elementSize = type == structwa ?
 		Data_Description_countMembers (* (Data_Description *) d_description -> tagType) + 1 : 1;
-	long firstElement = d_minimum + (d_topField - 1) / elementSize;
+	integer firstElement = d_minimum + (d_topField - 1) / elementSize;
 
-	for (long ielement = firstElement; ielement <= d_maximum; ielement ++) {
+	for (integer ielement = firstElement; ielement <= d_maximum; ielement ++) {
 		unsigned char *elementAddress = (unsigned char *) d_address + ielement * d_description -> size;
 		int skip = ielement == firstElement ? (d_topField - 1) % elementSize : 0;
 
@@ -642,7 +627,7 @@ void structVectorEditor :: v_showMembers () {
 }
 
 static void VectorEditor_create (DataEditor root, const char32 *title, void *address,
-	Data_Description description, long minimum, long maximum)
+	Data_Description description, integer minimum, integer maximum)
 {
 	try {
 		autoVectorEditor me = Thing_new (VectorEditor);
@@ -659,8 +644,8 @@ static void VectorEditor_create (DataEditor root, const char32 *title, void *add
 
 Thing_implement (MatrixEditor, DataSubEditor, 0);
 
-long structMatrixEditor :: v_countFields () {
-	long numberOfElements = (d_maximum - d_minimum + 1) * (d_max2 - d_min2 + 1);
+integer structMatrixEditor :: v_countFields () {
+	integer numberOfElements = (d_maximum - d_minimum + 1) * (d_max2 - d_min2 + 1);
 	if (d_description -> type == structwa)
 		return numberOfElements * (Data_Description_countMembers (* (Data_Description *) d_description -> tagType) + 1);
 	else
@@ -672,11 +657,11 @@ void structMatrixEditor :: v_showMembers () {
 	int elementSize = type == structwa ?
 		Data_Description_countMembers (* (Data_Description *) d_description -> tagType) + 1 : 1;
 	int rowSize = elementSize * (d_max2 - d_min2 + 1);
-	long firstRow = d_minimum + (d_topField - 1) / rowSize;
-	long firstColumn = d_min2 + (d_topField - 1 - (firstRow - d_minimum) * rowSize) / elementSize;
+	integer firstRow = d_minimum + (d_topField - 1) / rowSize;
+	integer firstColumn = d_min2 + (d_topField - 1 - (firstRow - d_minimum) * rowSize) / elementSize;
 
-	for (long irow = firstRow; irow <= d_maximum; irow ++)
-	for (long icolumn = irow == firstRow ? firstColumn : d_min2; icolumn <= d_max2; icolumn ++) {
+	for (integer irow = firstRow; irow <= d_maximum; irow ++)
+	for (integer icolumn = irow == firstRow ? firstColumn : d_min2; icolumn <= d_max2; icolumn ++) {
 		unsigned char *elementAddress = * ((unsigned char **) d_address + irow) + icolumn * d_description -> size;
 
 		if (++ d_irow > kDataSubEditor_MAXNUM_ROWS) return;
@@ -701,7 +686,7 @@ void structMatrixEditor :: v_showMembers () {
 }
 
 static void MatrixEditor_create (DataEditor root, const char32 *title, void *address,
-	Data_Description description, long min1, long max1, long min2, long max2)
+	Data_Description description, integer min1, integer max1, integer min2, integer max2)
 {
 	try {
 		autoMatrixEditor me = Thing_new (MatrixEditor);
diff --git a/sys/DataEditor.h b/sys/DataEditor.h
index 4b76159..e88d314 100644
--- a/sys/DataEditor.h
+++ b/sys/DataEditor.h
@@ -33,7 +33,7 @@ typedef struct structDataSubEditor_FieldData {
 	GuiText text;
 	void *address;
 	Data_Description description;
-	long minimum, maximum, min2, max2;
+	integer minimum, maximum, min2, max2;
 	char32 *history;   // the full prefix of the members
 	int rank;   // should the button open a StructEditor (0) or VectorEditor (1) or MatrixEditor (2) ?
 	int y;
@@ -58,30 +58,30 @@ Thing_define (DataSubEditor, Editor) {
 	void v_createHelpMenuItems (EditorMenu menu)
 		override;
 
-	virtual long v_countFields () { return 0; }
+	virtual integer v_countFields () { return 0; }
 	virtual void v_showMembers () { }
 };
 
 Thing_define (VectorEditor, DataSubEditor) {
-	long d_minimum, d_maximum;
+	integer d_minimum, d_maximum;
 
-	long v_countFields ()
+	integer v_countFields ()
 		override;
 	void v_showMembers ()
 		override;
 };
 
 Thing_define (MatrixEditor, DataSubEditor) {
-	long d_minimum, d_maximum, d_min2, d_max2;
+	integer d_minimum, d_maximum, d_min2, d_max2;
 
-	long v_countFields ()
+	integer v_countFields ()
 		override;
 	void v_showMembers ()
 		override;
 };
 
 Thing_define (StructEditor, DataSubEditor) {
-	long v_countFields ()
+	integer v_countFields ()
 		override;
 	void v_showMembers ()
 		override;
diff --git a/sys/DemoEditor.h b/sys/DemoEditor.h
index aea56f6..7e52c72 100644
--- a/sys/DemoEditor.h
+++ b/sys/DemoEditor.h
@@ -25,7 +25,7 @@ Thing_define (DemoEditor, Editor) {
 	autoGraphics graphics;
 	void *praatPicture;
 	bool clicked, keyPressed, shiftKeyPressed, commandKeyPressed, optionKeyPressed, extraControlKeyPressed;
-	long x, y;
+	integer x, y;
 	char32 key;
 	bool waitingForInput, userWantsToClose, fullScreen;
 
diff --git a/sys/Editor.cpp b/sys/Editor.cpp
index 34ceda1..489823e 100644
--- a/sys/Editor.cpp
+++ b/sys/Editor.cpp
@@ -73,7 +73,7 @@ static void commonCallback (EditorCommand me, GuiMenuItemEvent /* event */) {
 	}
 }
 
-GuiMenuItem EditorMenu_addCommand (EditorMenu me, const char32 *itemTitle /* cattable */, long flags, EditorCommandCallback commandCallback)
+GuiMenuItem EditorMenu_addCommand (EditorMenu me, const char32 *itemTitle /* cattable */, uint32 flags, EditorCommandCallback commandCallback)
 {
 	autoEditorCommand thee = Thing_new (EditorCommand);
 	thy d_editor = my d_editor;
@@ -91,7 +91,7 @@ GuiMenuItem EditorMenu_addCommand (EditorMenu me, const char32 *itemTitle /* cat
 
 /*GuiObject EditorCommand_getItemWidget (EditorCommand me) { return my itemWidget; }*/
 
-EditorMenu Editor_addMenu (Editor me, const char32 *menuTitle, long flags) {
+EditorMenu Editor_addMenu (Editor me, const char32 *menuTitle, uint32 flags) {
 	autoEditorMenu thee = Thing_new (EditorMenu);
 	thy d_editor = me;
 	thy menuTitle = Melder_dup (menuTitle);
@@ -101,11 +101,11 @@ EditorMenu Editor_addMenu (Editor me, const char32 *menuTitle, long flags) {
 
 /*GuiObject EditorMenu_getMenuWidget (EditorMenu me) { return my menuWidget; }*/
 
-GuiMenuItem Editor_addCommand (Editor me, const char32 *menuTitle, const char32 *itemTitle, long flags, EditorCommandCallback commandCallback)
+GuiMenuItem Editor_addCommand (Editor me, const char32 *menuTitle, const char32 *itemTitle, uint32 flags, EditorCommandCallback commandCallback)
 {
 	try {
-		long numberOfMenus = my menus.size;
-		for (long imenu = 1; imenu <= numberOfMenus; imenu ++) {
+		integer numberOfMenus = my menus.size;
+		for (integer imenu = 1; imenu <= numberOfMenus; imenu ++) {
 			EditorMenu menu = my menus.at [imenu];
 			if (str32equ (menuTitle, menu -> menuTitle))
 				return EditorMenu_addCommand (menu, itemTitle, flags, commandCallback);
@@ -122,11 +122,11 @@ static void Editor_scriptCallback (Editor me, EditorCommand cmd, UiForm /* sendi
 	DO_RunTheScriptFromAnyAddedEditorCommand (me, cmd -> script);
 }
 
-GuiMenuItem Editor_addCommandScript (Editor me, const char32 *menuTitle, const char32 *itemTitle, long flags,
+GuiMenuItem Editor_addCommandScript (Editor me, const char32 *menuTitle, const char32 *itemTitle, uint32 flags,
 	const char32 *script)
 {
-	long numberOfMenus = my menus.size;
-	for (long imenu = 1; imenu <= numberOfMenus; imenu ++) {
+	integer numberOfMenus = my menus.size;
+	for (integer imenu = 1; imenu <= numberOfMenus; imenu ++) {
 		EditorMenu menu = my menus.at [imenu];
 		if (str32equ (menuTitle, menu -> menuTitle)) {
 			autoEditorCommand cmd = Thing_new (EditorCommand);
@@ -157,8 +157,8 @@ GuiMenuItem Editor_addCommandScript (Editor me, const char32 *menuTitle, const c
 }
 
 void Editor_setMenuSensitive (Editor me, const char32 *menuTitle, int sensitive) {
-	int numberOfMenus = my menus.size;
-	for (int imenu = 1; imenu <= numberOfMenus; imenu ++) {
+	integer numberOfMenus = my menus.size;
+	for (integer imenu = 1; imenu <= numberOfMenus; imenu ++) {
 		EditorMenu menu = my menus.at [imenu];
 		if (str32equ (menuTitle, menu -> menuTitle)) {
 			GuiThing_setSensitive (menu -> menuWidget, sensitive);
@@ -168,11 +168,11 @@ void Editor_setMenuSensitive (Editor me, const char32 *menuTitle, int sensitive)
 }
 
 EditorCommand Editor_getMenuCommand (Editor me, const char32 *menuTitle, const char32 *itemTitle) {
-	int numberOfMenus = my menus.size;
+	integer numberOfMenus = my menus.size;
 	for (int imenu = 1; imenu <= numberOfMenus; imenu ++) {
 		EditorMenu menu = my menus.at [imenu];
 		if (str32equ (menuTitle, menu -> menuTitle)) {
-			int numberOfCommands = menu -> commands.size, icommand;
+			integer numberOfCommands = menu -> commands.size, icommand;
 			for (icommand = 1; icommand <= numberOfCommands; icommand ++) {
 				EditorCommand command = menu -> commands.at [icommand];
 				if (str32equ (itemTitle, command -> itemTitle))
@@ -184,11 +184,11 @@ EditorCommand Editor_getMenuCommand (Editor me, const char32 *menuTitle, const c
 }
 
 void Editor_doMenuCommand (Editor me, const char32 *commandTitle, int narg, Stackel args, const char32 *arguments, Interpreter interpreter) {
-	int numberOfMenus = my menus.size;
+	integer numberOfMenus = my menus.size;
 	for (int imenu = 1; imenu <= numberOfMenus; imenu ++) {
 		EditorMenu menu = my menus.at [imenu];
-		long numberOfCommands = menu -> commands.size;
-		for (long icommand = 1; icommand <= numberOfCommands; icommand ++) {
+		integer numberOfCommands = menu -> commands.size;
+		for (integer icommand = 1; icommand <= numberOfCommands; icommand ++) {
 			EditorCommand command = menu -> commands.at [icommand];
 			if (str32equ (commandTitle, command -> itemTitle)) {
 				command -> commandCallback (me, command, nullptr, narg, args, arguments, interpreter);
@@ -354,27 +354,28 @@ void structEditor :: v_createMenus () {
 	}
 }
 
+BOOLEAN_VARIABLE (v_form_pictureWindow_eraseFirst)
 void structEditor :: v_form_pictureWindow (EditorCommand cmd) {
-	LABEL (U"", U"Picture window:")
-	BOOLEAN (U"Erase first", true);
+	LABEL (U"Picture window:")
+	BOOLEAN_FIELD (v_form_pictureWindow_eraseFirst, U"Erase first", true)
 }
 void structEditor :: v_ok_pictureWindow (EditorCommand cmd) {
-	SET_INTEGER (U"Erase first", pref_picture_eraseFirst ());
+	SET_BOOLEAN (v_form_pictureWindow_eraseFirst, our pref_picture_eraseFirst ())
 }
-void structEditor :: v_do_pictureWindow (EditorCommand cmd) {
-	pref_picture_eraseFirst () = GET_INTEGER (U"Erase first");
+void structEditor :: v_do_pictureWindow (EditorCommand /* cmd */) {
+	our pref_picture_eraseFirst () = v_form_pictureWindow_eraseFirst;
 }
 
+OPTIONMENU_ENUM_VARIABLE (kEditor_writeNameAtTop, v_form_pictureMargins_writeNameAtTop)
 void structEditor :: v_form_pictureMargins (EditorCommand cmd) {
-	UiField _radio_;
-	LABEL (U"", U"Margins:")
-	OPTIONMENU_ENUM (U"Write name at top", kEditor_writeNameAtTop, kEditor_writeNameAtTop::DEFAULT);
+	LABEL (U"Margins:")
+	OPTIONMENU_ENUM_FIELD (v_form_pictureMargins_writeNameAtTop, U"Write name at top", kEditor_writeNameAtTop, kEditor_writeNameAtTop::DEFAULT)
 }
 void structEditor :: v_ok_pictureMargins (EditorCommand cmd) {
-	SET_ENUM (U"Write name at top", kEditor_writeNameAtTop, pref_picture_writeNameAtTop ());
+	SET_ENUM (v_form_pictureMargins_writeNameAtTop, kEditor_writeNameAtTop, pref_picture_writeNameAtTop ())
 }
-void structEditor :: v_do_pictureMargins (EditorCommand cmd) {
-	pref_picture_writeNameAtTop () = GET_ENUM (kEditor_writeNameAtTop, U"Write name at top");
+void structEditor :: v_do_pictureMargins (EditorCommand /* cmd */) {
+	pref_picture_writeNameAtTop () = v_form_pictureMargins_writeNameAtTop;
 }
 
 static void gui_window_cb_goAway (Editor me) {
@@ -424,7 +425,7 @@ void Editor_init (Editor me, int x, int y, int width, int height, const char32 *
 		/*
 		 * Zero x: randomize between the left and right edge of the screen.
 		 */
-		left = NUMrandomInteger ((int) xmin + 4, (int) xmin + (int) widthmax - width - 4);
+		left = (int) NUMrandomInteger ((int) xmin + 4, (int) xmin + (int) widthmax - width - 4);
 		right = left + width;
 	}
 	if (y > 0) {
@@ -443,7 +444,7 @@ void Editor_init (Editor me, int x, int y, int width, int height, const char32 *
 		/*
 		 * Zero y: randomize between the top and bottom of the screen.
 		 */
-		top = NUMrandomInteger ((int) ymin + 4, (int) ymin + (int) heightmax - height - 4);
+		top = (int) NUMrandomInteger ((int) ymin + 4, (int) ymin + (int) heightmax - height - 4);
 		//Melder_casual (ymin, U" ", heightmax, U" ", height, U" ", top);
 		bottom = top + height;
 	}
diff --git a/sys/Editor.h b/sys/Editor.h
index edfe6ef..3eea5b7 100644
--- a/sys/Editor.h
+++ b/sys/Editor.h
@@ -113,15 +113,15 @@ Thing_define (Editor, Thing) {
 	#include "Editor_prefs.h"
 };
 
-GuiMenuItem EditorMenu_addCommand (EditorMenu me, const char32 *itemTitle /* cattable */, long flags, EditorCommandCallback commandCallback);
+GuiMenuItem EditorMenu_addCommand (EditorMenu me, const char32 *itemTitle /* cattable */, uint32 flags, EditorCommandCallback commandCallback);
 GuiMenuItem EditorCommand_getItemWidget (EditorCommand me);
 
-EditorMenu Editor_addMenu (Editor me, const char32 *menuTitle, long flags);
+EditorMenu Editor_addMenu (Editor me, const char32 *menuTitle, uint32 flags);
 GuiObject EditorMenu_getMenuWidget (EditorMenu me);
 
 #define Editor_HIDDEN  (1 << 14)
-GuiMenuItem Editor_addCommand (Editor me, const char32 *menuTitle, const char32 *itemTitle, long flags, EditorCommandCallback commandCallback);
-GuiMenuItem Editor_addCommandScript (Editor me, const char32 *menuTitle, const char32 *itemTitle, long flags,
+GuiMenuItem Editor_addCommand (Editor me, const char32 *menuTitle, const char32 *itemTitle, uint32 flags, EditorCommandCallback commandCallback);
+GuiMenuItem Editor_addCommandScript (Editor me, const char32 *menuTitle, const char32 *itemTitle, uint32 flags,
 	const char32 *script);
 void Editor_setMenuSensitive (Editor me, const char32 *menu, int sensitive);
 
diff --git a/sys/EditorM.h b/sys/EditorM.h
index 5b629d0..996534f 100644
--- a/sys/EditorM.h
+++ b/sys/EditorM.h
@@ -29,120 +29,302 @@
 #undef CHANNEL
 #undef BOOLEAN
 #undef LABEL
+#undef MUTABLE_LABEL
 #undef TEXTFIELD
 #undef RADIO
+#undef RADIOSTR
 #undef RADIOBUTTON
 #undef OPTIONMENU
+#undef OPTIONMENUSTR
 #undef OPTION
 #undef RADIO_ENUM
 #undef OPTIONMENU_ENUM
 #undef LIST
 #undef SET_REAL
 #undef SET_INTEGER
+#undef SET_BOOLEAN
 #undef SET_STRING
 #undef SET_ENUM
-#undef GET_REAL
-#undef GET_INTEGER
-#undef GET_STRING
 #undef GET_FILE
 
 #define EDITOR_ARGS_FORM  EditorCommand cmd, UiForm sendingForm, int narg, Stackel args, const char32 *sendingString, Interpreter interpreter
 #define EDITOR_ARGS_CMD  EditorCommand cmd, UiForm, int, Stackel, const char32 *, Interpreter
 #define EDITOR_ARGS_DIRECT  EditorCommand, UiForm, int, Stackel, const char32 *, Interpreter
-#define EDITOR_FORM(title,helpTitle)  if (! cmd -> d_uiform) { UiField _radio_ = nullptr; (void) _radio_; \
+
+#define EDITOR_FORM(title,helpTitle)  \
+	UiField _radio_ = nullptr; \
+	(void) _radio_; \
+	if (cmd -> d_uiform) goto _form_inited_; \
 	cmd -> d_uiform = UiForm_createE (cmd, title, cmd -> itemTitle, helpTitle);
-#define EDITOR_OK  UiForm_finish (cmd -> d_uiform.get()); } if (! sendingForm && ! args && ! sendingString) {
-#define EDITOR_DO  UiForm_do (cmd -> d_uiform.get(), false); } else if (! sendingForm) { \
-	UiForm_parseStringE (cmd, narg, args, sendingString, interpreter); } else {
-#define EDITOR_END  }
+
+#define EDITOR_OK  \
+	UiForm_finish (cmd -> d_uiform.get()); \
+_form_inited_: \
+	if (! args && ! sendingForm && ! sendingString) {
+
+#define EDITOR_DO  \
+		UiForm_do (cmd -> d_uiform.get(), false); \
+	} else if (! sendingForm) { \
+		UiForm_parseStringE (cmd, narg, args, sendingString, interpreter); \
+	} else {
+
+#define EDITOR_END  \
+	}
 
 /*
 	Functions to define the fields in a form on the basis of the label text
-	(or an invisible name) and factory default value.
+	and factory default value.
 	They are to be called between EDITOR_FORM and EDITOR_OK.
 */
 
-#define REAL(fieldLabel, defaultValue) \
-	UiForm_addReal (cmd -> d_uiform.get(), fieldLabel, defaultValue);
+#define REAL_VARIABLE(realVariable) \
+	static double realVariable;
+
+#define REAL_FIELD(realVariable, labelText, defaultStringValue) \
+	UiForm_addReal (cmd -> d_uiform.get(), & realVariable, nullptr, labelText, defaultStringValue);
+
+#define REAL(realVariable, labelText, defaultStringValue) \
+	REAL_VARIABLE (realVariable) \
+	REAL_FIELD (realVariable, labelText, defaultStringValue)
+
+
+#define REAL_OR_UNDEFINED_VARIABLE(realVariable) \
+	static double realVariable;
+
+#define REAL_OR_UNDEFINED_FIELD(realVariable, labelText, defaultStringValue) \
+	UiForm_addRealOrUndefined (cmd -> d_uiform.get(), & realVariable, nullptr, labelText, defaultStringValue);
+
+#define REAL_OR_UNDEFINED(realVariable, labelText, defaultStringValue) \
+	REAL_OR_UNDEFINED_VARIABLE (realVariable) \
+	REAL_OR_UNDEFINED_FIELD (realVariable, labelText, defaultStringValue)
+
+
+#define POSITIVE_VARIABLE(realVariable) \
+	static double realVariable;
+
+#define POSITIVE_FIELD(realVariable, labelText, defaultStringValue) \
+	UiForm_addPositive (cmd -> d_uiform.get(), & realVariable, nullptr, labelText, defaultStringValue);
+
+#define POSITIVE(realVariable, labelText, defaultStringValue) \
+	POSITIVE_VARIABLE (realVariable) \
+	POSITIVE_FIELD (realVariable, labelText, defaultStringValue)
+
+
+#define INTEGER_VARIABLE(integerVariable) \
+	static integer integerVariable;
+
+#define INTEGER_FIELD(integerVariable, labelText, defaultStringValue) \
+	UiForm_addInteger (cmd -> d_uiform.get(), & integerVariable, nullptr, labelText, defaultStringValue);
+
+#define INTEGER(integerVariable, labelText, defaultStringValue) \
+	INTEGER_VARIABLE (integerVariable) \
+	INTEGER_FIELD (integerVariable, labelText, defaultStringValue)
+
+
+#define NATURAL_VARIABLE(integerVariable) \
+	static integer integerVariable;
+
+#define NATURAL_FIELD(integerVariable, labelText, defaultStringValue) \
+	UiForm_addNatural (cmd -> d_uiform.get(), & integerVariable, nullptr, labelText, defaultStringValue);
+
+#define NATURAL(integerVariable, labelText, defaultStringValue) \
+	NATURAL_VARIABLE (integerVariable) \
+	NATURAL_FIELD (integerVariable, labelText, defaultStringValue)
+
+
+#define WORD_VARIABLE(stringVariable) \
+	static char32 *stringVariable;
+
+#define WORD_FIELD(stringVariable, labelText, defaultStringValue) \
+	UiForm_addWord (cmd -> d_uiform.get(), & stringVariable, nullptr, labelText, defaultStringValue);
+
+#define WORD(stringVariable, labelText, defaultStringValue) \
+	WORD_VARIABLE (stringVariable) \
+	WORD_FIELD (stringVariable, labelText, defaultStringValue)
+
+
+#define SENTENCE_VARIABLE(stringVariable) \
+	static char32 *stringVariable;
+
+#define SENTENCE_FIELD(stringVariable, labelText, defaultStringValue) \
+	UiForm_addSentence (cmd -> d_uiform.get(), & stringVariable, nullptr, labelText, defaultStringValue);
+
+#define SENTENCE(stringVariable, labelText, defaultStringValue) \
+	SENTENCE_VARIABLE (stringVariable) \
+	SENTENCE_FIELD (stringVariable, labelText, defaultStringValue)
+
+
+#define COLOUR_VARIABLE(colourVariable) \
+	static Graphics_Colour colourVariable;
 
-#define REAL_OR_UNDEFINED(fieldLabel, defaultValue) \
-	UiForm_addRealOrUndefined (cmd -> d_uiform.get(), fieldLabel, defaultValue);
+#define COLOUR_FIELD(colourVariable, labelText, defaultStringValue) \
+	UiForm_addColour (cmd -> d_uiform.get(), & colourVariable, nullptr, labelText, defaultStringValue);
 
-#define POSITIVE(fieldLabel, defaultValue) \
-	UiForm_addPositive (cmd -> d_uiform.get(), fieldLabel, defaultValue);
+#define COLOUR(colourVariable, labelText, defaultStringValue) \
+	COLOUR_VARIABLE (colourVariable) \
+	COLOUR_FIELD (colourVariable, labelText, defaultStringValue)
 
-#define INTEGER(fieldLabel, defaultValue) \
-	UiForm_addInteger (cmd -> d_uiform.get(), fieldLabel, defaultValue);
 
-#define NATURAL(fieldLabel, defaultValue) \
-	UiForm_addNatural (cmd -> d_uiform.get(), fieldLabel, defaultValue);
+#define CHANNEL_VARIABLE(integerVariable) \
+	static integer integerVariable;
 
-#define WORD(fieldLabel, defaultValue) \
-	UiForm_addWord (cmd -> d_uiform.get(), fieldLabel, defaultValue);
+#define CHANNEL_FIELD(integerVariable, labelText, defaultStringValue) \
+	UiForm_addChannel (cmd -> d_uiform.get(), & integerVariable, nullptr, labelText, defaultStringValue);
 
-#define SENTENCE(fieldLabel, defaultValue) \
-	UiForm_addSentence (cmd -> d_uiform.get(), fieldLabel, defaultValue);
+#define CHANNEL(integerVariable, labelText, defaultStringValue) \
+	CHANNEL_VARIABLE (integerVariable) \
+	CHANNEL_FIELD (integerVariable, labelText, defaultStringValue)
 
-#define COLOUR(fieldLabel, defaultValue) \
-	UiForm_addColour (cmd -> d_uiform.get(), fieldLabel, defaultValue);
 
-#define CHANNEL(fieldLabel, defaultValue) \
-	UiForm_addChannel (cmd -> d_uiform.get(), fieldLabel, defaultValue);
+#define BOOLEAN_VARIABLE(booleanVariable) \
+	static bool booleanVariable;
 
-#define BOOLEAN(fieldLabel, defaultValue) \
-	UiForm_addBoolean (cmd -> d_uiform.get(), fieldLabel, defaultValue);
+#define BOOLEAN_FIELD(booleanVariable, labelText, defaultBooleanValue) \
+	UiForm_addBoolean (cmd -> d_uiform.get(), & booleanVariable, nullptr, labelText, defaultBooleanValue);
 
-#define LABEL(invisibleName, labelText) \
-	UiForm_addLabel (cmd -> d_uiform.get(), invisibleName, labelText);
+#define BOOLEAN(booleanVariable, labelText, defaultBooleanValue) \
+	BOOLEAN_VARIABLE (booleanVariable) \
+	BOOLEAN_FIELD (booleanVariable, labelText, defaultBooleanValue)
 
-#define TEXTFIELD(invisibleName, defaultValue) \
-	UiForm_addText (cmd -> d_uiform.get(), invisibleName, defaultValue);
 
-#define RADIO(fieldLabel, defaultValue) \
-	_radio_ = UiForm_addRadio (cmd -> d_uiform.get(), fieldLabel, defaultValue);
+#define LABEL(labelText) \
+	UiForm_addLabel (cmd -> d_uiform.get(), nullptr, labelText);
 
-#define RADIOBUTTON(fieldLabel) \
-	UiRadio_addButton (_radio_, fieldLabel);
 
-#define OPTIONMENU(fieldLabel, defaultValue) \
-	_radio_ = UiForm_addOptionMenu (cmd -> d_uiform.get(), fieldLabel, defaultValue);
+#define MUTABLE_LABEL_VARIABLE(stringVariable) \
+	static char32 *stringVariable;
 
-#define OPTION(fieldLabel) \
-	UiOptionMenu_addButton (_radio_, fieldLabel);
+#define MUTABLE_LABEL_FIELD(stringVariable, labelText) \
+	UiForm_addLabel (cmd -> d_uiform.get(), & stringVariable, labelText);
 
-#define RADIO_ENUM(fieldLabel, EnumeratedType, defaultValue) \
-	{ enum EnumeratedType _compilerTypeCheckDummy = defaultValue; (void) _compilerTypeCheckDummy; } \
-	_radio_ = UiForm_addRadio (cmd -> d_uiform.get(), fieldLabel, (int) defaultValue - (int) EnumeratedType::MIN + 1); \
-	for (int _ienum = (int) EnumeratedType::MIN; _ienum <= (int) EnumeratedType::MAX; _ienum ++) \
-		UiRadio_addButton (_radio_, EnumeratedType##_getText ((enum EnumeratedType) _ienum));
+#define MUTABLE_LABEL(stringVariable, labelText) \
+	MUTABLE_LABEL_VARIABLE (stringVariable) \
+	MUTABLE_LABEL_FIELD (stringVariable, labelText)
 
-#define OPTIONMENU_ENUM(fieldLabel, EnumeratedType, defaultValue) \
-	{ enum EnumeratedType _compilerTypeCheckDummy = defaultValue; (void) _compilerTypeCheckDummy; } \
-	_radio_ = UiForm_addOptionMenu (cmd -> d_uiform.get(), fieldLabel, (int) defaultValue - (int) EnumeratedType::MIN + 1); \
-	for (int _ienum = (int) EnumeratedType::MIN; _ienum <= (int) EnumeratedType::MAX; _ienum ++) \
-		UiOptionMenu_addButton (_radio_, EnumeratedType##_getText ((enum EnumeratedType) _ienum));
 
-#define LIST(fieldLabel, numberOfStrings, strings, defaultValue) \
-	UiForm_addList (cmd -> d_uiform.get(), fieldLabel, numberOfStrings, strings, defaultValue);
+#define TEXTFIELD_VARIABLE(stringVariable) \
+	static char32 *stringVariable;
+
+#define TEXTFIELD_FIELD(stringVariable, labelText, defaultValue) \
+	if (labelText != nullptr) UiForm_addLabel (cmd -> d_uiform.get(), nullptr, labelText); \
+	UiForm_addText (cmd -> d_uiform.get(), & stringVariable, nullptr, U"", defaultValue);
+
+#define TEXTFIELD(stringVariable, labelText, defaultValue) \
+	TEXTFIELD_VARIABLE (stringVariable) \
+	TEXTFIELD_FIELD (stringVariable, labelText, defaultValue)
+
+
+#define RADIO_VARIABLE(optionVariable) \
+	static int optionVariable;
+
+#define RADIO_FIELD(optionVariable, labelText, defaultValue) \
+	_radio_ = UiForm_addRadio (cmd -> d_uiform.get(), & optionVariable, nullptr, nullptr, labelText, defaultValue, 1);
+
+#define RADIO(optionVariable, labelText, defaultValue) \
+	RADIO_VARIABLE (optionVariable) \
+	RADIO_FIELD (optionVariable, labelText, defaultValue)
+
+
+#define RADIOSTR(stringVariable, labelText, defaultValue) \
+	static char32 *stringVariable; \
+	_radio_ = UiForm_addRadio (cmd -> d_uiform.get(), nullptr, & stringVariable, nullptr, labelText, defaultValue, 1);
+
+
+#define RADIOBUTTON(labelText) \
+	UiRadio_addButton (_radio_, labelText);
+
+
+#define OPTIONMENU_VARIABLE(optionVariable) \
+	static int optionVariable;
+
+#define OPTIONMENU_FIELD(optionVariable, labelText, defaultValue) \
+	_radio_ = UiForm_addOptionMenu (cmd -> d_uiform.get(), & optionVariable, nullptr, nullptr, labelText, defaultValue, 1);
+
+#define OPTIONMENU(optionVariable, labelText, defaultValue) \
+	OPTIONMENU_VARIABLE (optionVariable) \
+	OPTIONMENU_FIELD(optionVariable, labelText, defaultValue)
+
+
+#define OPTIONMENUSTR(stringVariable, labelText, defaultValue) \
+	static char32 *stringVariable; \
+	_radio_ = UiForm_addOptionMenu (cmd -> d_uiform.get(), nullptr, & stringVariable, nullptr, labelText, defaultValue, 1);
+
+
+#define OPTION(labelText) \
+	UiOptionMenu_addButton (_radio_, labelText);
+
+
+#define RADIO_ENUM_VARIABLE(EnumeratedType, enumeratedVariable) \
+	static enum EnumeratedType enumeratedVariable; \
+
+#define RADIO_ENUM_FIELD(enumeratedVariable, labelText, EnumeratedType, defaultValue) \
+	{/* type checks */ \
+		enum EnumeratedType _compilerTypeCheckDummy = defaultValue; \
+		_compilerTypeCheckDummy = enumeratedVariable; \
+	} \
+	{/* scope */ \
+		UiField _radio = UiForm_addRadio (cmd -> d_uiform.get(), (int *) & enumeratedVariable, nullptr, nullptr, labelText, \
+			(int) defaultValue - (int) EnumeratedType::MIN + 1, (int) EnumeratedType::MIN); \
+		for (int _ienum = (int) EnumeratedType::MIN; _ienum <= (int) EnumeratedType::MAX; _ienum ++) \
+			UiRadio_addButton (_radio, EnumeratedType##_getText ((enum EnumeratedType) _ienum)); \
+	}
+
+#define RADIO_ENUM(enumeratedVariable, labelText, EnumeratedType, defaultValue) \
+	RADIO_ENUM_VARIABLE (EnumeratedType, enumeratedVariable) \
+	RADIO_ENUM_FIELD (enumeratedVariable, labelText, EnumeratedType, defaultValue)
+
+
+#define OPTIONMENU_ENUM_VARIABLE(EnumeratedType, enumeratedVariable) \
+	static enum EnumeratedType enumeratedVariable; \
+
+#define OPTIONMENU_ENUM_FIELD(enumeratedVariable, labelText, EnumeratedType, defaultValue) \
+	{/* type checks */ \
+		enum EnumeratedType _compilerTypeCheckDummy = defaultValue; \
+		_compilerTypeCheckDummy = enumeratedVariable; \
+	} \
+	{/* scope */ \
+		UiField _radio = UiForm_addOptionMenu (cmd -> d_uiform.get(), (int *) & enumeratedVariable, nullptr, nullptr, labelText, \
+			(int) defaultValue - (int) EnumeratedType::MIN + 1, (int) EnumeratedType::MIN); \
+		for (int _ienum = (int) EnumeratedType::MIN; _ienum <= (int) EnumeratedType::MAX; _ienum ++) \
+			UiOptionMenu_addButton (_radio, EnumeratedType##_getText ((enum EnumeratedType) _ienum)); \
+	}
+
+#define OPTIONMENU_ENUM(enumeratedVariable, labelText, EnumeratedType, defaultValue) \
+	OPTIONMENU_ENUM_VARIABLE (EnumeratedType, enumeratedVariable) \
+	OPTIONMENU_ENUM_FIELD (enumeratedVariable, labelText, EnumeratedType, defaultValue)
+
+
+#define LIST(integerVariable, labelText, numberOfStrings, strings, defaultValue) \
+	static integer integerVariable; \
+	UiForm_addList (cmd -> d_uiform.get(), & integerVariable, nullptr, nullptr, labelText, numberOfStrings, strings, defaultValue);
 
 /*
-	Four optional functions to change the content of a field on the basis of the current
+	Seven optional functions to change the content of a field on the basis of the current
 	editor setting rather than on the basis of the factory default.
 	They are to be called between EDITOR_OK and EDITOR_DO.
 */
 
-#define SET_REAL(fieldLabel, newValue) \
-	UiForm_setReal (cmd -> d_uiform.get(), fieldLabel, newValue);
+#define SET_REAL(realVariable, realValue) \
+	UiForm_setReal (cmd -> d_uiform.get(), & realVariable, realValue);
+
+#define SET_INTEGER(integerVariable, integerValue)  \
+	UiForm_setInteger (cmd -> d_uiform.get(), & integerVariable, integerValue);
+
+#define SET_INTEGER_AS_STRING(integerVariable, stringValue)  \
+	UiForm_setIntegerAsString (cmd -> d_uiform.get(), & integerVariable, stringValue);
+
+#define SET_BOOLEAN(booleanVariable, booleanValue)  \
+	UiForm_setBoolean (cmd -> d_uiform.get(), & booleanVariable, booleanValue);
 
-#define SET_INTEGER(fieldLabel, newValue) \
-	UiForm_setInteger (cmd -> d_uiform.get(), fieldLabel, newValue);
+#define SET_OPTION(optionVariable, optionValue)  \
+	UiForm_setOption (cmd -> d_uiform.get(), & optionVariable, optionValue);
 
-#define SET_STRING(fieldLabelOrInvisibleName, newValue) \
-	UiForm_setString (cmd -> d_uiform.get(), fieldLabelOrInvisibleName, newValue);
+#define SET_STRING(stringVariable, stringValue) \
+	UiForm_setString (cmd -> d_uiform.get(), & stringVariable, stringValue);
 
-#define SET_ENUM(fieldLabel, EnumeratedType, newValue) \
-	{ enum EnumeratedType _compilerTypeCheckDummy = newValue; (void) _compilerTypeCheckDummy; } \
-	UiForm_setString (cmd -> d_uiform.get(), fieldLabel, EnumeratedType##_getText (newValue));
+#define SET_ENUM(enumeratedVariable, EnumeratedType, enumeratedValue) \
+	enumeratedVariable = enumeratedValue /* type check */; \
+	UiForm_setOption (cmd -> d_uiform.get(), (int *) & enumeratedVariable, (int) enumeratedValue - (int) EnumeratedType::MIN + 1);
 
 
 #define DIALOG  cmd -> d_uiform
@@ -150,7 +332,7 @@
 #define EDITOR_FORM_SAVE(title,helpTitle) \
 	if (! cmd -> d_uiform) { \
 		cmd -> d_uiform = autoUiForm (UiOutfile_createE (cmd, title, cmd -> itemTitle, helpTitle)); \
-		} if (! sendingForm && ! args && ! sendingString) { char32 defaultName [300]; defaultName [0] = U'\0';
+		} if (! args && ! sendingForm && ! sendingString) { char32 defaultName [300]; defaultName [0] = U'\0';
 #define EDITOR_DO_SAVE \
 	UiOutfile_do (cmd -> d_uiform.get(), defaultName); } else { MelderFile file; structMelderFile file2 { }; \
 		if (! args && ! sendingString) file = UiFile_getFile (sendingForm); \
@@ -159,16 +341,12 @@
 #define EDITOR_FORM_READ(title,helpTitle) \
 	if (! cmd -> d_uiform) { \
 		cmd -> d_uiform = autoUiForm (UiInfile_createE (cmd, title, cmd -> itemTitle, helpTitle)); \
-		} if (! sendingForm && ! args && ! sendingString) {
+		} if (! args && ! sendingForm && ! sendingString) {
 #define EDITOR_DO_READ \
 	UiInfile_do (cmd -> d_uiform.get()); } else { MelderFile file; structMelderFile file2 { }; \
 		if (! args && ! sendingString) file = UiFile_getFile (sendingForm); \
 		else { Melder_relativePathToFile (args ? args [1]. string : sendingString, & file2); file = & file2; }
 
-#define GET_REAL(name)  UiForm_getReal (cmd -> d_uiform.get(), name)
-#define GET_INTEGER(name)  UiForm_getInteger (cmd -> d_uiform.get(), name)
-#define GET_STRING(name)  UiForm_getString (cmd -> d_uiform.get(), name)
-#define GET_ENUM(enum,name)  (enum) enum##_getValue (GET_STRING (name))
 #define GET_FILE  UiForm_getFile (cmd -> d_uiform.get())
 
 /* End of file EditorM.h */
diff --git a/sys/Formula.cpp b/sys/Formula.cpp
index d12e4cb..cfe11d7 100644
--- a/sys/Formula.cpp
+++ b/sys/Formula.cpp
@@ -668,7 +668,7 @@ static void Formula_lexan () {
 					U_RIGHT_GUILLEMET U" in formula "
 					U"(variables start with lower case; object names contain an underscore).");
 			} else if (str32nequ (token.string, U"Object_", 7)) {
-				long uniqueID = Melder_atoi (token.string + 7);
+				integer uniqueID = Melder_atoi (token.string + 7);
 				int i = theCurrentPraatObjects -> n;
 				while (i > 0 && uniqueID != theCurrentPraatObjects -> list [i]. id)
 					i --;
@@ -2459,7 +2459,7 @@ inline static void nummat_multiplyByScalar (nummat x, real factor) {
 }
 inline static autonumvec add_numvec (numvec x, real addend) {
 	autonumvec result (x.size, false);
-	for (long i = 1; i <= x.size; i ++) {
+	for (integer i = 1; i <= x.size; i ++) {
 		result [i] = x [i] + addend;
 	}
 	return result;
@@ -2548,7 +2548,7 @@ static void do_add () {
 				i.e.
 				result# [i] = x# [i] + y# [i]
 			*/
-			long nx = x->numericVector.size, ny = y->numericVector.size;
+			integer nx = x->numericVector.size, ny = y->numericVector.size;
 			if (nx != ny) {
 				/*@praat
 					#
@@ -2627,8 +2627,8 @@ static void do_add () {
 				i.e.
 				result## [i, j] = x## [i, j] + y## [i, j]
 			*/
-			long xnrow = x->numericMatrix.nrow, xncol = x->numericMatrix.ncol;
-			long ynrow = y->numericMatrix.nrow, yncol = y->numericMatrix.ncol;
+			integer xnrow = x->numericMatrix.nrow, xncol = x->numericMatrix.ncol;
+			integer ynrow = y->numericMatrix.nrow, yncol = y->numericMatrix.ncol;
 			if (xnrow != ynrow)
 				Melder_throw (U"When adding matrices, their numbers of rows should be equal, instead of ", xnrow, U" and ", ynrow, U".");
 			if (xncol != yncol)
@@ -2668,7 +2668,7 @@ static void do_add () {
 		/*
 			result$ = x$ + y$
 		*/
-		long length1 = str32len (x->string), length2 = str32len (y->string);
+		integer length1 = str32len (x->string), length2 = str32len (y->string);
 		char32 *result = Melder_malloc (char32, length1 + length2 + 1);
 		str32cpy (result, x->string);
 		str32cpy (result + length1, y->string);
@@ -2809,7 +2809,7 @@ static void do_sub () {
 				i.e.
 				result# [i] = x# [i] - y# [i]
 			*/
-			long nx = x->numericVector.size, ny = y->numericVector.size;
+			integer nx = x->numericVector.size, ny = y->numericVector.size;
 			if (nx != ny)
 				Melder_throw (U"When subtracting vectors, their numbers of elements should be equal, instead of ", nx, U" and ", ny, U".");
 			if (x -> owned) {
@@ -2843,8 +2843,8 @@ static void do_sub () {
 	}
 	if (x->which == Stackel_NUMERIC_MATRIX) {
 		if (y->which == Stackel_NUMERIC_MATRIX) {
-			long xnrow = x->numericMatrix.nrow, xncol = x->numericMatrix.ncol;
-			long ynrow = y->numericMatrix.nrow, yncol = y->numericMatrix.ncol;
+			integer xnrow = x->numericMatrix.nrow, xncol = x->numericMatrix.ncol;
+			integer ynrow = y->numericMatrix.nrow, yncol = y->numericMatrix.ncol;
 			if (xnrow != ynrow)
 				Melder_throw (U"When subtracting matrices, their numbers of rows should be equal, instead of ", xnrow, U" and ", ynrow, U".");
 			if (xncol != yncol)
@@ -2915,9 +2915,9 @@ static void do_mul () {
 				moveNumericVector (y, x);
 				w ++;
 			} else {
-				long ny = y->numericVector.size;
+				integer ny = y->numericVector.size;
 				autonumvec result { ny, false };
-				for (long i = 1; i <= ny; i ++) {
+				for (integer i = 1; i <= ny; i ++) {
 					double yvalue = y->numericVector [i];
 					result [i] = xvalue * yvalue;
 				}
@@ -2935,10 +2935,10 @@ static void do_mul () {
 				moveNumericMatrix (y, x);
 				w ++;
 			} else {
-				long nrow = y->numericMatrix.nrow, ncol = y->numericMatrix.ncol;
+				integer nrow = y->numericMatrix.nrow, ncol = y->numericMatrix.ncol;
 				autonummat result (nrow, ncol, false);
-				for (long irow = 1; irow <= nrow; irow ++) {
-					for (long icol = 1; icol <= ncol; icol ++) {
+				for (integer irow = 1; irow <= nrow; irow ++) {
+					for (integer icol = 1; icol <= ncol; icol ++) {
 						double yvalue = y->numericMatrix [irow] [icol];
 						result [irow] [icol] = xvalue * yvalue;
 					}
@@ -2952,11 +2952,11 @@ static void do_mul () {
 		/*
 			result# = x# * y#
 		*/
-		long nx = x->numericVector.size, ny = y->numericVector.size;
+		integer nx = x->numericVector.size, ny = y->numericVector.size;
 		if (nx != ny)
 			Melder_throw (U"When multiplying vectors, their numbers of elements should be equal, instead of ", nx, U" and ", ny, U".");
 		autonumvec result { nx, false };
-		for (long i = 1; i <= nx; i ++) {
+		for (integer i = 1; i <= nx; i ++) {
 			double xvalue = x->numericVector [i];
 			double yvalue = y->numericVector [i];
 			result [i] = xvalue * yvalue;
@@ -2974,11 +2974,11 @@ static void do_rdiv () {
 	}
 	if (x->which == Stackel_NUMERIC_VECTOR) {
 		if (y->which == Stackel_NUMERIC_VECTOR) {
-			long nelem1 = x->numericVector.size, nelem2 = y->numericVector.size;
+			integer nelem1 = x->numericVector.size, nelem2 = y->numericVector.size;
 			if (nelem1 != nelem2)
 				Melder_throw (U"When dividing vectors, their numbers of elements should be equal, instead of ", nelem1, U" and ", nelem2, U".");
 			autonumvec result { nelem1, false };
-			for (long ielem = 1; ielem <= nelem1; ielem ++)
+			for (integer ielem = 1; ielem <= nelem1; ielem ++)
 				result [ielem] = x->numericVector [ielem] / y->numericVector [ielem];
 			pushNumericVector (result.move());
 			return;
@@ -2987,13 +2987,13 @@ static void do_rdiv () {
 			/*
 				result# = x# / y
 			*/
-			long xn = x->numericVector.size;
+			integer xn = x->numericVector.size;
 			autonumvec result { xn, false };
 			double yvalue = y->number;
 			if (yvalue == 0.0) {
 				Melder_throw (U"Cannot divide (/) ", Stackel_whichText (x), U" by zero.");
 			} else {
-				for (long i = 1; i <= xn; i ++) {
+				for (integer i = 1; i <= xn; i ++) {
 					double xvalue = x->numericVector [i];
 					result [i] = xvalue / yvalue;
 				}
@@ -3079,26 +3079,26 @@ static void do_softmax () {
 	Stackel x = & theStack [w];
 	if (x->which == Stackel_NUMERIC_VECTOR) {
 		if (! x->owned) {
-			x->numericVector = copy_numvec (x->numericVector). releaseToAmbiguousOwner();
+			x->numericVector = copy_numvec (x->numericVector). releaseToAmbiguousOwner();   // TODO: no need to copy
 			x->owned = true;
 		}
-		long nelm = x->numericVector.size;
+		integer nelm = x->numericVector.size;
 		double maximum = -1e308;
-		for (long i = 1; i <= nelm; i ++) {
+		for (integer i = 1; i <= nelm; i ++) {
 			if (x->numericVector [i] > maximum) {
 				maximum = x->numericVector [i];
 			}
 		}
-		for (long i = 1; i <= nelm; i ++) {
+		for (integer i = 1; i <= nelm; i ++) {
 			x->numericVector [i] -= maximum;
 		}
-		double sum = 0.0;
-		for (long i = 1; i <= nelm; i ++) {
+		real80 sum = 0.0;
+		for (integer i = 1; i <= nelm; i ++) {
 			x->numericVector [i] = exp (x->numericVector [i]);
 			sum += x->numericVector [i];
 		}
-		for (long i = 1; i <= nelm; i ++) {
-			x->numericVector [i] /= sum;
+		for (integer i = 1; i <= nelm; i ++) {
+			x->numericVector [i] /= (real) sum;
 		}
 	} else {
 		Melder_throw (U"The function ", Formula_instructionNames [parse [programPointer]. symbol],
@@ -3148,9 +3148,9 @@ static void do_rectify () {
 static void do_rectify_numvec () {
 	Stackel x = pop;
 	if (x->which == Stackel_NUMERIC_VECTOR) {
-		long nelm = x->numericVector.size;
+		integer nelm = x->numericVector.size;
 		autonumvec result { nelm, false };
-		for (long i = 1; i <= nelm; i ++) {
+		for (integer i = 1; i <= nelm; i ++) {
 			double xvalue = x->numericVector [i];
 			result [i] = isundef (xvalue) ? undefined : xvalue > 0.0 ? xvalue : 0.0;
 		}
@@ -3229,9 +3229,9 @@ static void do_exp () {
 static void do_exp_numvec () {
 	Stackel x = pop;
 	if (x->which == Stackel_NUMERIC_VECTOR) {
-		long nelm = x->numericVector.size;
+		integer nelm = x->numericVector.size;
 		autonumvec result (nelm, false);
-		for (long i = 1; i <= nelm; i ++) {
+		for (integer i = 1; i <= nelm; i ++) {
 			result [i] = exp (x->numericVector [i]);
 		}
 		pushNumericVector (result.move());
@@ -3242,10 +3242,10 @@ static void do_exp_numvec () {
 static void do_exp_nummat () {
 	Stackel x = pop;
 	if (x->which == Stackel_NUMERIC_MATRIX) {
-		long nrow = x->numericMatrix.nrow, ncol = x->numericMatrix.ncol;
+		integer nrow = x->numericMatrix.nrow, ncol = x->numericMatrix.ncol;
 		autonummat result (nrow, ncol, false);
-		for (long irow = 1; irow <= nrow; irow ++) {
-			for (long icol = 1; icol <= ncol; icol ++) {
+		for (integer irow = 1; irow <= nrow; irow ++) {
+			for (integer icol = 1; icol <= ncol; icol ++) {
 				result [irow] [icol] = exp (x->numericMatrix [irow] [icol]);
 			}
 		}
@@ -3354,9 +3354,9 @@ static void do_function_dd_d_numvec (double (*f) (double, double)) {
 		Melder_throw (U"The function ", Formula_instructionNames [parse [programPointer]. symbol], U" requires three arguments.");
 	Stackel y = pop, x = pop, a = pop;
 	if (a->which == Stackel_NUMERIC_VECTOR && x->which == Stackel_NUMBER && y->which == Stackel_NUMBER) {
-		long numberOfElements = a->numericVector.size;
+		integer numberOfElements = a->numericVector.size;
 		autonumvec newData (numberOfElements, false);
-		for (long ielem = 1; ielem <= numberOfElements; ielem ++) {
+		for (integer ielem = 1; ielem <= numberOfElements; ielem ++) {
 			newData [ielem] = f (x->number, y->number);
 		}
 		pushNumericVector (newData.move());
@@ -3373,11 +3373,11 @@ static void do_function_dd_d_nummat (double (*f) (double, double)) {
 		Melder_throw (U"The function ", Formula_instructionNames [parse [programPointer]. symbol], U" requires three arguments.");
 	Stackel y = pop, x = pop, a = pop;
 	if (a->which == Stackel_NUMERIC_MATRIX && x->which == Stackel_NUMBER && y->which == Stackel_NUMBER) {
-		long numberOfRows = a->numericMatrix.nrow;
-		long numberOfColumns = a->numericMatrix.ncol;
+		integer numberOfRows = a->numericMatrix.nrow;
+		integer numberOfColumns = a->numericMatrix.ncol;
 		autonummat newData (numberOfRows, numberOfColumns, false);
-		for (long irow = 1; irow <= numberOfRows; irow ++) {
-			for (long icol = 1; icol <= numberOfColumns; icol ++) {
+		for (integer irow = 1; irow <= numberOfRows; irow ++) {
+			for (integer icol = 1; icol <= numberOfColumns; icol ++) {
 				newData [irow] [icol] = f (x->number, y->number);
 			}
 		}
@@ -3388,16 +3388,16 @@ static void do_function_dd_d_nummat (double (*f) (double, double)) {
 			Stackel_whichText (a), U", ", Stackel_whichText (x), U" and ", Stackel_whichText (y), U".");
 	}
 }
-static void do_function_ll_l_numvec (long (*f) (long, long)) {
+static void do_function_ll_l_numvec (integer (*f) (integer, integer)) {
 	Stackel n = pop;
 	Melder_assert (n -> which == Stackel_NUMBER);
 	if (n -> number != 3)
 		Melder_throw (U"The function ", Formula_instructionNames [parse [programPointer]. symbol], U" requires three arguments.");
 	Stackel y = pop, x = pop, a = pop;
 	if (a->which == Stackel_NUMERIC_VECTOR && x->which == Stackel_NUMBER) {
-		long numberOfElements = a->numericVector.size;
+		integer numberOfElements = a->numericVector.size;
 		autonumvec newData (numberOfElements, false);
-		for (long ielem = 1; ielem <= numberOfElements; ielem ++) {
+		for (integer ielem = 1; ielem <= numberOfElements; ielem ++) {
 			newData [ielem] = f (lround (x->number), lround (y->number));
 		}
 		pushNumericVector (newData.move());
@@ -3407,18 +3407,18 @@ static void do_function_ll_l_numvec (long (*f) (long, long)) {
 			Stackel_whichText (a), U", ", Stackel_whichText (x), U" and ", Stackel_whichText (y), U".");
 	}
 }
-static void do_function_ll_l_nummat (long (*f) (long, long)) {
+static void do_function_ll_l_nummat (integer (*f) (integer, integer)) {
 	Stackel n = pop;
 	Melder_assert (n -> which == Stackel_NUMBER);
 	if (n -> number != 3)
 		Melder_throw (U"The function ", Formula_instructionNames [parse [programPointer]. symbol], U" requires three arguments.");
 	Stackel y = pop, x = pop, a = pop;
 	if (a->which == Stackel_NUMERIC_MATRIX && x->which == Stackel_NUMBER && y->which == Stackel_NUMBER) {
-		long numberOfRows = a->numericMatrix.nrow;
-		long numberOfColumns = a->numericMatrix.ncol;
+		integer numberOfRows = a->numericMatrix.nrow;
+		integer numberOfColumns = a->numericMatrix.ncol;
 		autonummat newData (numberOfRows, numberOfColumns, false);
-		for (long irow = 1; irow <= numberOfRows; irow ++) {
-			for (long icol = 1; icol <= numberOfColumns; icol ++) {
+		for (integer irow = 1; irow <= numberOfRows; irow ++) {
+			for (integer icol = 1; icol <= numberOfColumns; icol ++) {
 				newData [irow] [icol] = f (lround (x->number), lround (y->number));
 			}
 		}
@@ -3429,7 +3429,7 @@ static void do_function_ll_l_nummat (long (*f) (long, long)) {
 			Stackel_whichText (a), U", ", Stackel_whichText (x), U" and ", Stackel_whichText (y), U".");
 	}
 }
-static void do_function_dl_d (double (*f) (double, long)) {
+static void do_function_dl_d (double (*f) (double, integer)) {
 	Stackel y = pop, x = pop;
 	if (x->which == Stackel_NUMBER && y->which == Stackel_NUMBER) {
 		pushNumber (isundef (x->number) || isundef (y->number) ? undefined :
@@ -3440,7 +3440,7 @@ static void do_function_dl_d (double (*f) (double, long)) {
 			Stackel_whichText (x), U" and ", Stackel_whichText (y), U".");
 	}
 }
-static void do_function_ld_d (double (*f) (long, double)) {
+static void do_function_ld_d (double (*f) (integer, double)) {
 	Stackel y = pop, x = pop;
 	if (x->which == Stackel_NUMBER && y->which == Stackel_NUMBER) {
 		pushNumber (isundef (x->number) || isundef (y->number) ? undefined :
@@ -3451,7 +3451,7 @@ static void do_function_ld_d (double (*f) (long, double)) {
 			Stackel_whichText (x), U" and ", Stackel_whichText (y), U".");
 	}
 }
-static void do_function_ll_l (long (*f) (long, long)) {
+static void do_function_ll_l (integer (*f) (integer, integer)) {
 	Stackel y = pop, x = pop;
 	if (x->which == Stackel_NUMBER && y->which == Stackel_NUMBER) {
 		pushNumber (isundef (x->number) || isundef (y->number) ? undefined :
@@ -3639,17 +3639,17 @@ static void shared_do_writeInfo (int numberOfArguments) {
 		} else if (arg->which == Stackel_STRING) {
 			MelderInfo_write (arg->string);
 		} else if (arg->which == Stackel_NUMERIC_VECTOR) {
-			long numberOfElements = arg->numericVector.size;
+			integer numberOfElements = arg->numericVector.size;
 			double *data = arg->numericVector.at;
-			for (long i = 1; i <= numberOfElements; i ++) {
+			for (integer i = 1; i <= numberOfElements; i ++) {
 				MelderInfo_write (data [i], i == numberOfElements ? U"" : U" ");
 			}
 		} else if (arg->which == Stackel_NUMERIC_MATRIX) {
-			long numberOfRows = arg->numericMatrix.nrow;
-			long numberOfColumns = arg->numericMatrix.ncol;
+			integer numberOfRows = arg->numericMatrix.nrow;
+			integer numberOfColumns = arg->numericMatrix.ncol;
 			double **data = arg->numericMatrix.at;
-			for (long irow = 1; irow <= numberOfRows; irow ++) {
-				for (long icol = 1; icol <= numberOfRows; icol ++) {
+			for (integer irow = 1; irow <= numberOfRows; irow ++) {
+				for (integer icol = 1; icol <= numberOfRows; icol ++) {
 					MelderInfo_write (data [irow] [icol], icol == numberOfColumns ? U"" : U" ");
 				}
 				MelderInfo_write (irow == numberOfRows ? U"" : U"\n");
@@ -4009,10 +4009,10 @@ static void do_imax () {
 	} else if (last->which == Stackel_NUMERIC_VECTOR) {
 		if (n->number != 1)
 			Melder_throw (U"The function \"imax\" requires exactly one vector argument.");
-		long numberOfElements = last->numericVector.size;
-		long result = 1;
+		integer numberOfElements = last->numericVector.size;
+		integer result = 1;
 		double maximum = last->numericVector [1];
-		for (long i = 2; i <= numberOfElements; i ++) {
+		for (integer i = 2; i <= numberOfElements; i ++) {
 			if (last->numericVector [i] > maximum) {
 				result = i;
 				maximum = last->numericVector [i];
@@ -4120,11 +4120,11 @@ static void do_linearNumvec () {
 		Melder_throw (U"In the function \"linear#\", the number of steps (third argument) has to be a number, not ", Stackel_whichText (stack_numberOfSteps), U".");
 	if (isundef (stack_numberOfSteps -> number))
 		Melder_throw (U"Undefined number of steps in the function \"linear#\" (third argument).");
-	long numberOfSteps = lround (stack_numberOfSteps -> number);
+	integer numberOfSteps = lround (stack_numberOfSteps -> number);
 	if (numberOfSteps <= 0)
 		Melder_throw (U"In the function \"linear#\", the number of steps (third argument) has to be positive, not ", numberOfSteps, U".");
 	autonumvec result { numberOfSteps, false };
-	for (long ielem = 1; ielem <= numberOfSteps; ielem ++) {
+	for (integer ielem = 1; ielem <= numberOfSteps; ielem ++) {
 		result [ielem] = excludeEdges ?
 			minimum + (ielem - 0.5) * (maximum - minimum) / numberOfSteps :
 			minimum + (ielem - 1) * (maximum - minimum) / (numberOfSteps - 1);
@@ -4235,7 +4235,7 @@ static void do_hash () {
 
 static void do_numericVectorElement () {
 	InterpreterVariable vector = parse [programPointer]. content.variable;
-	long element = 1;   // default
+	integer element = 1;   // default
 	Stackel r = pop;
 	if (r -> which != Stackel_NUMBER)
 		Melder_throw (U"In vector indexing, the index has to be a number, not ", Stackel_whichText (r), U".");
@@ -4250,7 +4250,7 @@ static void do_numericVectorElement () {
 }
 static void do_numericMatrixElement () {
 	InterpreterVariable matrix = parse [programPointer]. content.variable;
-	long row = 1, column = 1;   // default
+	integer row = 1, column = 1;   // default
 	Stackel c = pop;
 	if (c -> which != Stackel_NUMBER)
 		Melder_throw (U"In matrix indexing, the column index has to be a number, not ", Stackel_whichText (c), U".");
@@ -4370,8 +4370,8 @@ static void do_leftStr () {
 	if (narg->number == 1 || narg->number == 2) {
 		Stackel x = ( narg->number == 2 ? pop : nullptr ), s = pop;
 		if (s->which == Stackel_STRING && (x == nullptr || x->which == Stackel_NUMBER)) {
-			long newlength = x ? lround (x->number) : 1;
-			long length = str32len (s->string);
+			integer newlength = x ? lround (x->number) : 1;
+			integer length = str32len (s->string);
 			if (newlength < 0) newlength = 0;
 			if (newlength > length) newlength = length;
 			#if 0
@@ -4396,8 +4396,8 @@ static void do_rightStr () {
 	if (narg->number == 1 || narg->number == 2) {
 		Stackel x = ( narg->number == 2 ? pop : nullptr ), s = pop;
 		if (s->which == Stackel_STRING && (x == nullptr || x->which == Stackel_NUMBER)) {
-			long newlength = x ? lround (x->number) : 1;
-			long length = str32len (s->string);
+			integer newlength = x ? lround (x->number) : 1;
+			integer length = str32len (s->string);
 			if (newlength < 0) newlength = 0;
 			if (newlength > length) newlength = length;
 			pushString (Melder_dup (s->string + length - newlength));
@@ -4413,9 +4413,9 @@ static void do_midStr () {
 	if (narg->number == 2 || narg->number == 3) {
 		Stackel y = ( narg->number == 3 ? pop : nullptr ), x = pop, s = pop;
 		if (s->which == Stackel_STRING && x->which == Stackel_NUMBER && (y == nullptr || y->which == Stackel_NUMBER)) {
-			long newlength = y ? lround (y->number) : 1;
-			long start = lround (x->number);
-			long length = str32len (s->string), finish = start + newlength - 1;
+			integer newlength = y ? lround (y->number) : 1;
+			integer start = lround (x->number);
+			integer length = str32len (s->string), finish = start + newlength - 1;
 			autostring32 result;
 			if (start < 1) start = 1;
 			if (finish > length) finish = length;
@@ -4438,7 +4438,7 @@ static void do_midStr () {
 static void do_unicodeToBackslashTrigraphsStr () {
 	Stackel s = pop;
 	if (s->which == Stackel_STRING) {
-		long length = str32len (s->string);
+		integer length = str32len (s->string);
 		autostring32 trigraphs = Melder_calloc (char32, 3 * length + 1);
 		Longchar_genericize32 (s->string, trigraphs.peek());
 		pushString (trigraphs.transfer());
@@ -4449,7 +4449,7 @@ static void do_unicodeToBackslashTrigraphsStr () {
 static void do_backslashTrigraphsToUnicodeStr () {
 	Stackel s = pop;
 	if (s->which == Stackel_STRING) {
-		long length = str32len (s->string);
+		integer length = str32len (s->string);
 		//autostring32 unicode = Melder_calloc (char32, length + 1);
 		//Longchar_nativize32 (s->string, unicode.peek(), false);
 		//pushString (unicode.transfer());
@@ -4475,7 +4475,7 @@ static void do_index () {
 	Stackel t = pop, s = pop;
 	if (s->which == Stackel_STRING && t->which == Stackel_STRING) {
 		char32 *substring = str32str (s->string, t->string);
-		long result = substring ? substring - s->string + 1 : 0;
+		integer result = substring ? substring - s->string + 1 : 0;
 		pushNumber (result);
 	} else {
 		Melder_throw (U"The function \"index\" requires two strings, not ",
@@ -4487,7 +4487,7 @@ static void do_rindex () {
 	if (whole->which == Stackel_STRING && part->which == Stackel_STRING) {
 		char32 *lastSubstring = str32str (whole->string, part->string);
 		if (part->string [0] == '\0') {
-			long result = str32len (whole->string);
+			integer result = str32len (whole->string);
 			pushNumber (result);
 		} else if (lastSubstring) {
 			for (;;) {
@@ -4538,7 +4538,7 @@ static void do_index_regex (int backward) {
 static void do_replaceStr () {
 	Stackel x = pop, u = pop, t = pop, s = pop;
 	if (s->which == Stackel_STRING && t->which == Stackel_STRING && u->which == Stackel_STRING && x->which == Stackel_NUMBER) {
-		long numberOfMatches;
+		integer numberOfMatches;
 		//autostring32 result = str_replace_literal (s->string, t->string, u->string, lround (x->number), & numberOfMatches);
 		//pushString (result.transfer());
 		char32 *result = str_replace_literal (s->string, t->string, u->string, lround (x->number), & numberOfMatches);
@@ -4555,7 +4555,7 @@ static void do_replace_regexStr () {
 		if (! compiled_regexp) {
 			Melder_throw (U"replace_regex$(): ", errorMessage, U".");
 		} else {
-			long numberOfMatches;
+			integer numberOfMatches;
 			//autostring32 result = str_replace_regexp (s->string, compiled_regexp, u->string, lround (x->number), & numberOfMatches);
 			//pushString (result.transfer());
 			char32 *result = str_replace_regexp (s->string, compiled_regexp, u->string, lround (x->number), & numberOfMatches);
@@ -4616,7 +4616,7 @@ static void do_extractTextStr (bool singleWord) {
 		if (! substring) {
 			result.reset (Melder_dup (U""));
 		} else {
-			long length;
+			integer length;
 			/* Skip the prompt. */
 			substring += str32len (t->string);
 			if (singleWord) {
@@ -4644,7 +4644,7 @@ static void do_extractTextStr (bool singleWord) {
 }
 static void do_selected () {
 	Stackel n = pop;
-	long result = 0;
+	integer result = 0;
 	if (n->number == 0) {
 		result = praat_idOfSelected (nullptr, 0);
 	} else if (n->number == 1) {
@@ -4731,7 +4731,7 @@ static void do_selectedStr () {
 #endif
 static void do_numberOfSelected () {
 	Stackel n = pop;
-	long result = 0;
+	integer result = 0;
 	if (n->number == 0) {
 		result = praat_numberOfSelected (nullptr);
 	} else if (n->number == 1) {
@@ -5079,7 +5079,7 @@ static void do_object_rowstr () {
 		Daata data = OBJECT;
 		if (data -> v_hasGetRowStr ()) {
 			if (index -> which == Stackel_NUMBER) {
-				long number = lround (index->number);
+				integer number = lround (index->number);
 				autostring32 result = Melder_dup (data -> v_getRowStr (number));
 				if (! result.peek())
 					Melder_throw (U"Row index out of bounds.");
@@ -5094,7 +5094,7 @@ static void do_object_rowstr () {
 		Daata data = object -> object;
 		if (data -> v_hasGetRowStr ()) {
 			if (index -> which == Stackel_NUMBER) {
-				long number = lround (index->number);
+				integer number = lround (index->number);
 				autostring32 result = Melder_dup (data -> v_getRowStr (number));
 				if (! result.peek())
 					Melder_throw (U"Row index out of bounds.");
@@ -5118,7 +5118,7 @@ static void do_object_colstr () {
 		Daata data = OBJECT;
 		if (data -> v_hasGetColStr ()) {
 			if (index -> which == Stackel_NUMBER) {
-				long number = lround (index->number);
+				integer number = lround (index->number);
 				autostring32 result = Melder_dup (data -> v_getColStr (number));
 				if (! result.peek())
 					Melder_throw (U"Column index out of bounds.");
@@ -5133,7 +5133,7 @@ static void do_object_colstr () {
 		Daata data = object -> object;
 		if (data -> v_hasGetColStr ()) {
 			if (index -> which == Stackel_NUMBER) {
-				long number = lround (index->number);
+				integer number = lround (index->number);
 				autostring32 result = Melder_dup (data -> v_getColStr (number));
 				if (! result.peek())
 					Melder_throw (U"Column index out of bounds.");
@@ -5248,10 +5248,10 @@ static void do_readFileStr () {
 static void do_numericVectorLiteral () {
 	Stackel n = pop;
 	Melder_assert (n->which == Stackel_NUMBER);
-	long numberOfElements = lround (n->number);
+	integer numberOfElements = lround (n->number);
 	Melder_assert (numberOfElements > 0);
 	autonumvec result { numberOfElements, false };
-	for (long ielement = numberOfElements; ielement > 0; ielement --) {
+	for (integer ielement = numberOfElements; ielement > 0; ielement --) {
 		Stackel e = pop;
 		if (e->which != Stackel_NUMBER)
 			Melder_throw (U"Vector element has to be a number, not ", Stackel_whichText (e));
@@ -5301,7 +5301,7 @@ static void do_mulNumvec () {
 		/*
 			result# = mul# (x##, y#)
 		*/
-		long xNcol = x->numericMatrix.ncol, ySize = y->numericVector.size;
+		integer xNcol = x->numericMatrix.ncol, ySize = y->numericVector.size;
 		if (ySize != xNcol)
 			Melder_throw (U"In the function \"mul#\", the number of columns of the matrix and the dimension of the vector should be equal, "
 				"not ", xNcol, U" and ", ySize);
@@ -5314,11 +5314,11 @@ static void do_mulNumvec () {
 static void do_repeatNumvec () {
 	Stackel n = pop, x = pop;
 	if (x->which == Stackel_NUMERIC_VECTOR && n->which == Stackel_NUMBER) {
-		long n_old = x->numericVector.size;
-		long times = lround (n->number);
+		integer n_old = x->numericVector.size;
+		integer times = lround (n->number);
 		autonumvec result { n_old * times, false };
-		for (long i = 1; i <= times; i ++) {
-			for (long j = 1; j <= n_old; j ++) {
+		for (integer i = 1; i <= times; i ++) {
+			for (integer j = 1; j <= n_old; j ++) {
 				result [(i - 1) * n_old + j] = x->numericVector [j];
 			}
 		}
@@ -5815,8 +5815,8 @@ static void do_demoExtraControlKeyPressed () {
 	bool result = Demo_extraControlKeyPressed ();
 	pushNumber (result);
 }
-static long Stackel_getRowNumber (Stackel row, Daata thee) {
-	long result = 0;
+static integer Stackel_getRowNumber (Stackel row, Daata thee) {
+	integer result = 0;
 	if (row->which == Stackel_NUMBER) {
 		result = lround (row->number);
 	} else if (row->which == Stackel_STRING) {
@@ -5830,8 +5830,8 @@ static long Stackel_getRowNumber (Stackel row, Daata thee) {
 	}
 	return result;
 }
-static long Stackel_getColumnNumber (Stackel column, Daata thee) {
-	long result = 0;
+static integer Stackel_getColumnNumber (Stackel column, Daata thee) {
+	integer result = 0;
 	if (column->which == Stackel_NUMBER) {
 		result = lround (column->number);
 	} else if (column->which == Stackel_STRING) {
@@ -5845,7 +5845,7 @@ static long Stackel_getColumnNumber (Stackel column, Daata thee) {
 	}
 	return result;
 }
-static void do_self0 (long irow, long icol) {
+static void do_self0 (integer irow, integer icol) {
 	Daata me = theSource;
 	if (! me) Melder_throw (U"The name \"self\" is restricted to formulas for objects.");
 	if (my v_hasGetCell ()) {
@@ -5877,7 +5877,7 @@ static void do_self0 (long irow, long icol) {
 		Melder_throw (Thing_className (me), U" objects (like self) accept no [] indexing.");
 	}
 }
-static void do_selfStr0 (long irow, long icol) {
+static void do_selfStr0 (integer irow, integer icol) {
 	Daata me = theSource;
 	if (! me) Melder_throw (U"The name \"self$\" is restricted to formulas for objects.");
 	if (my v_hasGetCellStr ()) {
@@ -5936,7 +5936,7 @@ static void do_toObject () {
 	}
 	pushObject (thee);
 }
-static void do_objectCell0 (long irow, long icol) {
+static void do_objectCell0 (integer irow, integer icol) {
 	Stackel object = pop;
 	Daata thee = object->object;
 	if (thy v_hasGetCell ()) {
@@ -5967,7 +5967,7 @@ static void do_objectCell0 (long irow, long icol) {
 		Melder_throw (Thing_className (thee), U" objects accept no [] indexing.");
 	}
 }
-static void do_matriks0 (long irow, long icol) {
+static void do_matriks0 (integer irow, integer icol) {
 	Daata thee = parse [programPointer]. content.object;
 	if (thy v_hasGetCell ()) {
 		pushNumber (thy v_getCell ());
@@ -5997,11 +5997,11 @@ static void do_matriks0 (long irow, long icol) {
 		Melder_throw (Thing_className (thee), U" objects accept no [] indexing.");
 	}
 }
-static void do_selfMatriks1 (long irow) {
+static void do_selfMatriks1 (integer irow) {
 	Daata me = theSource;
 	Stackel column = pop;
 	if (! me) Melder_throw (U"The name \"self\" is restricted to formulas for objects.");
-	long icol = Stackel_getColumnNumber (column, me);
+	integer icol = Stackel_getColumnNumber (column, me);
 	if (my v_hasGetVector ()) {
 		pushNumber (my v_getVector (irow, icol));
 	} else if (my v_hasGetMatrix ()) {
@@ -6016,11 +6016,11 @@ static void do_selfMatriks1 (long irow) {
 		Melder_throw (Thing_className (me), U" objects (like self) accept no [column] indexes.");
 	}
 }
-static void do_selfMatriksStr1 (long irow) {
+static void do_selfMatriksStr1 (integer irow) {
 	Daata me = theSource;
 	Stackel column = pop;
 	if (! me) Melder_throw (U"The name \"self$\" is restricted to formulas for objects.");
-	long icol = Stackel_getColumnNumber (column, me);
+	integer icol = Stackel_getColumnNumber (column, me);
 	if (my v_hasGetVectorStr ()) {
 		autostring32 result = Melder_dup (my v_getVectorStr (icol));
 		pushString (result.transfer());
@@ -6037,10 +6037,10 @@ static void do_selfMatriksStr1 (long irow) {
 		Melder_throw (Thing_className (me), U" objects (like self) accept no [column] indexes.");
 	}
 }
-static void do_objectCell1 (long irow) {
+static void do_objectCell1 (integer irow) {
 	Stackel column = pop, object = pop;
 	Daata thee = object->object;
-	long icol = Stackel_getColumnNumber (column, thee);
+	integer icol = Stackel_getColumnNumber (column, thee);
 	if (thy v_hasGetVector ()) {
 		pushNumber (thy v_getVector (irow, icol));
 	} else if (thy v_hasGetMatrix ()) {
@@ -6055,10 +6055,10 @@ static void do_objectCell1 (long irow) {
 		Melder_throw (Thing_className (thee), U" objects accept no [column] indexes.");
 	}
 }
-static void do_matriks1 (long irow) {
+static void do_matriks1 (integer irow) {
 	Daata thee = parse [programPointer]. content.object;
 	Stackel column = pop;
-	long icol = Stackel_getColumnNumber (column, thee);
+	integer icol = Stackel_getColumnNumber (column, thee);
 	if (thy v_hasGetVector ()) {
 		pushNumber (thy v_getVector (irow, icol));
 	} else if (thy v_hasGetMatrix ()) {
@@ -6073,10 +6073,10 @@ static void do_matriks1 (long irow) {
 		Melder_throw (Thing_className (thee), U" objects accept no [column] indexes.");
 	}
 }
-static void do_objectCellStr1 (long irow) {
+static void do_objectCellStr1 (integer irow) {
 	Stackel column = pop, object = pop;
 	Daata thee = object->object;
-	long icol = Stackel_getColumnNumber (column, thee);
+	integer icol = Stackel_getColumnNumber (column, thee);
 	if (thy v_hasGetVectorStr ()) {
 		autostring32 result = Melder_dup (thy v_getVectorStr (icol));
 		pushString (result.transfer());
@@ -6093,10 +6093,10 @@ static void do_objectCellStr1 (long irow) {
 		Melder_throw (Thing_className (thee), U" objects accept no [column] indexes for string cells.");
 	}
 }
-static void do_matrixStr1 (long irow) {
+static void do_matrixStr1 (integer irow) {
 	Daata thee = parse [programPointer]. content.object;
 	Stackel column = pop;
-	long icol = Stackel_getColumnNumber (column, thee);
+	integer icol = Stackel_getColumnNumber (column, thee);
 	if (thy v_hasGetVectorStr ()) {
 		autostring32 result = Melder_dup (thy v_getVectorStr (icol));
 		pushString (result.transfer());
@@ -6117,8 +6117,8 @@ static void do_selfMatriks2 () {
 	Daata me = theSource;
 	Stackel column = pop, row = pop;
 	if (! me) Melder_throw (U"The name \"self\" is restricted to formulas for objects.");
-	long irow = Stackel_getRowNumber (row, me);
-	long icol = Stackel_getColumnNumber (column, me);
+	integer irow = Stackel_getRowNumber (row, me);
+	integer icol = Stackel_getColumnNumber (column, me);
 	if (! my v_hasGetMatrix ())
 		Melder_throw (Thing_className (me), U" objects like \"self\" accept no [row, column] indexing.");
 	pushNumber (my v_getMatrix (irow, icol));
@@ -6127,8 +6127,8 @@ static void do_selfMatriksStr2 () {
 	Daata me = theSource;
 	Stackel column = pop, row = pop;
 	if (! me) Melder_throw (U"The name \"self$\" is restricted to formulas for objects.");
-	long irow = Stackel_getRowNumber (row, me);
-	long icol = Stackel_getColumnNumber (column, me);
+	integer irow = Stackel_getRowNumber (row, me);
+	integer icol = Stackel_getColumnNumber (column, me);
 	if (! my v_hasGetMatrixStr ())
 		Melder_throw (Thing_className (me), U" objects like \"self$\" accept no [row, column] indexing for string cells.");
 	autostring32 result = Melder_dup (my v_getMatrixStr (irow, icol));
@@ -6137,8 +6137,8 @@ static void do_selfMatriksStr2 () {
 static void do_objectCell2 () {
 	Stackel column = pop, row = pop, object = pop;
 	Daata thee = object->object;
-	long irow = Stackel_getRowNumber (row, thee);
-	long icol = Stackel_getColumnNumber (column, thee);
+	integer irow = Stackel_getRowNumber (row, thee);
+	integer icol = Stackel_getColumnNumber (column, thee);
 	if (! thy v_hasGetMatrix ())
 		Melder_throw (Thing_className (thee), U" objects accept no [id, row, column] indexing.");
 	pushNumber (thy v_getMatrix (irow, icol));
@@ -6146,8 +6146,8 @@ static void do_objectCell2 () {
 static void do_matriks2 () {
 	Daata thee = parse [programPointer]. content.object;
 	Stackel column = pop, row = pop;
-	long irow = Stackel_getRowNumber (row, thee);
-	long icol = Stackel_getColumnNumber (column, thee);
+	integer irow = Stackel_getRowNumber (row, thee);
+	integer icol = Stackel_getColumnNumber (column, thee);
 	if (! thy v_hasGetMatrix ())
 		Melder_throw (Thing_className (thee), U" objects accept no [row, column] indexing.");
 	pushNumber (thy v_getMatrix (irow, icol));
@@ -6155,8 +6155,8 @@ static void do_matriks2 () {
 static void do_objectCellStr2 () {
 	Stackel column = pop, row = pop, object = pop;
 	Daata thee = object->object;
-	long irow = Stackel_getRowNumber (row, thee);
-	long icol = Stackel_getColumnNumber (column, thee);
+	integer irow = Stackel_getRowNumber (row, thee);
+	integer icol = Stackel_getColumnNumber (column, thee);
 	if (! thy v_hasGetMatrixStr ())
 		Melder_throw (Thing_className (thee), U" objects accept no [id, row, column] indexing for string cells.");
 	autostring32 result = Melder_dup (thy v_getMatrixStr (irow, icol));
@@ -6165,14 +6165,14 @@ static void do_objectCellStr2 () {
 static void do_matriksStr2 () {
 	Daata thee = parse [programPointer]. content.object;
 	Stackel column = pop, row = pop;
-	long irow = Stackel_getRowNumber (row, thee);
-	long icol = Stackel_getColumnNumber (column, thee);
+	integer irow = Stackel_getRowNumber (row, thee);
+	integer icol = Stackel_getColumnNumber (column, thee);
 	if (! thy v_hasGetMatrixStr ())
 		Melder_throw (Thing_className (thee), U" objects accept no [row, column] indexing for string cells.");
 	autostring32 result = Melder_dup (thy v_getMatrixStr (irow, icol));
 	pushString (result.transfer());
 }
-static void do_objectLocation0 (long irow, long icol) {
+static void do_objectLocation0 (integer irow, integer icol) {
 	Stackel object = pop;
 	Daata thee = object->object;
 	if (thy v_hasGetFunction0 ()) {
@@ -6211,7 +6211,7 @@ static void do_objectLocation0 (long irow, long icol) {
 		Melder_throw (Thing_className (thee), U" objects accept no () values.");
 	}
 }
-static void do_funktie0 (long irow, long icol) {
+static void do_funktie0 (integer irow, integer icol) {
 	Daata thee = parse [programPointer]. content.object;
 	if (thy v_hasGetFunction0 ()) {
 		pushNumber (thy v_getFunction0 ());
@@ -6249,7 +6249,7 @@ static void do_funktie0 (long irow, long icol) {
 		Melder_throw (Thing_className (thee), U" objects accept no () values.");
 	}
 }
-static void do_selfFunktie1 (long irow) {
+static void do_selfFunktie1 (integer irow) {
 	Daata me = theSource;
 	Stackel x = pop;
 	if (x->which == Stackel_NUMBER) {
@@ -6269,7 +6269,7 @@ static void do_selfFunktie1 (long irow) {
 		Melder_throw (Thing_className (me), U" objects like \"self\" accept only numeric x values.");
 	}
 }
-static void do_objectLocation1 (long irow) {
+static void do_objectLocation1 (integer irow) {
 	Stackel x = pop, object = pop;
 	Daata thee = object->object;
 	if (x->which == Stackel_NUMBER) {
@@ -6294,7 +6294,7 @@ static void do_objectLocation1 (long irow) {
 		Melder_throw (Thing_className (thee), U" objects accept only numeric x values.");
 	}
 }
-static void do_funktie1 (long irow) {
+static void do_funktie1 (integer irow) {
 	Daata thee = parse [programPointer]. content.object;
 	Stackel x = pop;
 	if (x->which == Stackel_NUMBER) {
@@ -6356,7 +6356,7 @@ static void do_funktie2 () {
 static void do_rowStr () {
 	Daata thee = parse [programPointer]. content.object;
 	Stackel row = pop;
-	long irow = Stackel_getRowNumber (row, thee);
+	integer irow = Stackel_getRowNumber (row, thee);
 	autostring32 result = Melder_dup (thy v_getRowStr (irow));
 	if (! result.peek())
 		Melder_throw (U"Row index out of bounds.");
@@ -6365,7 +6365,7 @@ static void do_rowStr () {
 static void do_colStr () {
 	Daata thee = parse [programPointer]. content.object;
 	Stackel col = pop;
-	long icol = Stackel_getColumnNumber (col, thee);
+	integer icol = Stackel_getColumnNumber (col, thee);
 	autostring32 result = Melder_dup (thy v_getColStr (icol));
 	if (! result.peek())
 		Melder_throw (U"Column index out of bounds.");
@@ -6385,7 +6385,7 @@ static double NUMerf (double x) {
 	return 1.0 - NUMerfcc (x);
 }
 
-void Formula_run (long row, long col, Formula_Result *result) {
+void Formula_run (integer row, integer col, Formula_Result *result) {
 	FormulaInstruction f = parse;
 	programPointer = 1;   // first symbol of the program
 	if (! theStack) theStack = Melder_calloc_f (struct structStackel, 10000);
diff --git a/sys/Formula.h b/sys/Formula.h
index 25d1829..3852b1d 100644
--- a/sys/Formula.h
+++ b/sys/Formula.h
@@ -70,7 +70,7 @@ Thing_declare (Interpreter);
 
 void Formula_compile (Interpreter interpreter, Daata data, const char32 *expression, int expressionType, bool optimize);
 
-void Formula_run (long row, long col, Formula_Result *result);
+void Formula_run (integer row, integer col, Formula_Result *result);
 
 /* End of file Formula.h */
 #endif
diff --git a/sys/Graphics.cpp b/sys/Graphics.cpp
index dc9273f..6fccb73 100644
--- a/sys/Graphics.cpp
+++ b/sys/Graphics.cpp
@@ -126,7 +126,7 @@ int Graphics_getResolution (Graphics me) {
 }
 
 void Graphics_setWsViewport (Graphics me,
-	long x1DC, long x2DC, long y1DC, long y2DC)
+	integer x1DC, integer x2DC, integer y1DC, integer y2DC)
 {
 	if (x1DC < my d_x1DCmin || x2DC > my d_x2DCmax || y1DC < my d_y1DCmin || y2DC > my d_y2DCmax) {
 		Melder_warning (U"Graphics_setWsViewport: coordinates too large:\n",
@@ -160,7 +160,7 @@ void Graphics_setWsViewport (Graphics me,
 }
 
 void Graphics_resetWsViewport (Graphics me,
-	long x1DC, long x2DC, long y1DC, long y2DC)
+	integer x1DC, integer x2DC, integer y1DC, integer y2DC)
 {
 	my d_x1DC = x1DC;
 	my d_x2DC = x2DC;
@@ -169,7 +169,7 @@ void Graphics_resetWsViewport (Graphics me,
 	computeTrafo (me);
 }
 
-void Graphics_inqWsViewport (Graphics me, long *x1DC, long *x2DC, long *y1DC, long *y2DC) {
+void Graphics_inqWsViewport (Graphics me, integer *x1DC, integer *x2DC, integer *y1DC, integer *y2DC) {
 	*x1DC = my d_x1DC;
 	*x2DC = my d_x2DC;
 	*y1DC = my d_y1DC;
@@ -195,7 +195,7 @@ void Graphics_inqWsWindow (Graphics me, double *x1NDC, double *x2NDC, double *y1
 
 /***** CO-ORDINATE TRANFORMATIONS *****/
 
-void Graphics_DCtoWC (Graphics me, long xDC, long yDC, double *xWC, double *yWC) {
+void Graphics_DCtoWC (Graphics me, integer xDC, integer yDC, double *xWC, double *yWC) {
 	if (my yIsZeroAtTheTop) {
 		*xWC = (xDC + 0.5 - my deltaX) / my scaleX;
 		*yWC = (yDC - 0.5 - my deltaY) / my scaleY;
@@ -208,7 +208,7 @@ void Graphics_DCtoWC (Graphics me, long xDC, long yDC, double *xWC, double *yWC)
 #define wdx(x)  ((x) * my scaleX + my deltaX)
 #define wdy(y)  ((y) * my scaleY + my deltaY)
 
-void Graphics_WCtoDC (Graphics me, double xWC, double yWC, long *xDC, long *yDC) {
+void Graphics_WCtoDC (Graphics me, double xWC, double yWC, integer *xDC, integer *yDC) {
 	*xDC = wdx (xWC);
 	*yDC = wdy (yWC);
 }
diff --git a/sys/Graphics.h b/sys/Graphics.h
index 238359a..4051ab7 100644
--- a/sys/Graphics.h
+++ b/sys/Graphics.h
@@ -33,11 +33,11 @@ typedef struct {
 	unsigned char link, rightToLeft;
 	short style, size, baseline;
 	double size_real;
-	unsigned long code;
+	uint32 code;
 	char32 kar;
 	Longchar_Info karInfo;
 	double width;
-	union { long integer; const char *string; void *pointer; } font;
+	union { integer integer_; const char *string; void *pointer; } font;
 	int cell, line, run;
 } _Graphics_widechar;
 
@@ -58,13 +58,13 @@ Thing_define (Graphics, Thing) {
 	int resolution;
 		/* Dots per inch. */
 	enum kGraphics_resolution resolutionNumber;
-	long d_x1DCmin, d_x2DCmax, d_y1DCmin, d_y2DCmax;
+	integer d_x1DCmin, d_x2DCmax, d_y1DCmin, d_y2DCmax;
 		/* Maximum dimensions of the output device. */
 		/* x1DCmin < x2DCmax; y1DCmin < y2DCmax; */
 		/* The point (x1DCmin, y1DCmin) can be either in the top left */
 		/* or in the bottom left, depending on the yIsZeroAtTheTop flag. */
 		/* Device variables. */
-	long d_x1DC, d_x2DC, d_y1DC, d_y2DC;
+	integer d_x1DC, d_x2DC, d_y1DC, d_y2DC;
 		/* Current dimensions of the output device, or: */
 		/* device coordinates of the viewport rectangle. */
 		/* x1DCmin <= x1DC < x2DC <= x2DCmax; */
@@ -108,7 +108,7 @@ Thing_define (Graphics, Thing) {
 	int percentSignIsItalic, numberSignIsBold, circumflexIsSuperscript, underscoreIsSubscript;
 	int dollarSignIsCode, atSignIsLink;
 	bool recording, duringXor;
-	long irecord, nrecord;
+	integer irecord, nrecord;
 	double *record;
 	Graphics_Viewport outerViewport;   // for Graphics_(un)setInner ()
 	double horTick, vertTick;   // for Graphics_mark(s)XXX ()
@@ -117,8 +117,8 @@ Thing_define (Graphics, Thing) {
 	void v_destroy () noexcept
 		override;
 
-	virtual void v_polyline (long /* numberOfPoints */, double * /* xyDC */, bool /* close */) { }
-	virtual void v_fillArea (long /* numberOfPoints */, double * /* xyDC */) { }
+	virtual void v_polyline (integer /* numberOfPoints */, double * /* xyDC */, bool /* close */) { }
+	virtual void v_fillArea (integer /* numberOfPoints */, double * /* xyDC */) { }
 	virtual void v_rectangle (double /* x1DC */, double /* x2DC */, double /* y1DC */, double /* y2DC */) { }
 	virtual void v_fillRectangle (double /* x1DC */, double /* x2DC */, double /* y1DC */, double /* y2DC */) { }
 	virtual void v_circle (double /* xDC */, double /* yDC */, double /* rDC */) { }
@@ -158,26 +158,26 @@ autoGraphics Graphics_create_xmdrawingarea (GuiDrawingArea drawingArea);
 
 int Graphics_getResolution (Graphics me);
 
-void Graphics_setWsViewport (Graphics me, long x1DC, long x2DC, long y1DC, long y2DC);
-void Graphics_resetWsViewport (Graphics me, long x1DC, long x2DC, long y1DC, long y2DC);
+void Graphics_setWsViewport (Graphics me, integer x1DC, integer x2DC, integer y1DC, integer y2DC);
+void Graphics_resetWsViewport (Graphics me, integer x1DC, integer x2DC, integer y1DC, integer y2DC);
 void Graphics_setWsWindow (Graphics me, double x1NDC, double x2NDC, double y1NDC, double y2NDC);
-void Graphics_inqWsViewport (Graphics me, long *x1DC, long *x2DC, long *y1DC, long *y2DC);
+void Graphics_inqWsViewport (Graphics me, integer *x1DC, integer *x2DC, integer *y1DC, integer *y2DC);
 void Graphics_inqWsWindow (Graphics me, double *x1NDC, double *x2NDC, double *y1NDC, double *y2NDC);
 void Graphics_clearWs (Graphics me);
 void Graphics_flushWs (Graphics me);
 void Graphics_updateWs (Graphics me);
 void Graphics_beginMovieFrame (Graphics me, Graphics_Colour *colour);
 void Graphics_endMovieFrame (Graphics me, double frameDuration);
-void Graphics_DCtoWC (Graphics me, long xDC, long yDC, double *xWC, double *yWC);
-void Graphics_WCtoDC (Graphics me, double xWC, double yWC, long *xDC, long *yDC);
+void Graphics_DCtoWC (Graphics me, integer xDC, integer yDC, double *xWC, double *yWC);
+void Graphics_WCtoDC (Graphics me, double xWC, double yWC, integer *xDC, integer *yDC);
 
 void Graphics_setViewport (Graphics me, double x1NDC, double x2NDC, double y1NDC, double y2NDC);
 Graphics_Viewport Graphics_insetViewport (Graphics me, double x1rel, double x2rel, double y1rel, double y2rel);
 void Graphics_resetViewport (Graphics me, Graphics_Viewport viewport);
 void Graphics_setWindow (Graphics me, double x1, double x2, double y1, double y2);
 
-void Graphics_polyline (Graphics me, long numberOfPoints, double *x, double *y);
-void Graphics_polyline_closed (Graphics me, long numberOfPoints, double *x, double *y);
+void Graphics_polyline (Graphics me, integer numberOfPoints, double *x, double *y);
+void Graphics_polyline_closed (Graphics me, integer numberOfPoints, double *x, double *y);
 void Graphics_text (Graphics me, double x, double y, Melder_1_ARG);
 void Graphics_text (Graphics me, double x, double y, Melder_2_ARGS);
 void Graphics_text (Graphics me, double x, double y, Melder_3_ARGS);
@@ -196,27 +196,27 @@ void Graphics_textRect (Graphics me, double x1, double x2, double y1, double y2,
 double Graphics_textWidth       (Graphics me, const char32 *text /* cattable */);
 double Graphics_textWidth_ps    (Graphics me, const char32 *text /* cattable */, bool useSilipaPS);
 double Graphics_textWidth_ps_mm (Graphics me, const char32 *text /* cattable */, bool useSilipaPS);
-void Graphics_fillArea (Graphics me, long numberOfPoints, double *x, double *y);
-void Graphics_cellArray (Graphics me, double **z, long ix1, long ix2, double x1, double x2,
-	long iy1, long iy2, double y1, double y2, double minimum, double maximum);
-void Graphics_cellArray_colour (Graphics me, double_rgbt **z, long ix1, long ix2, double x1, double x2,
-	long iy1, long iy2, double y1, double y2, double minimum, double maximum);
-void Graphics_cellArray8 (Graphics me, unsigned char **z, long ix1, long ix2, double x1, double x2,
-	long iy1, long iy2, double y1, double y2, unsigned char minimum, unsigned char maximum);
-void Graphics_image (Graphics me, double **z, long ix1, long ix2, double x1, double x2,
-	long iy1, long iy2, double y1, double y2, double minimum, double maximum);
-void Graphics_image_colour (Graphics me, double_rgbt **z, long ix1, long ix2, double x1, double x2,
-	long iy1, long iy2, double y1, double y2, double minimum, double maximum);
-void Graphics_image8 (Graphics me, unsigned char **z, long ix1, long ix2, double x1, double x2,
-	long iy1, long iy2, double y1, double y2, unsigned char minimum, unsigned char maximum);
+void Graphics_fillArea (Graphics me, integer numberOfPoints, double *x, double *y);
+void Graphics_cellArray (Graphics me, double **z, integer ix1, integer ix2, double x1, double x2,
+	integer iy1, integer iy2, double y1, double y2, double minimum, double maximum);
+void Graphics_cellArray_colour (Graphics me, double_rgbt **z, integer ix1, integer ix2, double x1, double x2,
+	integer iy1, integer iy2, double y1, double y2, double minimum, double maximum);
+void Graphics_cellArray8 (Graphics me, unsigned char **z, integer ix1, integer ix2, double x1, double x2,
+	integer iy1, integer iy2, double y1, double y2, unsigned char minimum, unsigned char maximum);
+void Graphics_image (Graphics me, double **z, integer ix1, integer ix2, double x1, double x2,
+	integer iy1, integer iy2, double y1, double y2, double minimum, double maximum);
+void Graphics_image_colour (Graphics me, double_rgbt **z, integer ix1, integer ix2, double x1, double x2,
+	integer iy1, integer iy2, double y1, double y2, double minimum, double maximum);
+void Graphics_image8 (Graphics me, unsigned char **z, integer ix1, integer ix2, double x1, double x2,
+	integer iy1, integer iy2, double y1, double y2, unsigned char minimum, unsigned char maximum);
 void Graphics_imageFromFile (Graphics me, const char32 *relativeFileName, double x1, double x2, double y1, double y2);
 void Graphics_line (Graphics me, double x1, double y1, double x2, double y2);
 void Graphics_rectangle (Graphics me, double x1, double x2, double y1, double y2);
 void Graphics_fillRectangle (Graphics me, double x1, double x2, double y1, double y2);
 void Graphics_roundedRectangle (Graphics me, double x1, double x2, double y1, double y2, double r_mm);
 void Graphics_fillRoundedRectangle (Graphics me, double x1, double x2, double y1, double y2, double r_mm);
-void Graphics_function (Graphics me, double y [], long ix1, long ix2, double x1, double x2);   // y [ix1..ix2]
-void Graphics_function16 (Graphics me, int16_t y [], int stagger, long ix1, long ix2, double x1, double x2);   // y [ix1..ix2] or y [ix1*2..ix2*2]
+void Graphics_function (Graphics me, double y [], integer ix1, integer ix2, double x1, double x2);   // y [ix1..ix2]
+void Graphics_function16 (Graphics me, int16_t y [], int stagger, integer ix1, integer ix2, double x1, double x2);   // y [ix1..ix2] or y [ix1*2..ix2*2]
 void Graphics_circle (Graphics me, double x, double y, double r);
 void Graphics_fillCircle (Graphics me, double x, double y, double r);
 void Graphics_circle_mm (Graphics me, double x, double y, double d);
@@ -317,14 +317,14 @@ Graphics_Colour Graphics_inqColour (Graphics me);
 enum kGraphics_colourScale Graphics_inqColourScale (Graphics me);
 
 void Graphics_contour (Graphics me, double **z,
-	long ix1, long ix2, double x1WC, double x2WC, long iy1, long iy2, double y1WC, double y2WC, double height);
+	integer ix1, integer ix2, double x1WC, double x2WC, integer iy1, integer iy2, double y1WC, double y2WC, double height);
 void Graphics_altitude (Graphics me, double **z,
-	long ix1, long ix2, double x1, double x2, long iy1, long iy2, double y1, double y2, int numberOfBorders, double borders []);
+	integer ix1, integer ix2, double x1, double x2, integer iy1, integer iy2, double y1, double y2, int numberOfBorders, double borders []);
 void Graphics_grey (Graphics me, double **z,
-	long ix1, long ix2, double x1, double x2, long iy1, long iy2, double y1, double y2, int numberOfBorders, double borders []);
+	integer ix1, integer ix2, double x1, double x2, integer iy1, integer iy2, double y1, double y2, int numberOfBorders, double borders []);
 #define Graphics_gray Graphics_grey
-void Graphics_surface (Graphics me, double **z, long ix1, long ix2, double x1, double x2,
-	long iy1, long iy2, double y1, double y2, double minimum, double maximum, double elevation, double azimuth);
+void Graphics_surface (Graphics me, double **z, integer ix1, integer ix2, double x1, double x2,
+	integer iy1, integer iy2, double y1, double y2, double minimum, double maximum, double elevation, double azimuth);
 
 void Graphics_setInner (Graphics me);
 void Graphics_unsetInner (Graphics me);
diff --git a/sys/GraphicsP.h b/sys/GraphicsP.h
index 8750175..0be94ef 100644
--- a/sys/GraphicsP.h
+++ b/sys/GraphicsP.h
@@ -111,9 +111,9 @@ Thing_define (GraphicsScreen, Graphics) {
 
 	void v_destroy () noexcept
 		override;
-	void v_polyline (long numberOfPoints, double *xyDC, bool close)
+	void v_polyline (integer numberOfPoints, double *xyDC, bool close)
 		override;
-	void v_fillArea (long numberOfPoints, double *xyDC)
+	void v_fillArea (integer numberOfPoints, double *xyDC)
 		override;
 	void v_rectangle (double x1DC, double x2DC, double y1DC, double y2DC)
 		override;
@@ -161,9 +161,9 @@ Thing_define (GraphicsPostscript, Graphics) {
 
 	void v_destroy () noexcept
 		override;
-	void v_polyline (long numberOfPoints, double *xyDC, bool close)
+	void v_polyline (integer numberOfPoints, double *xyDC, bool close)
 		override;
-	void v_fillArea (long numberOfPoints, double *xyDC)
+	void v_fillArea (integer numberOfPoints, double *xyDC)
 		override;
 	void v_rectangle (double x1DC, double x2DC, double y1DC, double y2DC)
 		override;
@@ -185,10 +185,10 @@ Thing_define (GraphicsPostscript, Graphics) {
 
 /* Opcodes for recording. */
 
-double * _Graphics_check (Graphics me, long number);
+double * _Graphics_check (Graphics me, integer number);
 #define put(f)  * ++ p = (double) (f)
 #define op(opcode,number)  double *p = _Graphics_check (me, number); if (! p) return; put (opcode); put (number)
-#define mput(n,a)  { double *f = a; for (long l = 0; l < n; l ++) put (f [l]); }
+#define mput(n,a)  { double *f = a; for (integer l = 0; l < n; l ++) put (f [l]); }
 #define sput(s,l)  { put (l); strcpy ((char *) (p + 1), s); p += l; }
 
 /* When adding opcodes in the following list, add them at the end. */
@@ -214,7 +214,7 @@ enum opcode { SET_VIEWPORT = 101, SET_INNER, UNSET_INNER, SET_WINDOW,
 };
 
 void _GraphicsScreen_text_init (GraphicsScreen me);
-void _Graphics_fillRectangle (Graphics me, long x1DC, long x2DC, long y1DC, long y2DC);
+void _Graphics_fillRectangle (Graphics me, integer x1DC, integer x2DC, integer y1DC, integer y2DC);
 void _Graphics_setColour (Graphics me, Graphics_Colour colour);
 void _Graphics_setGrey (Graphics me, double grey);
 void _Graphics_colour_init (Graphics me);
diff --git a/sys/GraphicsScreen.cpp b/sys/GraphicsScreen.cpp
index fb6c233..7a5d417 100644
--- a/sys/GraphicsScreen.cpp
+++ b/sys/GraphicsScreen.cpp
@@ -128,8 +128,8 @@ void structGraphicsScreen :: v_destroy () noexcept {
 			trace (U"copying the device-independent bits to the savable bitmap.");
 
 			/*
-			for (long irow = 1; irow <= height; irow ++) {
-				for (long icol = 1; icol <= width; icol ++) {
+			for (integer irow = 1; irow <= height; irow ++) {
+				for (integer icol = 1; icol <= width; icol ++) {
 					unsigned char blue = *bits ++, green = *bits ++, red = *bits ++, alpha = 255 - *bits ++;
 					Gdiplus::Color gdiplusColour (alpha, red, green, blue);
 					gdiplusBitmap. SetPixel (icol - 1, height - irow, gdiplusColour);
@@ -633,8 +633,8 @@ autoGraphics Graphics_create_pngfile (MelderFile file, int resolution,
 		SelectPen (my d_gdiGraphicsContext, GetStockPen (BLACK_PEN));
 		SelectBrush (my d_gdiGraphicsContext, GetStockBrush (NULL_BRUSH));
 	#elif quartz
-		long width = (x2inches - x1inches) * resolution, height = (y2inches - y1inches) * resolution;
-		long stride = width * 4;
+		integer width = (x2inches - x1inches) * resolution, height = (y2inches - y1inches) * resolution;
+		integer stride = width * 4;
 		stride = (stride + 15) & ~15;   // CommonCode/AppDrawing.c: "a multiple of 16 bytes, for best performance"
 		my d_bits = Melder_malloc (uint8_t, stride * height);
 		static CGColorSpaceRef colourSpace = nullptr;
diff --git a/sys/Graphics_altitude.cpp b/sys/Graphics_altitude.cpp
index d33ded8..0f60930 100644
--- a/sys/Graphics_altitude.cpp
+++ b/sys/Graphics_altitude.cpp
@@ -1,6 +1,6 @@
 /* Graphics_altitude.cpp
  *
- * Copyright (C) 1992-2011,2015,2016 Paul Boersma
+ * Copyright (C) 1992-2011,2015,2016,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
 
 #include "Graphics.h"
 
-static int empty (double **data, int **right, int **below, long row1, long col1, double height, int row, int col, int ori) {
+static int empty (double **data, int **right, int **below, integer row1, integer col1, double height, int row, int col, int ori) {
 	if (ori == 3) { row ++; ori = 1; } else if (ori == 2) { col ++; ori = 4; }
 	if (ori == 1)
 		return (data [row] [col] < height) != (data [row] [col + 1] < height) &&
@@ -31,8 +31,8 @@ static int empty (double **data, int **right, int **below, long row1, long col1,
 #define MAXALTSIDE  50
 #define MAXALTPATH  (2 * MAXALTSIDE * (MAXALTSIDE - 1) + 2)
 
-static long numberOfPoints;
-static long row1, row2, col1, col2;
+static integer numberOfPoints;
+static integer row1, row2, col1, col2;
 static int **right, **below;
 static double *x, *y;
 static int closed;
@@ -123,8 +123,8 @@ static void smallAlt (Graphics graphics, double **z, double height) {
 }
 
 void Graphics_contour (Graphics me, double **z,
-	long ix1, long ix2, double x1WC, double x2WC,
-	long iy1, long iy2, double y1WC, double y2WC,
+	integer ix1, integer ix2, double x1WC, double x2WC,
+	integer iy1, integer iy2, double y1WC, double y2WC,
 	double height)
 {
 	if (ix2 <= ix1 || iy2 <= iy1) return;
@@ -148,8 +148,8 @@ void Graphics_contour (Graphics me, double **z,
 }
 
 void Graphics_altitude (Graphics me, double **z,
-	long ix1, long ix2, double x1WC, double x2WC,
-	long iy1, long iy2, double y1WC, double y2WC,
+	integer ix1, integer ix2, double x1WC, double x2WC,
+	integer iy1, integer iy2, double y1WC, double y2WC,
 	int numberOfBorders, double borders [])
 {
 	int iborder;
diff --git a/sys/Graphics_colour.cpp b/sys/Graphics_colour.cpp
index 79b50f7..c6b1ab5 100644
--- a/sys/Graphics_colour.cpp
+++ b/sys/Graphics_colour.cpp
@@ -147,7 +147,7 @@ void Graphics_setGrey (Graphics me, double grey) {
 	if (my recording) { op (SET_GREY, 1); put (grey); }
 }
 
-static void highlight (Graphics graphics, long x1DC, long x2DC, long y1DC, long y2DC, int direction) {
+static void highlight (Graphics graphics, integer x1DC, integer x2DC, integer y1DC, integer y2DC, int direction) {
 	if (graphics -> screen) {
 		GraphicsScreen me = static_cast <GraphicsScreen> (graphics);
 		#if cairo
@@ -256,8 +256,8 @@ void Graphics_unhighlight (Graphics me, double x1WC, double x2WC, double y1WC, d
 		{ op (UNHIGHLIGHT, 4); put (x1WC); put (x2WC); put (y1WC); put (y2WC); }
 }
 
-static void highlight2 (Graphics graphics, long x1DC, long x2DC, long y1DC, long y2DC,
-	long x1DC_inner, long x2DC_inner, long y1DC_inner, long y2DC_inner, int direction)
+static void highlight2 (Graphics graphics, integer x1DC, integer x2DC, integer y1DC, integer y2DC,
+	integer x1DC_inner, integer x2DC_inner, integer y1DC_inner, integer y2DC_inner, int direction)
 {
 	if (graphics -> screen) {
 		GraphicsScreen me = static_cast <GraphicsScreen> (graphics);
diff --git a/sys/Graphics_grey.cpp b/sys/Graphics_grey.cpp
index 7b26af6..408c7a0 100644
--- a/sys/Graphics_grey.cpp
+++ b/sys/Graphics_grey.cpp
@@ -79,7 +79,7 @@ static int numberOfClosedContours;
 static ClosedContour *closedContours;
 
 static int numberOfPoints;
-static long row1, row2, col1, col2;
+static integer row1, row2, col1, col2;
 static int iBorder, numberOfBorders;
 static int **right, **below;
 static double **data, *border, *x, *y;
@@ -447,8 +447,8 @@ static void smallGrey () {
 }
 
 void Graphics_grey (Graphics me, double **z,
-	long ix1, long ix2, double x1WC, double x2WC,
-	long iy1, long iy2, double y1WC, double y2WC,
+	integer ix1, integer ix2, double x1WC, double x2WC,
+	integer iy1, integer iy2, double y1WC, double y2WC,
 	int _numberOfBorders, double borders [])
 {
 	if (ix2 <= ix1 || iy2 <= iy1) return;
diff --git a/sys/Graphics_image.cpp b/sys/Graphics_image.cpp
index 94c7269..d785dbe 100644
--- a/sys/Graphics_image.cpp
+++ b/sys/Graphics_image.cpp
@@ -36,14 +36,14 @@
 #define wdy(y)  ((y) * my scaleY + my deltaY)
 
 static void _GraphicsScreen_cellArrayOrImage (GraphicsScreen me, double **z_float, double_rgbt **z_rgbt, unsigned char **z_byte,
-	long ix1, long ix2, long x1DC, long x2DC,
-	long iy1, long iy2, long y1DC, long y2DC,
+	integer ix1, integer ix2, integer x1DC, integer x2DC,
+	integer iy1, integer iy2, integer y1DC, integer y2DC,
 	double minimum, double maximum,
-	long clipx1, long clipx2, long clipy1, long clipy2, int interpolate)
+	integer clipx1, integer clipx2, integer clipy1, integer clipy2, int interpolate)
 {
-	/*long t=clock();*/
-	long nx = ix2 - ix1 + 1;   /* The number of cells along the horizontal axis. */
-	long ny = iy2 - iy1 + 1;   /* The number of cells along the vertical axis. */
+	/*integer t=clock();*/
+	integer nx = ix2 - ix1 + 1;   /* The number of cells along the horizontal axis. */
+	integer ny = iy2 - iy1 + 1;   /* The number of cells along the vertical axis. */
 	double dx = (double) (x2DC - x1DC) / (double) nx;   /* Horizontal pixels per cell. Positive. */
 	double dy = (double) (y2DC - y1DC) / (double) ny;   /* Vertical pixels per cell. Negative. */
 	double scale = 255.0 / (maximum - minimum), offset = 255.0 + minimum * scale;
@@ -65,7 +65,7 @@ static void _GraphicsScreen_cellArrayOrImage (GraphicsScreen me, double **z_floa
 		try {
 			/*unsigned int cellWidth = (unsigned int) dx + 1;*/
 			unsigned int cellHeight = (unsigned int) (- (int) dy) + 1;
-			long ix, iy;
+			integer ix, iy;
 			#if cairo
 				cairo_pattern_t *grey [256];
 				for (int igrey = 0; igrey < sizeof (grey) / sizeof (*grey); igrey ++) {
@@ -83,11 +83,11 @@ static void _GraphicsScreen_cellArrayOrImage (GraphicsScreen me, double **z_floa
 				CGContextSetAlpha (my d_macGraphicsContext, 1.0);
 				CGContextSetBlendMode (my d_macGraphicsContext, kCGBlendModeNormal);
 			#endif
-			autoNUMvector <long> lefts (ix1, ix2 + 1);
+			autoNUMvector <integer> lefts (ix1, ix2 + 1);
 			for (ix = ix1; ix <= ix2 + 1; ix ++)
-				lefts [ix] = x1DC + (long) ((ix - ix1) * dx);
+				lefts [ix] = x1DC + (integer) ((ix - ix1) * dx);
 			for (iy = iy1; iy <= iy2; iy ++) {
-				long bottom = y1DC + (long) ((iy - iy1) * dy), top = bottom - cellHeight;
+				integer bottom = y1DC + (integer) ((iy - iy1) * dy), top = bottom - cellHeight;
 				if (top > clipy1 || bottom < clipy2) continue;
 				if (top < clipy2) top = clipy2;
 				if (bottom > clipy1) bottom = clipy1;
@@ -95,7 +95,7 @@ static void _GraphicsScreen_cellArrayOrImage (GraphicsScreen me, double **z_floa
 					rect. bottom = bottom; rect. top = top;
 				#endif
 				for (ix = ix1; ix <= ix2; ix ++) {
-					long left = lefts [ix], right = lefts [ix + 1];
+					integer left = lefts [ix], right = lefts [ix + 1];
 					if (right < clipx1 || left > clipx2) continue;
 					if (left < clipx1) left = clipx1;
 					if (right > clipx2) right = clipx2;
@@ -117,12 +117,12 @@ static void _GraphicsScreen_cellArrayOrImage (GraphicsScreen me, double **z_floa
 						#endif
 					} else {
 						#if cairo
-							long value = offset - scale * ( z_float ? z_float [iy] [ix] : z_byte [iy] [ix] );
+							integer value = offset - scale * ( z_float ? z_float [iy] [ix] : z_byte [iy] [ix] );
 							cairo_set_source (my d_cairoGraphicsContext, grey [value <= 0 ? 0 : value >= sizeof (grey) / sizeof (*grey) ? sizeof (grey) / sizeof (*grey) : value]);
 							cairo_rectangle (my d_cairoGraphicsContext, left, top, right - left, bottom - top);
 							cairo_fill (my d_cairoGraphicsContext);
 						#elif gdi
-							long value = offset - scale * ( z_float ? z_float [iy] [ix] : z_byte [iy] [ix] );
+							integer value = offset - scale * ( z_float ? z_float [iy] [ix] : z_byte [iy] [ix] );
 							rect. left = left; rect. right = right;
 							FillRect (my d_gdiGraphicsContext, & rect, greyBrush [value <= 0 ? 0 : value >= 255 ? 255 : value]);
 						#elif quartz
@@ -144,14 +144,14 @@ static void _GraphicsScreen_cellArrayOrImage (GraphicsScreen me, double **z_floa
 			#endif
 		} catch (MelderError) { }
 	} else {
-		long xDC, yDC;
-		long undersampling = 1;
+		integer xDC, yDC;
+		integer undersampling = 1;
 		/*
 		 * Prepare for off-screen bitmap drawing.
 		 */
 		#if cairo
-			long arrayWidth = clipx2 - clipx1;
-			long arrayHeight = clipy1 - clipy2;
+			integer arrayWidth = clipx2 - clipx1;
+			integer arrayHeight = clipy1 - clipy2;
 			trace (U"arrayWidth ", arrayWidth, U", arrayHeight ", arrayHeight);
 			cairo_surface_t *sfc = cairo_image_surface_create (CAIRO_FORMAT_RGB24, arrayWidth, arrayHeight);
 			unsigned char *bits = cairo_image_surface_get_data (sfc);
@@ -166,13 +166,13 @@ static void _GraphicsScreen_cellArrayOrImage (GraphicsScreen me, double **z_floa
 			for (int igrey = 0; igrey < sizeof (grey) / sizeof (*grey); igrey++)
 				grey [igrey] = 255 - (unsigned char) (igrey * 255.0 / (sizeof (grey) / sizeof (*grey) - 1));
 		#elif gdi
-			long bitmapWidth = clipx2 - clipx1, bitmapHeight = clipy1 - clipy2;
+			integer bitmapWidth = clipx2 - clipx1, bitmapHeight = clipy1 - clipy2;
 			int igrey;
 			/*
 			 * Create a device-independent bitmap, 32 bits deep.
 			 */
 			struct { BITMAPINFOHEADER header; } bitmapInfo;
-			long scanLineLength = bitmapWidth * 4;   // for 24 bits: (bitmapWidth * 3 + 3) & ~3L;
+			integer scanLineLength = bitmapWidth * 4;   // for 24 bits: (bitmapWidth * 3 + 3) & ~3L;
 			HBITMAP bitmap;
 			unsigned char *bits;   // a pointer to memory allocated by VirtualAlloc or by CreateDIBSection ()
 			bitmapInfo. header.biSize = sizeof (BITMAPINFOHEADER);
@@ -189,9 +189,9 @@ static void _GraphicsScreen_cellArrayOrImage (GraphicsScreen me, double **z_floa
 			bitmap = CreateDIBSection (my d_gdiGraphicsContext /* ignored */, (CONST BITMAPINFO *) & bitmapInfo,
 				DIB_RGB_COLORS, (VOID **) & bits, nullptr, 0);
 		#elif quartz
-			long bytesPerRow = (clipx2 - clipx1) * 4;
+			integer bytesPerRow = (clipx2 - clipx1) * 4;
 			Melder_assert (bytesPerRow > 0);
-			long numberOfRows = clipy1 - clipy2;
+			integer numberOfRows = clipy1 - clipy2;
 			Melder_assert (numberOfRows > 0);
 			unsigned char *imageData = Melder_malloc_f (unsigned char, bytesPerRow * numberOfRows);
 		#endif
@@ -266,8 +266,8 @@ static void _GraphicsScreen_cellArrayOrImage (GraphicsScreen me, double **z_floa
 		#endif
 		if (interpolate) {
 			try {
-				autoNUMvector <long> ileft (clipx1, clipx2);
-				autoNUMvector <long> iright (clipx1, clipx2);
+				autoNUMvector <integer> ileft (clipx1, clipx2);
+				autoNUMvector <integer> iright (clipx1, clipx2);
 				autoNUMvector <double> rightWeight (clipx1, clipx2);
 				autoNUMvector <double> leftWeight (clipx1, clipx2);
 				for (xDC = clipx1; xDC < clipx2; xDC += undersampling) {
@@ -279,7 +279,7 @@ static void _GraphicsScreen_cellArrayOrImage (GraphicsScreen me, double **z_floa
 				}
 				for (yDC = clipy2; yDC < clipy1; yDC += undersampling) {
 					double iy_real = iy2 + 0.5 - ((double) ny * (yDC - y2DC)) / (y1DC - y2DC);
-					long itop = ceil (iy_real), ibottom = itop - 1;
+					integer itop = ceil (iy_real), ibottom = itop - 1;
 					double bottomWeight = itop - iy_real, topWeight = 1.0 - bottomWeight;
 					unsigned char *pixelAddress = ROW_START_ADDRESS;
 					if (itop > iy2) itop = iy2;
@@ -347,11 +347,11 @@ static void _GraphicsScreen_cellArrayOrImage (GraphicsScreen me, double **z_floa
 			} catch (MelderError) { Melder_clearError (); }
 		} else {
 			try {
-				autoNUMvector <long> ix (clipx1, clipx2);
+				autoNUMvector <integer> ix (clipx1, clipx2);
 				for (xDC = clipx1; xDC < clipx2; xDC += undersampling)
 					ix [xDC] = floor (ix1 + (nx * (xDC - x1DC)) / (x2DC - x1DC));
 				for (yDC = clipy2; yDC < clipy1; yDC += undersampling) {
-					long iy = ceil (iy2 - (ny * (yDC - y2DC)) / (y1DC - y2DC));
+					integer iy = ceil (iy2 - (ny * (yDC - y2DC)) / (y1DC - y2DC));
 					unsigned char *pixelAddress = ROW_START_ADDRESS;
 					Melder_assert (iy >= iy1 && iy <= iy2);
 					if (z_float) {
@@ -447,13 +447,13 @@ static void _GraphicsScreen_cellArrayOrImage (GraphicsScreen me, double **z_floa
 }
 
 static void _GraphicsPostscript_cellArrayOrImage (GraphicsPostscript me, double **z_float, double_rgbt **z_rgbt, unsigned char **z_byte,
-	long ix1, long ix2, long x1DC, long x2DC,
-	long iy1, long iy2, long y1DC, long y2DC,
+	integer ix1, integer ix2, integer x1DC, integer x2DC,
+	integer iy1, integer iy2, integer y1DC, integer y2DC,
 	double minimum, double maximum,
-	long clipx1, long clipx2, long clipy1, long clipy2, int interpolate)
+	integer clipx1, integer clipx2, integer clipy1, integer clipy2, int interpolate)
 {
-	long interpolateX = 1, interpolateY = 1;
-	long nx = ix2 - ix1 + 1, ny = iy2 - iy1 + 1, filling = 0;
+	integer interpolateX = 1, interpolateY = 1;
+	integer nx = ix2 - ix1 + 1, ny = iy2 - iy1 + 1, filling = 0;
 	double scale = ( my photocopyable ? 200.1f : 255.1f ) / (maximum - minimum);
 	double offset = 255.1f + minimum * scale;
 	int minimalGrey = my photocopyable ? 55 : 0;
@@ -479,8 +479,8 @@ static void _GraphicsPostscript_cellArrayOrImage (GraphicsPostscript me, double
 			nx, nx, ny, nx, ny);
 	} else if (interpolateX > 1 && interpolateY > 1) {
 		/* Interpolate both horizontally and vertically. */
-		long nx_new = nx * interpolateX;
-		long ny_new = ny * interpolateY;
+		integer nx_new = nx * interpolateX;
+		integer ny_new = ny * interpolateY;
 		/* Interpolation between rows requires us to remember two original rows: */
 		my d_printf (my d_file, "/lorow %ld string def /hirow %ld string def\n", nx, nx);
 		/* New rows (scanlines) are longer: */
@@ -532,7 +532,7 @@ static void _GraphicsPostscript_cellArrayOrImage (GraphicsPostscript me, double
 			"/irow irow 1 add def scanline } image\n");
 	} else if (interpolateX > 1) {
 		/* Interpolate horizontally only. */
-		long nx_new = nx * interpolateX;
+		integer nx_new = nx * interpolateX;
 		/* Remember one original row: */
 		my d_printf (my d_file, "/row %ld string def\n", nx, nx);
 		/* New rows (scanlines) are longer: */
@@ -564,7 +564,7 @@ static void _GraphicsPostscript_cellArrayOrImage (GraphicsPostscript me, double
 			"scanline } image\n");
 	} else {
 		/* Interpolate vertically only. */
-		long ny_new = ny * interpolateY;
+		integer ny_new = ny * interpolateY;
 		/* Interpolation between rows requires us to remember two original rows: */
 		my d_printf (my d_file, "/lorow %ld string def /hirow %ld string def\n", nx, nx);
 		/* New rows (scanlines) are equally long: */
@@ -606,7 +606,7 @@ static void _GraphicsPostscript_cellArrayOrImage (GraphicsPostscript me, double
 			"} for\n"
 			"/irow irow 1 add def scanline } image\n");
 	}
-	for (long iy = iy1; iy <= iy2; iy ++) for (long ix = ix1; ix <= ix2; ix ++) {
+	for (integer iy = iy1; iy <= iy2; iy ++) for (integer ix = ix1; ix <= ix2; ix ++) {
 		int value = (int) (offset - scale * ( z_float ? z_float [iy] [ix] : z_byte [iy] [ix] ));
 		my d_printf (my d_file, "%.2x", value <= minimalGrey ? minimalGrey : value >= 255 ? 255 : value);
 		if (++ filling == 39) { my d_printf (my d_file, "\n"); filling = 0; }
@@ -616,9 +616,9 @@ static void _GraphicsPostscript_cellArrayOrImage (GraphicsPostscript me, double
 }
 
 static void _cellArrayOrImage (Graphics me, double **z_float, double_rgbt **z_rgbt, unsigned char **z_byte,
-	long ix1, long ix2, long x1DC, long x2DC,
-	long iy1, long iy2, long y1DC, long y2DC, double minimum, double maximum,
-	long clipx1, long clipx2, long clipy1, long clipy2, int interpolate)
+	integer ix1, integer ix2, integer x1DC, integer x2DC,
+	integer iy1, integer iy2, integer y1DC, integer y2DC, double minimum, double maximum,
+	integer clipx1, integer clipx2, integer clipy1, integer clipy2, int interpolate)
 {
 	if (my screen) {
 		_GraphicsScreen_cellArrayOrImage (static_cast <GraphicsScreen> (me), z_float, z_rgbt, z_byte, ix1, ix2, x1DC, x2DC, iy1, iy2, y1DC, y2DC,
@@ -631,8 +631,8 @@ static void _cellArrayOrImage (Graphics me, double **z_float, double_rgbt **z_rg
 }
 
 static void cellArrayOrImage (Graphics me, double **z_float, double_rgbt **z_rgbt, unsigned char **z_byte,
-	long ix1, long ix2, double x1WC, double x2WC,
-	long iy1, long iy2, double y1WC, double y2WC,
+	integer ix1, integer ix2, double x1WC, double x2WC,
+	integer iy1, integer iy2, double y1WC, double y2WC,
 	double minimum, double maximum, int interpolate)
 {
 	if (ix2 < ix1 || iy2 < iy1 || minimum == maximum) return;
@@ -641,22 +641,22 @@ static void cellArrayOrImage (Graphics me, double **z_float, double_rgbt **z_rgb
 		iy1, iy2, wdy (y1WC), wdy (y2WC), minimum, maximum,
 		wdx (my d_x1WC), wdx (my d_x2WC), wdy (my d_y1WC), wdy (my d_y2WC), interpolate);
 	if (my recording) {
-		long nrow = iy2 - iy1 + 1, ncol = ix2 - ix1 + 1;
+		integer nrow = iy2 - iy1 + 1, ncol = ix2 - ix1 + 1;
 		op (interpolate ? ( z_float ? IMAGE      : z_rgbt ? IMAGE_COLOUR      : IMAGE8 ) :
 		                  ( z_float ? CELL_ARRAY : z_rgbt ? CELL_ARRAY_COLOUR : CELL_ARRAY8 ),
 		    8 + nrow * ncol * ( z_rgbt ? 4 : 1 ));
 		put (x1WC); put (x2WC); put (y1WC); put (y2WC);
 		put (minimum); put (maximum);
 		put (nrow); put (ncol);
-		for (long iy = iy1; iy <= iy2; iy ++) {
+		for (integer iy = iy1; iy <= iy2; iy ++) {
 			if (z_float) {
 				double *row = z_float [iy];
-				for (long ix = ix1; ix <= ix2; ix ++) {
+				for (integer ix = ix1; ix <= ix2; ix ++) {
 					put (row [ix]);
 				}
 			} else if (z_rgbt) {
 				double_rgbt *row = z_rgbt [iy];
-				for (long ix = ix1; ix <= ix2; ix ++) {
+				for (integer ix = ix1; ix <= ix2; ix ++) {
 					put (row [ix]. red);
 					put (row [ix]. green);
 					put (row [ix]. blue);
@@ -664,7 +664,7 @@ static void cellArrayOrImage (Graphics me, double **z_float, double_rgbt **z_rgb
 				}
 			} else {
 				unsigned char *row = z_byte [iy];
-				for (long ix = ix1; ix <= ix2; ix ++) {
+				for (integer ix = ix1; ix <= ix2; ix ++) {
 					put (row [ix]);
 				}
 			}
@@ -672,33 +672,33 @@ static void cellArrayOrImage (Graphics me, double **z_float, double_rgbt **z_rgb
 	}
 }
 
-void Graphics_cellArray (Graphics me, double **z, long ix1, long ix2, double x1WC, double x2WC,
-	long iy1, long iy2, double y1WC, double y2WC, double minimum, double maximum)
+void Graphics_cellArray (Graphics me, double **z, integer ix1, integer ix2, double x1WC, double x2WC,
+	integer iy1, integer iy2, double y1WC, double y2WC, double minimum, double maximum)
 { cellArrayOrImage (me, z, nullptr, nullptr, ix1, ix2, x1WC, x2WC, iy1, iy2, y1WC, y2WC, minimum, maximum, false); }
 
-void Graphics_cellArray_colour (Graphics me, double_rgbt **z, long ix1, long ix2, double x1WC, double x2WC,
-	long iy1, long iy2, double y1WC, double y2WC, double minimum, double maximum)
+void Graphics_cellArray_colour (Graphics me, double_rgbt **z, integer ix1, integer ix2, double x1WC, double x2WC,
+	integer iy1, integer iy2, double y1WC, double y2WC, double minimum, double maximum)
 { cellArrayOrImage (me, nullptr, z, nullptr, ix1, ix2, x1WC, x2WC, iy1, iy2, y1WC, y2WC, minimum, maximum, false); }
 
-void Graphics_cellArray8 (Graphics me, unsigned char **z, long ix1, long ix2, double x1WC, double x2WC,
-	long iy1, long iy2, double y1WC, double y2WC, unsigned char minimum, unsigned char maximum)
+void Graphics_cellArray8 (Graphics me, unsigned char **z, integer ix1, integer ix2, double x1WC, double x2WC,
+	integer iy1, integer iy2, double y1WC, double y2WC, unsigned char minimum, unsigned char maximum)
 { cellArrayOrImage (me, nullptr, nullptr, z, ix1, ix2, x1WC, x2WC, iy1, iy2, y1WC, y2WC, minimum, maximum, false); }
 
-void Graphics_image (Graphics me, double **z, long ix1, long ix2, double x1WC, double x2WC,
-	long iy1, long iy2, double y1WC, double y2WC, double minimum, double maximum)
+void Graphics_image (Graphics me, double **z, integer ix1, integer ix2, double x1WC, double x2WC,
+	integer iy1, integer iy2, double y1WC, double y2WC, double minimum, double maximum)
 { cellArrayOrImage (me, z, nullptr, nullptr, ix1, ix2, x1WC, x2WC, iy1, iy2, y1WC, y2WC, minimum, maximum, true); }
 
-void Graphics_image_colour (Graphics me, double_rgbt **z, long ix1, long ix2, double x1WC, double x2WC,
-	long iy1, long iy2, double y1WC, double y2WC, double minimum, double maximum)
+void Graphics_image_colour (Graphics me, double_rgbt **z, integer ix1, integer ix2, double x1WC, double x2WC,
+	integer iy1, integer iy2, double y1WC, double y2WC, double minimum, double maximum)
 { cellArrayOrImage (me, nullptr, z, nullptr, ix1, ix2, x1WC, x2WC, iy1, iy2, y1WC, y2WC, minimum, maximum, true); }
 
-void Graphics_image8 (Graphics me, unsigned char **z, long ix1, long ix2, double x1WC, double x2WC,
-	long iy1, long iy2, double y1WC, double y2WC, unsigned char minimum, unsigned char maximum)
+void Graphics_image8 (Graphics me, unsigned char **z, integer ix1, integer ix2, double x1WC, double x2WC,
+	integer iy1, integer iy2, double y1WC, double y2WC, unsigned char minimum, unsigned char maximum)
 { cellArrayOrImage (me, nullptr, nullptr, z, ix1, ix2, x1WC, x2WC, iy1, iy2, y1WC, y2WC, minimum, maximum, true); }
 
 static void _GraphicsScreen_imageFromFile (GraphicsScreen me, const char32 *relativeFileName, double x1, double x2, double y1, double y2) {
-	long x1DC = wdx (x1), x2DC = wdx (x2), y1DC = wdy (y1), y2DC = wdy (y2);
-	long width = x2DC - x1DC, height = my yIsZeroAtTheTop ? y1DC - y2DC : y2DC - y1DC;
+	integer x1DC = wdx (x1), x2DC = wdx (x2), y1DC = wdy (y1), y2DC = wdy (y2);
+	integer width = x2DC - x1DC, height = my yIsZeroAtTheTop ? y1DC - y2DC : y2DC - y1DC;
 	#if 0
 		structMelderFile file { };
 		Melder_relativePathToFile (relativeFileName, & file);
@@ -715,8 +715,8 @@ static void _GraphicsScreen_imageFromFile (GraphicsScreen me, const char32 *rela
 				y2DC -= height / 2, y1DC = y2DC + height;
 			}
 			autoNUMmatrix <double_rgbt> z (1, photo -> ny, 1, photo -> nx);
-			for (long iy = 1; iy <= photo -> ny; iy ++) {
-				for (long ix = 1; ix <= photo -> nx; ix ++) {
+			for (integer iy = 1; iy <= photo -> ny; iy ++) {
+				for (integer ix = 1; ix <= photo -> nx; ix ++) {
 					z [iy] [ix]. red          = photo -> d_red          -> z [iy] [ix];
 					z [iy] [ix]. green        = photo -> d_green        -> z [iy] [ix];
 					z [iy] [ix]. blue         = photo -> d_blue         -> z [iy] [ix];
diff --git a/sys/Graphics_linesAndAreas.cpp b/sys/Graphics_linesAndAreas.cpp
index 5f0a7a3..a1c0052 100644
--- a/sys/Graphics_linesAndAreas.cpp
+++ b/sys/Graphics_linesAndAreas.cpp
@@ -28,13 +28,13 @@
 static void psPrepareLine (GraphicsPostscript me) {
 	double lineWidth_pixels = LINE_WIDTH_IN_PIXELS (me);
 	if (my lineType == Graphics_DOTTED)
-		my d_printf (my d_file, "[%ld %ld] 0 setdash\n", (long) (my resolution / 100), (long) (my resolution / 75 + lineWidth_pixels));
+		my d_printf (my d_file, "[%ld %ld] 0 setdash\n", (long_not_integer) (my resolution / 100), (long) (my resolution / 75 + lineWidth_pixels));
 	else if (my lineType == Graphics_DASHED)
-		my d_printf (my d_file, "[%ld %ld] 0 setdash\n", (long) (my resolution / 25), (long) (my resolution / 50 + lineWidth_pixels));
+		my d_printf (my d_file, "[%ld %ld] 0 setdash\n", (long_not_integer) (my resolution / 25), (long) (my resolution / 50 + lineWidth_pixels));
 	else if (my lineType == Graphics_DASHED_DOTTED)
 		my d_printf (my d_file, "[%ld %ld %ld %ld] 0 setdash\n",
-			(long) (my resolution / 100), (long) (my resolution / 60 + lineWidth_pixels),
-			(long) (my resolution / 25), (long) (my resolution / 60 + lineWidth_pixels));
+			(long_not_integer) (my resolution / 100), (long_not_integer) (my resolution / 60 + lineWidth_pixels),
+			(long_not_integer) (my resolution / 25), (long_not_integer) (my resolution / 60 + lineWidth_pixels));
 	if (my lineWidth != 1.0)
 		my d_printf (my d_file, "%g setlinewidth\n", lineWidth_pixels);
 }
@@ -159,12 +159,12 @@ static void psRevertLine (GraphicsPostscript me) {
 
 /* First level. */
 
-void structGraphicsScreen :: v_polyline (long numberOfPoints, double *xyDC, bool close) {
+void structGraphicsScreen :: v_polyline (integer numberOfPoints, double *xyDC, bool close) {
 	#if cairo
 		if (duringXor) {
 			#if ALLOW_GDK_DRAWING
 				gdkPrepareLine (this);
-				for (long i = 0; i < numberOfPoints - 1; i ++) {
+				for (integer i = 0; i < numberOfPoints - 1; i ++) {
 					gdk_draw_line (our d_window, our d_gdkGraphicsContext,
 						xyDC [i + i], xyDC [i + i + 1], xyDC [i + i + 2], xyDC [i + i + 3]);
 				}
@@ -176,7 +176,7 @@ void structGraphicsScreen :: v_polyline (long numberOfPoints, double *xyDC, bool
 			cairoPrepareLine (this);
 			// cairo_new_path (d_cairoGraphicsContext); // move_to() automatically creates a new path
 			cairo_move_to (our d_cairoGraphicsContext, xyDC [0], xyDC [1]);
-			for (long i = 1; i < numberOfPoints; i ++) {
+			for (integer i = 1; i < numberOfPoints; i ++) {
 				cairo_line_to (our d_cairoGraphicsContext, xyDC [i + i], xyDC [i + i + 1]);
 			}
 			if (close) cairo_close_path (our d_cairoGraphicsContext);
@@ -188,7 +188,7 @@ void structGraphicsScreen :: v_polyline (long numberOfPoints, double *xyDC, bool
 			Gdiplus::Graphics dcplus (our d_gdiGraphicsContext);
 			Gdiplus::Point *points = Melder_malloc (Gdiplus::Point, numberOfPoints + close);
 			if (points) {
-				for (long i = 0; i < numberOfPoints; i ++) {
+				for (integer i = 0; i < numberOfPoints; i ++) {
 					points [i]. X = *xyDC, xyDC ++;
 					points [i]. Y = *xyDC, xyDC ++;
 				}
@@ -217,7 +217,7 @@ void structGraphicsScreen :: v_polyline (long numberOfPoints, double *xyDC, bool
 			winPrepareLine (this);
 			POINT *points = Melder_malloc (POINT, numberOfPoints + close);
 			if (points) {
-				for (long i = 0; i < numberOfPoints; i ++) {
+				for (integer i = 0; i < numberOfPoints; i ++) {
 					points [i]. x = *xyDC, xyDC ++;
 					points [i]. y = *xyDC, xyDC ++;
 				}
@@ -225,12 +225,12 @@ void structGraphicsScreen :: v_polyline (long numberOfPoints, double *xyDC, bool
 					points [numberOfPoints] = points [0];
 				Polyline (our d_gdiGraphicsContext, points, numberOfPoints + close);
 				if (our d_fatNonSolid) {
-					for (long i = 0; i < numberOfPoints; i ++)
+					for (integer i = 0; i < numberOfPoints; i ++)
 						points [i]. x -= 1;
 					if (close)
 						points [numberOfPoints] = points [0];
 					Polyline (our d_gdiGraphicsContext, points, numberOfPoints + close);
-					for (long i = 0; i < numberOfPoints; i ++) {
+					for (integer i = 0; i < numberOfPoints; i ++) {
 						points [i]. x += 1;
 						points [i]. y -= 1;
 					}
@@ -248,7 +248,7 @@ void structGraphicsScreen :: v_polyline (long numberOfPoints, double *xyDC, bool
 		CGContextBeginPath (our d_macGraphicsContext);
 		trace (U"starting point ", xyDC [0], U" ", xyDC [1]);
 		CGContextMoveToPoint (our d_macGraphicsContext, xyDC [0], xyDC [1]);   // starts a new subpath
-		for (long i = 1; i < numberOfPoints; i ++) {
+		for (integer i = 1; i < numberOfPoints; i ++) {
 			CGContextAddLineToPoint (our d_macGraphicsContext, xyDC [i + i], xyDC [i + i + 1]);
 		}
 		if (close)
@@ -259,11 +259,11 @@ void structGraphicsScreen :: v_polyline (long numberOfPoints, double *xyDC, bool
 	#endif
 }
 
-void structGraphicsPostscript :: v_polyline (long numberOfPoints, double *xyDC, bool close) {
-	long nn = 2 * numberOfPoints;
+void structGraphicsPostscript :: v_polyline (integer numberOfPoints, double *xyDC, bool close) {
+	integer nn = 2 * numberOfPoints;
 	psPrepareLine (this);
 	our d_printf (our d_file, "N %.7g %.7g moveto\n", xyDC [0], xyDC [1]);
-	for (long i = 2; i < nn; i += 2) {
+	for (integer i = 2; i < nn; i += 2) {
 		double dx = xyDC [i] - xyDC [i - 2], dy = xyDC [i + 1] - xyDC [i - 1];
 		our d_printf (our d_file, "%.7g %.7g L\n", dx, dy);
 	}
@@ -273,12 +273,12 @@ void structGraphicsPostscript :: v_polyline (long numberOfPoints, double *xyDC,
 	psRevertLine (this);
 }
 
-void structGraphicsScreen :: v_fillArea (long numberOfPoints, double *xyDC) {
+void structGraphicsScreen :: v_fillArea (integer numberOfPoints, double *xyDC) {
 	#if cairo
 		if (our d_cairoGraphicsContext == nullptr) return;
 		// cairo_new_path (our d_cairoGraphicsContext); // move_to() automatically creates a new path
 		cairo_move_to (our d_cairoGraphicsContext, xyDC [0], xyDC [1]);
-		for (long i = 1; i < numberOfPoints; i ++)
+		for (integer i = 1; i < numberOfPoints; i ++)
 			cairo_line_to (our d_cairoGraphicsContext, xyDC [i + i], xyDC [i + i + 1]);
 		cairo_close_path (our d_cairoGraphicsContext);
 		cairo_fill (our d_cairoGraphicsContext);
@@ -286,7 +286,7 @@ void structGraphicsScreen :: v_fillArea (long numberOfPoints, double *xyDC) {
 		MY_BRUSH
 		BeginPath (our d_gdiGraphicsContext);
 		MoveToEx (our d_gdiGraphicsContext, xyDC [0], xyDC [1], nullptr);
-		for (long i = 1; i < numberOfPoints; i ++)
+		for (integer i = 1; i < numberOfPoints; i ++)
 			LineTo (our d_gdiGraphicsContext, xyDC [i + i], xyDC [i + i + 1]);
 		EndPath (our d_gdiGraphicsContext);
 		FillPath (our d_gdiGraphicsContext);
@@ -296,7 +296,7 @@ void structGraphicsScreen :: v_fillArea (long numberOfPoints, double *xyDC) {
 		quartzPrepareFill (this);
 		CGContextBeginPath (our d_macGraphicsContext);
 		CGContextMoveToPoint (our d_macGraphicsContext, xyDC [0], xyDC [1]);
-		for (long i = 1; i < numberOfPoints; i ++) {
+		for (integer i = 1; i < numberOfPoints; i ++) {
 			CGContextAddLineToPoint (our d_macGraphicsContext, xyDC [i + i], xyDC [i + i + 1]);
 		}
 		CGContextFillPath (our d_macGraphicsContext);
@@ -304,10 +304,10 @@ void structGraphicsScreen :: v_fillArea (long numberOfPoints, double *xyDC) {
 	#endif
 }
 
-void structGraphicsPostscript :: v_fillArea (long numberOfPoints, double *xyDC) {
-	long nn = numberOfPoints + numberOfPoints;
+void structGraphicsPostscript :: v_fillArea (integer numberOfPoints, double *xyDC) {
+	integer nn = numberOfPoints + numberOfPoints;
 	d_printf (d_file, "N %.7g %.7g M\n", xyDC [0], xyDC [1]);
-	for (long i = 2; i < nn; i += 2) {
+	for (integer i = 2; i < nn; i += 2) {
 		d_printf (d_file, "%.7g %.7g L\n", xyDC [i] - xyDC [i - 2], xyDC [i + 1] - xyDC [i - 1]);
 	}
 	d_printf (d_file, "closepath fill\n");
@@ -423,7 +423,7 @@ void structGraphicsScreen :: v_circle (double xDC, double yDC, double rDC) {
 
 void structGraphicsPostscript :: v_circle (double xDC, double yDC, double rDC) {
 	psPrepareLine (this);
-	d_printf (d_file, "N %ld %ld %ld C\n", (long) xDC, (long) yDC, (long) rDC);
+	d_printf (d_file, "N %ld %ld %ld C\n", (long_not_integer) xDC, (long_not_integer) yDC, (long_not_integer) rDC);
 	psRevertLine (this);
 }
 
@@ -749,7 +749,7 @@ void structGraphics :: v_fillRoundedRectangle (double x1DC, double x2DC, double
 #define wdx(x)  ((x) * my scaleX + my deltaX)
 #define wdy(y)  ((y) * my scaleY + my deltaY)
 
-void Graphics_polyline (Graphics me, long numberOfPoints, double *xWC, double *yWC) {   // base 0
+void Graphics_polyline (Graphics me, integer numberOfPoints, double *xWC, double *yWC) {   // base 0
 	if (numberOfPoints == 0) return;
 	double *xyDC;
 	try {
@@ -761,7 +761,7 @@ void Graphics_polyline (Graphics me, long numberOfPoints, double *xWC, double *y
 		Melder_clearError ();
 		return;
 	}
-	for (long i = 0; i < numberOfPoints; i ++) {
+	for (integer i = 0; i < numberOfPoints; i ++) {
 		xyDC [i + i] = wdx (xWC [i]);
 		xyDC [i + i + 1] = wdy (yWC [i]);
 	}
@@ -775,7 +775,7 @@ void Graphics_polyline (Graphics me, long numberOfPoints, double *xWC, double *y
 	}
 }
 
-void Graphics_polyline_closed (Graphics me, long numberOfPoints, double *xWC, double *yWC) {   // base 0
+void Graphics_polyline_closed (Graphics me, integer numberOfPoints, double *xWC, double *yWC) {   // base 0
 	if (numberOfPoints == 0) return;
 	double *xyDC;
 	try {
@@ -787,7 +787,7 @@ void Graphics_polyline_closed (Graphics me, long numberOfPoints, double *xWC, do
 		Melder_clearError ();
 		return;
 	}
-	for (long i = 0; i < numberOfPoints; i ++) {
+	for (integer i = 0; i < numberOfPoints; i ++) {
 		xyDC [i + i] = wdx (xWC [i]);
 		xyDC [i + i + 1] = wdy (yWC [i]);
 	}
@@ -812,7 +812,7 @@ void Graphics_line (Graphics me, double x1WC, double y1WC, double x2WC, double y
 	if (my recording) { op (LINE, 4); put (x1WC); put (y1WC); put (x2WC); put (y2WC); }
 }
 
-void Graphics_fillArea (Graphics me, long numberOfPoints, double *xWC, double *yWC) {
+void Graphics_fillArea (Graphics me, integer numberOfPoints, double *xWC, double *yWC) {
 	double *xyDC;
 	try {
 		xyDC = Melder_malloc (double, 2 * numberOfPoints);
@@ -823,7 +823,7 @@ void Graphics_fillArea (Graphics me, long numberOfPoints, double *xWC, double *y
 		Melder_clearError ();
 		return;
 	}
-	for (long i = 0; i < numberOfPoints; i ++) {
+	for (integer i = 0; i < numberOfPoints; i ++) {
 		xyDC [i + i] = wdx (xWC [i]);
 		xyDC [i + i + 1] = wdy (yWC [i]);
 	}
@@ -838,10 +838,10 @@ void Graphics_fillArea (Graphics me, long numberOfPoints, double *xWC, double *y
 }
 
 #define MACRO_Graphics_function(TYPE) \
-	long x1DC, x2DC; \
-	long clipy1 = wdy (my d_y1WC), clipy2 = wdy (my d_y2WC); \
+	integer x1DC, x2DC; \
+	integer clipy1 = wdy (my d_y1WC), clipy2 = wdy (my d_y2WC); \
 	double dx, offsetX, translation, scale; \
-	long n = ix2 - ix1 + 1; \
+	integer n = ix2 - ix1 + 1; \
  \
 	if (ix2 <= ix1 || my scaleX == 0.0) return; \
  \
@@ -853,16 +853,16 @@ void Graphics_fillArea (Graphics me, long numberOfPoints, double *xWC, double *y
 	x1DC = translation + ix1 * scale; \
 	x2DC = translation + ix2 * scale; \
 	if (n > (x2DC - x1DC + 1) * 2) {  /* Optimize: draw one vertical line for each device x coordinate. */ \
-		long numberOfPixels = x2DC - x1DC + 1, k = 0; \
-		long numberOfPointsActuallyDrawn = numberOfPixels * 2; \
+		integer numberOfPixels = x2DC - x1DC + 1, k = 0; \
+		integer numberOfPointsActuallyDrawn = numberOfPixels * 2; \
 		double *xyDC; \
 		TYPE lastMini; \
 		if (numberOfPointsActuallyDrawn < 1) return; \
 		xyDC = Melder_malloc_f (double, 2 * numberOfPointsActuallyDrawn); \
-		for (long i = 0; i < numberOfPixels; i ++) { \
-			long j, jmin = ix1 + i / scale, jmax = ix1 + (i + 1) / scale; \
+		for (integer i = 0; i < numberOfPixels; i ++) { \
+			integer j, jmin = ix1 + i / scale, jmax = ix1 + (i + 1) / scale; \
 			TYPE mini, maxi; \
-			long minDC, maxDC; \
+			integer minDC, maxDC; \
 			if (jmin > ix2) jmin = ix2; \
 			if (jmax > ix2) jmax = ix2; \
 			mini = yWC [STAGGER (jmin)], maxi = mini; \
@@ -919,9 +919,9 @@ void Graphics_fillArea (Graphics me, long numberOfPoints, double *xWC, double *y
 		Melder_free (xyDC); \
 	} else {  /* Normal. */  \
 		double *xyDC = Melder_malloc_f (double, 2 * n); \
-		for (long i = 0; i < n; i ++) { \
-			long ix = ix1 + i; \
-			long value = wdy (yWC [STAGGER (ix)]); \
+		for (integer i = 0; i < n; i ++) { \
+			integer ix = ix1 + i; \
+			integer value = wdy (yWC [STAGGER (ix)]); \
 			xyDC [i + i] = translation + ix * scale; \
 			if (my yIsZeroAtTheTop) { \
 				if (FUNCTIONS_ARE_CLIPPED && value > clipy1) value = clipy1; \
@@ -936,14 +936,14 @@ void Graphics_fillArea (Graphics me, long numberOfPoints, double *xWC, double *y
 		Melder_free (xyDC); \
 	}
 
-void Graphics_function (Graphics me, double yWC [], long ix1, long ix2, double x1WC, double x2WC) {
+void Graphics_function (Graphics me, double yWC [], integer ix1, integer ix2, double x1WC, double x2WC) {
 	#define STAGGER(i)  (i)
 	MACRO_Graphics_function (double)
 	#undef STAGGER
 	if (my recording) { op (FUNCTION, 3 + n); put (n); put (x1WC); put (x2WC); mput (n, & yWC [ix1]) }
 }
 
-void Graphics_function16 (Graphics me, int16_t yWC [], int stagger, long ix1, long ix2, double x1WC, double x2WC) {
+void Graphics_function16 (Graphics me, int16_t yWC [], int stagger, integer ix1, integer ix2, double x1WC, double x2WC) {
 	if (stagger == 1) {
 		#define STAGGER(i)  ((i) + (i))
 		MACRO_Graphics_function (int16_t)
@@ -1016,9 +1016,9 @@ void Graphics_speckle (Graphics me, double xWC, double yWC) {
 }
 
 void Graphics_rectangle_mm (Graphics me, double xWC, double yWC, double horSide, double vertSide) {
-	long xDC = wdx (xWC), yDC = wdy (yWC);
-	long halfHorSide = ceil (0.5 * horSide * my resolution / 25.4);
-	long halfVertSide = ceil (0.5 * vertSide * my resolution / 25.4);
+	integer xDC = wdx (xWC), yDC = wdy (yWC);
+	integer halfHorSide = ceil (0.5 * horSide * my resolution / 25.4);
+	integer halfVertSide = ceil (0.5 * vertSide * my resolution / 25.4);
 	if (my yIsZeroAtTheTop) {
 		my v_rectangle (xDC - halfHorSide, xDC + halfHorSide, yDC + halfVertSide, yDC - halfVertSide);
 	} else {
@@ -1028,9 +1028,9 @@ void Graphics_rectangle_mm (Graphics me, double xWC, double yWC, double horSide,
 }
 
 void Graphics_fillRectangle_mm (Graphics me, double xWC, double yWC, double horSide, double vertSide) {
-	long xDC = wdx (xWC), yDC = wdy (yWC);
-	long halfHorSide = ceil (0.5 * horSide * my resolution / 25.4);
-	long halfVertSide = ceil (0.5 * vertSide * my resolution / 25.4);
+	integer xDC = wdx (xWC), yDC = wdy (yWC);
+	integer halfHorSide = ceil (0.5 * horSide * my resolution / 25.4);
+	integer halfVertSide = ceil (0.5 * vertSide * my resolution / 25.4);
 	if (my yIsZeroAtTheTop) {
 		my v_fillRectangle (xDC - halfHorSide, xDC + halfHorSide, yDC + halfVertSide, yDC - halfVertSide);
 	} else {
diff --git a/sys/Graphics_record.cpp b/sys/Graphics_record.cpp
index 14fc4bb..627e758 100644
--- a/sys/Graphics_record.cpp
+++ b/sys/Graphics_record.cpp
@@ -20,7 +20,7 @@
 
 #define RECORDING_HEADER_LENGTH 2
 
-double * _Graphics_check (Graphics me, long number) {
+double * _Graphics_check (Graphics me, integer number) {
 	static bool messageHasAlreadyBeenShownOnce = false;
 	double *result = nullptr;
 	double *record = my record;
@@ -94,7 +94,7 @@ void Graphics_play (Graphics me, Graphics thee) {
 		#define mget(n)  (p += n, p - n)
 		#define sget(n)  ((char *) (p += n, p - n + 1))
 		int opcode = (int) get;
-		(void) (long) get;   // ignore number of arguments
+		(void) (integer) get;   // ignore number of arguments
 		switch (opcode) {
 			case SET_VIEWPORT:
 			{  double x1NDC = get, x2NDC = get, y1NDC = get, y2NDC = get;
@@ -107,11 +107,11 @@ void Graphics_play (Graphics me, Graphics thee) {
 				Graphics_setWindow (thee, x1, x2, y1, y2);
 			}  break;
 			case TEXT:
-			{  double x = get, y = get; long length = get; char *text_utf8 = sget (length);
+			{  double x = get, y = get; integer length = get; char *text_utf8 = sget (length);
 				Graphics_text (thee, x, y, Melder_peek8to32 (text_utf8));
 			}  break;
 			case POLYLINE:
-			{  long n = get; double *x = mget (n), *y = mget (n);
+			{  integer n = get; double *x = mget (n), *y = mget (n);
 				Graphics_polyline (thee, n, & x [1], & y [1]);
 			} break;
 			case LINE:
@@ -123,11 +123,11 @@ void Graphics_play (Graphics me, Graphics thee) {
 				Graphics_arrow (thee, x1, y1, x2, y2);
 			}  break;
 			case FILL_AREA:
-			{  long n = get; double *x = mget (n), *y = mget (n);
+			{  integer n = get; double *x = mget (n), *y = mget (n);
 				Graphics_fillArea (thee, n, & x [1], & y [1]);
 			}  break;
 			case FUNCTION:
-			{  long n = get; double x1 = get, x2 = get, *y = mget (n);
+			{  integer n = get; double x1 = get, x2 = get, *y = mget (n);
 				Graphics_function (thee, y, 1, n, x1, x2);
 			}  break;
 			case RECTANGLE:
@@ -161,7 +161,7 @@ void Graphics_play (Graphics me, Graphics thee) {
 			}  break;
 			case CELL_ARRAY:
 			{  double x1 = get, x2 = get, y1 = get, y2 = get, minimum = get, maximum = get;
-				long nrow = get, ncol = get;
+				integer nrow = get, ncol = get;
 				/*
 				 * We don't copy all the data into a new matrix.
 				 * Instead, we create row pointers z [1..nrow] that point directly into the recorded data.
@@ -169,7 +169,7 @@ void Graphics_play (Graphics me, Graphics thee) {
 				 */
 				double **z = Melder_malloc_f (double *, nrow);
 				z [0] = p + 1;
-				for (long irow = 1; irow < nrow; irow ++) z [irow] = z [irow - 1] + ncol;
+				for (integer irow = 1; irow < nrow; irow ++) z [irow] = z [irow - 1] + ncol;
 				p += nrow * ncol;
 				Graphics_cellArray (thee, z, 0, ncol - 1, x1, x2,
 								0, nrow - 1, y1, y2, minimum, maximum);
@@ -227,10 +227,10 @@ void Graphics_play (Graphics me, Graphics thee) {
 			}  break;
 			case IMAGE8:
 			{  double x1 = get, x2 = get, y1 = get, y2 = get, minimum = get, maximum = get;
-				long nrow = get, ncol = get;
+				integer nrow = get, ncol = get;
 				unsigned char **z = NUMmatrix <unsigned char> (1, nrow, 1, ncol);   // BUG memory
-				for (long irow = 1; irow <= nrow; irow ++)
-					for (long icol = 1; icol <= ncol; icol ++)
+				for (integer irow = 1; irow <= nrow; irow ++)
+					for (integer icol = 1; icol <= ncol; icol ++)
 						z [irow] [icol] = get;
 				Graphics_image8 (thee, z, 1, ncol, x1, x2, 1, nrow, y1, y2, minimum, maximum);
 				NUMmatrix_free (z, 1, 1);
@@ -288,17 +288,17 @@ void Graphics_play (Graphics me, Graphics thee) {
 			}  break;
 			case CELL_ARRAY8:
 			{  double x1 = get, x2 = get, y1 = get, y2 = get, minimum = get, maximum = get;
-				long nrow = get, ncol = get;
+				integer nrow = get, ncol = get;
 				unsigned char **z = NUMmatrix <unsigned char> (1, nrow, 1, ncol);   // BUG memory
-				for (long irow = 1; irow <= nrow; irow ++)
-					for (long icol = 1; icol <= ncol; icol ++)
+				for (integer irow = 1; irow <= nrow; irow ++)
+					for (integer icol = 1; icol <= ncol; icol ++)
 						z [irow] [icol] = get;
 				Graphics_cellArray8 (thee, z, 1, ncol, x1, x2, 1, nrow, y1, y2, minimum, maximum);
 				NUMmatrix_free (z, 1, 1);
 			}  break;
 			case IMAGE:
 			{  double x1 = get, x2 = get, y1 = get, y2 = get, minimum = get, maximum = get;
-				long nrow = get, ncol = get;
+				integer nrow = get, ncol = get;
 				/*
 				 * We don't copy all the data into a new matrix.
 				 * Instead, we create row pointers z [1..nrow] that point directly into the recorded data.
@@ -306,7 +306,7 @@ void Graphics_play (Graphics me, Graphics thee) {
 				 */
 				double **z = Melder_malloc_f (double *, nrow);
 				z [0] = p + 1;
-				for (long irow = 1; irow < nrow; irow ++) z [irow] = z [irow - 1] + ncol;
+				for (integer irow = 1; irow < nrow; irow ++) z [irow] = z [irow - 1] + ncol;
 				p += nrow * ncol;
 				Graphics_image (thee, z, 0, ncol - 1, x1, x2,
 								0, nrow - 1, y1, y2, minimum, maximum);
@@ -330,16 +330,16 @@ void Graphics_play (Graphics me, Graphics thee) {
 				Graphics_setColour (thee, colour);
 			} break;
 			case IMAGE_FROM_FILE:
-			{  double x1 = get, x2 = get, y1 = get, y2 = get; long length = get; char *text_utf8 = sget (length);
+			{  double x1 = get, x2 = get, y1 = get, y2 = get; integer length = get; char *text_utf8 = sget (length);
 				Graphics_imageFromFile (thee, Melder_peek8to32 (text_utf8), x1, x2, y1, y2);
 			}  break;
 			case POLYLINE_CLOSED:
-			{  long n = get; double *x = mget (n), *y = mget (n);
+			{  integer n = get; double *x = mget (n), *y = mget (n);
 				Graphics_polyline_closed (thee, n, & x [1], & y [1]);
 			} break;
 			case CELL_ARRAY_COLOUR:
 			{  double x1 = get, x2 = get, y1 = get, y2 = get, minimum = get, maximum = get;
-				long nrow = get, ncol = get;
+				integer nrow = get, ncol = get;
 				/*
 				 * We don't copy all the data into a new matrix.
 				 * Instead, we create row pointers z [1..nrow] that point directly into the recorded data.
@@ -347,7 +347,7 @@ void Graphics_play (Graphics me, Graphics thee) {
 				 */
 				double_rgbt **z = Melder_malloc_f (double_rgbt *, nrow);
 				z [0] = (double_rgbt *) (p + 1);
-				for (long irow = 1; irow < nrow; irow ++) z [irow] = z [irow - 1] + ncol;
+				for (integer irow = 1; irow < nrow; irow ++) z [irow] = z [irow - 1] + ncol;
 				p += nrow * ncol * 4;
 				Graphics_cellArray_colour (thee, z, 0, ncol - 1, x1, x2,
 								0, nrow - 1, y1, y2, minimum, maximum);
@@ -355,7 +355,7 @@ void Graphics_play (Graphics me, Graphics thee) {
 			}  break;
 			case IMAGE_COLOUR:
 			{  double x1 = get, x2 = get, y1 = get, y2 = get, minimum = get, maximum = get;
-				long nrow = get, ncol = get;
+				integer nrow = get, ncol = get;
 				/*
 				 * We don't copy all the data into a new matrix.
 				 * Instead, we create row pointers z [1..nrow] that point directly into the recorded data.
@@ -363,7 +363,7 @@ void Graphics_play (Graphics me, Graphics thee) {
 				 */
 				double_rgbt **z = Melder_malloc_f (double_rgbt *, nrow);
 				z [0] = (double_rgbt *) (p + 1);
-				for (long irow = 1; irow < nrow; irow ++) z [irow] = z [irow - 1] + ncol;
+				for (integer irow = 1; irow < nrow; irow ++) z [irow] = z [irow - 1] + ncol;
 				p += nrow * ncol * 4;
 				Graphics_image_colour (thee, z, 0, ncol - 1, x1, x2,
 								0, nrow - 1, y1, y2, minimum, maximum);
@@ -392,8 +392,8 @@ void Graphics_writeRecordings (Graphics me, FILE *f) {
 		#define get  (* ++ p)
 		int opcode = (int) get;
 		binputr32 ((float) opcode, f);
-		long numberOfArguments = (long) get;
-		const long largestIntegerRepresentableAs32BitFloat = 0x00FFFFFF;
+		integer numberOfArguments = (integer) get;
+		const integer largestIntegerRepresentableAs32BitFloat = 0x00FFFFFF;
 		if (numberOfArguments > largestIntegerRepresentableAs32BitFloat) {
 			binputr32 (-1.0, f);
 			binputi32 (numberOfArguments, f);
@@ -406,7 +406,7 @@ void Graphics_writeRecordings (Graphics me, FILE *f) {
 			binputr32 (get, f);   // y
 			binputr32 (get, f);   // length
 			Melder_assert (sizeof (double) == 8);
-			if ((long) fwrite (++ p, 8, numberOfArguments - 3, f) < numberOfArguments - 3)   // text
+			if ((integer) fwrite (++ p, 8, numberOfArguments - 3, f) < numberOfArguments - 3)   // text
 				Melder_throw (U"Error writing graphics recordings.");
 			p += numberOfArguments - 4;
 		} else if (opcode == IMAGE_FROM_FILE) {
@@ -416,21 +416,21 @@ void Graphics_writeRecordings (Graphics me, FILE *f) {
 			binputr32 (get, f);   // y2
 			binputr32 (get, f);   // length
 			Melder_assert (sizeof (double) == 8);
-			if ((long) fwrite (++ p, 8, numberOfArguments - 5, f) < numberOfArguments - 5)   // text
+			if ((integer) fwrite (++ p, 8, numberOfArguments - 5, f) < numberOfArguments - 5)   // text
 				Melder_throw (U"Error writing graphics recordings.");
 			p += numberOfArguments - 6;
 		} else {
-			for (long i = numberOfArguments; i > 0; i --) binputr32 (get, f);
+			for (integer i = numberOfArguments; i > 0; i --) binputr32 (get, f);
 		}
 	}
 }
 
 void Graphics_readRecordings (Graphics me, FILE *f) {
-	long old_irecord = my irecord;
-	long added_irecord = 0;
+	integer old_irecord = my irecord;
+	integer added_irecord = 0;
 	double* p = nullptr;
 	double* endp = nullptr;
-	signed long numberOfArguments = 0;
+	integer numberOfArguments = 0;
 	int opcode = 0;
 	try {
 		added_irecord = bingeti32 (f);
@@ -441,7 +441,7 @@ void Graphics_readRecordings (Graphics me, FILE *f) {
 		while (p < endp) {
 			opcode = (int) bingetr32 (f);
 			put (opcode);
-			numberOfArguments = (signed long) bingetr32 (f);
+			numberOfArguments = (integer) bingetr32 (f);
 			if (numberOfArguments == -1) {
 				numberOfArguments = bingeti32 (f);
 			}
@@ -463,12 +463,12 @@ void Graphics_readRecordings (Graphics me, FILE *f) {
 					Melder_throw (U"Error reading graphics recordings.");
 				p += numberOfArguments - 6;
 			} else {
-				for (long i = numberOfArguments; i > 0; i --) put (bingetr32 (f));
+				for (integer i = numberOfArguments; i > 0; i --) put (bingetr32 (f));
 			}
 		}   
 	} catch (MelderError) {
 		my irecord = old_irecord;
-		Melder_throw (U"Error reading graphics record ", added_irecord - (long) (endp - p),
+		Melder_throw (U"Error reading graphics record ", added_irecord - (integer) (endp - p),
 			U" out of ", added_irecord, U".\nOpcode ", opcode, U", args ", numberOfArguments, U".");
 	}
 }
@@ -478,11 +478,11 @@ void Graphics_markGroup (Graphics me) {
 }
 
 void Graphics_undoGroup (Graphics me) {
-	long lastMark = 0;   // not yet found
-	long jrecord = 0;
+	integer lastMark = 0;   // not yet found
+	integer jrecord = 0;
 	while (jrecord < my irecord) {   // keep looking for marks until the end
 		int opcode = (int) my record [++ jrecord];
-		long number = (long) my record [++ jrecord];
+		integer number = (integer) my record [++ jrecord];
 		if (opcode == MARK_GROUP) lastMark = jrecord - 1;   // found a mark
 		jrecord += number;
 	}
diff --git a/sys/Graphics_surface.cpp b/sys/Graphics_surface.cpp
index b420efd..0931a69 100644
--- a/sys/Graphics_surface.cpp
+++ b/sys/Graphics_surface.cpp
@@ -1,6 +1,6 @@
 /* Graphics_surface.cpp
  *
- * Copyright (C) 1992-2011 Paul Boersma
+ * Copyright (C) 1992-2011,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,8 +19,8 @@
 #include "Graphics.h"
 
 void Graphics_surface (Graphics me, double **z,
-	long ix1, long ix2, double x1, double x2,
-	long iy1, long iy2, double y1, double y2,
+	integer ix1, integer ix2, double x1, double x2,
+	integer iy1, integer iy2, double y1, double y2,
 	double minimum, double maximum,
 	double elevation, double azimuth)
 {
@@ -31,7 +31,7 @@ void Graphics_surface (Graphics me, double **z,
 	 * The x and y indices of the front corner of the frontmost tetragon are ix1 and iy1,
 	 * so that the x and y indices of its back corner are ix1 + 1 and iy1 + 1.
 	 */
-	long maxsum = ix2 + iy2, minsum = (ix1 + 1) + (iy1 + 1), sum;
+	integer maxsum = ix2 + iy2, minsum = (ix1 + 1) + (iy1 + 1), sum;
 	(void) elevation;   /* BUG */
 	(void) azimuth;   /* BUG */
 	if (ix2 <= ix1 || iy2 <= iy1) return;
@@ -46,16 +46,16 @@ void Graphics_surface (Graphics me, double **z,
 		/* We are going to cycle over a diagonal sequence of points.
 		 * Compute the row boundaries of this sequence.
 		 */
-		long iymin = iy1 + 1, iymax = iy2, iy;
+		integer iymin = iy1 + 1, iymax = iy2, iy;
 		if (iymin < sum - ix2) iymin = sum - ix2;
 		if (iymax > sum - (ix1 + 1)) iymax = sum - (ix1 + 1);
 		for (iy = iymin; iy <= iymax; iy ++) {
 
 			/* Compute the indices of all four points.
 			 */
-			long ix = sum - iy;
-			long ixback = ix, ixfront = ix - 1, ixleft = ix - 1, ixright = ix;
-			long iyback = iy, iyfront = iy - 1, iyleft = iy, iyright = iy - 1;
+			integer ix = sum - iy;
+			integer ixback = ix, ixfront = ix - 1, ixleft = ix - 1, ixright = ix;
+			integer iyback = iy, iyfront = iy - 1, iyleft = iy, iyright = iy - 1;
 
 			/* Compute the world coordinates of all four points.
 			 */
diff --git a/sys/Graphics_text.cpp b/sys/Graphics_text.cpp
index 0d33f44..791fe20 100644
--- a/sys/Graphics_text.cpp
+++ b/sys/Graphics_text.cpp
@@ -194,7 +194,7 @@ inline static int chooseFont (Graphics me, _Graphics_widechar *lc) {
 		
 		Exception: if the character is a slash, its font has already been converted to Courier.
 	*/
-	int font = lc -> font.integer;
+	int font = lc -> font.integer_;
 	Longchar_Info info = lc -> karInfo;
 	int alphabet = info -> alphabet;
 
@@ -268,7 +268,7 @@ inline static int chooseFont (Graphics me, _Graphics_widechar *lc) {
 				kGraphics_font_IPAPALATINO :
 				(int) kGraphics_font::PALATINO
 			) :
-		(int) my font;   // why not lc -> font.integer?
+		(int) my font;   // why not lc -> font.integer_?
 	Melder_assert (font >= 0 && font <= kGraphics_font_DINGBATS);
 	return font;
 }
@@ -288,7 +288,7 @@ static void charSize (void *void_me, _Graphics_widechar *lc) {
 			lc -> baseline *= my fontSize * 0.01;
 			lc -> code = lc -> kar;
 			lc -> font.string = nullptr;
-			lc -> font.integer = 0;
+			lc -> font.integer_ = 0;
 			lc -> size = size;
 		#elif gdi
 			Longchar_Info info = lc -> karInfo;
@@ -298,7 +298,7 @@ static void charSize (void *void_me, _Graphics_widechar *lc) {
 			int smallSize = (3 * normalSize + 2) / 4;
 			font = info -> alphabet == Longchar_SYMBOL ? kGraphics_font_SYMBOL :
 			       info -> alphabet == Longchar_PHONETIC ? kGraphics_font_IPATIMES :
-			       info -> alphabet == Longchar_DINGBATS ? kGraphics_font_DINGBATS : lc -> font.integer;
+			       info -> alphabet == Longchar_DINGBATS ? kGraphics_font_DINGBATS : lc -> font.integer_;
 			if ((unsigned int) lc -> kar >= 0x2E80 && (unsigned int) lc -> kar <= 0x9FFF)
 				font = ( theGraphicsCjkFontStyle == kGraphics_cjkFontStyle::CHINESE ? kGraphics_font_CHINESE : kGraphics_font_JAPANESE );
 			size = lc -> size < 100 ? smallSize : normalSize;
@@ -349,7 +349,7 @@ static void charSize (void *void_me, _Graphics_widechar *lc) {
 			lc -> width = extent. cx;
 			lc -> baseline *= my fontSize * 0.01 * my resolution / 72.0;
 			lc -> font.string = nullptr;
-			lc -> font.integer = font;   // kGraphics_font_HELVETICA .. kGraphics_font_DINGBATS
+			lc -> font.integer_ = font;   // kGraphics_font_HELVETICA .. kGraphics_font_DINGBATS
 			lc -> size = size;   // 0..4 instead of 10..24
 			lc -> style = style;   // without Graphics_CODE
 		#elif quartz
@@ -360,7 +360,7 @@ static void charSize (void *void_me, _Graphics_widechar *lc) {
 		Longchar_Info info = lc -> karInfo;
 		int font = info -> alphabet == Longchar_SYMBOL ? kGraphics_font_SYMBOL :
 				info -> alphabet == Longchar_PHONETIC ? kGraphics_font_IPATIMES :
-				info -> alphabet == Longchar_DINGBATS ? kGraphics_font_DINGBATS : lc -> font.integer;
+				info -> alphabet == Longchar_DINGBATS ? kGraphics_font_DINGBATS : lc -> font.integer_;
 		int style = lc -> style == Graphics_ITALIC ? Graphics_ITALIC :
 			lc -> style == Graphics_BOLD || lc -> link ? Graphics_BOLD :
 			lc -> style == Graphics_BOLD_ITALIC ? Graphics_BOLD_ITALIC : 0;
@@ -447,7 +447,7 @@ static void charSize (void *void_me, _Graphics_widechar *lc) {
 				}
 			}
 		}
-		lc -> font.integer = 0;
+		lc -> font.integer_ = 0;
 		lc -> font.string = my fontInfos [font] [style];
 
 		/*
@@ -579,7 +579,7 @@ static void charDraw (void *void_me, int xDC, int yDC, _Graphics_widechar *lc,
 			if (! my d_cairoGraphicsContext) return;
 			// TODO!
 			if (lc -> link) _Graphics_setColour (me, Graphics_BLUE);
-			int font = lc -> font.integer;
+			int font = lc -> font.integer_;
 			cairo_save (my d_cairoGraphicsContext);
 			cairo_translate (my d_cairoGraphicsContext, xDC, yDC);
 			//cairo_scale (my d_cairoGraphicsContext, 1, -1);
@@ -598,7 +598,7 @@ static void charDraw (void *void_me, int xDC, int yDC, _Graphics_widechar *lc,
 			if (lc -> link) _Graphics_setColour (me, my colour);
 			return;
 		#elif gdi
-			int font = lc -> font.integer;
+			int font = lc -> font.integer_;
 			WCHAR *codesW = Melder_peek32toW (codes);
 			if (my duringXor) {
 				int descent = (1.0/216) * my fontSize * my resolution;
@@ -649,7 +649,7 @@ static void charDraw (void *void_me, int xDC, int yDC, _Graphics_widechar *lc,
 			/*
 			 * Determine the font family.
 			 */
-			int font = lc -> font.integer;   // the font of the first character
+			int font = lc -> font.integer_;   // the font of the first character
 
 			/*
 			 * Determine the style.
@@ -823,12 +823,12 @@ static void exitText (void *void_me) {
 
 #define MAX_LINK_LENGTH  300
 
-static long bufferSize;
+static integer bufferSize;
 static _Graphics_widechar *theWidechar;
 static char32 *charCodes;
 static int initBuffer (const char32 *txt) {
 	try {
-		long sizeNeeded = str32len (txt) + 1;
+		integer sizeNeeded = str32len (txt) + 1;
 		if (sizeNeeded > bufferSize) {
 			sizeNeeded += sizeNeeded / 2 + 100;
 			Melder_free (theWidechar);
@@ -869,7 +869,7 @@ static void charSizes (Graphics me, _Graphics_widechar string [], bool measureEa
 			Longchar_Info info = lc -> karInfo;
 			Melder_assert (info);
 			int font = chooseFont (me, lc);
-			lc -> font.string = nullptr;   // this erases font.integer!
+			lc -> font.string = nullptr;   // this erases font.integer_!
 
 			/*
 			 * Determine the style.
@@ -917,7 +917,7 @@ static void charSizes (Graphics me, _Graphics_widechar string [], bool measureEa
 			lc -> size = size;
 			lc -> baseline *= 0.01 * normalSize;
 			lc -> code = lc -> kar;
-			lc -> font.integer = font;
+			lc -> font.integer_ = font;
 			if (Longchar_Info_isDiacritic (info)) {
 				numberOfDiacritics ++;
 			}
@@ -930,7 +930,7 @@ static void charSizes (Graphics me, _Graphics_widechar string [], bool measureEa
 			if (measureEachCharacterSeparately ||
 				next->kar <= U' ' || next->style != lc->style ||
 				next->baseline != lc->baseline || next->size != lc->size || next->link != lc->link ||
-				next->font.integer != lc->font.integer || next->font.string != lc->font.string ||
+				next->font.integer_ != lc->font.integer_ || next->font.string != lc->font.string ||
 				next->rightToLeft != lc->rightToLeft ||
 				(my textRotation != 0.0 && my screen && my resolution > 150))
 			{
@@ -938,7 +938,7 @@ static void charSizes (Graphics me, _Graphics_widechar string [], bool measureEa
 				#if cairo
 					const char *codes8 = Melder_peek32to8 (charCodes);
 					int length = strlen (codes8);
-					PangoFontDescription *fontDescription = PangoFontDescription_create (lc -> font.integer, lc);
+					PangoFontDescription *fontDescription = PangoFontDescription_create (lc -> font.integer_, lc);
 
 					/*
 						Measuring the width of a text with a homogeneous Praat font
@@ -975,7 +975,7 @@ static void charSizes (Graphics me, _Graphics_widechar string [], bool measureEa
 					CFMutableAttributedStringRef cfstring =
 						CFAttributedStringCreateMutable (kCFAllocatorDefault, (CFIndex) [s length]);
 					CFAttributedStringReplaceString (cfstring, CFRangeMake (0, 0), (CFStringRef) s);
-					CFAttributedStringSetAttribute (cfstring, textRange, kCTFontAttributeName, theScreenFonts [lc -> font.integer] [100] [lc -> style]);
+					CFAttributedStringSetAttribute (cfstring, textRange, kCTFontAttributeName, theScreenFonts [lc -> font.integer_] [100] [lc -> style]);
 
 					/*
 					 * Measure.
@@ -1095,7 +1095,7 @@ static void drawOneCell (Graphics me, int xDC, int yDC, _Graphics_widechar lc []
 			 */
 			if (next->kar < U' ' || next->style != plc->style ||
 				next->baseline != plc->baseline || next->size != plc->size ||
-				next->font.integer != plc->font.integer || next->font.string != plc->font.string ||
+				next->font.integer_ != plc->font.integer_ || next->font.string != plc->font.string ||
 				next->rightToLeft != plc->rightToLeft ||
 				(my screen && my resolution > 150))
 			{
@@ -1138,7 +1138,7 @@ static void drawOneCell (Graphics me, int xDC, int yDC, _Graphics_widechar lc []
 							_Graphics_widechar *next = plc + 1;
 							if (next->style != plc->style ||
 								next->baseline != plc->baseline || next->size != plc->size || next->link != plc->link ||
-								next->font.integer != plc->font.integer || next->font.string != plc->font.string ||
+								next->font.integer_ != plc->font.integer_ || next->font.string != plc->font.string ||
 								next->rightToLeft != plc->rightToLeft)
 							{
 								// nothing
@@ -1174,7 +1174,7 @@ static void drawOneCell (Graphics me, int xDC, int yDC, _Graphics_widechar lc []
 				x += plc -> width;
 				if (next->kar < U' ' || next->style != plc->style ||
 					next->baseline != plc->baseline || next->size != plc->size || next->link != plc->link ||
-					next->font.integer != plc->font.integer || next->font.string != plc->font.string ||
+					next->font.integer_ != plc->font.integer_ || next->font.string != plc->font.string ||
 					next->rightToLeft != plc->rightToLeft)
 				{
 					charCodes [nchars] = U'\0';   // ...and flush
@@ -1406,7 +1406,7 @@ static void parseTextIntoCellsLinesRuns (Graphics me, const char32 *txt /* catta
 			((my fontStyle & Graphics_ITALIC) | charItalic | wordItalic | globalItalic ? Graphics_ITALIC : 0) +
 			((my fontStyle & Graphics_BOLD) | charBold | wordBold | globalBold ? Graphics_BOLD : 0);
 		out -> font.string = nullptr;
-		out -> font.integer = my fontStyle == Graphics_CODE || wordCode || globalCode ||
+		out -> font.integer_ = my fontStyle == Graphics_CODE || wordCode || globalCode ||
 			kar == U'/' || kar == U'|' ? (int) kGraphics_font::COURIER : (int) my font;
 		out -> link = wordLink | globalLink;
 		out -> baseline = charSuperscript | globalSuperscript ? 34 : charSubscript | globalSubscript ? -25 : 0;
@@ -1414,7 +1414,7 @@ static void parseTextIntoCellsLinesRuns (Graphics me, const char32 *txt /* catta
 		if (kar == U'/') {
 			out -> baseline -= out -> size / 12;
 			out -> size += out -> size / 10;
-			if (my screen) out -> font.integer = (int) kGraphics_font::PALATINO;
+			if (my screen) out -> font.integer_ = (int) kGraphics_font::PALATINO;
 		}
 		out -> code = U'?';   // does this have any meaning?
 		Melder_assert (kar != U'\0');
@@ -1447,8 +1447,8 @@ double Graphics_textWidth (Graphics me, const char32 *txt) {
 void Graphics_textRect (Graphics me, double x1, double x2, double y1, double y2, const char32 *txt) {
 	_Graphics_widechar *plc, *startOfLine;
 	double width = 0.0, lineHeight = (1.1 / 72) * my fontSize * my resolution;
-	long x1DC = x1 * my scaleX + my deltaX + 2, x2DC = x2 * my scaleX + my deltaX - 2;
-	long y1DC = y1 * my scaleY + my deltaY, y2DC = y2 * my scaleY + my deltaY;
+	integer x1DC = x1 * my scaleX + my deltaX + 2, x2DC = x2 * my scaleX + my deltaX - 2;
+	integer y1DC = y1 * my scaleY + my deltaY, y2DC = y2 * my scaleY + my deltaY;
 	int availableHeight = my yIsZeroAtTheTop ? y1DC - y2DC : y2DC - y1DC, availableWidth = x2DC - x1DC;
 	int linesAvailable = availableHeight / lineHeight, linesNeeded = 1, lines, iline;
 	if (linesAvailable <= 0) linesAvailable = 1;
@@ -1505,7 +1505,7 @@ void Graphics_textRect (Graphics me, double x1, double x2, double y1, double y2,
 static void _Graphics_text (Graphics me, double xWC, double yWC, const char32 *txt) {
 	if (my wrapWidth == 0.0 && str32chr (txt, U'\n') && my textRotation == 0.0) {
 		double lineSpacingWC = (1.2/72.0) * my fontSize * my resolution / fabs (my scaleY);
-		long numberOfLines = 1;
+		integer numberOfLines = 1;
 		for (const char32 *p = & txt [0]; *p != U'\0'; p ++) {
 			if (*p == U'\n') {
 				numberOfLines ++;
@@ -1614,7 +1614,7 @@ static double psTextWidth (_Graphics_widechar string [], bool useSilipaPS) {
 		Longchar_Info info = character -> karInfo;
 		int font = info -> alphabet == Longchar_SYMBOL ? kGraphics_font_SYMBOL :
 				info -> alphabet == Longchar_PHONETIC ? kGraphics_font_IPATIMES :
-				info -> alphabet == Longchar_DINGBATS ? kGraphics_font_DINGBATS : character -> font.integer;
+				info -> alphabet == Longchar_DINGBATS ? kGraphics_font_DINGBATS : character -> font.integer_;
 		int style = character -> style == Graphics_ITALIC ? Graphics_ITALIC :
 			character -> style == Graphics_BOLD || character -> link ? Graphics_BOLD :
 			character -> style == Graphics_BOLD_ITALIC ? Graphics_BOLD_ITALIC : 0;
diff --git a/sys/Gui.h b/sys/Gui.h
index 93eea2b..ab12c76 100644
--- a/sys/Gui.h
+++ b/sys/Gui.h
@@ -144,15 +144,15 @@
 	 */
 	typedef MSG XEvent;
 	typedef unsigned char Boolean;
-	typedef long Cardinal;
+	typedef integer Cardinal;
 	typedef unsigned int Dimension;
 	typedef int Position;
 	typedef void *Window;
 	typedef char *String;
 	typedef struct Display Display;
-	/*typedef long Time;*/
-	typedef long Atom;
-	typedef struct { int /* elsewhere: char* */ name; long value; } Arg, *ArgList;
+	/*typedef integer Time;*/
+	typedef integer Atom;
+	typedef struct { int /* elsewhere: char* */ name; integer value; } Arg, *ArgList;
 
 	/*
 	 * Declarations of X11 functions.
@@ -167,11 +167,11 @@
 	 */
 	typedef void *XtPointer;
 	typedef GuiObject *GuiObjectList;
-	typedef long XtWorkProcId, XtIntervalId;
+	typedef integer XtWorkProcId, XtIntervalId;
 	typedef void (*XtCallbackProc) (GuiObject w, XtPointer client_data, XtPointer call_data);
 	typedef bool (*XtWorkProc) (void *client_data);
 	typedef void (*XtTimerCallbackProc) (XtPointer, XtIntervalId *);
-	typedef unsigned long WidgetClass;
+	typedef uinteger WidgetClass;
 	#define False 0
 	#define True 1
 
@@ -179,7 +179,7 @@
 	 * Declarations of Xt functions.
 	 */
 	void XtAddCallback (GuiObject w, int kind, XtCallbackProc proc, XtPointer closure);
-	XtIntervalId GuiAddTimeOut (unsigned long interval,
+	XtIntervalId GuiAddTimeOut (uinteger interval,
 		XtTimerCallbackProc timerProc, XtPointer closure);
 	XtWorkProcId GuiAddWorkProc (XtWorkProc workProc, XtPointer closure);
 	void GuiMainLoop ();
@@ -208,7 +208,7 @@
 	void XtVaGetValues (GuiObject w, ...);
 	void XtVaSetValues (GuiObject w, ...);
 	Window XtWindow (GuiObject w);
-	long Gui_getNumberOfMotifWidgets ();
+	integer Gui_getNumberOfMotifWidgets ();
 
 	/*
 	 * Xm widget classes.
@@ -582,13 +582,13 @@ GuiList GuiList_create      (GuiForm parent, int left, int right, int top, int b
 GuiList GuiList_createShown (GuiForm parent, int left, int right, int top, int bottom, bool allowMultipleSelection, const char32 *header);
 
 void GuiList_deleteAllItems (GuiList me);
-void GuiList_deleteItem (GuiList me, long position);
+void GuiList_deleteItem (GuiList me, integer position);
 void GuiList_deselectAllItems (GuiList me);
-void GuiList_deselectItem (GuiList me, long position);
-long GuiList_getBottomPosition (GuiList me);
-long GuiList_getNumberOfItems (GuiList me);
-long * GuiList_getSelectedPositions (GuiList me, long *numberOfSelected);
-long GuiList_getTopPosition (GuiList me);
+void GuiList_deselectItem (GuiList me, integer position);
+integer GuiList_getBottomPosition (GuiList me);
+integer GuiList_getNumberOfItems (GuiList me);
+integer * GuiList_getSelectedPositions (GuiList me, integer *numberOfSelected);
+integer GuiList_getTopPosition (GuiList me);
 
 /**
 	Inserts a new item into a GuiList at a given position.
@@ -601,11 +601,11 @@ long GuiList_getTopPosition (GuiList me);
 		A value of 1 therefore puts the new item at the top of the list.
 		A value of 0 is special: the item is put at the bottom of the list.
  */
-void GuiList_insertItem  (GuiList me, const char32 *itemText /* cattable */, long position);
+void GuiList_insertItem  (GuiList me, const char32 *itemText /* cattable */, integer position);
 
-void GuiList_replaceItem (GuiList me, const char32 *itemText /* cattable */, long position);
-void GuiList_setTopPosition (GuiList me, long topPosition);
-void GuiList_selectItem (GuiList me, long position);
+void GuiList_replaceItem (GuiList me, const char32 *itemText /* cattable */, integer position);
+void GuiList_setTopPosition (GuiList me, integer topPosition);
+void GuiList_selectItem (GuiList me, integer position);
 void GuiList_setSelectionChangedCallback (GuiList me, GuiList_SelectionChangedCallback callback, Thing boss);
 void GuiList_setDoubleClickCallback (GuiList me, GuiList_DoubleClickCallback callback, Thing boss);
 void GuiList_setScrollCallback (GuiList me, GuiList_ScrollCallback callback, Thing boss);
@@ -865,7 +865,7 @@ typedef MelderCallback <void, structThing /* boss */, GuiTextEvent> GuiText_Chan
 typedef struct _history_entry_s history_entry;
 struct _history_entry_s {
 	history_entry *prev, *next;
-	long first, last;
+	integer first, last;
 	history_data text;
 	bool type_del : 1;
 };
@@ -901,16 +901,16 @@ void GuiText_copy (GuiText me);
 void GuiText_cut (GuiText me);
 char32 * GuiText_getSelection (GuiText me);
 char32 * GuiText_getString (GuiText me);
-char32 * GuiText_getStringAndSelectionPosition (GuiText me, long *first, long *last);
+char32 * GuiText_getStringAndSelectionPosition (GuiText me, integer *first, integer *last);
 void GuiText_paste (GuiText me);
 void GuiText_redo (GuiText me);
 void GuiText_remove (GuiText me);
-void GuiText_replace (GuiText me, long from_pos, long to_pos, const char32 *value);
+void GuiText_replace (GuiText me, integer from_pos, integer to_pos, const char32 *value);
 void GuiText_scrollToSelection (GuiText me);
 void GuiText_setChangedCallback (GuiText me, GuiText_ChangedCallback changedCallback, Thing changedBoss);
 void GuiText_setFontSize (GuiText me, int size);
 void GuiText_setRedoItem (GuiText me, GuiMenuItem item);
-void GuiText_setSelection (GuiText me, long first, long last);
+void GuiText_setSelection (GuiText me, integer first, integer last);
 void GuiText_setString (GuiText me, const char32 *text);
 void GuiText_setUndoItem (GuiText me, GuiMenuItem item);
 void GuiText_undo (GuiText me);
@@ -961,7 +961,7 @@ void GuiObject_destroy (GuiObject me);
 void Gui_setOpenDocumentCallback (void (*openDocumentCallback) (MelderFile file));
 void Gui_setQuitApplicationCallback (int (*quitApplicationCallback) (void));
 
-extern unsigned long theGuiTopLowAccelerators [8];
+extern uinteger theGuiTopLowAccelerators [8];
 
 /* End of file Gui.h */
 #endif
diff --git a/sys/GuiList.cpp b/sys/GuiList.cpp
index 7d6fce6..bc84c48 100644
--- a/sys/GuiList.cpp
+++ b/sys/GuiList.cpp
@@ -294,7 +294,7 @@ void GuiList_deleteAllItems (GuiList me) {
 	#endif
 }
 
-void GuiList_deleteItem (GuiList me, long position) {
+void GuiList_deleteItem (GuiList me, integer position) {
 	Melder_assert (position >= 1);   // so that we can subtract 1 even if the result has to be unsigned
 	GuiControlBlockValueChangedCallbacks block (me);
 	#if gtk
@@ -325,7 +325,7 @@ void GuiList_deselectAllItems (GuiList me) {
 	#endif
 }
 
-void GuiList_deselectItem (GuiList me, long position) {
+void GuiList_deselectItem (GuiList me, integer position) {
 	Melder_assert (position >= 1);   // so that we can subtract 1 even if the result has to be unsigned
 	GuiControlBlockValueChangedCallbacks block (me);
 	#if gtk
@@ -347,18 +347,18 @@ void GuiList_deselectItem (GuiList me, long position) {
 	#endif
 }
 
-long * GuiList_getSelectedPositions (GuiList me, long *numberOfSelectedPositions) {
+integer * GuiList_getSelectedPositions (GuiList me, integer *numberOfSelectedPositions) {
 	*numberOfSelectedPositions = 0;
-	long *selectedPositions = nullptr;
+	integer *selectedPositions = nullptr;
 	#if gtk
 		GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (my d_widget));
 		GtkListStore *list_store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (my d_widget)));
 		int n = gtk_tree_selection_count_selected_rows (selection);
 		if (n > 0) {
 			GList *list = gtk_tree_selection_get_selected_rows (selection, (GtkTreeModel **) & list_store);
-			long ipos = 1;
+			integer ipos = 1;
 			*numberOfSelectedPositions = n;
-			selectedPositions = NUMvector <long> (1, *numberOfSelectedPositions);
+			selectedPositions = NUMvector <integer> (1, *numberOfSelectedPositions);
 			Melder_assert (selectedPositions);
 			for (GList *l = g_list_first (list); l != nullptr; l = g_list_next (l)) {
 				gint *index = gtk_tree_path_get_indices ((GtkTreePath *) l -> data);
@@ -385,9 +385,9 @@ long * GuiList_getSelectedPositions (GuiList me, long *numberOfSelectedPositions
 			ListBox_GetSelItems (my d_widget -> window, n, indices);
 		}
 		*numberOfSelectedPositions = n;
-		selectedPositions = NUMvector <long> (1, *numberOfSelectedPositions);
+		selectedPositions = NUMvector <integer> (1, *numberOfSelectedPositions);
 		Melder_assert (selectedPositions);
-		for (long ipos = 1; ipos <= *numberOfSelectedPositions; ipos ++) {
+		for (integer ipos = 1; ipos <= *numberOfSelectedPositions; ipos ++) {
 			selectedPositions [ipos] = indices [ipos - 1] + 1;   // convert from zero-based list of zero-based indices
 		}
 		Melder_free (indices);
@@ -395,7 +395,7 @@ long * GuiList_getSelectedPositions (GuiList me, long *numberOfSelectedPositions
 		GuiCocoaList *list = (GuiCocoaList *) my d_widget;
 		NSIndexSet *indexSet = [list. tableView   selectedRowIndexes];
 		*numberOfSelectedPositions = 0;
-		selectedPositions = NUMvector <long> (1, [indexSet count]);   
+		selectedPositions = NUMvector <integer> (1, [indexSet count]);
 		NSUInteger currentIndex = [indexSet firstIndex];
 		while (currentIndex != NSNotFound) {
 			selectedPositions [++ *numberOfSelectedPositions] = currentIndex + 1;
@@ -405,10 +405,10 @@ long * GuiList_getSelectedPositions (GuiList me, long *numberOfSelectedPositions
 	return selectedPositions;
 }
 
-long GuiList_getBottomPosition (GuiList me) {
+integer GuiList_getBottomPosition (GuiList me) {
 	#if gtk
 		GtkTreePath *path;
-		long position = 1;
+		integer position = 1;
 		if (gtk_tree_view_get_visible_range (GTK_TREE_VIEW (my d_widget), nullptr, & path)) {
 			int *indices = gtk_tree_path_get_indices (path);
 			position = indices ? indices[0] + 1 : 1;
@@ -417,9 +417,9 @@ long GuiList_getBottomPosition (GuiList me) {
 		trace (U"bottom: ", position);
 		return position;
 	#elif motif
-		long bottom = ListBox_GetTopIndex (my d_widget -> window) + my d_widget -> height / ListBox_GetItemHeight (my d_widget -> window, 0);
+		integer bottom = ListBox_GetTopIndex (my d_widget -> window) + my d_widget -> height / ListBox_GetItemHeight (my d_widget -> window, 0);
 		if (bottom < 1) bottom = 1;
-		long n = ListBox_GetCount (my d_widget -> window);
+		integer n = ListBox_GetCount (my d_widget -> window);
 		if (bottom > n) bottom = n;
 		return bottom;
 	#elif cocoa
@@ -429,8 +429,8 @@ long GuiList_getBottomPosition (GuiList me) {
 	#endif
 }
 
-long GuiList_getNumberOfItems (GuiList me) {
-	long numberOfItems = 0;
+integer GuiList_getNumberOfItems (GuiList me) {
+	integer numberOfItems = 0;
 	#if gtk
 		GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (my d_widget));
 		numberOfItems = gtk_tree_model_iter_n_children (model, nullptr);
@@ -443,10 +443,10 @@ long GuiList_getNumberOfItems (GuiList me) {
 	return numberOfItems;
 }
 
-long GuiList_getTopPosition (GuiList me) {
+integer GuiList_getTopPosition (GuiList me) {
 	#if gtk
 		GtkTreePath *path;
-		long position = 1;
+		integer position = 1;
 		if (gtk_tree_view_get_visible_range (GTK_TREE_VIEW (my d_widget), & path, nullptr)) {
 			int *indices = gtk_tree_path_get_indices (path);
 			position = indices ? indices[0] + 1 : 1;
@@ -455,9 +455,9 @@ long GuiList_getTopPosition (GuiList me) {
 		trace (U"top: ", position);
 		return position;
 	#elif motif
-		long top = ListBox_GetTopIndex (my d_widget -> window);
+		integer top = ListBox_GetTopIndex (my d_widget -> window);
 		if (top < 1) top = 1;
-		long n = ListBox_GetCount (my d_widget -> window);
+		integer n = ListBox_GetCount (my d_widget -> window);
 		if (top > n) top = 0;
 		return top;
 	#elif cocoa
@@ -467,7 +467,7 @@ long GuiList_getTopPosition (GuiList me) {
 	#endif
 }
 
-void GuiList_insertItem (GuiList me, const char32 *itemText /* cattable */, long position_base1) {
+void GuiList_insertItem (GuiList me, const char32 *itemText /* cattable */, integer position_base1) {
 	bool explicitlyInsertAtEnd = ( position_base1 <= 0 );
 	GuiControlBlockValueChangedCallbacks block (me);
 	#if gtk
@@ -491,7 +491,7 @@ void GuiList_insertItem (GuiList me, const char32 *itemText /* cattable */, long
 		if (explicitlyInsertAtEnd) {
 			[[nativeList contents]   addObject: nativeItemText];
 		} else {
-			NSUInteger nativePosition_base0 = (unsigned long) position_base1 - 1;
+			NSUInteger nativePosition_base0 = (uinteger) position_base1 - 1;
 			[[nativeList contents]   insertObject: nativeItemText   atIndex: nativePosition_base0];
 		}
 		[nativeItemText release];
@@ -499,7 +499,7 @@ void GuiList_insertItem (GuiList me, const char32 *itemText /* cattable */, long
 	#endif
 }
 
-void GuiList_replaceItem (GuiList me, const char32 *itemText, long position) {
+void GuiList_replaceItem (GuiList me, const char32 *itemText, integer position) {
 	GuiControlBlockValueChangedCallbacks block (me);
 	#if gtk
 		GtkTreeIter iter;
@@ -516,7 +516,7 @@ void GuiList_replaceItem (GuiList me, const char32 *itemText, long position) {
 		// gtk_list_store_set (list_store, & iter, 0, Melder_peek32to8 (itemText), -1);
 		// TODO: Tekst opsplitsen
 	#elif motif
-		long nativePosition = position - 1;   // convert from 1-based to zero-based
+		integer nativePosition = position - 1;   // convert from 1-based to zero-based
 		ListBox_DeleteString (my d_widget -> window, nativePosition);
 		ListBox_InsertString (my d_widget -> window, nativePosition, Melder_peek32toW (itemText));
 	#elif cocoa
@@ -528,7 +528,7 @@ void GuiList_replaceItem (GuiList me, const char32 *itemText, long position) {
 	#endif
 }
 
-void GuiList_selectItem (GuiList me, long position) {
+void GuiList_selectItem (GuiList me, integer position) {
 	Melder_assert (position >= 1);   // so that we can subtract 1 even if the result has to be unsigned
 	GuiControlBlockValueChangedCallbacks block (me);
 	#if gtk
@@ -572,7 +572,7 @@ void GuiList_setScrollCallback (GuiList me, GuiList_ScrollCallback callback, Thi
 	my d_scrollBoss = boss;
 }
 
-void GuiList_setTopPosition (GuiList me, long topPosition) {
+void GuiList_setTopPosition (GuiList me, integer topPosition) {
 	trace (U"Set top position ", topPosition);
 	#if gtk
 //		GtkListStore *list_store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (my md_widget)));
diff --git a/sys/GuiP.h b/sys/GuiP.h
index bb88dca..3e00382 100644
--- a/sys/GuiP.h
+++ b/sys/GuiP.h
@@ -56,8 +56,8 @@ class GuiControlBlockValueChangedCallbacks {
 
 	class structGuiObject {
 	public:
-		long magicNumber;
-		unsigned long widgetClass;
+		integer magicNumber;
+		uinteger widgetClass;
 		GuiObject parent, previousSibling, nextSibling, firstChild;
 		char32 *name;
 		bool inMenu, nativized, managed, insensitive;
@@ -84,7 +84,7 @@ class GuiControlBlockValueChangedCallbacks {
 			struct { GuiObject horizontalBar, verticalBar, clipWindow, workWindow; } scrolledWindow;
 			struct { XtCallbackList moveCallbacks; } drawingArea;
 			struct { bool active, isDialog, canFullScreen;
-				unsigned long lowAccelerators [8]; XtCallbackProc goAwayCallback; XtPointer goAwayClosure; } shell;
+				uinteger lowAccelerators [8]; XtCallbackProc goAwayCallback; XtPointer goAwayClosure; } shell;
 			struct { unsigned char acceleratorChar; int acceleratorModifiers; } pushButton;
 			struct { int inBar; } cascadeButton;
 			struct { unsigned char acceleratorChar; int acceleratorModifiers; XtCallbackList valueChangedCallbacks; } toggleButton;
@@ -102,8 +102,8 @@ class GuiControlBlockValueChangedCallbacks {
 		GuiObject messageText;   /* For message boxes. */
 		bool autoUnmanage;   /* For bulletin boards. */
 		GuiObject subMenuId, popUpButton;   /* For cascade buttons and their menus. */
-		long increment, pageIncrement, sliderSize;   /* For scroll bars. */
-		long minimum, maximum, value;   /* For scales and scroll bars. */
+		integer increment, pageIncrement, sliderSize;   /* For scroll bars. */
+		integer minimum, maximum, value;   /* For scales and scroll bars. */
 
 		XtCallbackProc activateCallback, destroyCallback;
 		XtPointer activateClosure, destroyClosure;
diff --git a/sys/GuiText.cpp b/sys/GuiText.cpp
index 5e72e25..c809c44 100644
--- a/sys/GuiText.cpp
+++ b/sys/GuiText.cpp
@@ -154,7 +154,7 @@ void _GuiWinText_map (GuiObject widget) {
 	ShowWindow (widget -> window, SW_SHOW);
 }
 
-static long NativeText_getLength (GuiObject widget) {
+static integer NativeText_getLength (GuiObject widget) {
 	return Edit_GetTextLength (widget -> window);   // in UTF-16 code units
 }
 
@@ -162,8 +162,8 @@ static long NativeText_getLength (GuiObject widget) {
  * SELECTION
  */
 
-static int NativeText_getSelectionRange (GuiObject widget, long *out_left, long *out_right) {
-	unsigned long left, right;
+static int NativeText_getSelectionRange (GuiObject widget, integer *out_left, integer *out_right) {
+	uinteger left, right;
 	Melder_assert (MEMBER (widget, Text));
 	SendMessage (widget -> window, EM_GETSEL, (WPARAM) & left, (LPARAM) & right);   // 32-bit (R&N: 579)
 	if (out_left) *out_left = left;
@@ -230,7 +230,7 @@ void _GuiText_exit () {
 	 *  - with the current, if current also is an insert/delete event and the ranges of previous and current event match
 	 *  - with the previous delete and current insert event, in case the ranges of both event-pairs respectively match
 	 */
-	static history_entry * history_addAndMerge (GuiText me, history_data text_new, long first, long last, bool deleted) {
+	static history_entry * history_addAndMerge (GuiText me, history_data text_new, integer first, integer last, bool deleted) {
 		history_entry *he = nullptr;
 		
 		if (! my d_prev)
@@ -269,9 +269,9 @@ void _GuiText_exit () {
 				history_entry *del_one = my d_prev;
 				history_entry *ins_mult = del_one->prev;
 				history_entry *del_mult = ins_mult->prev;
-				long from1 = del_mult->first, to1 = del_mult->last;
-				long from2 = ins_mult->first, to2 = ins_mult->last;
-				long from3 = del_one->first, to3 = del_one->last;
+				integer from1 = del_mult->first, to1 = del_mult->last;
+				integer from2 = ins_mult->first, to2 = ins_mult->last;
+				integer from3 = del_one->first, to3 = del_one->last;
 				if (from3 == first && to3 == last && from2 == from1 && to2 == to1 && to1 == first &&
 						! ins_mult->type_del && del_mult->type_del) {
 					// most common for overwriting text
@@ -303,7 +303,7 @@ void _GuiText_exit () {
 	 *   text_new  a newly allocated string that will be freed by a history function
 	 *             (history_add or history_clear)
 	 */
-	static void history_add (GuiText me, history_data text_new, long first, long last, bool deleted) {
+	static void history_add (GuiText me, history_data text_new, integer first, integer last, bool deleted) {
 
 		// delete all newer entries; from here on there is no 'Redo' until the next 'Undo' is performed
 		history_entry *old_hnext = my d_next, *hnext;
@@ -730,13 +730,13 @@ char32 * GuiText_getSelection (GuiText me) {
 			}
 		}
 	#elif motif
-		long startW, endW;
+		integer startW, endW;
 		NativeText_getSelectionRange (my d_widget, & startW, & endW);
 		if (endW > startW) {   // at least one character selected?
 			/*
 			 * Get all text.
 			 */
-			long lengthW = NativeText_getLength (my d_widget);   // in UTF-16 code units
+			integer lengthW = NativeText_getLength (my d_widget);   // in UTF-16 code units
 			WCHAR *bufferW = Melder_malloc_f (WCHAR, lengthW + 1);
 			GetWindowTextW (my d_widget -> window, bufferW, lengthW + 1);
 			/*
@@ -750,9 +750,9 @@ char32 * GuiText_getSelection (GuiText me) {
 			return result;
 		}
 	#elif cocoa
-		long start, end;
+		integer start, end;
 		autostring32 selection = GuiText_getStringAndSelectionPosition (me, & start, & end);
-		long length = end - start;
+		integer length = end - start;
 		if (length > 0) {
 			char32 *result = Melder_malloc_f (char32, length + 1);
 			memcpy (result, & selection [start], length * sizeof (char32));
@@ -765,11 +765,11 @@ char32 * GuiText_getSelection (GuiText me) {
 }
 
 char32 * GuiText_getString (GuiText me) {
-	long first, last;
+	integer first, last;
 	return GuiText_getStringAndSelectionPosition (me, & first, & last);
 }
 
-char32 * GuiText_getStringAndSelectionPosition (GuiText me, long *first, long *last) {
+char32 * GuiText_getStringAndSelectionPosition (GuiText me, integer *first, integer *last) {
 	#if gtk
 		if (G_OBJECT_TYPE (G_OBJECT (my d_widget)) == GTK_TYPE_ENTRY) {
 			gint first_gint, last_gint;
@@ -792,21 +792,21 @@ char32 * GuiText_getStringAndSelectionPosition (GuiText me, long *first, long *l
 		}
 		return nullptr;
 	#elif motif
-		long lengthW = NativeText_getLength (my d_widget);
+		integer lengthW = NativeText_getLength (my d_widget);
 		WCHAR *bufferW = Melder_malloc_f (WCHAR, lengthW + 1);
 		GetWindowTextW (my d_widget -> window, bufferW, lengthW + 1);
-		long firstW, lastW;
+		integer firstW, lastW;
 		NativeText_getSelectionRange (my d_widget, & firstW, & lastW);
 
-		long differenceFirst = 0;
-		for (long i = 0; i < firstW; i ++) {
+		integer differenceFirst = 0;
+		for (integer i = 0; i < firstW; i ++) {
 			if (bufferW [i] == 13 && (bufferW [i + 1] == L'\n' || bufferW [i + 1] == 0x0085)) differenceFirst ++;
 			if (bufferW [i] >= 0xDC00 && bufferW [i] <= 0xDFFF) differenceFirst ++;
 		}
 		*first = firstW - differenceFirst;
 
-		long differenceLast = differenceFirst;
-		for (long i = firstW; i < lastW; i ++) {
+		integer differenceLast = differenceFirst;
+		for (integer i = firstW; i < lastW; i ++) {
 			if (bufferW [i] == 13 && (bufferW [i + 1] == L'\n' || bufferW [i + 1] == 0x0085)) differenceLast ++;
 			if (bufferW [i] >= 0xDC00 && bufferW [i] <= 0xDFFF) differenceLast ++;
 		}
@@ -824,8 +824,8 @@ char32 * GuiText_getStringAndSelectionPosition (GuiText me, long *first, long *l
 			NSRange nsRange = [my d_cocoaTextView   selectedRange];
 			*first = nsRange. location;
 			*last = *first + nsRange. length;
-			for (long i = 0; i < *first; i ++) if (result [i] > 0xFFFF) { (*first) --; (*last) --; }
-			for (long i = *first; i < *last; i ++) if (result [i] > 0xFFFF) { (*last) --; }
+			for (integer i = 0; i < *first; i ++) if (result [i] > 0xFFFF) { (*first) --; (*last) --; }
+			for (integer i = *first; i < *last; i ++) if (result [i] > 0xFFFF) { (*last) --; }
 			return result;
 		} else {
 			NSString *nsString = [(NSTextField *) my d_widget   stringValue];
@@ -834,8 +834,8 @@ char32 * GuiText_getStringAndSelectionPosition (GuiText me, long *first, long *l
 			NSRange nsRange = [[[(NSTextField *) my d_widget   window] fieldEditor: NO forObject: nil] selectedRange];
 			*first = nsRange. location;
 			*last = *first + nsRange. length;
-			for (long i = 0; i < *first; i ++) if (result [i] > 0xFFFF) { (*first) --; (*last) --; }
-			for (long i = *first; i < *last; i ++) if (result [i] > 0xFFFF) { (*last) --; }
+			for (integer i = 0; i < *first; i ++) if (result [i] > 0xFFFF) { (*first) --; (*last) --; }
+			for (integer i = *first; i < *last; i ++) if (result [i] > 0xFFFF) { (*last) --; }
 			return result;
 		}
 	#else
@@ -894,7 +894,7 @@ void GuiText_remove (GuiText me) {
 	#endif
 }
 
-void GuiText_replace (GuiText me, long from_pos, long to_pos, const char32 *text) {
+void GuiText_replace (GuiText me, integer from_pos, integer to_pos, const char32 *text) {
 	#if gtk
 		gchar *newText = Melder_peek32to8 (text);
 		if (G_OBJECT_TYPE (G_OBJECT (my d_widget)) == GTK_TYPE_ENTRY) {
@@ -931,11 +931,11 @@ void GuiText_replace (GuiText me, long from_pos, long to_pos, const char32 *text
 		UpdateWindow (my d_widget -> window);
 	#elif cocoa
 		if (my d_cocoaTextView) {
-			long numberOfLeadingHighUnicodeValues = 0, numberOfSelectedHighUnicodeValues = 0;
+			integer numberOfLeadingHighUnicodeValues = 0, numberOfSelectedHighUnicodeValues = 0;
 			{// scope
 				autostring32 oldText = GuiText_getString (me);
-				for (long i = 0; i < from_pos; i ++) if (oldText [i] > 0xFFFF) numberOfLeadingHighUnicodeValues ++;
-				for (long i = from_pos; i < to_pos; i ++) if (oldText [i] > 0xFFFF) numberOfSelectedHighUnicodeValues ++;
+				for (integer i = 0; i < from_pos; i ++) if (oldText [i] > 0xFFFF) numberOfLeadingHighUnicodeValues ++;
+				for (integer i = from_pos; i < to_pos; i ++) if (oldText [i] > 0xFFFF) numberOfSelectedHighUnicodeValues ++;
 			}
 			from_pos += numberOfLeadingHighUnicodeValues;
 			to_pos += numberOfLeadingHighUnicodeValues + numberOfSelectedHighUnicodeValues;
@@ -985,7 +985,7 @@ void GuiText_setFontSize (GuiText me, int size) {
 		gtk_widget_modify_style (GTK_WIDGET (my d_widget), modStyle);
 	#elif motif
 		// a trick to update the window. BUG: why doesn't UpdateWindow seem to suffice?
-		long first, last;
+		integer first, last;
 		char32 *text = GuiText_getStringAndSelectionPosition (me, & first, & last);
 		GuiText_setString (me, U"");   // erase all
 		UpdateWindow (my d_widget -> window);
@@ -1025,7 +1025,7 @@ void GuiText_setRedoItem (GuiText me, GuiMenuItem item) {
 	#endif
 }
 
-void GuiText_setSelection (GuiText me, long first, long last) {
+void GuiText_setSelection (GuiText me, integer first, integer last) {
 	if (my d_widget) {
 	#if gtk
 		if (G_OBJECT_TYPE (G_OBJECT (my d_widget)) == GTK_TYPE_ENTRY) {
@@ -1041,22 +1041,22 @@ void GuiText_setSelection (GuiText me, long first, long last) {
 		char32 *text = GuiText_getString (me);
 		if (first < 0) first = 0;
 		if (last < 0) last = 0;
-		long length = str32len (text);
+		integer length = str32len (text);
 		if (first >= length) first = length;
 		if (last >= length) last = length;
 		/*
 		 * 'first' and 'last' are the positions of the selection in the text when separated by LF alone.
 		 * We have to convert this to the positions that the selection has in a text separated by CR/LF sequences.
 		 */
-		long numberOfLeadingLineBreaks = 0, numberOfSelectedLineBreaks = 0;
-		for (long i = 0; i < first; i ++) if (text [i] == U'\n') numberOfLeadingLineBreaks ++;
-		for (long i = first; i < last; i ++) if (text [i] == U'\n') numberOfSelectedLineBreaks ++;
+		integer numberOfLeadingLineBreaks = 0, numberOfSelectedLineBreaks = 0;
+		for (integer i = 0; i < first; i ++) if (text [i] == U'\n') numberOfLeadingLineBreaks ++;
+		for (integer i = first; i < last; i ++) if (text [i] == U'\n') numberOfSelectedLineBreaks ++;
 		/*
 		 * On Windows, characters are counted in UTF-16 units, whereas 'first' and 'last' are in UTF-32 units. Convert.
 		 */
-		long numberOfLeadingHighUnicodeValues = 0, numberOfSelectedHighUnicodeValues = 0;
-		for (long i = 0; i < first; i ++) if (text [i] > 0xFFFF) numberOfLeadingHighUnicodeValues ++;
-		for (long i = first; i < last; i ++) if (text [i] > 0xFFFF) numberOfSelectedHighUnicodeValues ++;
+		integer numberOfLeadingHighUnicodeValues = 0, numberOfSelectedHighUnicodeValues = 0;
+		for (integer i = 0; i < first; i ++) if (text [i] > 0xFFFF) numberOfLeadingHighUnicodeValues ++;
+		for (integer i = first; i < last; i ++) if (text [i] > 0xFFFF) numberOfSelectedHighUnicodeValues ++;
 
 		first += numberOfLeadingLineBreaks;
 		last += numberOfLeadingLineBreaks + numberOfSelectedLineBreaks;
@@ -1071,9 +1071,9 @@ void GuiText_setSelection (GuiText me, long first, long last) {
 		 * On Cocoa, characters are counted in UTF-16 units, whereas 'first' and 'last' are in UTF-32 units. Convert.
 		 */
 		char32 *text = GuiText_getString (me);
-		long numberOfLeadingHighUnicodeValues = 0, numberOfSelectedHighUnicodeValues = 0;
-		for (long i = 0; i < first; i ++) if (text [i] > 0xFFFF) numberOfLeadingHighUnicodeValues ++;
-		for (long i = first; i < last; i ++) if (text [i] > 0xFFFF) numberOfSelectedHighUnicodeValues ++;
+		integer numberOfLeadingHighUnicodeValues = 0, numberOfSelectedHighUnicodeValues = 0;
+		for (integer i = 0; i < first; i ++) if (text [i] > 0xFFFF) numberOfLeadingHighUnicodeValues ++;
+		for (integer i = first; i < last; i ++) if (text [i] > 0xFFFF) numberOfSelectedHighUnicodeValues ++;
 		first += numberOfLeadingHighUnicodeValues;
 		last += numberOfLeadingHighUnicodeValues + numberOfSelectedHighUnicodeValues;
 		Melder_free (text);
diff --git a/sys/GuiWindow.cpp b/sys/GuiWindow.cpp
index 65eeb85..b0e9d82 100644
--- a/sys/GuiWindow.cpp
+++ b/sys/GuiWindow.cpp
@@ -175,7 +175,7 @@ GuiWindow GuiWindow_create (int x, int y, int width, int height, int minimumWidt
 	return me.releaseToAmbiguousOwner();
 }
 
-unsigned long theGuiTopLowAccelerators [8];
+uinteger theGuiTopLowAccelerators [8];
 
 void GuiWindow_addMenuBar (GuiWindow me) {
 	#if gtk
diff --git a/sys/HyperPage.cpp b/sys/HyperPage.cpp
index 8310da9..146c2f2 100644
--- a/sys/HyperPage.cpp
+++ b/sys/HyperPage.cpp
@@ -146,10 +146,10 @@ void HyperPage_initSheetOfPaper (HyperPage me) {
 static void updateVerticalScrollBar (HyperPage me);
 
 void HyperPage_any (HyperPage me, const char32 *text, kGraphics_font font, int size, int style, double minFooterDistance,
-	double x, double secondIndent, double topSpacing, double bottomSpacing, unsigned long method)
+	double x, double secondIndent, double topSpacing, double bottomSpacing, uint32 method)
 {
 	if (my rightMargin == 0) return;   // no infinite heights please
-	double heightGuess = size * (1.2/72) * ((long) size * str32len (text) / (int) (my rightMargin * 150));
+	double heightGuess = size * (1.2/72) * ((integer) size * str32len (text) / (int) (my rightMargin * 150));
 
 if (! my printing) {
 	Graphics_Link *paragraphLinks;
@@ -394,7 +394,7 @@ if (! my printing) {
 		Graphics_setFontSize (my graphics.get(), size);
 		my d_x = true_width_inches > my rightMargin ? 0.0 : 0.5 * (my rightMargin - true_width_inches);
 		Graphics_setWrapWidth (my graphics.get(), 0.0);
-		long x1DCold, x2DCold, y1DCold, y2DCold;
+		integer x1DCold, x2DCold, y1DCold, y2DCold;
 		Graphics_inqWsViewport (my graphics.get(), & x1DCold, & x2DCold, & y1DCold, & y2DCold);
 		double x1NDCold, x2NDCold, y1NDCold, y2NDCold;
 		Graphics_inqWsWindow (my graphics.get(), & x1NDCold, & x2NDCold, & y1NDCold, & y2NDCold);
@@ -422,7 +422,7 @@ if (! my printing) {
 
 			Graphics_setViewport (my graphics.get(), theCurrentPraatPicture -> x1NDC, theCurrentPraatPicture -> x2NDC, theCurrentPraatPicture -> y1NDC, theCurrentPraatPicture -> y2NDC);
 			Graphics_setWindow (my graphics.get(), 0.0, 1.0, 0.0, 1.0);
-			long x1DC, y1DC, x2DC, y2DC;
+			integer x1DC, y1DC, x2DC, y2DC;
 			Graphics_WCtoDC (my graphics.get(), 0.0, 0.0, & x1DC, & y2DC);
 			Graphics_WCtoDC (my graphics.get(), 1.0, 1.0, & x2DC, & y1DC);
 			Graphics_resetWsViewport (my graphics.get(), x1DC, x2DC, y1DC, y2DC);
@@ -457,8 +457,8 @@ if (! my printing) {
 			Graphics_setSpeckleSize (my graphics.get(), 1.0);
 			Graphics_setColour (my graphics.get(), Graphics_BLACK);
 			/*Graphics_Link *paragraphLinks;
-			long numberOfParagraphLinks = Graphics_getLinks (& paragraphLinks);
-			if (my links) for (long ilink = 1; ilink <= numberOfParagraphLinks; ilink ++) {
+			integer numberOfParagraphLinks = Graphics_getLinks (& paragraphLinks);
+			if (my links) for (integer ilink = 1; ilink <= numberOfParagraphLinks; ilink ++) {
 				autoHyperLink link = HyperLink_create (paragraphLinks [ilink]. name,
 					paragraphLinks [ilink]. x1, paragraphLinks [ilink]. x2,
 					paragraphLinks [ilink]. y1, paragraphLinks [ilink]. y2);
@@ -491,7 +491,7 @@ if (! my printing) {
 	my d_x = 3.7 - 0.5 * true_width_inches;
 	if (my d_x < 0) my d_x = 0;
 	Graphics_setWrapWidth (my ps, 0);
-	long x1DCold, x2DCold, y1DCold, y2DCold;
+	integer x1DCold, x2DCold, y1DCold, y2DCold;
 	Graphics_inqWsViewport (my ps, & x1DCold, & x2DCold, & y1DCold, & y2DCold);
 	double x1NDCold, x2NDCold, y1NDCold, y2NDCold;
 	Graphics_inqWsWindow (my ps, & x1NDCold, & x2NDCold, & y1NDCold, & y2NDCold);
@@ -519,10 +519,10 @@ if (! my printing) {
 
 		Graphics_setViewport (my ps, theCurrentPraatPicture -> x1NDC, theCurrentPraatPicture -> x2NDC, theCurrentPraatPicture -> y1NDC, theCurrentPraatPicture -> y2NDC);
 		Graphics_setWindow (my ps, 0.0, 1.0, 0.0, 1.0);
-		long x1DC, y1DC, x2DC, y2DC;
+		integer x1DC, y1DC, x2DC, y2DC;
 		Graphics_WCtoDC (my ps, 0.0, 0.0, & x1DC, & y2DC);
 		Graphics_WCtoDC (my ps, 1.0, 1.0, & x2DC, & y1DC);
-		long shift = (long) (Graphics_getResolution (my ps) * true_height_inches) + (y1DCold - y2DCold);
+		integer shift = (integer) (Graphics_getResolution (my ps) * true_height_inches) + (y1DCold - y2DCold);
 		#if cocoa
 			shift = 0;   // this is a FIX
 		#endif
@@ -614,7 +614,7 @@ static void gui_drawingarea_cb_expose (HyperPage me, GuiDrawingArea_ExposeEvent
 
 static void gui_drawingarea_cb_click (HyperPage me, GuiDrawingArea_ClickEvent event) {
 	if (! my graphics) return;   // could be the case in the very beginning
-	for (long ilink = 1; ilink <= my links.size; ilink ++) {
+	for (integer ilink = 1; ilink <= my links.size; ilink ++) {
 		HyperLink link = my links.at [ilink];
 		if (! link)
 			Melder_fatal (U"gui_drawingarea_cb_click: empty link ", ilink, U"/", my links.size, U".");
@@ -647,41 +647,31 @@ static void menu_cb_pageSetup (HyperPage me, EDITOR_ARGS_DIRECT) {
 
 static void menu_cb_print (HyperPage me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Print", nullptr)
-		SENTENCE (U"Left or inside header", U"")
-		SENTENCE (U"Middle header", U"")
-		LABEL (U"", U"Right or outside header:")
-		TEXTFIELD (U"Right or outside header", U"")
-		SENTENCE (U"Left or inside footer", U"")
-		SENTENCE (U"Middle footer", U"")
-		SENTENCE (U"Right or outside footer", U"")
-		BOOLEAN (U"Mirror even/odd headers", true)
-		INTEGER (U"First page number", U"0 (= no page numbers)")
+		SENTENCE_FIELD (my insideHeader, U"Left or inside header", U"")
+		SENTENCE_FIELD (my middleHeader, U"Middle header", U"")
+		TEXTFIELD_FIELD (my outsideHeader, U"Right or outside header", U"")
+		SENTENCE_FIELD (my insideFooter, U"Left or inside footer", U"")
+		SENTENCE_FIELD (my middleFooter, U"Middle footer", U"")
+		SENTENCE_FIELD (my outsideFooter, U"Right or outside footer", U"")
+		BOOLEAN_FIELD (my mirror, U"Mirror even/odd headers", true)
+		INTEGER_FIELD (my d_printingPageNumber, U"First page number", U"0 (= no page numbers)")
 	EDITOR_OK
 		my v_defaultHeaders (cmd);
-		if (my d_printingPageNumber) SET_INTEGER (U"First page number", my d_printingPageNumber + 1)
+		if (my d_printingPageNumber != 0) SET_INTEGER (my d_printingPageNumber, my d_printingPageNumber + 1)
 	EDITOR_DO
-		my insideHeader = GET_STRING (U"Left or inside header");
-		my middleHeader = GET_STRING (U"Middle header");
-		my outsideHeader = GET_STRING (U"Right or outside header");
-		my insideFooter = GET_STRING (U"Left or inside footer");
-		my middleFooter = GET_STRING (U"Middle footer");
-		my outsideFooter = GET_STRING (U"Right or outside footer");
-		my mirror = GET_INTEGER (U"Mirror even/odd headers");
-		my d_printingPageNumber = GET_INTEGER (U"First page number");
 		Printer_print (print, me);
 	EDITOR_END
 }
 
 static void menu_cb_font (HyperPage me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Font", nullptr)
-		RADIO (U"Font", 1)
+		RADIO (font, U"Font", 1)
 			RADIOBUTTON (U"Times")
 			RADIOBUTTON (U"Helvetica")
 	EDITOR_OK
-		SET_INTEGER (U"Font", my p_font == kGraphics_font::TIMES ? 1 :
+		SET_OPTION (font, my p_font == kGraphics_font::TIMES ? 1 :
 				my p_font == kGraphics_font::HELVETICA ? 2 : my p_font == kGraphics_font::PALATINO ? 3 : 1);
 	EDITOR_DO
-		int font = GET_INTEGER (U"Font");
 		my pref_font () = my p_font = font == 1 ? kGraphics_font::TIMES : kGraphics_font::HELVETICA;
 		if (my graphics) Graphics_updateWs (my graphics.get());
 	EDITOR_END
@@ -708,20 +698,20 @@ static void menu_cb_24 (HyperPage me, EDITOR_ARGS_DIRECT) { setFontSize (me, 24)
 
 static void menu_cb_fontSize (HyperPage me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Font size", nullptr)
-		NATURAL (U"Font size (points)", my default_fontSize ())
+		NATURAL (fontSize, U"Font size (points)", my default_fontSize ())
 	EDITOR_OK
-		SET_INTEGER (U"Font size", my p_fontSize)
+		SET_INTEGER (fontSize, my p_fontSize)
 	EDITOR_DO
-		setFontSize (me, GET_INTEGER (U"Font size"));
+		setFontSize (me, fontSize);
 	EDITOR_END
 }
 
 static void menu_cb_searchForPage (HyperPage me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Search for page", nullptr)
-		TEXTFIELD (U"Page", U"a")
+		TEXTFIELD (page, U"Page:", U"a")
 	EDITOR_OK
 	EDITOR_DO
-		HyperPage_goToPage (me, GET_STRING (U"Page"));   // BUG
+		HyperPage_goToPage (me, page);
 	EDITOR_END
 }
 
@@ -887,7 +877,7 @@ static void gui_button_cb_previousPage (HyperPage me, GuiButtonEvent /* event */
 }
 
 static void gui_button_cb_nextPage (HyperPage me, GuiButtonEvent /* event */) {
-	long currentPageNumber = my v_getCurrentPageNumber ();
+	integer currentPageNumber = my v_getCurrentPageNumber ();
 	HyperPage_goToPage_i (me, currentPageNumber < my v_getNumberOfPages () ? currentPageNumber + 1 : 1);
 }
 
@@ -972,7 +962,7 @@ int HyperPage_goToPage (HyperPage me, const char32 *title) {
 	return 1;	
 }
 
-void HyperPage_goToPage_i (HyperPage me, long i) {
+void HyperPage_goToPage_i (HyperPage me, integer i) {
 	my v_goToPage_i (i);   // catch -> HyperPage_clear (me); ?
 	my top = 0;
 	HyperPage_clear (me);
diff --git a/sys/HyperPage.h b/sys/HyperPage.h
index 357faa5..42f444f 100644
--- a/sys/HyperPage.h
+++ b/sys/HyperPage.h
@@ -2,7 +2,7 @@
 #define _HyperPage_h_
 /* HyperPage.h
  *
- * Copyright (C) 1992-2011,2012,2014,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2012,2014,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -35,10 +35,10 @@ Thing_define (HyperPage, Editor) {
 	autoGraphics graphics;
 	Graphics ps;
 	double d_x, d_y, rightMargin, previousBottomSpacing;
-	long d_printingPageNumber;
+	integer d_printingPageNumber;
 	CollectionOf<structHyperLink> links;
-	bool printing;
-	int top, mirror;
+	bool printing, mirror;
+	int top;
 	char32 *insideHeader, *middleHeader, *outsideHeader;
 	char32 *insideFooter, *middleFooter, *outsideFooter;
 	char32 *entryHint; double entryPosition;
@@ -62,10 +62,10 @@ Thing_define (HyperPage, Editor) {
 		override;
 
 	virtual void v_draw () { }
-	virtual long v_getNumberOfPages () { return 0; }
-	virtual long v_getCurrentPageNumber () { return 0; }
+	virtual integer v_getNumberOfPages () { return 0; }
+	virtual integer v_getCurrentPageNumber () { return 0; }
 	virtual int v_goToPage (const char32 * /* title */) { return 0; }
-	virtual void v_goToPage_i (long /* pageNumber */) { }
+	virtual void v_goToPage_i (integer /* pageNumber */) { }
 	virtual void v_defaultHeaders (EditorCommand /* cmd */) { }
 	virtual bool v_hasHistory () { return false; }
 	virtual bool v_isOrdered () { return false; }
@@ -80,7 +80,7 @@ void HyperPage_clear (HyperPage me);
 #define HyperPage_USE_ENTRY_HINT  2
 
 void HyperPage_any (HyperPage me, const char32 *text, kGraphics_font font, int size, int style, double minFooterDistance,
-	double x, double secondIndent, double topSpacing, double bottomSpacing, unsigned long method);
+	double x, double secondIndent, double topSpacing, double bottomSpacing, uint32 method);
 void HyperPage_pageTitle (HyperPage me, const char32 *title);
 void HyperPage_intro (HyperPage me, const char32 *text);
 void HyperPage_entry (HyperPage me, const char32 *title);
@@ -109,7 +109,7 @@ void HyperPage_picture (HyperPage me, double width_inches, double height_inches,
 void HyperPage_script (HyperPage me, double width_inches, double height_inches, const char32 *script);
 
 int HyperPage_goToPage (HyperPage me, const char32 *title);
-void HyperPage_goToPage_i (HyperPage me, long i);
+void HyperPage_goToPage_i (HyperPage me, integer i);
 
 void HyperPage_init (HyperPage me, const char32 *title, Daata data);
 
diff --git a/sys/Interpreter.cpp b/sys/Interpreter.cpp
index 1c83df8..0e6a42a 100644
--- a/sys/Interpreter.cpp
+++ b/sys/Interpreter.cpp
@@ -108,12 +108,12 @@ autoInterpreter Interpreter_createFromEnvironment (Editor editor) {
 void Melder_includeIncludeFiles (char32 **text) {
 	for (int depth = 0; ; depth ++) {
 		char32 *head = *text;
-		long numberOfIncludes = 0;
+		integer numberOfIncludes = 0;
 		if (depth > 10)
 			Melder_throw (U"Include files nested too deep. Probably cyclic.");
 		for (;;) {
 			char32 *includeLocation, *includeFileName, *tail, *newText;
-			long headLength, includeTextLength, newLength;
+			integer headLength, includeTextLength, newLength;
 			/*
 				Look for an include statement. If not found, we have finished.
 			 */
@@ -176,9 +176,9 @@ inline static bool Melder_isblank (char32 kar) {
 	return kar == U' ' || kar == U'\t';
 }
 
-long Interpreter_readParameters (Interpreter me, char32 *text) {
+integer Interpreter_readParameters (Interpreter me, char32 *text) {
 	char32 *formLocation = nullptr;
-	long npar = 0;
+	integer npar = 0;
 	my dialogTitle [0] = U'\0';
 	/*
 	 * Look for a "form" line.
@@ -293,7 +293,7 @@ UiForm Interpreter_createForm (Interpreter me, GuiWindow parent, const char32 *p
 		Melder_cat (selectionOnly ? U"Run script (selection only): " : U"Run script: ", my dialogTitle),
 		okCallback, okClosure, nullptr, nullptr);
 	UiField radio = nullptr;
-	if (path) UiForm_addText (form, U"$file", path);
+	if (path) UiForm_addText (form, nullptr, nullptr, U"$file", path);
 	for (int ipar = 1; ipar <= my numberOfParameters; ipar ++) {
 		/*
 		 * Convert underscores to spaces.
@@ -303,35 +303,35 @@ UiForm Interpreter_createForm (Interpreter me, GuiWindow parent, const char32 *p
 		while (*p) { if (*p == U'_') *p = U' '; p ++; }
 		switch (my types [ipar]) {
 			case Interpreter_WORD:
-				UiForm_addWord (form, parameter, my arguments [ipar]); break;
+				UiForm_addWord (form, nullptr, nullptr, parameter, my arguments [ipar]); break;
 			case Interpreter_REAL:
-				UiForm_addReal (form, parameter, my arguments [ipar]); break;
+				UiForm_addReal (form, nullptr, nullptr, parameter, my arguments [ipar]); break;   // TODO: an address of a real variable
 			case Interpreter_POSITIVE:
-				UiForm_addPositive (form, parameter, my arguments [ipar]); break;
+				UiForm_addPositive (form, nullptr, nullptr, parameter, my arguments [ipar]); break;
 			case Interpreter_INTEGER:
-				UiForm_addInteger (form, parameter, my arguments [ipar]); break;
+				UiForm_addInteger (form, nullptr, nullptr, parameter, my arguments [ipar]); break;
 			case Interpreter_NATURAL:
-				UiForm_addNatural (form, parameter, my arguments [ipar]); break;
+				UiForm_addNatural (form, nullptr, nullptr, parameter, my arguments [ipar]); break;
 			case Interpreter_BOOLEAN:
-				UiForm_addBoolean (form, parameter, my arguments [ipar] [0] == U'1' ||
+				UiForm_addBoolean (form, nullptr, nullptr, parameter, my arguments [ipar] [0] == U'1' ||
 					my arguments [ipar] [0] == U'y' || my arguments [ipar] [0] == U'Y' ||
 					(my arguments [ipar] [0] == U'o' && my arguments [ipar] [1] == U'n')); break;
 			case Interpreter_SENTENCE:
-				UiForm_addSentence (form, parameter, my arguments [ipar]); break;
+				UiForm_addSentence (form, nullptr, nullptr, parameter, my arguments [ipar]); break;
 			case Interpreter_TEXT:
-				UiForm_addText (form, parameter, my arguments [ipar]); break;
+				UiForm_addText (form, nullptr, nullptr, parameter, my arguments [ipar]); break;
 			case Interpreter_CHOICE:
-				radio = UiForm_addRadio (form, parameter, Melder_atoi (my arguments [ipar])); break;
+				radio = UiForm_addRadio (form, nullptr, nullptr, nullptr, parameter, Melder_atoi (my arguments [ipar]), 1); break;
 			case Interpreter_OPTIONMENU:
-				radio = UiForm_addOptionMenu (form, parameter, Melder_atoi (my arguments [ipar])); break;
+				radio = UiForm_addOptionMenu (form, nullptr, nullptr, nullptr, parameter, Melder_atoi (my arguments [ipar]), 1); break;
 			case Interpreter_BUTTON:
 				if (radio) UiRadio_addButton (radio, my arguments [ipar]); break;
 			case Interpreter_OPTION:
 				if (radio) UiOptionMenu_addButton (radio, my arguments [ipar]); break;
 			case Interpreter_COMMENT:
-				UiForm_addLabel (form, parameter, my arguments [ipar]); break;
+				UiForm_addLabel (form, nullptr, my arguments [ipar]); break;
 			default:
-				UiForm_addWord (form, parameter, my arguments [ipar]); break;
+				UiForm_addWord (form, nullptr, nullptr, parameter, my arguments [ipar]); break;
 		}
 		/*
 		 * Strip parentheses and colon off parameter name.
@@ -376,7 +376,7 @@ void Interpreter_getArgumentsFromDialog (Interpreter me, UiForm dialog) {
 			case Interpreter_INTEGER:
 			case Interpreter_NATURAL:
 			case Interpreter_BOOLEAN: {
-				long value = UiForm_getInteger (dialog, parameter);
+				integer value = UiForm_getInteger (dialog, parameter);
 				Melder_free (my arguments [ipar]);
 				my arguments [ipar] = Melder_calloc_f (char32, 40);
 				Melder_sprint (my arguments [ipar],40, value);
@@ -384,7 +384,7 @@ void Interpreter_getArgumentsFromDialog (Interpreter me, UiForm dialog) {
 			}
 			case Interpreter_CHOICE:
 			case Interpreter_OPTIONMENU: {
-				long integerValue = 0;
+				integer integerValue = 0;
 				char32 *stringValue = nullptr;
 				integerValue = UiForm_getInteger (dialog, parameter);
 				stringValue = UiForm_getString (dialog, parameter);
@@ -410,7 +410,7 @@ void Interpreter_getArgumentsFromDialog (Interpreter me, UiForm dialog) {
 
 void Interpreter_getArgumentsFromString (Interpreter me, const char32 *arguments) {
 	int size = my numberOfParameters;
-	long length = str32len (arguments);
+	integer length = str32len (arguments);
 	while (size >= 1 && my parameters [size] [0] == U'\0')
 		size --;   /* Ignore fields without a variable name (button, comment). */
 	for (int ipar = 1; ipar <= size; ipar ++) {
@@ -650,8 +650,8 @@ InterpreterVariable Interpreter_lookUpVariable (Interpreter me, const char32 *ke
 	return variable_ref;
 }
 
-static long lookupLabel (Interpreter me, const char32 *labelName) {
-	for (long ilabel = 1; ilabel <= my numberOfLabels; ilabel ++)
+static integer lookupLabel (Interpreter me, const char32 *labelName) {
+	for (integer ilabel = 1; ilabel <= my numberOfLabels; ilabel ++)
 		if (str32equ (labelName, my labelNames [ilabel]))
 			return ilabel;
 	Melder_throw (U"Unknown label \"", labelName, U"\".");
@@ -921,7 +921,7 @@ inline static void NumericMatrixVariable_divide (InterpreterVariable variable, n
 }
 
 static void Interpreter_do_procedureCall (Interpreter me, char32 *command,
-	char32 **lines, integer numberOfLines, long& lineNumber, long callStack [], int& callDepth)
+	char32 **lines, integer numberOfLines, integer& lineNumber, integer callStack [], int& callDepth)
 {
 	/*
 		Modern type of procedure calls, with comma separation, quoted strings, and array support.
@@ -1065,7 +1065,7 @@ static void Interpreter_do_procedureCall (Interpreter me, char32 *command,
 	if (iline > numberOfLines) Melder_throw (U"Procedure \"", callName, U"\" not found.");
 }
 static void Interpreter_do_oldProcedureCall (Interpreter me, char32 *command,
-	char32 **lines, integer numberOfLines, long& lineNumber, long callStack [], int& callDepth)
+	char32 **lines, integer numberOfLines, integer& lineNumber, integer callStack [], int& callDepth)
 {
 	/*
 		Old type of procedure calls, with space separation, unquoted strings, and no array support.
@@ -1162,7 +1162,7 @@ static void Interpreter_do_oldProcedureCall (Interpreter me, char32 *command,
 }
 
 static void assignToNumericVectorElement (Interpreter me, char32 *& p, const char32* vectorName, MelderString& valueString) {
-	long indexValue = 0;
+	integer indexValue = 0;
 	static MelderString index { };
 	MelderString_empty (& index);
 	int depth = 0;
@@ -1237,7 +1237,7 @@ static void assignToNumericVectorElement (Interpreter me, char32 *& p, const cha
 }
 
 static void assignToNumericMatrixElement (Interpreter me, char32 *& p, const char32* matrixName, MelderString& valueString) {
-	long rowNumber = 0, columnNumber = 0;
+	integer rowNumber = 0, columnNumber = 0;
 	/*
 		Get the row number.
 	*/
@@ -1346,7 +1346,7 @@ static void assignToNumericMatrixElement (Interpreter me, char32 *& p, const cha
 
 void Interpreter_run (Interpreter me, char32 *text) {
 	autoNUMvector <char32 *> lines;   // not autostringvector, because the elements are reference copies
-	long lineNumber = 0;
+	integer lineNumber = 0;
 	bool assertionFailed = false;
 	try {
 		static MelderString valueString { };   // to divert the info
@@ -1354,7 +1354,7 @@ void Interpreter_run (Interpreter me, char32 *text) {
 		char32 *command = text;
 		autoMelderString command2;
 		autoMelderString buffer;
-		long numberOfLines = 0, assertErrorLineNumber = 0, callStack [1 + Interpreter_MAX_CALL_DEPTH];
+		integer numberOfLines = 0, assertErrorLineNumber = 0, callStack [1 + Interpreter_MAX_CALL_DEPTH];
 		bool atLastLine = false, fromif = false, fromendfor = false;
 		int callDepth = 0, chopped = 0, ipar;
 		my callDepth = 0;
@@ -1594,7 +1594,7 @@ void Interpreter_run (Interpreter me, char32 *text) {
 								/* Ignore. */
 							} else if (str32nequ (command2.string, U"endfor", 6) && wordEnd (command2.string [6])) {
 								int depth = 0;
-								long iline;
+								integer iline;
 								for (iline = lineNumber - 1; iline > 0; iline --) {
 									char32 *line = lines [iline];
 									if (line [0] == U'f' && line [1] == U'o' && line [2] == U'r' && line [3] == U' ') {
@@ -1607,7 +1607,7 @@ void Interpreter_run (Interpreter me, char32 *text) {
 								if (iline <= 0) Melder_throw (U"Unmatched 'endfor'.");
 							} else if (str32nequ (command2.string, U"endwhile", 8) && wordEnd (command2.string [8])) {
 								int depth = 0;
-								long iline;
+								integer iline;
 								for (iline = lineNumber - 1; iline > 0; iline --) {
 									if (str32nequ (lines [iline], U"while ", 6)) {
 										if (depth == 0) { lineNumber = iline - 1; break; }   // go before 'while'
@@ -1624,7 +1624,7 @@ void Interpreter_run (Interpreter me, char32 *text) {
 							} else fail = true;
 						} else if (str32nequ (command2.string, U"else", 4) && wordEnd (command2.string [4])) {
 							int depth = 0;
-							long iline;
+							integer iline;
 							for (iline = lineNumber + 1; iline <= numberOfLines; iline ++) {
 								if (str32nequ (lines [iline], U"endif", 5) && wordEnd (lines [iline] [5])) {
 									if (depth == 0) { lineNumber = iline; break; }   // go after `endif`
@@ -1641,7 +1641,7 @@ void Interpreter_run (Interpreter me, char32 *text) {
 								Interpreter_numericExpression (me, command2.string + 5, & value);
 								if (value == 0.0) {
 									int depth = 0;
-									long iline;
+									integer iline;
 									for (iline = lineNumber + 1; iline <= numberOfLines; iline ++) {
 										if (str32nequ (lines [iline], U"endif", 5) && wordEnd (lines [iline] [5])) {
 											if (depth == 0) { lineNumber = iline; break; }   // go after `endif`
@@ -1659,7 +1659,7 @@ void Interpreter_run (Interpreter me, char32 *text) {
 								}
 							} else {
 								int depth = 0;
-								long iline;
+								integer iline;
 								for (iline = lineNumber + 1; iline <= numberOfLines; iline ++) {
 									if (str32nequ (lines [iline], U"endif", 5) && wordEnd (lines [iline] [5])) {
 										if (depth == 0) { lineNumber = iline; break; }   // go after `endif`
@@ -1707,7 +1707,7 @@ void Interpreter_run (Interpreter me, char32 *text) {
 							var -> numericValue = loopVariable;
 							if (loopVariable > toValue) {
 								int depth = 0;
-								long iline;
+								integer iline;
 								for (iline = lineNumber + 1; iline <= numberOfLines; iline ++) {
 									if (str32nequ (lines [iline], U"endfor", 6)) {
 										if (depth == 0) { lineNumber = iline; break; }   // go after 'endfor'
@@ -1719,7 +1719,7 @@ void Interpreter_run (Interpreter me, char32 *text) {
 								if (iline > numberOfLines) Melder_throw (U"Unmatched 'for'.");
 							}
 						} else if (str32nequ (command2.string, U"form ", 5)) {
-							long iline;
+							integer iline;
 							for (iline = lineNumber + 1; iline <= numberOfLines; iline ++)
 								if (str32nequ (lines [iline], U"endform", 7))
 									{ lineNumber = iline; break; }   // go after 'endform'
@@ -1755,7 +1755,7 @@ void Interpreter_run (Interpreter me, char32 *text) {
 							Interpreter_numericExpression (me, command2.string + 3, & value);
 							if (value == 0.0) {
 								int depth = 0;
-								long iline;
+								integer iline;
 								for (iline = lineNumber + 1; iline <= numberOfLines; iline ++) {
 									if (str32nequ (lines [iline], U"endif", 5)) {
 										if (depth == 0) { lineNumber = iline; break; }   // go after 'endif'
@@ -2392,7 +2392,7 @@ void Interpreter_run (Interpreter me, char32 *text) {
 					}
 				} // endif fail
 				if (assertErrorLineNumber != 0 && assertErrorLineNumber != lineNumber) {
-					long save_assertErrorLineNumber = assertErrorLineNumber;
+					integer save_assertErrorLineNumber = assertErrorLineNumber;
 					assertErrorLineNumber = 0;
 					Melder_throw (U"Script assertion fails in line ", save_assertErrorLineNumber,
 							U": error « ", assertErrorString.string, U" » not raised. Instead: no error.");
diff --git a/sys/Interpreter.h b/sys/Interpreter.h
index 6309630..2323d42 100644
--- a/sys/Interpreter.h
+++ b/sys/Interpreter.h
@@ -53,7 +53,7 @@ Thing_define (Interpreter, Thing) {
 	char32 *arguments [1+Interpreter_MAXNUM_PARAMETERS];
 	char32 choiceArguments [1+Interpreter_MAXNUM_PARAMETERS] [100];
 	char32 labelNames [1+Interpreter_MAXNUM_LABELS] [1+Interpreter_MAX_LABEL_LENGTH];
-	long labelLines [1+Interpreter_MAXNUM_LABELS];
+	integer labelLines [1+Interpreter_MAXNUM_LABELS];
 	char32 dialogTitle [1+100], procedureNames [1+Interpreter_MAX_CALL_DEPTH] [100];
 	std::unordered_map <std::u32string, InterpreterVariable> variablesMap;
 	bool running, stopped;
@@ -66,7 +66,7 @@ autoInterpreter Interpreter_create (char32 *environmentName, ClassInfo editorCla
 autoInterpreter Interpreter_createFromEnvironment (Editor editor);
 
 void Melder_includeIncludeFiles (char32 **text);
-long Interpreter_readParameters (Interpreter me, char32 *text);
+integer Interpreter_readParameters (Interpreter me, char32 *text);
 Thing_declare (UiForm);
 UiForm Interpreter_createForm (Interpreter me, GuiWindow parent, const char32 *fileName,
 	void (*okCallback) (UiForm sendingForm, int narg, Stackel args, const char32 *sendingString, Interpreter interpreter, const char32 *invokingButtonTitle, bool modified, void *closure), void *okClosure,
diff --git a/sys/ManPage.h b/sys/ManPage.h
index ea19b14..e54de96 100644
--- a/sys/ManPage.h
+++ b/sys/ManPage.h
@@ -31,10 +31,10 @@ typedef struct structManPage_Paragraph {
 
 Thing_define (ManPage, Thing) {
 	const char32 *title, *author;
-	long date;
+	integer date;
 	struct structManPage_Paragraph *paragraphs;
-	long nlinksHither, nlinksThither;
-	long *linksHither, *linksThither;
+	integer nlinksHither, nlinksThither;
+	integer *linksHither, *linksThither;
 	double recordingTime;
 };
 
diff --git a/sys/ManPages.cpp b/sys/ManPages.cpp
index 0fcfdc5..e1f9e3b 100644
--- a/sys/ManPages.cpp
+++ b/sys/ManPages.cpp
@@ -33,11 +33,11 @@ static bool isSingleWordCharacter (char32 c) {
 	return isalnum ((int) c) || c == U'_';
 }
 
-static long lookUp_unsorted (ManPages me, const char32 *title);
+static integer lookUp_unsorted (ManPages me, const char32 *title);
 
 void structManPages :: v_destroy () noexcept {
 	if (our dynamic) {
-		for (long ipage = 1; ipage <= our pages.size; ipage ++) {
+		for (integer ipage = 1; ipage <= our pages.size; ipage ++) {
 			ManPage page = our pages.at [ipage];
 			Melder_free (page -> title);
 			Melder_free (page -> author);
@@ -48,13 +48,13 @@ void structManPages :: v_destroy () noexcept {
 				NUMvector_free <struct structManPage_Paragraph> (page -> paragraphs, 0);
 			}
 			if (ipage == 1) {
-				NUMvector_free <long> (page -> linksHither, 1);
-				NUMvector_free <long> (page -> linksThither, 1);
+				NUMvector_free <integer> (page -> linksHither, 1);
+				NUMvector_free <integer> (page -> linksThither, 1);
 			}
 		}
 	}
 	if (our titles)
-		for (long ipage = 1; ipage <= our pages.size; ipage ++) {
+		for (integer ipage = 1; ipage <= our pages.size; ipage ++) {
 			Melder_free (titles [ipage]);
 		}
 	NUMvector_free <const char32 *> (titles, 1);
@@ -244,7 +244,7 @@ autoManPages ManPages_create () {
 	return me;
 }
 
-void ManPages_addPage (ManPages me, const char32 *title, const char32 *author, long date,
+void ManPages_addPage (ManPages me, const char32 *title, const char32 *author, integer date,
 	struct structManPage_Paragraph paragraphs [])
 {
 	autoManPage page = Thing_new (ManPage);
@@ -268,25 +268,22 @@ static int pageCompare (const void *first, const void *second) {
 	return 0;   // should not occur
 }
 
-static long lookUp_unsorted (ManPages me, const char32 *title) {
-	long i;
-
+static integer lookUp_unsorted (ManPages me, const char32 *title) {
 	/*
-	 * First try to match an unaltered 'title' with the titles of the man pages.
-	 */
-	for (i = 1; i <= my pages.size; i ++) {
+		First try to match an unaltered 'title' with the titles of the man pages.
+	*/
+	for (integer i = 1; i <= my pages.size; i ++) {
 		ManPage page = my pages.at [i];
 		if (str32equ (page -> title, title)) return i;
 	}
-
 	/*
-	 * If that fails, try to find the upper-case variant.
-	 */
+		If that fails, try to find the upper-case variant.
+	*/
 	if (islower32 (title [0])) {
 		char32 upperTitle [300];
 		Melder_sprint (upperTitle,300, title);
 		upperTitle [0] = toupper32 (upperTitle [0]);
-		for (i = 1; i <= my pages.size; i ++) {
+		for (integer i = 1; i <= my pages.size; i ++) {
 			ManPage page = my pages.at [i];
 			if (str32equ (page -> title, upperTitle)) return i;
 		}
@@ -294,7 +291,7 @@ static long lookUp_unsorted (ManPages me, const char32 *title) {
 	return 0;
 }
 
-static long lookUp_sorted (ManPages me, const char32 *title) {
+static integer lookUp_sorted (ManPages me, const char32 *title) {
 	static autoManPage dummy;
 	ManPage *page;
 	if (! dummy) dummy = Thing_new (ManPage);
@@ -315,8 +312,8 @@ static long lookUp_sorted (ManPages me, const char32 *title) {
 }
 
 static void grind (ManPages me) {
-	long ndangle = 0, jpage, grandNlinks, ilinkHither, ilinkThither;
-	long *grandLinksHither, *grandLinksThither;
+	integer ndangle = 0, jpage, grandNlinks, ilinkHither, ilinkThither;
+	integer *grandLinksHither, *grandLinksThither;
 
 	qsort (& my pages.at [1], my pages.size, sizeof (ManPage), pageCompare);
 
@@ -354,7 +351,7 @@ static void grind (ManPages me) {
 	 * Forget nlinksHither and nlinksThither.
 	 */
 	if (grandNlinks == 0) { my ground = true; return; }
-	if (! (grandLinksHither = NUMvector <long> (1, grandNlinks)) || ! (grandLinksThither = NUMvector <long> (1, grandNlinks))) {
+	if (! (grandLinksHither = NUMvector <integer> (1, grandNlinks)) || ! (grandLinksThither = NUMvector <integer> (1, grandNlinks))) {
 		Melder_flushError ();
 		return;
 	}
@@ -403,36 +400,36 @@ static void grind (ManPages me) {
 	my ground = true;
 }
 
-long ManPages_uniqueLinksHither (ManPages me, long ipage) {
+integer ManPages_uniqueLinksHither (ManPages me, integer ipage) {
 	ManPage page = my pages.at [ipage];
-	long result = page -> nlinksHither, ilinkHither, ilinkThither;
-	for (ilinkHither = 1; ilinkHither <= page -> nlinksHither; ilinkHither ++) {
-		long link = page -> linksHither [ilinkHither];
-		for (ilinkThither = 1; ilinkThither <= page -> nlinksThither; ilinkThither ++)
+	integer result = page -> nlinksHither;
+	for (integer ilinkHither = 1; ilinkHither <= page -> nlinksHither; ilinkHither ++) {
+		integer link = page -> linksHither [ilinkHither];
+		for (integer ilinkThither = 1; ilinkThither <= page -> nlinksThither; ilinkThither ++)
 			if (page -> linksThither [ilinkThither] == link) { result --; break; }
 	}
 	return result;
 }
 
-long ManPages_lookUp (ManPages me, const char32 *title) {
+integer ManPages_lookUp (ManPages me, const char32 *title) {
 	if (! my ground) grind (me);
 	return lookUp_sorted (me, title);
 }
 
-static long ManPages_lookUp_caseSensitive (ManPages me, const char32 *title) {
+static integer ManPages_lookUp_caseSensitive (ManPages me, const char32 *title) {
 	if (! my ground) grind (me);
-	for (long i = 1; i <= my pages.size; i ++) {
+	for (integer i = 1; i <= my pages.size; i ++) {
 		ManPage page = my pages.at [i];
 		if (str32equ (page -> title, title)) return i;
 	}
 	return 0;
 }
 
-const char32 **ManPages_getTitles (ManPages me, long *numberOfTitles) {
+const char32 **ManPages_getTitles (ManPages me, integer *numberOfTitles) {
 	if (! my ground) grind (me);
 	if (! my titles) {
 		my titles = NUMvector <const char32 *> (1, my pages.size);   // TODO
-		for (long i = 1; i <= my pages.size; i ++) {
+		for (integer i = 1; i <= my pages.size; i ++) {
 			ManPage page = my pages.at [i];
 			my titles [i] = Melder_dup_f (page -> title);
 		}
@@ -473,7 +470,7 @@ static struct stylesInfo {
 };
 
 static void writeParagraphsAsHtml (ManPages me, MelderFile file, ManPage_Paragraph paragraphs, MelderString *buffer) {
-	long numberOfPictures = 0;
+	integer numberOfPictures = 0;
 	bool inList = false, inItalic = false, inBold = false;
 	bool inSub = false, inCode = false, inSuper = false, ul = false, inSmall = false;
 	bool wordItalic = false, wordBold = false, wordCode = false, letterSuper = false;
@@ -557,7 +554,7 @@ static void writeParagraphsAsHtml (ManPages me, MelderFile file, ManPage_Paragra
 				theCurrentPraatPicture -> y2NDC = paragraph -> height;
 				Graphics_setViewport (graphics.get(), theCurrentPraatPicture -> x1NDC, theCurrentPraatPicture -> x2NDC, theCurrentPraatPicture -> y1NDC, theCurrentPraatPicture -> y2NDC);
 				Graphics_setWindow (graphics.get(), 0.0, 1.0, 0.0, 1.0);
-				long x1DC, y1DC, x2DC, y2DC;
+				integer x1DC, y1DC, x2DC, y2DC;
 				Graphics_WCtoDC (graphics.get(), 0.0, 0.0, & x1DC, & y2DC);
 				Graphics_WCtoDC (graphics.get(), 1.0, 1.0, & x2DC, & y1DC);
 				Graphics_resetWsViewport (graphics.get(), x1DC, x2DC, y1DC, y2DC);
@@ -778,7 +775,7 @@ static const char32 *month [] =
 	{ U"", U"January", U"February", U"March", U"April", U"May", U"June",
 	  U"July", U"August", U"September", U"October", U"November", U"December" };
 
-static void writePageAsHtml (ManPages me, MelderFile file, long ipage, MelderString *buffer) {
+static void writePageAsHtml (ManPages me, MelderFile file, integer ipage, MelderString *buffer) {
 	ManPage page = my pages.at [ipage];
 	ManPage_Paragraph paragraphs = page -> paragraphs;
 	MelderString_append (buffer, U"<html><head><meta name=\"robots\" content=\"index,follow\">"
@@ -790,7 +787,7 @@ static void writePageAsHtml (ManPages me, MelderFile file, long ipage, MelderStr
 		page -> title, U"\n</b></font></table></table>\n");
 	writeParagraphsAsHtml (me, file, paragraphs, buffer);
 	if (ManPages_uniqueLinksHither (me, ipage)) {
-		long ilink, jlink, lastParagraph = 0;
+		integer ilink, jlink, lastParagraph = 0;
 		while ((int) page -> paragraphs [lastParagraph]. type != 0) lastParagraph ++;
 		if (lastParagraph > 0) {
 			const char32 *text = page -> paragraphs [lastParagraph - 1]. text;
@@ -799,7 +796,7 @@ static void writePageAsHtml (ManPages me, MelderFile file, long ipage, MelderStr
 		}
 		MelderString_append (buffer, U"<ul>\n");
 		for (ilink = 1; ilink <= page -> nlinksHither; ilink ++) {
-			long link = page -> linksHither [ilink];
+			integer link = page -> linksHither [ilink];
 			bool alreadyShown = false;
 			for (jlink = 1; jlink <= page -> nlinksThither; jlink ++)
 				if (page -> linksThither [jlink] == link)
@@ -820,7 +817,7 @@ static void writePageAsHtml (ManPages me, MelderFile file, long ipage, MelderStr
 	}
 	MelderString_append (buffer, U"<hr>\n<address>\n\t<p>© ", page -> author);
 	if (page -> date) {
-		long date = page -> date;
+		integer date = page -> date;
 		int imonth = date % 10000 / 100;
 		if (imonth < 0 || imonth > 12) imonth = 0;
 		MelderString_append (buffer, U", ", month [imonth], U" ", date % 100);
@@ -829,7 +826,7 @@ static void writePageAsHtml (ManPages me, MelderFile file, long ipage, MelderStr
 	MelderString_append (buffer, U"</p>\n</address>\n</body>\n</html>\n");
 }
 
-void ManPages_writeOneToHtmlFile (ManPages me, long ipage, MelderFile file) {
+void ManPages_writeOneToHtmlFile (ManPages me, integer ipage, MelderFile file) {
 	static MelderString buffer { };
 	MelderString_empty (& buffer);
 	writePageAsHtml (me, file, ipage, & buffer);
@@ -839,7 +836,7 @@ void ManPages_writeOneToHtmlFile (ManPages me, long ipage, MelderFile file) {
 void ManPages_writeAllToHtmlDir (ManPages me, const char32 *dirPath) {
 	structMelderDir dir { };
 	Melder_pathToDir (dirPath, & dir);
-	for (long ipage = 1; ipage <= my pages.size; ipage ++) {
+	for (integer ipage = 1; ipage <= my pages.size; ipage ++) {
 		ManPage page = my pages.at [ipage];
 		char32 fileName [256];
 		Melder_assert (str32len (page -> title) < 256 - 100);
diff --git a/sys/ManPages.h b/sys/ManPages.h
index d7b8e5d..4929f53 100644
--- a/sys/ManPages.h
+++ b/sys/ManPages.h
@@ -2,7 +2,7 @@
 #define _ManPages_h_
 /* ManPages.h
  *
- * Copyright (C) 1996-2011,2015 Paul Boersma
+ * Copyright (C) 1996-2011,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -35,20 +35,20 @@ Thing_define (ManPages, Daata) {
 
 autoManPages ManPages_create ();
 
-void ManPages_addPage (ManPages me, const char32 *title, const char32 *author, long date,
+void ManPages_addPage (ManPages me, const char32 *title, const char32 *author, integer date,
 	struct structManPage_Paragraph paragraphs []);
 /*
 	All string and struct arguments must be statically allocated
 	and not change after adding them to the ManPages.
 */
 
-long ManPages_lookUp (ManPages me, const char32 *title);
+integer ManPages_lookUp (ManPages me, const char32 *title);
 
-void ManPages_writeOneToHtmlFile (ManPages me, long ipage, MelderFile file);
+void ManPages_writeOneToHtmlFile (ManPages me, integer ipage, MelderFile file);
 void ManPages_writeAllToHtmlDir (ManPages me, const char32 *dirPath);
 
-long ManPages_uniqueLinksHither (ManPages me, long ipage);
-const char32 **ManPages_getTitles (ManPages me, long *numberOfTitles);
+integer ManPages_uniqueLinksHither (ManPages me, integer ipage);
+const char32 **ManPages_getTitles (ManPages me, integer *numberOfTitles);
 
 /* End of file ManPages.h */
 #endif
diff --git a/sys/ManPagesM.h b/sys/ManPagesM.h
index eb3971c..9797015 100644
--- a/sys/ManPagesM.h
+++ b/sys/ManPagesM.h
@@ -24,7 +24,7 @@
 	#include "ManPages.h"
 #endif
 
-#define MAN_BEGIN(t,a,d)  { const char32 *title = t, *author = a; long date = d; \
+#define MAN_BEGIN(t,a,d)  { const char32 *title = t, *author = a; integer date = d; \
 	static struct structManPage_Paragraph page [] = {
 #define INTRO(text)  { kManPage_type::INTRO, text, 0.0, 0.0, nullptr },
 #define ENTRY(text)  { kManPage_type::ENTRY, text, 0.0, 0.0, nullptr },
diff --git a/sys/Manual.cpp b/sys/Manual.cpp
index a47038d..9929408 100644
--- a/sys/Manual.cpp
+++ b/sys/Manual.cpp
@@ -52,27 +52,27 @@ static void menu_cb_writeOneToHtmlFile (Manual me, EDITOR_ARGS_FORM) {
 
 static void menu_cb_writeAllToHtmlDir (Manual me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Save all pages as HTML files", nullptr)
-		LABEL (U"", U"Type a directory name:")
-		TEXTFIELD (U"directory", U"")
+		TEXTFIELD (directory, U"Directory:", U"")
 	EDITOR_OK
 		structMelderDir currentDirectory { };
 		Melder_getDefaultDir (& currentDirectory);
-		SET_STRING (U"directory", Melder_dirToPath (& currentDirectory))
+		SET_STRING (directory, Melder_dirToPath (& currentDirectory))
 	EDITOR_DO
-		char32 *directory = GET_STRING (U"directory");
 		ManPages_writeAllToHtmlDir ((ManPages) my data, directory);
 	EDITOR_END
 }
 
 static void menu_cb_searchForPageList (Manual me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Search for page", nullptr)
-		ManPages manPages = (ManPages) my data;
-		long numberOfPages;
-		const char32 **pages = ManPages_getTitles (manPages, & numberOfPages);
-		LIST (U"Page", manPages -> pages.size, pages, 1)
+		static ManPages manPages;
+		static integer numberOfPages;
+		static const char32 **pages;
+		manPages = (ManPages) my data;
+		pages = ManPages_getTitles (manPages, & numberOfPages);
+		LIST (page, U"Page", manPages -> pages.size, pages, 1)
 	EDITOR_OK
 	EDITOR_DO
-		HyperPage_goToPage_i (me, GET_INTEGER (U"Page"));
+		HyperPage_goToPage_i (me, page);
 	EDITOR_END
 }
 
@@ -129,7 +129,7 @@ void structManual :: v_draw () {
 		}
 	}
 	if (ManPages_uniqueLinksHither (manPages, our path)) {
-		long ilink, jlink, lastParagraph = 0;
+		integer ilink, jlink, lastParagraph = 0;
 		bool goAhead = true;
 		while ((int) page -> paragraphs [lastParagraph]. type != 0) lastParagraph ++;
 		if (lastParagraph > 0) {
@@ -142,7 +142,7 @@ void structManual :: v_draw () {
 			}
 		}
 		if (goAhead) for (ilink = 1; ilink <= page -> nlinksHither; ilink ++) {
-			long link = page -> linksHither [ilink];
+			integer link = page -> linksHither [ilink];
 			bool alreadyShown = false;
 			for (jlink = 1; jlink <= page -> nlinksThither; jlink ++)
 				if (page -> linksThither [jlink] == link)
@@ -157,7 +157,7 @@ void structManual :: v_draw () {
 	}
 	if (! our printing && page -> date) {
 		char32 signature [100];
-		long date = page -> date;
+		integer date = page -> date;
 		int imonth = date % 10000 / 100;
 		if (imonth < 0 || imonth > 12) imonth = 0;
 		Melder_sprint (signature,100,
@@ -178,13 +178,13 @@ void structManual :: v_draw () {
 static void print (void *void_me, Graphics graphics) {
 	iam (Manual);
 	ManPages manPages = (ManPages) my data;
-	long numberOfPages = manPages -> pages.size, savePage = my path;
+	integer numberOfPages = manPages -> pages.size, savePage = my path;
 	my ps = graphics;
 	Graphics_setDollarSignIsCode (my ps, true);
 	Graphics_setAtSignIsLink (my ps, true);
 	my printing = true;
 	HyperPage_initSheetOfPaper ((HyperPage) me);
-	for (long ipage = 1; ipage <= numberOfPages; ipage ++) {
+	for (integer ipage = 1; ipage <= numberOfPages; ipage ++) {
 		ManPage page = manPages -> pages.at [ipage];
 		if (my printPagesStartingWith == nullptr ||
 		    Melder_stringMatchesCriterion (page -> title, kMelder_string::STARTS_WITH, my printPagesStartingWith))
@@ -208,17 +208,16 @@ static void print (void *void_me, Graphics graphics) {
 
 static void menu_cb_printRange (Manual me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Print range", nullptr)
-		SENTENCE (U"Left or inside header", U"")
-		SENTENCE (U"Middle header", U"")
-		SENTENCE (U"Right or outside header", U"Manual")
-		SENTENCE (U"Left or inside footer", U"")
-		SENTENCE (U"Middle footer", U"")
-		SENTENCE (U"Right or outside footer", U"")
-		BOOLEAN (U"Mirror even/odd headers", true)
-		LABEL (U"", U"Print all pages whose title starts with:")
-		TEXTFIELD (U"Print pages starting with", U"Intro")
-		INTEGER (U"First page number", U"1")
-		BOOLEAN (U"Suppress \"Links to this page\"", false)
+		SENTENCE (leftOrInsideHeader, U"Left or inside header", U"")
+		SENTENCE (middleHeader, U"Middle header", U"")
+		SENTENCE (rightOrOutsideHeader, U"Right or outside header", U"Manual")
+		SENTENCE (leftOrInsideFooter, U"Left or inside footer", U"")
+		SENTENCE (middleFooter, U"Middle footer", U"")
+		SENTENCE (rightOrOutsideFooter, U"Right or outside footer", U"")
+		BOOLEAN (mirrorEvenOddHeaders, U"Mirror even/odd headers", true)
+		TEXTFIELD (printAllPagesWhoseTitleStartsWith, U"Print all pages whose title starts with:", U"Intro")
+		INTEGER (firstPageNumber, U"First page number", U"1")
+		BOOLEAN (suppressLinksToThisPage, U"Suppress \"Links to this page\"", false)
 	EDITOR_OK
 		ManPages manPages = (ManPages) my data;
 		time_t today = time (nullptr);
@@ -231,24 +230,24 @@ static void menu_cb_printRange (Manual me, EDITOR_ARGS_FORM) {
 		#endif
 		char32 *date = Melder_peek8to32 (dateA), *newline;
 		newline = str32chr (date, U'\n'); if (newline) *newline = U'\0';
-		SET_STRING (U"Left or inside header", date)
-		SET_STRING (U"Right or outside header", my name)
-		if (my d_printingPageNumber) SET_INTEGER (U"First page number", my d_printingPageNumber + 1)
+		SET_STRING (leftOrInsideHeader, date)
+		SET_STRING (rightOrOutsideHeader, my name)
+		if (my d_printingPageNumber) SET_INTEGER (firstPageNumber, my d_printingPageNumber + 1)
 		if (my path >= 1 && my path <= manPages -> pages.size) {
 			ManPage page = manPages -> pages.at [my path];
-			SET_STRING (U"Print pages starting with", page -> title);
+			SET_STRING (printAllPagesWhoseTitleStartsWith, page -> title);
 		}
 	EDITOR_DO
-		my insideHeader = GET_STRING (U"Left or inside header");
-		my middleHeader = GET_STRING (U"Middle header");
-		my outsideHeader = GET_STRING (U"Right or outside header");
-		my insideFooter = GET_STRING (U"Left or inside footer");
-		my middleFooter = GET_STRING (U"Middle footer");
-		my outsideFooter = GET_STRING (U"Right or outside footer");
-		my mirror = GET_INTEGER (U"Mirror even/odd headers");
-		my printPagesStartingWith = GET_STRING (U"Print pages starting with");
-		my d_printingPageNumber = GET_INTEGER (U"First page number");
-		my suppressLinksHither = GET_INTEGER (U"Suppress \"Links to this page\"");
+		my insideHeader = leftOrInsideHeader;
+		my middleHeader = middleHeader;
+		my outsideHeader = rightOrOutsideHeader;
+		my insideFooter = leftOrInsideFooter;
+		my middleFooter = middleFooter;
+		my outsideFooter = rightOrOutsideFooter;
+		my mirror = mirrorEvenOddHeaders;
+		my printPagesStartingWith = printAllPagesWhoseTitleStartsWith;
+		my d_printingPageNumber = firstPageNumber;
+		my suppressLinksHither = suppressLinksToThisPage;
 		Printer_print (print, me);
 	EDITOR_END
 }
@@ -257,7 +256,7 @@ static void menu_cb_printRange (Manual me, EDITOR_ARGS_FORM) {
 
 static double *goodnessOfMatch;
 
-static double searchToken (ManPages me, long ipage, char32 *token) {
+static double searchToken (ManPages me, integer ipage, char32 *token) {
 	double goodness = 0.0;
 	ManPage page = my pages.at [ipage];
 	struct structManPage_Paragraph *par = & page -> paragraphs [0];
@@ -296,7 +295,7 @@ static double searchToken (ManPages me, long ipage, char32 *token) {
 
 static void search (Manual me, const char32 *query) {
 	ManPages manPages = (ManPages) my data;
-	long numberOfPages = manPages -> pages.size;
+	integer numberOfPages = manPages -> pages.size;
 	static MelderString searchText { };
 	MelderString_copy (& searchText, query);
 	for (char32 *p = & searchText.string [0]; *p != U'\0'; p ++) {
@@ -305,7 +304,7 @@ static void search (Manual me, const char32 *query) {
 	}
 	if (! goodnessOfMatch)
 		goodnessOfMatch = NUMvector <double> (1, numberOfPages);
-	for (long ipage = 1; ipage <= numberOfPages; ipage ++) {
+	for (integer ipage = 1; ipage <= numberOfPages; ipage ++) {
 		char32 *token = searchText.string;
 		goodnessOfMatch [ipage] = 1.0;
 		for (;;) {
@@ -321,10 +320,10 @@ static void search (Manual me, const char32 *query) {
 	 * Find the 20 best matches.
 	 */
 	my numberOfMatches = 0;
-	for (long imatch = 1; imatch <= 20; imatch ++) {
-		long imax = 0;
+	for (integer imatch = 1; imatch <= 20; imatch ++) {
+		integer imax = 0;
 		double max = 0.0;
-		for (long ipage = 1; ipage <= numberOfPages; ipage ++) {
+		for (integer ipage = 1; ipage <= numberOfPages; ipage ++) {
 			if (goodnessOfMatch [ipage] > max) {
 				max = goodnessOfMatch [ipage];
 				imax = ipage;
@@ -344,7 +343,7 @@ void Manual_search (Manual me, const char32 *query) {
 
 static void gui_button_cb_home (Manual me, GuiButtonEvent /* event */) {
 	ManPages pages = (ManPages) my data;
-	long iHome = ManPages_lookUp (pages, U"Intro");
+	integer iHome = ManPages_lookUp (pages, U"Intro");
 	HyperPage_goToPage_i (me, iHome ? iHome : 1);
 }
  
@@ -441,26 +440,26 @@ void structManual :: v_defaultHeaders (EditorCommand cmd) {
 		static const char32 *shortMonth [] =
 			{ U"Jan", U"Feb", U"Mar", U"Apr", U"May", U"Jun", U"Jul", U"Aug", U"Sep", U"Oct", U"Nov", U"Dec" };
 		ManPage page = manPages -> pages.at [my path];
-		long date = page -> date;
-		SET_STRING (U"Right or outside header", page -> title)
-		SET_STRING (U"Left or inside footer", page -> author)
+		integer date = page -> date;
+		SET_STRING (my outsideHeader, page -> title)
+		SET_STRING (my insideFooter, page -> author)
 		if (date) {
 			Melder_sprint (string,400, shortMonth [date % 10000 / 100 - 1], U" ", date % 100, U", ", date / 10000);
-			SET_STRING (U"Left or inside header", string)
+			SET_STRING (my insideHeader, string)
 		}
 	}
 }
 
-long structManual :: v_getNumberOfPages () {
+integer structManual :: v_getNumberOfPages () {
 	ManPages manPages = (ManPages) our data;
 	return manPages -> pages.size;
 }
 
-long structManual :: v_getCurrentPageNumber () {
+integer structManual :: v_getCurrentPageNumber () {
 	return our path ? our path : 1;
 }
 
-void structManual :: v_goToPage_i (long pageNumber) {
+void structManual :: v_goToPage_i (integer pageNumber) {
 	ManPages manPages = (ManPages) our data;
 	if (pageNumber < 1 || pageNumber > manPages -> pages.size) {
 		if (pageNumber == SEARCH_PAGE) {
@@ -497,7 +496,7 @@ int structManual :: v_goToPage (const char32 *title) {
 		}
 		return 0;
 	} else {
-		long i = ManPages_lookUp (manPages, title);
+		integer i = ManPages_lookUp (manPages, title);
 		if (! i)
 			Melder_throw (U"Page \"", title, U"\" not found.");
 		our v_goToPage_i (i);
@@ -508,7 +507,7 @@ int structManual :: v_goToPage (const char32 *title) {
 void Manual_init (Manual me, const char32 *title, Daata data, bool ownData) {
 	ManPages manPages = (ManPages) data;
 	char32 windowTitle [101];
-	long i;
+	integer i;
 	ManPage page;
 	ManPage_Paragraph par;
 	if (! (i = ManPages_lookUp (manPages, title)))
diff --git a/sys/Manual.h b/sys/Manual.h
index 0e914c5..b09b66f 100644
--- a/sys/Manual.h
+++ b/sys/Manual.h
@@ -22,12 +22,12 @@
 #include "ManPages.h"
 
 Thing_define (Manual, HyperPage) {
-	long path, numberOfParagraphs;
+	integer path, numberOfParagraphs;
 	struct structManPage_Paragraph *paragraphs;
 	GuiText searchText;
 	GuiButton homeButton, recordButton, playButton, publishButton;
 	int numberOfMatches;
-	long matches [1 + 20], fromPage, toPage;
+	integer matches [1 + 20], fromPage, toPage;
 	int suppressLinksHither;
 	char32 *printPagesStartingWith;
 
@@ -45,13 +45,13 @@ Thing_define (Manual, HyperPage) {
 		override;
 	void v_defaultHeaders (EditorCommand cmd)
 		override;
-	long v_getNumberOfPages ()
+	integer v_getNumberOfPages ()
 		override;
-	long v_getCurrentPageNumber ()
+	integer v_getCurrentPageNumber ()
 		override;
 	int v_goToPage (const char32 *title)
 		override;
-	void v_goToPage_i (long pageNumber)
+	void v_goToPage_i (integer pageNumber)
 		override;
 	bool v_hasHistory ()
 		override { return true; }
diff --git a/sys/MelderGui.cpp b/sys/MelderGui.cpp
index 8e1648b..ba1c837 100644
--- a/sys/MelderGui.cpp
+++ b/sys/MelderGui.cpp
@@ -238,7 +238,7 @@ static void * gui_monitor (double progress, const char32 *message) {
 	static void mac_message (NSAlertStyle macAlertType, const char32 *message32) {
 		static char16 message16 [4000];
 		int messageLength = str32len (message32);
-		unsigned long j = 0;
+		uinteger j = 0;
 		for (int i = 0; i < messageLength && j <= 4000 - 3; i ++) {
 			char32 kar = message32 [i];
 			if (kar <= 0x00FFFF) {
@@ -269,7 +269,7 @@ static void * gui_monitor (double progress, const char32 *message) {
 				}
 			}
 		}
-		unsigned long lengthOfFirstSentence = (unsigned long) (lineBreak - message16);
+		uinteger lengthOfFirstSentence = (uinteger) (lineBreak - message16);
 		/*
 		 * Create an alert dialog with an icon that is appropriate for the level.
 		 */
diff --git a/sys/Preferences.cpp b/sys/Preferences.cpp
index 19b4d51..2cbe308 100644
--- a/sys/Preferences.cpp
+++ b/sys/Preferences.cpp
@@ -61,8 +61,8 @@ void Preferences_addInt16 (const char32 *string, int *value, int defaultValue)
 void Preferences_addInt (const char32 *string, int *value, int defaultValue)
 	{ *value = defaultValue; Preferences_add (string, intwa, value, 0, 0, nullptr, nullptr); }
 
-void Preferences_addLong (const char32 *string, long *value, long defaultValue)
-	{ *value = defaultValue; Preferences_add (string, longwa, value, 0, 0, nullptr, nullptr); }
+void Preferences_addInteger (const char32 *string, integer *value, integer defaultValue)
+	{ *value = defaultValue; Preferences_add (string, integerwa, value, 0, 0, nullptr, nullptr); }
 
 void Preferences_addUbyte (const char32 *string, unsigned char *value, unsigned char defaultValue)
 	{ *value = defaultValue; Preferences_add (string, ubytewa, value, 0, 0, nullptr, nullptr); }
@@ -70,11 +70,11 @@ void Preferences_addUbyte (const char32 *string, unsigned char *value, unsigned
 void Preferences_addUint (const char32 *string, unsigned int *value, unsigned int defaultValue)
 	{ *value = defaultValue; Preferences_add (string, uintwa, value, 0, 0, nullptr, nullptr); }
 
-void Preferences_addUlong (const char32 *string, unsigned long *value, unsigned long defaultValue)
-	{ *value = defaultValue; Preferences_add (string, ulongwa, value, 0, 0, nullptr, nullptr); }
+void Preferences_addUinteger (const char32 *string, uinteger *value, uinteger defaultValue)
+	{ *value = defaultValue; Preferences_add (string, uintegerwa, value, 0, 0, nullptr, nullptr); }
 
 void Preferences_addBool (const char32 *string, bool *value, bool defaultValue)
-	{ *value = defaultValue; Preferences_add (string, boolwa, value, 0, 0, nullptr, nullptr); }
+	{ *value = defaultValue; Preferences_add (string, questionwa, value, 0, 0, nullptr, nullptr); }
 
 void Preferences_addDouble (const char32 *string, double *value, double defaultValue)
 	{ *value = defaultValue; Preferences_add (string, doublewa, value, 0, 0, nullptr, nullptr); }
@@ -122,18 +122,14 @@ void Preferences_read (MelderFile file) {
 					(int16) strtol (Melder_peek32to8 (value), nullptr, 10); break;
 				case intwa: * (int *) pref -> value =
 					strtol (Melder_peek32to8 (value), nullptr, 10); break;
-				case longwa: * (long *) pref -> value =
+				case integerwa: * (integer *) pref -> value =
 					strtol (Melder_peek32to8 (value), nullptr, 10); break;
 				case ubytewa: * (unsigned char *) pref -> value =
 					(uint8) strtoul (Melder_peek32to8 (value), nullptr, 10); break;
 				case uintwa: * (unsigned int *) pref -> value =
 					strtoul (Melder_peek32to8 (value), nullptr, 10); break;
-				case ulongwa: * (unsigned long *) pref -> value =
+				case uintegerwa: * (uinteger *) pref -> value =
 					strtoul (Melder_peek32to8 (value), nullptr, 10); break;
-				case boolwa: * (bool *) pref -> value =
-					str32nequ (value, U"yes", 3) ? true :
-					str32nequ (value, U"no", 2) ? false :
-					strtol (Melder_peek32to8 (value), nullptr, 10) != 0; break;
 				case doublewa: * (double *) pref -> value =
 					Melder_a8tof (Melder_peek32to8 (value)); break;
 				case stringwa: {
@@ -146,6 +142,10 @@ void Preferences_read (MelderFile file) {
 						intValue = pref -> getValue (U"\t");   // look for the default
 					* (int *) pref -> value = intValue; break;
 				}
+				case questionwa: * (bool *) pref -> value =
+					str32nequ (value, U"yes", 3) ? true :
+					str32nequ (value, U"no", 2) ? false :
+					strtol (Melder_peek32to8 (value), nullptr, 10) != 0; break;
 			}
 		}
 	} catch (MelderError) {
@@ -160,17 +160,17 @@ void Preferences_write (MelderFile file) {
 		Preference pref = thePreferences.at [ipref];
 		MelderString_append (& buffer, pref -> string, U": ");
 		switch (pref -> type) {
-			case bytewa:   MelderString_append (& buffer, (int) (* (signed char *)    pref -> value)); break;
-			case int16wa:  MelderString_append (& buffer,       (* (int16 *)          pref -> value)); break;
-			case intwa:    MelderString_append (& buffer,       (* (int *)            pref -> value)); break;
-			case longwa:   MelderString_append (& buffer,       (* (long *)           pref -> value)); break;
-			case ubytewa:  MelderString_append (& buffer, (int) (* (unsigned char *)  pref -> value)); break;
-			case uintwa:   MelderString_append (& buffer,       (* (unsigned int *)   pref -> value)); break;
-			case ulongwa:  MelderString_append (& buffer,       (* (unsigned long *)  pref -> value)); break;
-			case boolwa:   MelderString_append (& buffer,       (* (bool *)           pref -> value)); break;
-			case doublewa: MelderString_append (& buffer,       (* (double *)         pref -> value)); break;
-			case stringwa: MelderString_append (& buffer,         ((const char32 *)   pref -> value)); break;
-			case enumwa:   MelderString_append (& buffer, pref -> getText (* (int *) pref -> value)); break;
+			case bytewa:     MelderString_append (& buffer, (int) (* (signed char *)    pref -> value)); break;
+			case int16wa:    MelderString_append (& buffer,       (* (int16 *)          pref -> value)); break;
+			case intwa:      MelderString_append (& buffer,       (* (int *)            pref -> value)); break;
+			case integerwa:  MelderString_append (& buffer,       (* (integer *)        pref -> value)); break;
+			case ubytewa:    MelderString_append (& buffer, (int) (* (unsigned char *)  pref -> value)); break;
+			case uintwa:     MelderString_append (& buffer,       (* (unsigned int *)   pref -> value)); break;
+			case uintegerwa: MelderString_append (& buffer,       (* (uinteger *)       pref -> value)); break;
+			case doublewa:   MelderString_append (& buffer,       (* (double *)         pref -> value)); break;
+			case stringwa:   MelderString_append (& buffer,         ((const char32 *)   pref -> value)); break;
+			case enumwa:     MelderString_append (& buffer,  pref -> getText (* (int *) pref -> value)); break;
+			case questionwa: MelderString_append (& buffer,       (* (bool *)           pref -> value)); break;
 		}
 		MelderString_appendCharacter (& buffer, U'\n');
 	}
diff --git a/sys/Preferences.h b/sys/Preferences.h
index 6878ca0..912c532 100644
--- a/sys/Preferences.h
+++ b/sys/Preferences.h
@@ -36,19 +36,19 @@
 	to1 [Preferences_STRING_BUFFER_SIZE - 1] = U'\0'; \
 	str32cpy (to2, to1);
 
-void Preferences_addByte   (const char32 *string /* cattable */, signed char *value, signed char defaultValue);
-void Preferences_addShort  (const char32 *string /* cattable */, short *value, short defaultValue);
-void Preferences_addInt16  (const char32 *string /* cattable */, int *value, int defaultValue);
-void Preferences_addInt    (const char32 *string /* cattable */, int *value, int defaultValue);
-void Preferences_addLong   (const char32 *string /* cattable */, long *value, long defaultValue);
-void Preferences_addUbyte  (const char32 *string /* cattable */, unsigned char *value, unsigned char defaultValue);
-void Preferences_addUshort (const char32 *string /* cattable */, unsigned short *value, unsigned short defaultValue);
-void Preferences_addUint   (const char32 *string /* cattable */, unsigned int *value, unsigned int defaultValue);
-void Preferences_addUlong  (const char32 *string /* cattable */, unsigned long *value, unsigned long defaultValue);
-void Preferences_addBool   (const char32 *string /* cattable */, bool *value, bool defaultValue);
-void Preferences_addDouble (const char32 *string /* cattable */, double *value, double defaultValue);
-void Preferences_addString (const char32 *string /* cattable */, char32 *value, const char32 *defaultValue);
-void _Preferences_addEnum  (const char32 *string /* cattable */, int *value, int min, int max,
+void Preferences_addByte     (const char32 *string /* cattable */, signed char *value, signed char defaultValue);
+void Preferences_addShort    (const char32 *string /* cattable */, short *value, short defaultValue);
+void Preferences_addInt16    (const char32 *string /* cattable */, int *value, int defaultValue);
+void Preferences_addInt      (const char32 *string /* cattable */, int *value, int defaultValue);
+void Preferences_addInteger  (const char32 *string /* cattable */, integer *value, integer defaultValue);
+void Preferences_addUbyte    (const char32 *string /* cattable */, unsigned char *value, unsigned char defaultValue);
+void Preferences_addUshort   (const char32 *string /* cattable */, unsigned short *value, unsigned short defaultValue);
+void Preferences_addUint     (const char32 *string /* cattable */, unsigned int *value, unsigned int defaultValue);
+void Preferences_addUinteger (const char32 *string /* cattable */, uinteger *value, uinteger defaultValue);
+void Preferences_addBool     (const char32 *string /* cattable */, bool *value, bool defaultValue);
+void Preferences_addDouble   (const char32 *string /* cattable */, double *value, double defaultValue);
+void Preferences_addString   (const char32 *string /* cattable */, char32 *value, const char32 *defaultValue);
+void _Preferences_addEnum    (const char32 *string /* cattable */, int *value, int min, int max,
 	const char32 *(*getText) (int value), int (*getValue) (const char32 *text), int defaultValue);
 #define Preferences_addEnum(string, value, enumerated, defaultValue) \
 	_Preferences_addEnum (string, (int *) value, (int) enumerated::MIN, (int) enumerated::MAX, \
diff --git a/sys/ScriptEditor.cpp b/sys/ScriptEditor.cpp
index f1f2fa5..b09da76 100644
--- a/sys/ScriptEditor.cpp
+++ b/sys/ScriptEditor.cpp
@@ -26,7 +26,7 @@ Thing_implement (ScriptEditor, TextEditor, 0);
 static CollectionOf <structScriptEditor> theReferencesToAllOpenScriptEditors;
 
 bool ScriptEditors_dirty () {
-	for (long i = 1; i <= theReferencesToAllOpenScriptEditors.size; i ++) {
+	for (integer i = 1; i <= theReferencesToAllOpenScriptEditors.size; i ++) {
 		ScriptEditor me = theReferencesToAllOpenScriptEditors.at [i];
 		if (my dirty) return true;
 	}
@@ -155,74 +155,64 @@ static void menu_cb_runSelection (ScriptEditor me, EDITOR_ARGS_DIRECT) {
 
 static void menu_cb_addToMenu (ScriptEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Add to menu", U"Add to fixed menu...")
-		WORD (U"Window", U"?")
-		SENTENCE (U"Menu", U"File")
-		SENTENCE (U"Command", U"Do it...")
-		SENTENCE (U"After command", U"")
-		INTEGER (U"Depth", U"0")
-		LABEL (U"", U"Script file:")
-		TEXTFIELD (U"Script", U"")
+		WORD (window, U"Window", U"?")
+		SENTENCE (menu, U"Menu", U"File")
+		SENTENCE (command, U"Command", U"Do it...")
+		SENTENCE (afterCommand, U"After command", U"")
+		INTEGER (depth, U"Depth", U"0")
+		TEXTFIELD (scriptFile, U"Script file:", U"")
 	EDITOR_OK
-		if (my editorClass) SET_STRING (U"Window", my editorClass -> className)
+		if (my editorClass) SET_STRING (window, my editorClass -> className)
 		if (my name [0])
-			SET_STRING (U"Script", my name)
+			SET_STRING (scriptFile, my name)
 		else
-			SET_STRING (U"Script", U"(please save your script first)")
+			SET_STRING (scriptFile, U"(please save your script first)")
 	EDITOR_DO
-		praat_addMenuCommandScript (GET_STRING (U"Window"),
-			GET_STRING (U"Menu"), GET_STRING (U"Command"), GET_STRING (U"After command"),
-			GET_INTEGER (U"Depth"), GET_STRING (U"Script"));
+		praat_addMenuCommandScript (window, menu, command, afterCommand, depth, scriptFile);
 		praat_show ();
 	EDITOR_END
 }
 
 static void menu_cb_addToFixedMenu (ScriptEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Add to fixed menu", U"Add to fixed menu...");
-		RADIO (U"Window", 1)
+		RADIOSTR (window, U"Window", 1)
 			RADIOBUTTON (U"Objects")
 			RADIOBUTTON (U"Picture")
-		SENTENCE (U"Menu", U"New")
-		SENTENCE (U"Command", U"Do it...")
-		SENTENCE (U"After command", U"")
-		INTEGER (U"Depth", U"0")
-		LABEL (U"", U"Script file:")
-		TEXTFIELD (U"Script", U"")
+		SENTENCE (menu, U"Menu", U"New")
+		SENTENCE (command, U"Command", U"Do it...")
+		SENTENCE (afterCommand, U"After command", U"")
+		INTEGER (depth, U"Depth", U"0")
+		TEXTFIELD (scriptFile, U"Script file:", U"")
 	EDITOR_OK
 		if (my name [0])
-			SET_STRING (U"Script", my name)
+			SET_STRING (scriptFile, my name)
 		else
-			SET_STRING (U"Script", U"(please save your script first)")
+			SET_STRING (scriptFile, U"(please save your script first)")
 	EDITOR_DO
-		praat_addMenuCommandScript (GET_STRING (U"Window"),
-			GET_STRING (U"Menu"), GET_STRING (U"Command"), GET_STRING (U"After command"),
-			GET_INTEGER (U"Depth"), GET_STRING (U"Script"));
+		praat_addMenuCommandScript (window, menu, command, afterCommand, depth, scriptFile);
 		praat_show ();
 	EDITOR_END
 }
 
 static void menu_cb_addToDynamicMenu (ScriptEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Add to dynamic menu", U"Add to dynamic menu...")
-		WORD (U"Class 1", U"Sound")
-		INTEGER (U"Number 1", U"0")
-		WORD (U"Class 2", U"")
-		INTEGER (U"Number 2", U"0")
-		WORD (U"Class 3", U"")
-		INTEGER (U"Number 3", U"0")
-		SENTENCE (U"Command", U"Do it...")
-		SENTENCE (U"After command", U"")
-		INTEGER (U"Depth", U"0")
-		LABEL (U"", U"Script file:")
-		TEXTFIELD (U"Script", U"")
+		WORD (class1, U"Class 1", U"Sound")
+		INTEGER (number1, U"Number 1", U"0")
+		WORD (class2, U"Class 2", U"")
+		INTEGER (number2, U"Number 2", U"0")
+		WORD (class3, U"Class 3", U"")
+		INTEGER (number3, U"Number 3", U"0")
+		SENTENCE (command, U"Command", U"Do it...")
+		SENTENCE (afterCommand, U"After command", U"")
+		INTEGER (depth, U"Depth", U"0")
+		TEXTFIELD (scriptFile, U"Script file:", U"")
 	EDITOR_OK
 		if (my name [0])
-			SET_STRING (U"Script", my name)
+			SET_STRING (scriptFile, my name)
 		else
-			SET_STRING (U"Script", U"(please save your script first)")
+			SET_STRING (scriptFile, U"(please save your script first)")
 	EDITOR_DO
-		praat_addActionScript (GET_STRING (U"Class 1"), GET_INTEGER (U"Number 1"),
-			GET_STRING (U"Class 2"), GET_INTEGER (U"Number 2"), GET_STRING (U"Class 3"),
-			GET_INTEGER (U"Number 3"), GET_STRING (U"Command"), GET_STRING (U"After command"),
-			GET_INTEGER (U"Depth"), GET_STRING (U"Script"));
+		praat_addActionScript (class1, number1, class2, number2, class3, number3, command, afterCommand, depth, scriptFile);
 		praat_show ();
 	EDITOR_END
 }
@@ -235,7 +225,7 @@ static void menu_cb_pasteHistory (ScriptEditor me, EDITOR_ARGS_DIRECT) {
 	char32 *history = UiHistory_get ();
 	if (! history || history [0] == U'\0')
 		Melder_throw (U"No history.");
-	long length = str32len (history);
+	integer length = str32len (history);
 	if (history [length - 1] != U'\n') {
 		UiHistory_write (U"\n");
 		history = UiHistory_get ();
@@ -245,7 +235,7 @@ static void menu_cb_pasteHistory (ScriptEditor me, EDITOR_ARGS_DIRECT) {
 		history ++;
 		length --;
 	}
-	long first = 0, last = 0;
+	integer first = 0, last = 0;
 	char32 *text = GuiText_getStringAndSelectionPosition (my textWidget, & first, & last);
 	Melder_free (text);
 	GuiText_replace (my textWidget, first, last, history);
@@ -332,7 +322,7 @@ autoScriptEditor ScriptEditor_createFromText (Editor environment, const char32 *
 
 autoScriptEditor ScriptEditor_createFromScript_canBeNull (Editor environment, Script script) {
 	try {
-		for (long ieditor = 1; ieditor <= theReferencesToAllOpenScriptEditors.size; ieditor ++) {
+		for (integer ieditor = 1; ieditor <= theReferencesToAllOpenScriptEditors.size; ieditor ++) {
 			ScriptEditor editor = theReferencesToAllOpenScriptEditors.at [ieditor];
 			if (MelderFile_equal (& script -> file, & editor -> file)) {
 				Editor_raise (editor);
@@ -354,7 +344,7 @@ autoScriptEditor ScriptEditor_createFromScript_canBeNull (Editor environment, Sc
 }
 
 void ScriptEditor_debug_printAllOpenScriptEditors () {
-	for (long ieditor = 1; ieditor <= theReferencesToAllOpenScriptEditors.size; ieditor ++) {
+	for (integer ieditor = 1; ieditor <= theReferencesToAllOpenScriptEditors.size; ieditor ++) {
 		ScriptEditor editor = theReferencesToAllOpenScriptEditors.at [ieditor];
 		Melder_casual (U"Open script editor #", ieditor, U": <<", & editor -> file, U">>");
 	}
diff --git a/sys/Simple.cpp b/sys/Simple.cpp
index f64b417..bf06f49 100644
--- a/sys/Simple.cpp
+++ b/sys/Simple.cpp
@@ -1,6 +1,6 @@
 /* Simple.cpp
  *
- * Copyright (C) 1992-2012,2015 Paul Boersma
+ * Copyright (C) 1992-2012,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -45,10 +45,10 @@ autoSimpleInt SimpleInt_create (int number) {
 	return me;
 }
 
-Thing_implement (SimpleLong, Daata, 0);
+Thing_implement (SimpleInteger, Daata, 0);
 
-autoSimpleLong SimpleLong_create (long number) {
-	autoSimpleLong me = Thing_new (SimpleLong);
+autoSimpleInteger SimpleInteger_create (long number) {
+	autoSimpleInteger me = Thing_new (SimpleInteger);
 	my number = number;
 	return me;
 }
diff --git a/sys/Simple.h b/sys/Simple.h
index 0da7513..f3fd876 100644
--- a/sys/Simple.h
+++ b/sys/Simple.h
@@ -2,7 +2,7 @@
 #define _Simple_h_
 /* Simple.h
  *
- * Copyright (C) 1992-2012,2015 Paul Boersma
+ * Copyright (C) 1992-2012,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@
 #include "Simple_def.h"
 
 autoSimpleInt SimpleInt_create (int number);
-autoSimpleLong SimpleLong_create (long number);
+autoSimpleInteger SimpleInteger_create (integer number);
 autoSimpleDouble SimpleDouble_create (double number);
 autoSimpleString SimpleString_create (const char32 *string);
 
diff --git a/sys/Simple_def.h b/sys/Simple_def.h
index d12d368..5e2e562 100644
--- a/sys/Simple_def.h
+++ b/sys/Simple_def.h
@@ -22,10 +22,10 @@ oo_DEFINE_CLASS (SimpleInt, Daata)
 oo_END_CLASS (SimpleInt)
 #undef ooSTRUCT
 
-#define ooSTRUCT SimpleLong
-oo_DEFINE_CLASS (SimpleLong, Daata)
-	oo_LONG (number)
-oo_END_CLASS (SimpleLong)
+#define ooSTRUCT SimpleInteger
+oo_DEFINE_CLASS (SimpleInteger, Daata)
+	oo_INTEGER (number)
+oo_END_CLASS (SimpleInteger)
 #undef ooSTRUCT
 
 #define ooSTRUCT SimpleDouble
diff --git a/sys/Strings.cpp b/sys/Strings.cpp
index 581cbef..a3750dd 100644
--- a/sys/Strings.cpp
+++ b/sys/Strings.cpp
@@ -1,6 +1,6 @@
 /* Strings.cpp
  *
- * Copyright (C) 1992-2012,2014,2015 Paul Boersma
+ * Copyright (C) 1992-2012,2014,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -61,18 +61,18 @@
 
 Thing_implement (Strings, Daata, 0);
 
-static long Strings_totalLength (Strings me) {
-	long totalLength = 0;
-	for (long i = 1; i <= my numberOfStrings; i ++) {
+static integer Strings_totalLength (Strings me) {
+	integer totalLength = 0;
+	for (integer i = 1; i <= my numberOfStrings; i ++) {
 		totalLength += str32len (my strings [i]);
 	}
 	return totalLength;
 }
 
-static long Strings_maximumLength (Strings me) {
-	long maximumLength = 0;
-	for (long i = 1; i <= my numberOfStrings; i ++) {
-		long length = str32len (my strings [i]);
+static integer Strings_maximumLength (Strings me) {
+	integer maximumLength = 0;
+	for (integer i = 1; i <= my numberOfStrings; i ++) {
+		integer length = str32len (my strings [i]);
 		if (length > maximumLength) {
 			maximumLength = length;
 		}
@@ -87,7 +87,7 @@ void structStrings :: v_info () {
 	MelderInfo_writeLine (U"Longest string: ", Strings_maximumLength (this), U" characters");
 }
 
-const char32 * structStrings :: v_getVectorStr (long icol) {
+const char32 * structStrings :: v_getVectorStr (integer icol) {
 	if (icol < 1 || icol > our numberOfStrings) return U"";
 	char32 *stringValue = strings [icol];
 	return stringValue ? stringValue : U"";
@@ -235,7 +235,7 @@ autoStrings Strings_readFromRawTextFile (MelderFile file) {
 		/*
 		 * Read strings.
 		 */
-		for (long i = 1; i <= n; i ++) {
+		for (integer i = 1; i <= n; i ++) {
 			char32 *line = MelderReadText_readLine (text.peek());
 			my strings [i] = Melder_dup (line);
 		}
@@ -247,15 +247,15 @@ autoStrings Strings_readFromRawTextFile (MelderFile file) {
 
 void Strings_writeToRawTextFile (Strings me, MelderFile file) {
 	autoMelderString buffer;
-	for (long i = 1; i <= my numberOfStrings; i ++) {
+	for (integer i = 1; i <= my numberOfStrings; i ++) {
 		MelderString_append (& buffer, my strings [i], U"\n");
 	}
 	MelderFile_writeText (file, buffer.string, Melder_getOutputEncoding ());
 }
 
 void Strings_randomize (Strings me) {
-	for (long i = 1; i < my numberOfStrings; i ++) {
-		long other = NUMrandomInteger (i, my numberOfStrings);
+	for (integer i = 1; i < my numberOfStrings; i ++) {
+		integer other = NUMrandomInteger (i, my numberOfStrings);
 		char32 *dummy = my strings [other];
 		my strings [other] = my strings [i];
 		my strings [i] = dummy;
@@ -264,7 +264,7 @@ void Strings_randomize (Strings me) {
 
 void Strings_genericize (Strings me) {
 	autostring32 buffer = Melder_calloc (char32, Strings_maximumLength (me) * 3 + 1);
-	for (long i = 1; i <= my numberOfStrings; i ++) {
+	for (integer i = 1; i <= my numberOfStrings; i ++) {
 		const char32 *p = (const char32 *) my strings [i];
 		while (*p) {
 			if (*p > 126) {   // backslashes are not converted, i.e. genericize^2 == genericize
@@ -284,7 +284,7 @@ void Strings_genericize (Strings me) {
 
 void Strings_nativize (Strings me) {
 	autostring32 buffer = Melder_calloc (char32, Strings_maximumLength (me) + 1);
-	for (long i = 1; i <= my numberOfStrings; i ++) {
+	for (integer i = 1; i <= my numberOfStrings; i ++) {
 		Longchar_nativize32 (my strings [i], buffer.peek(), false);
 		autostring32 newString = Melder_dup (buffer.peek());
 		/*
@@ -299,18 +299,18 @@ void Strings_sort (Strings me) {
 	NUMsort_str (my numberOfStrings, my strings);
 }
 
-void Strings_remove (Strings me, long position) {
+void Strings_remove (Strings me, integer position) {
 	if (position < 1 || position > my numberOfStrings) {
 		Melder_throw (U"You supplied a position of ", position, U", but for this string it has to be in the range [1, ", my numberOfStrings, U"].");
 	}
 	Melder_free (my strings [position]);
-	for (long i = position; i < my numberOfStrings; i ++) {
+	for (integer i = position; i < my numberOfStrings; i ++) {
 		my strings [i] = my strings [i + 1];
 	}
 	my numberOfStrings --;
 }
 
-void Strings_replace (Strings me, long position, const char32 *text) {
+void Strings_replace (Strings me, integer position, const char32 *text) {
 	if (position < 1 || position > my numberOfStrings) {
 		Melder_throw (U"You supplied a position of ", position, U", but for this string it has to be in the range [1, ", my numberOfStrings, U"].");
 	}
@@ -327,7 +327,7 @@ void Strings_replace (Strings me, long position, const char32 *text) {
 	my strings [position] = newString.transfer();
 }
 
-void Strings_insert (Strings me, long position, const char32 *text) {
+void Strings_insert (Strings me, integer position, const char32 *text) {
 	if (position == 0) {
 		position = my numberOfStrings + 1;
 	} else if (position < 1 || position > my numberOfStrings + 1) {
@@ -341,12 +341,12 @@ void Strings_insert (Strings me, long position, const char32 *text) {
 	/*
 	 * Change without error.
 	 */
-	for (long i = 1; i < position; i ++) {
+	for (integer i = 1; i < position; i ++) {
 		newStrings [i] = my strings [i];
 	}
 	newStrings [position] = newString.transfer();
 	my numberOfStrings ++;
-	for (long i = position + 1; i <= my numberOfStrings; i ++) {
+	for (integer i = position + 1; i <= my numberOfStrings; i ++) {
 		newStrings [i] = my strings [i - 1];
 	}
 	NUMvector_free (my strings, 1);
diff --git a/sys/StringsEditor.cpp b/sys/StringsEditor.cpp
index 0c8f248..bbd730a 100644
--- a/sys/StringsEditor.cpp
+++ b/sys/StringsEditor.cpp
@@ -38,7 +38,7 @@ void structStringsEditor :: v_createHelpMenuItems (EditorMenu menu) {
 static void updateList (StringsEditor me) {
 	Strings strings = (Strings) my data;
 	GuiList_deleteAllItems (my list);
-	for (long i = 1; i <= strings -> numberOfStrings; i ++)
+	for (integer i = 1; i <= strings -> numberOfStrings; i ++)
 		GuiList_insertItem (my list, strings -> strings [i], 0);
 }
 
@@ -47,8 +47,8 @@ static void gui_button_cb_insert (StringsEditor me, GuiButtonEvent /* event */)
 	/*
 	 * Find the first selected item.
 	 */
-	long numberOfSelected, *selected = GuiList_getSelectedPositions (my list, & numberOfSelected);
-	long position = selected ? selected [1] : strings -> numberOfStrings + 1;
+	integer numberOfSelected, *selected = GuiList_getSelectedPositions (my list, & numberOfSelected);
+	integer position = selected ? selected [1] : strings -> numberOfStrings + 1;
 	NUMvector_free (selected, 1);
 	char32 *text = GuiText_getString (my text);
 	/*
@@ -89,8 +89,8 @@ static void gui_button_cb_append (StringsEditor me, GuiButtonEvent /* event */)
 }
 
 static void gui_button_cb_remove (StringsEditor me, GuiButtonEvent /* event */) {
-	long numberOfSelected, *selected = GuiList_getSelectedPositions (my list, & numberOfSelected);
-	for (long iselected = numberOfSelected; iselected >= 1; iselected --) {
+	integer numberOfSelected, *selected = GuiList_getSelectedPositions (my list, & numberOfSelected);
+	for (integer iselected = numberOfSelected; iselected >= 1; iselected --) {
 		Strings_remove ((Strings) my data, selected [iselected]);
 	}
 	NUMvector_free (selected, 1);
@@ -100,9 +100,9 @@ static void gui_button_cb_remove (StringsEditor me, GuiButtonEvent /* event */)
 
 static void gui_button_cb_replace (StringsEditor me, GuiButtonEvent /* event */) {
 	Strings strings = (Strings) my data;
-	long numberOfSelected, *selected = GuiList_getSelectedPositions (my list, & numberOfSelected);
+	integer numberOfSelected, *selected = GuiList_getSelectedPositions (my list, & numberOfSelected);
 	char32 *text = GuiText_getString (my text);
-	for (long iselected = 1; iselected <= numberOfSelected; iselected ++) {
+	for (integer iselected = 1; iselected <= numberOfSelected; iselected ++) {
 		Strings_replace (strings, selected [iselected], text);
 		GuiList_replaceItem (my list, text, selected [iselected]);
 	}
diff --git a/sys/Strings_.h b/sys/Strings_.h
index 9a891df..0fce671 100644
--- a/sys/Strings_.h
+++ b/sys/Strings_.h
@@ -2,7 +2,7 @@
 #define _Strings_h_
 /* Strings.h
  *
- * Copyright (C) 1992-2011,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -32,9 +32,9 @@ void Strings_genericize (Strings me);
 void Strings_nativize (Strings me);
 void Strings_sort (Strings me);
 
-void Strings_remove (Strings me, long position);
-void Strings_replace (Strings me, long position, const char32 *text);
-void Strings_insert (Strings me, long position, const char32 *text);
+void Strings_remove (Strings me, integer position);
+void Strings_replace (Strings me, integer position, const char32 *text);
+void Strings_insert (Strings me, integer position, const char32 *text);
 
 /* End of file Strings.h */
 #endif
diff --git a/sys/Strings_def.h b/sys/Strings_def.h
index b7212b1..18af9b7 100644
--- a/sys/Strings_def.h
+++ b/sys/Strings_def.h
@@ -1,6 +1,6 @@
 /* Strings_def.h
  *
- * Copyright (C) 1992-2011,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2015,2017 Paul Boersma
  *
  * This code 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 @@
 #define ooSTRUCT Strings
 oo_DEFINE_CLASS (Strings, Daata)
 
-	oo_LONG (numberOfStrings)
+	oo_INTEGER (numberOfStrings)
 	oo_STRING_VECTOR (strings, numberOfStrings)
 
 	#if oo_DECLARING
@@ -28,7 +28,7 @@ oo_DEFINE_CLASS (Strings, Daata)
 			override;
 		bool v_hasGetVectorStr ()
 			override { return true; }
-		const char32 * v_getVectorStr (long icol)
+		const char32 * v_getVectorStr (integer icol)
 			override;
 	#endif
 
diff --git a/sys/TextEditor.cpp b/sys/TextEditor.cpp
index 39c5963..29ff8e3 100644
--- a/sys/TextEditor.cpp
+++ b/sys/TextEditor.cpp
@@ -64,7 +64,7 @@ void structTextEditor :: v_nameChanged () {
 }
 
 static void openDocument (TextEditor me, MelderFile file) {
-	for (long ieditor = 1; ieditor <= theReferencesToAllOpenTextEditors.size; ieditor ++) {
+	for (integer ieditor = 1; ieditor <= theReferencesToAllOpenTextEditors.size; ieditor ++) {
 		TextEditor editor = theReferencesToAllOpenTextEditors.at [ieditor];
 		if (editor != me && MelderFile_equal (file, & editor -> file)) {
 			Editor_raise (editor);
@@ -397,27 +397,27 @@ static void menu_cb_erase (TextEditor me, EDITOR_ARGS_DIRECT) {
 	GuiText_remove (my textWidget);
 }
 
-static bool getSelectedLines (TextEditor me, long *firstLine, long *lastLine) {
-	long left, right;
+static bool getSelectedLines (TextEditor me, integer *firstLine, integer *lastLine) {
+	integer left, right;
 	char32 *text = GuiText_getStringAndSelectionPosition (my textWidget, & left, & right);
-	long textLength = str32len (text);
+	integer textLength = str32len (text);
 	Melder_assert (left >= 0);
 	Melder_assert (left <= right);
 	Melder_assert (right <= textLength);
-	long i = 0;
+	integer i = 0;
 	*firstLine = 1;
 	/*
 	 * Cycle through the text in order to see how many linefeeds we pass.
 	 */
 	for (; i < left; i ++) {
-		if (text [i] == '\n') {
+		if (text [i] == U'\n') {
 			(*firstLine) ++;
 		}
 	}
 	if (left == right) return false;
 	*lastLine = *firstLine;
 	for (; i < right; i ++) {
-		if (text [i] == '\n') {
+		if (text [i] == U'\n') {
 			(*lastLine) ++;
 		}
 	}
@@ -428,11 +428,11 @@ static bool getSelectedLines (TextEditor me, long *firstLine, long *lastLine) {
 static char32 *theFindString = nullptr, *theReplaceString = nullptr;
 static void do_find (TextEditor me) {
 	if (! theFindString) return;   // e.g. when the user does "Find again" before having done any "Find"
-	long left, right;
+	integer left, right;
 	autostring32 text = GuiText_getStringAndSelectionPosition (my textWidget, & left, & right);
 	char32 *location = str32str (& text [right], theFindString);
 	if (location) {
-		long index = location - text.peek();
+		integer index = location - text.peek();
 		GuiText_setSelection (my textWidget, index, index + str32len (theFindString));
 		GuiText_scrollToSelection (my textWidget);
 		#ifdef _WIN32
@@ -442,7 +442,7 @@ static void do_find (TextEditor me) {
 		/* Try from the start of the document. */
 		location = str32str (text.peek(), theFindString);
 		if (location) {
-			long index = location - text.peek();
+			integer index = location - text.peek();
 			GuiText_setSelection (my textWidget, index, index + str32len (theFindString));
 			GuiText_scrollToSelection (my textWidget);
 			#ifdef _WIN32
@@ -461,7 +461,7 @@ static void do_replace (TextEditor me) {
 		do_find (me);
 		return;
 	}
-	long left, right;
+	integer left, right;
 	autostring32 text = GuiText_getStringAndSelectionPosition (my textWidget, & left, & right);
 	GuiText_replace (my textWidget, left, right, theReplaceString);
 	GuiText_setSelection (my textWidget, left, left + str32len (theReplaceString));
@@ -473,13 +473,12 @@ static void do_replace (TextEditor me) {
 
 static void menu_cb_find (TextEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Find", nullptr)
-		LABEL (U"", U"Find:")
-		TEXTFIELD (U"findString", U"")
+		TEXTFIELD (findString, U"Find:", U"")
 	EDITOR_OK
-		if (theFindString) SET_STRING (U"findString", theFindString);
+		if (theFindString) SET_STRING (findString, theFindString);
 	EDITOR_DO
 		Melder_free (theFindString);
-		theFindString = Melder_dup_f (GET_STRING (U"findString"));
+		theFindString = Melder_dup_f (findString);
 		do_find (me);
 	EDITOR_END
 }
@@ -490,23 +489,21 @@ static void menu_cb_findAgain (TextEditor me, EDITOR_ARGS_DIRECT) {
 
 static void menu_cb_replace (TextEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Find", nullptr)
-		LABEL (U"", U"This is a \"slow\" find-and-replace method;")
-		LABEL (U"", U"if the selected text is identical to the Find string,")
-		LABEL (U"", U"the selected text will be replaced by the Replace string;")
-		LABEL (U"", U"otherwise, the next occurrence of the Find string will be selected.")
-		LABEL (U"", U"So you typically need two clicks on Apply to get a text replaced.")
-		LABEL (U"", U"Find:")
-		TEXTFIELD (U"findString", U"")
-		LABEL (U"", U"Replace with:")
-		TEXTFIELD (U"replaceString", U"")
+		LABEL (U"This is a \"slow\" find-and-replace method;")
+		LABEL (U"if the selected text is identical to the Find string,")
+		LABEL (U"the selected text will be replaced by the Replace string;")
+		LABEL (U"otherwise, the next occurrence of the Find string will be selected.")
+		LABEL (U"So you typically need two clicks on Apply to get a text replaced.")
+		TEXTFIELD (findString, U"Find:", U"")
+		TEXTFIELD (replaceString, U"Replace with:", U"")
 	EDITOR_OK
-		if (theFindString) SET_STRING (U"findString", theFindString);
-		if (theReplaceString) SET_STRING (U"replaceString", theReplaceString);
+		if (theFindString) SET_STRING (findString, theFindString);
+		if (theReplaceString) SET_STRING (replaceString, theReplaceString);
 	EDITOR_DO
 		Melder_free (theFindString);
-		theFindString = Melder_dup (GET_STRING (U"findString"));
+		theFindString = Melder_dup (findString);
 		Melder_free (theReplaceString);
-		theReplaceString = Melder_dup (GET_STRING (U"replaceString"));
+		theReplaceString = Melder_dup (replaceString);
 		do_replace (me);
 	EDITOR_END
 }
@@ -516,7 +513,7 @@ static void menu_cb_replaceAgain (TextEditor me, EDITOR_ARGS_DIRECT) {
 }
 
 static void menu_cb_whereAmI (TextEditor me, EDITOR_ARGS_DIRECT) {
-	long numberOfLinesLeft, numberOfLinesRight;
+	integer numberOfLinesLeft, numberOfLinesRight;
 	if (! getSelectedLines (me, & numberOfLinesLeft, & numberOfLinesRight)) {
 		Melder_information (U"The cursor is on line ", numberOfLinesLeft, U".");
 	} else if (numberOfLinesLeft == numberOfLinesRight) {
@@ -528,14 +525,14 @@ static void menu_cb_whereAmI (TextEditor me, EDITOR_ARGS_DIRECT) {
 
 static void menu_cb_goToLine (TextEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Go to line", nullptr)
-		NATURAL (U"Line", U"1")
+		NATURAL (lineToGo, U"Line", U"1")
 	EDITOR_OK
-		long firstLine, lastLine;
+		integer firstLine, lastLine;
 		getSelectedLines (me, & firstLine, & lastLine);
-		SET_INTEGER (U"Line", firstLine);
+		SET_INTEGER (lineToGo, firstLine)
 	EDITOR_DO
 		autostring32 text = GuiText_getString (my textWidget);
-		long lineToGo = GET_INTEGER (U"Line"), currentLine = 1;
+		integer currentLine = 1;
 		int64 left = 0, right = 0;
 		if (lineToGo == 1) {
 			for (; text [right] != U'\n' && text [right] != U'\0'; right ++) { }
@@ -615,11 +612,11 @@ static void menu_cb_18 (TextEditor me, EDITOR_ARGS_DIRECT) { setFontSize (me, 18
 static void menu_cb_24 (TextEditor me, EDITOR_ARGS_DIRECT) { setFontSize (me, 24); }
 static void menu_cb_fontSize (TextEditor me, EDITOR_ARGS_FORM) {
 	EDITOR_FORM (U"Text window: Font size", nullptr)
-		NATURAL (U"Font size (points)", U"12")
+		NATURAL (fontSize, U"Font size (points)", U"12")
 	EDITOR_OK
-		SET_INTEGER (U"Font size", (long) my p_fontSize);
+		SET_INTEGER (fontSize, (integer) my p_fontSize);
 	EDITOR_DO
-		setFontSize (me, GET_INTEGER (U"Font size"));
+		setFontSize (me, fontSize);
 	EDITOR_END
 }
 
diff --git a/sys/Thing.cpp b/sys/Thing.cpp
index 78b992f..a082a1b 100644
--- a/sys/Thing.cpp
+++ b/sys/Thing.cpp
@@ -20,7 +20,7 @@
 #include <time.h>
 #include "Thing.h"
 
-long theTotalNumberOfThings;
+integer theTotalNumberOfThings;
 
 void structThing :: v_info ()
 {
@@ -56,7 +56,7 @@ autoThing Thing_newFromClass (ClassInfo classInfo) {
 	return me;
 }
 
-static int theNumberOfReadableClasses = 0;
+static integer theNumberOfReadableClasses = 0;
 static ClassInfo theReadableClasses [1 + 1000];
 static void _Thing_addOneReadableClass (ClassInfo readableClass) {
 	if (++ theNumberOfReadableClasses > 1000)
@@ -76,10 +76,10 @@ void Thing_recognizeClassesByName (ClassInfo readableClass, ...) {
 	va_end (arg);
 }
 
-long Thing_listReadableClasses () {
+integer Thing_listReadableClasses () {
 	Melder_clearInfo ();
 	MelderInfo_open ();
-	for (long iclass = 1; iclass <= theNumberOfReadableClasses; iclass ++) {
+	for (integer iclass = 1; iclass <= theNumberOfReadableClasses; iclass ++) {
 		ClassInfo klas = theReadableClasses [iclass];
 		MelderInfo_writeLine (klas -> sequentialUniqueIdOfReadableClass, U"\t", klas -> className);
 	}
@@ -87,7 +87,7 @@ long Thing_listReadableClasses () {
 	return theNumberOfReadableClasses;
 }
 
-static int theNumberOfAliases = 0;
+static integer theNumberOfAliases = 0;
 static struct {
 	ClassInfo readableClass;
 	const char32 *otherName;
@@ -101,6 +101,7 @@ void Thing_recognizeClassByOtherName (ClassInfo readableClass, const char32 *oth
 ClassInfo Thing_classFromClassName (const char32 *klas, int *p_formatVersion) {
 	static char32 buffer [1+100];
 	str32ncpy (buffer, klas ? klas : U"", 100);
+	buffer [100] = U'\0';
 	char32 *space = str32chr (buffer, U' ');
 	if (space) {
 		*space = U'\0';   // strip version number
@@ -112,7 +113,7 @@ ClassInfo Thing_classFromClassName (const char32 *klas, int *p_formatVersion) {
 	/*
 	 * First try the class names that were registered with Thing_recognizeClassesByName.
 	 */
-	for (int i = 1; i <= theNumberOfReadableClasses; i ++) {
+	for (integer i = 1; i <= theNumberOfReadableClasses; i ++) {
 		ClassInfo classInfo = theReadableClasses [i];
 		if (str32equ (buffer, classInfo -> className)) {
 			return classInfo;
@@ -122,7 +123,7 @@ ClassInfo Thing_classFromClassName (const char32 *klas, int *p_formatVersion) {
 	/*
 	 * Then try the aliases that were registered with Thing_recognizeClassByOtherName.
 	 */
-	for (int i = 1; i <= theNumberOfAliases; i ++) {
+	for (integer i = 1; i <= theNumberOfAliases; i ++) {
 		if (str32equ (buffer, theAliases [i]. otherName)) {
 			ClassInfo classInfo = theAliases [i]. readableClass;
 			return classInfo;
@@ -199,7 +200,7 @@ void * _Thing_check (Thing me, ClassInfo klas, const char *fileName, int line) {
 	return me;
 }
 
-void Thing_infoWithIdAndFile (Thing me, long id, MelderFile file) {
+void Thing_infoWithIdAndFile (Thing me, integer id, MelderFile file) {
 	//Melder_assert (me);
 	Melder_clearInfo ();
 	MelderInfo_open ();
@@ -242,9 +243,9 @@ void Thing_setName (Thing me, const char32 *name /* cattable */) {
 
 void Thing_swap (Thing me, Thing thee) {
 	Melder_assert (my classInfo == thy classInfo);
-	int n = my classInfo -> size;
+	integer n = my classInfo -> size;
 	char *p, *q;
-	int i;
+	integer i;
 	for (p = (char *) me, q = (char *) thee, i = n; i > 0; i --, p ++, q ++) {
 		char tmp = *p;
 		*p = *q;
diff --git a/sys/Thing.h b/sys/Thing.h
index 25cdcac..324653e 100644
--- a/sys/Thing.h
+++ b/sys/Thing.h
@@ -37,13 +37,13 @@ struct structClassInfo {
 	 */
 	const char32 *className;
 	ClassInfo semanticParent;
-	long size;
+	integer size;
 	Thing (* _new) ();   // objects have to be constructed via this function, because it calls C++ "new", which initializes the C++ class pointer
-	long version;
+	integer version;
 	/*
 	 * The following field is initialized by Thing_recognizeClassesByName, only for classes that have to be read (usually from disk).
 	 */
-	long sequentialUniqueIdOfReadableClass;
+	integer sequentialUniqueIdOfReadableClass;
 	/*
 	 * The following field is initialized by Thing_dummyObject(), which is used only rarely.
 	 */
@@ -147,7 +147,7 @@ bool Thing_isSubclass (ClassInfo klas, ClassInfo ancestor);
 */
 
 void Thing_info (Thing me);
-void Thing_infoWithIdAndFile (Thing me, long id, MelderFile file);
+void Thing_infoWithIdAndFile (Thing me, integer id, MelderFile file);
 
 void Thing_recognizeClassesByName (ClassInfo readableClass, ...);
 /*
@@ -168,7 +168,7 @@ void Thing_recognizeClassesByName (ClassInfo readableClass, ...);
 		Calls to this routine should preferably be put in the beginning of main ().
 */
 void Thing_recognizeClassByOtherName (ClassInfo readableClass, const char32 *otherName);
-long Thing_listReadableClasses ();
+integer Thing_listReadableClasses ();
 
 ClassInfo Thing_classFromClassName (const char32 *className, int *formatVersion);
 /*
@@ -222,7 +222,7 @@ void * _Thing_check (Thing me, ClassInfo table, const char *fileName, int line);
 
 /* For debugging. */
 
-extern long theTotalNumberOfThings;
+extern integer theTotalNumberOfThings;
 /* This number is 0 initially, increments at every successful `new', and decrements at every `forget'. */
 
 template <class T>
@@ -492,23 +492,23 @@ autoThing Thing_newFromClassName (const char32 *className, int *p_formatVersion)
 template <class T>
 class autoThingVector {
 	_Thing_auto<T> *d_ptr;
-	long d_from, d_to;
+	integer d_from, d_to;
 public:
-	autoThingVector<T> (long from, long to) : d_from (from), d_to (to) {
+	autoThingVector<T> (integer from, integer to) : d_from (from), d_to (to) {
 		d_ptr = static_cast <_Thing_auto<T>*> (NUMvector (sizeof (_Thing_auto<T>), from, to, true));
 	}
-	autoThingVector (_Thing_auto<T> *ptr, long from, long to) : d_ptr (ptr), d_from (from), d_to (to) {
+	autoThingVector (_Thing_auto<T> *ptr, integer from, integer to) : d_ptr (ptr), d_from (from), d_to (to) {
 	}
 	autoThingVector () : d_ptr (nullptr), d_from (1), d_to (0) {
 	}
 	~autoThingVector<T> () {
 		if (d_ptr) {
-			for (long i = d_from; i <= d_to; i ++)
+			for (integer i = d_from; i <= d_to; i ++)
 				d_ptr [i].reset();
 			NUMvector_free (sizeof (_Thing_auto<T>), d_ptr, d_from);
 		}
 	}
-	_Thing_auto<T>& operator[] (long i) {
+	_Thing_auto<T>& operator[] (integer i) {
 		return d_ptr [i];
 	}
 	_Thing_auto<T>* peek () const {
@@ -521,9 +521,9 @@ public:
 		return temp;
 	}
 
-	void reset (long from, long to) {
+	void reset (integer from, integer to) {
 		if (d_ptr) {
-			for (long i = d_from; i <= d_to; i ++)
+			for (integer i = d_from; i <= d_to; i ++)
 				forget (d_ptr [i]);
 			NUMvector_free (sizeof (T), d_ptr, d_from);
 			d_ptr = nullptr;
diff --git a/sys/Ui.cpp b/sys/Ui.cpp
index 504b8c9..e942db1 100644
--- a/sys/Ui.cpp
+++ b/sys/Ui.cpp
@@ -52,19 +52,24 @@
 Thing_implement (UiField, Thing, 0);
 
 void structUiField :: v_destroy () noexcept {
-	Melder_free (formLabel);
-	Melder_free (stringValue);
-	Melder_free (stringValueA);
-	Melder_free (stringDefaultValue);
-	UiField_Parent :: v_destroy ();
+	Melder_free (our formLabel);
+	Melder_free (our stringValue);
+	Melder_free (our stringValueA);
+	Melder_free (our stringDefaultValue);
+	if (our owned) {
+		our numericVectorVariable -> reset();
+		our numericMatrixVariable -> reset();
+	}
+	our UiField_Parent :: v_destroy ();
 }
 
 static UiField UiField_create (int type, const char32 *name) {
 	autoUiField me = Thing_new (UiField);
-	char32 shortName [101], *p;
+	char32 shortName [1+100], *p;
 	my type = type;
 	my formLabel = Melder_dup (name);
-	str32cpy (shortName, name);
+	str32ncpy (shortName, name, 100);
+	shortName [100] = U'\0';
 	/*
 	 * Strip parentheses and colon off parameter name.
 	 */
@@ -82,23 +87,23 @@ static UiField UiField_create (int type, const char32 *name) {
 
 Thing_implement (UiOption, Thing, 0);
 
-static UiOption UiOption_create (const char32 *label) {
+static autoUiOption UiOption_create (const char32 *label) {
 	autoUiOption me = Thing_new (UiOption);
 	Thing_setName (me.get(), label);
-	return me.releaseToAmbiguousOwner();
+	return me;
 }
 
 UiOption UiRadio_addButton (UiField me, const char32 *label) {
 	if (! me) return nullptr;
 	Melder_assert (my type == UI_RADIO || my type == UI_OPTIONMENU);
-	autoUiOption thee (UiOption_create (label));
+	autoUiOption thee = UiOption_create (label);
 	return my options. addItem_move (thee.move());
 }
 
 UiOption UiOptionMenu_addButton (UiField me, const char32 *label) {
 	if (! me) return nullptr;
 	Melder_assert (my type == UI_RADIO || my type == UI_OPTIONMENU);
-	autoUiOption thee (UiOption_create (label));
+	autoUiOption thee = UiOption_create (label);
 	return my options. addItem_move (thee.move());
 }
 
@@ -219,7 +224,7 @@ static void UiField_widgetToValue (UiField me) {
 			if ((my type == UI_NATURAL || my type == UI_CHANNEL) && my integerValue < 1) {
 				Melder_throw (U_LEFT_DOUBLE_QUOTE, my name, U_RIGHT_DOUBLE_QUOTE U" should be a positive whole number.");
 			}
-			if (my longVariable) *my longVariable = my integerValue;
+			if (my integerVariable) *my integerVariable = my integerValue;
 		} break; case UI_WORD: {
 			Melder_free (my stringValue);
 			my stringValue = GuiText_getString (my text);
@@ -241,19 +246,15 @@ static void UiField_widgetToValue (UiField me) {
 			Melder_free (my stringValue);
 			my stringValue = GuiText_getString (my text);
 			if (my numericVectorVariable) {
-				numvec vec;
-				bool owned;
-				Interpreter_numericVectorExpression (nullptr, my stringValue, & vec, & owned);
-				*my numericVectorVariable = owned ? autonumvec (vec) : copy_numvec (vec);
+				if (my owned) my numericVectorVariable -> reset();
+				Interpreter_numericVectorExpression (nullptr, my stringValue, my numericVectorVariable, & my owned);
 			}
 		} break; case UI_NUMMAT: {
 			Melder_free (my stringValue);
 			my stringValue = GuiText_getString (my text);
 			if (my numericMatrixVariable) {
-				nummat mat;
-				bool owned;
-				Interpreter_numericMatrixExpression (nullptr, my stringValue, & mat, & owned);
-				*my numericMatrixVariable = owned ? autonummat (mat) : copy_nummat (mat);
+				if (my owned) my numericMatrixVariable -> reset();
+				Interpreter_numericMatrixExpression (nullptr, my stringValue, my numericMatrixVariable, & my owned);
 			}
 		} break; case UI_BOOLEAN: {
 			my integerValue = GuiCheckButton_getValue (my checkButton);
@@ -276,16 +277,16 @@ static void UiField_widgetToValue (UiField me) {
 			if (my intVariable) *my intVariable = my integerValue - my subtract;
 			if (my stringVariable) *my stringVariable = my options.at [my integerValue] -> name;
 		} break; case UI_LIST: {
-			long numberOfSelected, *selected = GuiList_getSelectedPositions (my list, & numberOfSelected);   // BUG memory
+			integer numberOfSelected, *selected = GuiList_getSelectedPositions (my list, & numberOfSelected);   // BUG memory
 			if (! selected) {
 				Melder_warning (U"No items selected.");
 				my integerValue = 1;
 			} else {
 				if (numberOfSelected > 1) Melder_warning (U"More than one item selected.");
 				my integerValue = selected [1];
-				NUMvector_free <long> (selected, 1);
+				NUMvector_free <integer> (selected, 1);
 			}
-			if (my longVariable) *my longVariable = my integerValue;
+			if (my integerVariable) *my integerVariable = my integerValue;
 			if (my stringVariable) *my stringVariable = (char32 *) my strings [my integerValue];
 		} break; case UI_COLOUR: {
 			autostring32 string = GuiText_getString (my text);
@@ -295,98 +296,7 @@ static void UiField_widgetToValue (UiField me) {
 				Interpreter_numericExpression (nullptr, string.peek(), & my colourValue. red);
 				my colourValue. green = my colourValue. blue = my colourValue. red;
 			}
-		}
-	}
-}
-
-static void UiField_stringToValue (UiField me, const char32 *string, Interpreter interpreter) {
-	switch (my type) {
-		case UI_REAL: case UI_REAL_OR_UNDEFINED: case UI_POSITIVE: {
-			if (str32spn (string, U" \t") == str32len (string))
-				Melder_throw (U"Argument “", my name, U"” empty.");
-			Interpreter_numericExpression (interpreter, string, & my realValue);
-			if (isundef (my realValue) && my type != UI_REAL_OR_UNDEFINED)
-				Melder_throw (U"\"", my name, U"\" has the value \"undefined\".");
-			if (my type == UI_POSITIVE && my realValue <= 0.0)
-				Melder_throw (U"\"", my name, U"\" must be greater than 0.");
-			if (my realVariable) *my realVariable = my realValue;
-		} break; case UI_INTEGER: case UI_NATURAL: case UI_CHANNEL: {
-			if (str32spn (string, U" \t") == str32len (string))
-				Melder_throw (U"Argument “", my name, U"” empty.");
-			if (my type == UI_CHANNEL && (str32equ (string, U"All") || str32equ (string, U"Average"))) {
-				my integerValue = 0;
-			} else if (my type == UI_CHANNEL && (str32equ (string, U"Left") || str32equ (string, U"Mono"))) {
-				my integerValue = 1;
-			} else if (my type == UI_CHANNEL && (str32equ (string, U"Right") || str32equ (string, U"Stereo"))) {
-				my integerValue = 2;
-			} else {
-				double realValue;
-				Interpreter_numericExpression (interpreter, string, & realValue);
-				my integerValue = lround (realValue);
-			}
-			if (my type == UI_NATURAL && my integerValue < 1)
-				Melder_throw (U"\"", my name, U"\" must be a positive whole number.");
-			if (my longVariable) *my longVariable = my integerValue;
-		} break; case UI_WORD: case UI_SENTENCE: case UI_TEXT: {
-			Melder_free (my stringValue);
-			my stringValue = Melder_dup_f (string);
-			if (my stringVariable) *my stringVariable = my stringValue;
-		} break; case UI_BOOLEAN: {
-			if (! string [0])
-				Melder_throw (U"Empty argument for toggle button.");
-			my integerValue = string [0] == U'1' || string [0] == U'y' || string [0] == U'Y' ||
-				string [0] == U't' || string [0] == U'T';
-			if (my boolVariable) *my boolVariable = my integerValue;
-		} break; case UI_RADIO: case UI_OPTIONMENU: {
-			my integerValue = 0;
-			for (int i = 1; i <= my options.size; i ++) {
-				UiOption b = my options.at [i];
-				if (str32equ (string, b -> name))
-					my integerValue = i;
-			}
-			if (my integerValue == 0) {
-				/*
-					Retry with different case.
-				*/
-				for (int i = 1; i <= my options.size; i ++) {
-					UiOption b = my options.at [i];
-					char32 name2 [100];
-					str32cpy (name2, b -> name);
-					if (islower32 (name2 [0])) name2 [0] = toupper32 (name2 [0]);
-					else if (isupper32 (name2 [0])) name2 [0] = tolower32 (name2 [0]);
-					if (str32equ (string, name2))
-						my integerValue = i;
-				}
-			}
-			if (my integerValue == 0) {
-				Melder_throw (U"Field \"", my name, U"\" must not have the value \"", string, U"\".");
-			}
-			if (my intVariable) *my intVariable = my integerValue - my subtract;
-			if (my stringVariable) *my stringVariable = my options.at [my integerValue] -> name;
-		} break; case UI_LIST: {
-			long i = 1;
-			for (; i <= my numberOfStrings; i ++)
-				if (str32equ (string, my strings [i])) break;
-			if (i > my numberOfStrings)
-				Melder_throw (U"Field \"", my name, U"\" must not have the value \"", string, U"\".");
-			my integerValue = i;
-			if (my longVariable) *my longVariable = my integerValue;
-			if (my stringVariable) *my stringVariable = (char32 *) my strings [my integerValue];
-		} break; case UI_COLOUR: {
-			autostring32 string2 = Melder_dup_f (string);
-			if (colourToValue (me, string2.peek())) {
-				/* OK */
-			} else {
-				try {
-					Interpreter_numericExpression (interpreter, string2.peek(), & my colourValue. red);
-					my colourValue. green = my colourValue. blue = my colourValue. red;
-				} catch (MelderError) {
-					Melder_clearError ();
-					Melder_throw (U"Cannot compute a colour from \"", string2.peek(), U"\".");
-				}
-			}
-		} break; default: {
-			Melder_throw (U"Unknown field type ", my type, U".");
+			if (my colourVariable) *my colourVariable = my colourValue;
 		}
 	}
 }
@@ -640,13 +550,7 @@ static UiField UiForm_addField (UiForm me, int type, const char32 *label) {
 	return my field [++ my numberOfFields] = UiField_create (type, label);
 }
 
-UiField UiForm_addReal (UiForm me, const char32 *label, const char32 *defaultValue) {
-	autoUiField thee (UiForm_addField (me, UI_REAL, label));
-	thy stringDefaultValue = Melder_dup (defaultValue);
-	return thee.releaseToAmbiguousOwner();
-}
-
-UiField UiForm_addReal4 (UiForm me, double *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue) {
+UiField UiForm_addReal (UiForm me, double *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue) {
 	autoUiField thee (UiForm_addField (me, UI_REAL, label));
 	thy stringDefaultValue = Melder_dup (defaultValue);
 	thy realVariable = variable;
@@ -654,13 +558,7 @@ UiField UiForm_addReal4 (UiForm me, double *variable, const char32 *variableName
 	return thee.releaseToAmbiguousOwner();
 }
 
-UiField UiForm_addRealOrUndefined (UiForm me, const char32 *label, const char32 *defaultValue) {
-	autoUiField thee (UiForm_addField (me, UI_REAL_OR_UNDEFINED, label));
-	thy stringDefaultValue = Melder_dup (defaultValue);
-	return thee.releaseToAmbiguousOwner();
-}
-
-UiField UiForm_addRealOrUndefined4 (UiForm me, double *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue) {
+UiField UiForm_addRealOrUndefined (UiForm me, double *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue) {
 	autoUiField thee (UiForm_addField (me, UI_REAL_OR_UNDEFINED, label));
 	thy stringDefaultValue = Melder_dup (defaultValue);
 	thy realVariable = variable;
@@ -668,13 +566,7 @@ UiField UiForm_addRealOrUndefined4 (UiForm me, double *variable, const char32 *v
 	return thee.releaseToAmbiguousOwner();
 }
 
-UiField UiForm_addPositive (UiForm me, const char32 *label, const char32 *defaultValue) {
-	autoUiField thee (UiForm_addField (me, UI_POSITIVE, label));
-	thy stringDefaultValue = Melder_dup (defaultValue);
-	return thee.releaseToAmbiguousOwner();
-}
-
-UiField UiForm_addPositive4 (UiForm me, double *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue) {
+UiField UiForm_addPositive (UiForm me, double *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue) {
 	autoUiField thee (UiForm_addField (me, UI_POSITIVE, label));
 	thy stringDefaultValue = Melder_dup (defaultValue);
 	thy realVariable = variable;
@@ -682,41 +574,23 @@ UiField UiForm_addPositive4 (UiForm me, double *variable, const char32 *variable
 	return thee.releaseToAmbiguousOwner();
 }
 
-UiField UiForm_addInteger (UiForm me, const char32 *label, const char32 *defaultValue) {
-	autoUiField thee (UiForm_addField (me, UI_INTEGER, label));
-	thy stringDefaultValue = Melder_dup (defaultValue);
-	return thee.releaseToAmbiguousOwner();
-}
-
-UiField UiForm_addInteger4 (UiForm me, long *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue) {
+UiField UiForm_addInteger (UiForm me, integer *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue) {
 	autoUiField thee (UiForm_addField (me, UI_INTEGER, label));
 	thy stringDefaultValue = Melder_dup (defaultValue);
-	thy longVariable = variable;
+	thy integerVariable = variable;
 	thy variableName = variableName;
 	return thee.releaseToAmbiguousOwner();
 }
 
-UiField UiForm_addNatural (UiForm me, const char32 *label, const char32 *defaultValue) {
-	autoUiField thee (UiForm_addField (me, UI_NATURAL, label));
-	thy stringDefaultValue = Melder_dup (defaultValue);
-	return thee.releaseToAmbiguousOwner();
-}
-
-UiField UiForm_addNatural4 (UiForm me, long *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue) {
+UiField UiForm_addNatural (UiForm me, integer *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue) {
 	autoUiField thee (UiForm_addField (me, UI_NATURAL, label));
 	thy stringDefaultValue = Melder_dup (defaultValue);
-	thy longVariable = variable;
+	thy integerVariable = variable;
 	thy variableName = variableName;
 	return thee.releaseToAmbiguousOwner();
 }
 
-UiField UiForm_addWord (UiForm me, const char32 *label, const char32 *defaultValue) {
-	autoUiField thee (UiForm_addField (me, UI_WORD, label));
-	thy stringDefaultValue = Melder_dup (defaultValue);
-	return thee.releaseToAmbiguousOwner();
-}
-
-UiField UiForm_addWord4 (UiForm me, char32 **variable, const char32 *variableName, const char32 *label, const char32 *defaultValue) {
+UiField UiForm_addWord (UiForm me, char32 **variable, const char32 *variableName, const char32 *label, const char32 *defaultValue) {
 	autoUiField thee (UiForm_addField (me, UI_WORD, label));
 	thy stringDefaultValue = Melder_dup (defaultValue);
 	thy stringVariable = variable;
@@ -724,13 +598,7 @@ UiField UiForm_addWord4 (UiForm me, char32 **variable, const char32 *variableNam
 	return thee.releaseToAmbiguousOwner();
 }
 
-UiField UiForm_addSentence (UiForm me, const char32 *label, const char32 *defaultValue) {
-	autoUiField thee (UiForm_addField (me, UI_SENTENCE, label));
-	thy stringDefaultValue = Melder_dup (defaultValue);
-	return thee.releaseToAmbiguousOwner();
-}
-
-UiField UiForm_addSentence4 (UiForm me, char32 **variable, const char32 *variableName, const char32 *label, const char32 *defaultValue) {
+UiField UiForm_addSentence (UiForm me, char32 **variable, const char32 *variableName, const char32 *label, const char32 *defaultValue) {
 	autoUiField thee (UiForm_addField (me, UI_SENTENCE, label));
 	thy stringDefaultValue = Melder_dup (defaultValue);
 	thy stringVariable = variable;
@@ -738,19 +606,14 @@ UiField UiForm_addSentence4 (UiForm me, char32 **variable, const char32 *variabl
 	return thee.releaseToAmbiguousOwner();
 }
 
-UiField UiForm_addLabel (UiForm me, const char32 *name, const char32 *label) {
-	autoUiField thee (UiForm_addField (me, UI_LABEL, name));
+UiField UiForm_addLabel (UiForm me, char32 **variable, const char32 *label) {
+	autoUiField thee (UiForm_addField (me, UI_LABEL, label));
+	thy stringVariable = variable;
 	thy stringValue = Melder_dup (label);
 	return thee.releaseToAmbiguousOwner();
 }
 
-UiField UiForm_addBoolean (UiForm me, const char32 *label, int defaultValue) {
-	autoUiField thee (UiForm_addField (me, UI_BOOLEAN, label));
-	thy integerDefaultValue = defaultValue;
-	return thee.releaseToAmbiguousOwner();
-}
-
-UiField UiForm_addBoolean4 (UiForm me, bool *variable, const char32 *variableName, const char32 *label, int defaultValue) {
+UiField UiForm_addBoolean (UiForm me, bool *variable, const char32 *variableName, const char32 *label, int defaultValue) {
 	autoUiField thee (UiForm_addField (me, UI_BOOLEAN, label));
 	thy integerDefaultValue = defaultValue;
 	thy boolVariable = variable;
@@ -758,13 +621,7 @@ UiField UiForm_addBoolean4 (UiForm me, bool *variable, const char32 *variableNam
 	return thee.releaseToAmbiguousOwner();
 }
 
-UiField UiForm_addText (UiForm me, const char32 *name, const char32 *defaultValue) {
-	autoUiField thee (UiForm_addField (me, UI_TEXT, name));
-	thy stringDefaultValue = Melder_dup (defaultValue);
-	return thee.releaseToAmbiguousOwner();
-}
-
-UiField UiForm_addText4 (UiForm me, char32 **variable, const char32 *variableName, const char32 *name, const char32 *defaultValue) {
+UiField UiForm_addText (UiForm me, char32 **variable, const char32 *variableName, const char32 *name, const char32 *defaultValue) {
 	autoUiField thee (UiForm_addField (me, UI_TEXT, name));
 	thy stringDefaultValue = Melder_dup (defaultValue);
 	thy stringVariable = variable;
@@ -772,7 +629,7 @@ UiField UiForm_addText4 (UiForm me, char32 **variable, const char32 *variableNam
 	return thee.releaseToAmbiguousOwner();
 }
 
-UiField UiForm_addNumvec (UiForm me, autonumvec *variable, const char32 *variableName, const char32 *name, const char32 *defaultValue) {
+UiField UiForm_addNumvec (UiForm me, numvec *variable, const char32 *variableName, const char32 *name, const char32 *defaultValue) {
 	autoUiField thee (UiForm_addField (me, UI_NUMVEC, name));
 	thy stringDefaultValue = Melder_dup (defaultValue);
 	thy numericVectorVariable = variable;
@@ -780,7 +637,7 @@ UiField UiForm_addNumvec (UiForm me, autonumvec *variable, const char32 *variabl
 	return thee.releaseToAmbiguousOwner();
 }
 
-UiField UiForm_addNummat (UiForm me, autonummat *variable, const char32 *variableName, const char32 *name, const char32 *defaultValue) {
+UiField UiForm_addNummat (UiForm me, nummat *variable, const char32 *variableName, const char32 *name, const char32 *defaultValue) {
 	autoUiField thee (UiForm_addField (me, UI_NUMMAT, name));
 	thy stringDefaultValue = Melder_dup (defaultValue);
 	thy numericMatrixVariable = variable;
@@ -788,13 +645,7 @@ UiField UiForm_addNummat (UiForm me, autonummat *variable, const char32 *variabl
 	return thee.releaseToAmbiguousOwner();
 }
 
-UiField UiForm_addRadio (UiForm me, const char32 *label, int defaultValue) {
-	autoUiField thee (UiForm_addField (me, UI_RADIO, label));
-	thy integerDefaultValue = defaultValue;
-	return thee.releaseToAmbiguousOwner();
-}
-
-UiField UiForm_addRadio4 (UiForm me, int *intVariable, char32 **stringVariable, const char32 *variableName, const char32 *label, int defaultValue, int base) {
+UiField UiForm_addRadio (UiForm me, int *intVariable, char32 **stringVariable, const char32 *variableName, const char32 *label, int defaultValue, int base) {
 	autoUiField thee (UiForm_addField (me, UI_RADIO, label));
 	thy integerDefaultValue = defaultValue;
 	thy intVariable = intVariable;
@@ -804,13 +655,7 @@ UiField UiForm_addRadio4 (UiForm me, int *intVariable, char32 **stringVariable,
 	return thee.releaseToAmbiguousOwner();
 }
 
-UiField UiForm_addOptionMenu (UiForm me, const char32 *label, int defaultValue) {
-	autoUiField thee (UiForm_addField (me, UI_OPTIONMENU, label));
-	thy integerDefaultValue = defaultValue;
-	return thee.releaseToAmbiguousOwner();
-}
-
-UiField UiForm_addOptionMenu4 (UiForm me, int *intVariable, char32 **stringVariable, const char32 *variableName, const char32 *label, int defaultValue, int base) {
+UiField UiForm_addOptionMenu (UiForm me, int *intVariable, char32 **stringVariable, const char32 *variableName, const char32 *label, int defaultValue, int base) {
 	autoUiField thee (UiForm_addField (me, UI_OPTIONMENU, label));
 	thy integerDefaultValue = defaultValue;
 	thy intVariable = intVariable;
@@ -820,41 +665,29 @@ UiField UiForm_addOptionMenu4 (UiForm me, int *intVariable, char32 **stringVaria
 	return thee.releaseToAmbiguousOwner();
 }
 
-UiField UiForm_addList (UiForm me, const char32 *label, long numberOfStrings, const char32 **strings, long defaultValue) {
-	autoUiField thee (UiForm_addField (me, UI_LIST, label));
-	thy numberOfStrings = numberOfStrings;
-	thy strings = strings;
-	thy integerDefaultValue = defaultValue;
-	return thee.releaseToAmbiguousOwner();
-}
-
-UiField UiForm_addList4 (UiForm me, long *longVariable, char32 **stringVariable, const char32 *variableName, const char32 *label, long numberOfStrings, const char32 **strings, long defaultValue) {
+UiField UiForm_addList (UiForm me, integer *integerVariable, char32 **stringVariable, const char32 *variableName, const char32 *label, integer numberOfStrings, const char32 **strings, integer defaultValue) {
 	autoUiField thee (UiForm_addField (me, UI_LIST, label));
 	thy numberOfStrings = numberOfStrings;
 	thy strings = strings;
 	thy integerDefaultValue = defaultValue;
-	thy longVariable = longVariable;
+	thy integerVariable = integerVariable;
 	thy stringVariable = stringVariable;
 	thy variableName = variableName;
 	return thee.releaseToAmbiguousOwner();
 }
 
-UiField UiForm_addColour (UiForm me, const char32 *label, const char32 *defaultValue) {
+UiField UiForm_addColour (UiForm me, Graphics_Colour *colourVariable, const char32 *variableName, const char32 *label, const char32 *defaultValue) {
 	autoUiField thee (UiForm_addField (me, UI_COLOUR, label));
 	thy stringDefaultValue = Melder_dup (defaultValue);
+	thy colourVariable = colourVariable;
+	thy variableName = variableName;
 	return thee.releaseToAmbiguousOwner();
 }
 
-UiField UiForm_addChannel (UiForm me, const char32 *label, const char32 *defaultValue) {
-	autoUiField thee (UiForm_addField (me, UI_CHANNEL, label));
-	thy stringDefaultValue = Melder_dup (defaultValue);
-	return thee.releaseToAmbiguousOwner();
-}
-
-UiField UiForm_addChannel4 (UiForm me, long *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue) {
+UiField UiForm_addChannel (UiForm me, integer *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue) {
 	autoUiField thee (UiForm_addField (me, UI_CHANNEL, label));
 	thy stringDefaultValue = Melder_dup (defaultValue);
-	thy longVariable = variable;
+	thy integerVariable = variable;
 	thy variableName = variableName;
 	return thee.releaseToAmbiguousOwner();
 }
@@ -871,7 +704,7 @@ UiField UiForm_addChannel4 (UiForm me, long *variable, const char32 *variableNam
 static MelderString theFinishBuffer { };
 
 static void appendColon () {
-	long length = theFinishBuffer.length;
+	integer length = theFinishBuffer.length;
 	if (length < 1) return;
 	char32 lastCharacter = theFinishBuffer.string [length - 1];
 	if (lastCharacter == U':' || lastCharacter == U'?' || lastCharacter == U'.') return;
@@ -892,7 +725,7 @@ void UiForm_finish (UiForm me) {
 	/*
 		Compute height. Cannot leave this to the default geometry management system.
 	*/
-	for (long ifield = 1; ifield <= my numberOfFields; ifield ++ ) {
+	for (integer ifield = 1; ifield <= my numberOfFields; ifield ++ ) {
 		UiField thee = my field [ifield], previous = my field [ifield - 1];
 		dialogHeight +=
 			ifield == 1 ? Gui_TOP_DIALOG_SPACING :
@@ -921,7 +754,7 @@ void UiForm_finish (UiForm me) {
 
 	form = my d_dialogForm;
 
-	for (long ifield = 1; ifield <= size; ifield ++) {
+	for (integer ifield = 1; ifield <= size; ifield ++) {
 		UiField field = my field [ifield];
 		y = field -> y;
 		switch (field -> type) {
@@ -983,7 +816,7 @@ void UiForm_finish (UiForm me) {
 				field -> label = GuiLabel_createShown (form, x, x + labelWidth, ylabel, ylabel + Gui_RADIOBUTTON_HEIGHT,
 					theFinishBuffer.string, GuiLabel_RIGHT);
 				GuiRadioGroup_begin ();
-				for (long ibutton = 1; ibutton <= field -> options.size; ibutton ++) {
+				for (integer ibutton = 1; ibutton <= field -> options.size; ibutton ++) {
 					UiOption button = field -> options.at [ibutton];
 					MelderString_copy (& theFinishBuffer, button -> name);
 					button -> radioButton = GuiRadioButton_createShown (form,
@@ -1005,7 +838,7 @@ void UiForm_finish (UiForm me) {
 				field -> label = GuiLabel_createShown (form, x, x + labelWidth, ylabel, ylabel + Gui_OPTIONMENU_HEIGHT,
 					theFinishBuffer.string, GuiLabel_RIGHT);
 				field -> optionMenu = GuiOptionMenu_createShown (form, fieldX, fieldX + fieldWidth, y, y + Gui_OPTIONMENU_HEIGHT, 0);
-				for (long ibutton = 1; ibutton <= field -> options.size; ibutton ++) {
+				for (integer ibutton = 1; ibutton <= field -> options.size; ibutton ++) {
 					UiOption button = field -> options.at [ibutton];
 					MelderString_copy (& theFinishBuffer, button -> name);
 					GuiOptionMenu_addOption (field -> optionMenu, theFinishBuffer.string);
@@ -1028,14 +861,14 @@ void UiForm_finish (UiForm me) {
 				field -> label = GuiLabel_createShown (form, x, x + labelWidth, y + 1, y + 21,
 					theFinishBuffer.string, GuiLabel_RIGHT);
 				field -> list = GuiList_create (form, fieldX, fieldX + listWidth, y, y + LIST_HEIGHT, false, theFinishBuffer.string);
-				for (long i = 1; i <= field -> numberOfStrings; i ++) {
+				for (integer i = 1; i <= field -> numberOfStrings; i ++) {
 					GuiList_insertItem (field -> list, field -> strings [i], 0);
 				}
 				GuiThing_show (field -> list);
 			} break;
 		}
 	}
-	for (long ifield = 1; ifield <= my numberOfFields; ifield ++)
+	for (integer ifield = 1; ifield <= my numberOfFields; ifield ++)
 		UiField_setDefault (my field [ifield]);
 	/*separator = XmCreateSeparatorGadget (column, "separator", nullptr, 0);*/
 	y = dialogHeight - Gui_BOTTOM_DIALOG_SPACING - Gui_PUSHBUTTON_HEIGHT;
@@ -1044,7 +877,7 @@ void UiForm_finish (UiForm me) {
 			U"Help", gui_button_cb_help, me, 0);
 	}
 	bool commentsOnly = true;
-	for (long ifield = 1; ifield <= my numberOfFields; ifield ++) {
+	for (integer ifield = 1; ifield <= my numberOfFields; ifield ++) {
 		if (my field [ifield] -> type != UI_LABEL) {
 			commentsOnly = false;
 			break;
@@ -1112,7 +945,13 @@ void UiForm_do (UiForm me, bool modified) {
 
 static void UiField_api_header_C (UiField me, UiField next, bool isLastNonLabelField) {
 	if (my type == UI_LABEL) {
-		if (! next || next -> type != UI_TEXT) {
+		bool weAreFollowedByAWideField =
+			next && (next -> type == UI_TEXT || next -> type == UI_NUMVEC || next -> type == UI_NUMMAT);
+		bool weLabelTheFollowingField =
+			weAreFollowedByAWideField &&
+			Melder_stringMatchesCriterion (my stringValue, kMelder_string::ENDS_WITH, U":");
+		bool weAreAComment = ! weLabelTheFollowingField;
+		if (weAreAComment) {
 			MelderInfo_writeLine (U"\t/* ", my stringValue, U" */");
 		}
 		return;
@@ -1172,6 +1011,8 @@ static void UiField_api_header_C (UiField me, UiField next, bool isLastNonLabelF
 		}
 	}
 	*q = U'\0';
+	if (! my variableName)
+		Melder_warning (U"Missing variable name for field label: ", my formLabel);
 	MelderInfo_write (my variableName ? my variableName : cName);
 	if (! isLastNonLabelField) MelderInfo_write (U",");
 
@@ -1271,7 +1112,7 @@ static void UiField_argToValue (UiField me, Stackel arg, Interpreter /* interpre
 	switch (my type) {
 		case UI_REAL: case UI_REAL_OR_UNDEFINED: case UI_POSITIVE: {
 			if (arg -> which != Stackel_NUMBER)
-				Melder_throw (U"Argument \"", my name, U"\" should be a number, not ", Stackel_whichText(arg), U".");
+				Melder_throw (U"Argument \"", my name, U"\" should be a number, not ", Stackel_whichText (arg), U".");
 			my realValue = arg -> number;
 			if (isundef (my realValue) && my type != UI_REAL_OR_UNDEFINED)
 				Melder_throw (U"Argument \"", my name, U"\" has the value \"undefined\".");
@@ -1301,13 +1142,29 @@ static void UiField_argToValue (UiField me, Stackel arg, Interpreter /* interpre
 			} else {
 				Melder_throw (U"Argument \"", my name, U"\" should be a number, not ", Stackel_whichText (arg), U".");
 			}
-			if (my longVariable) *my longVariable = my integerValue;
+			if (my integerVariable) *my integerVariable = my integerValue;
 		} break; case UI_WORD: case UI_SENTENCE: case UI_TEXT: {
 			if (arg -> which != Stackel_STRING)
-				Melder_throw (U"Argument \"", my name, U"\" should be a string, not ", Stackel_whichText(arg), U".");
+				Melder_throw (U"Argument \"", my name, U"\" should be a string, not ", Stackel_whichText (arg), U".");
 			Melder_free (my stringValue);
 			my stringValue = Melder_dup (arg -> string);
 			if (my stringVariable) *my stringVariable = my stringValue;
+		} break; case UI_NUMVEC: {
+			if (arg -> which != Stackel_NUMERIC_VECTOR)
+				Melder_throw (U"Argument \"", my name, U"\" should be a numeric vector, not ", Stackel_whichText (arg), U".");
+			if (my numericVectorVariable) {
+				if (my owned) my numericVectorVariable -> reset();
+				*my numericVectorVariable = arg -> numericVector;
+				my owned = arg -> owned;
+			}
+		} break; case UI_NUMMAT: {
+			if (arg -> which != Stackel_NUMERIC_MATRIX)
+				Melder_throw (U"Argument \"", my name, U"\" should be a numeric matrix, not ", Stackel_whichText (arg), U".");
+			if (my numericMatrixVariable) {
+				if (my owned) my numericMatrixVariable -> reset();
+				*my numericMatrixVariable = arg -> numericMatrix;
+				my owned = arg -> owned;
+			}
 		} break; case UI_BOOLEAN: {
 			if (arg -> which == Stackel_STRING) {
 				if (str32equ (arg -> string, U"no") || str32equ (arg -> string, U"off")) {
@@ -1355,13 +1212,13 @@ static void UiField_argToValue (UiField me, Stackel arg, Interpreter /* interpre
 		} break; case UI_LIST: {
 			if (arg -> which != Stackel_STRING)
 				Melder_throw (U"List argument \"", my name, U"\" should be a string, not ", Stackel_whichText(arg), U".");
-			long i = 1;
+			integer i = 1;
 			for (; i <= my numberOfStrings; i ++)
 				if (str32equ (arg -> string, my strings [i])) break;
 			if (i > my numberOfStrings)
 				Melder_throw (U"List argument \"", my name, U"\" cannot have the value \"", arg -> string, U"\".");
 			my integerValue = i;
-			if (my longVariable) *my longVariable = my integerValue;
+			if (my integerVariable) *my integerVariable = my integerValue;
 			if (my stringVariable) *my stringVariable = (char32 *) my strings [my integerValue];
 		} break; case UI_COLOUR: {
 			if (arg -> which == Stackel_NUMBER) {
@@ -1374,6 +1231,7 @@ static void UiField_argToValue (UiField me, Stackel arg, Interpreter /* interpre
 					Melder_throw (U"Cannot compute a colour from \"", string2.peek(), U"\".");
 				}
 			}
+			if (my colourVariable) *my colourVariable = my colourValue;
 		} break; default: {
 			Melder_throw (U"Unknown field type ", my type, U".");
 		}
@@ -1382,8 +1240,8 @@ static void UiField_argToValue (UiField me, Stackel arg, Interpreter /* interpre
 
 void UiForm_call (UiForm me, int narg, Stackel args, Interpreter interpreter) {
 	int size = my numberOfFields, iarg = 0;
-	while (size >= 1 && my field [size] -> type == UI_LABEL)
-		size --;   // ignore trailing fields without a value
+	//while (size >= 1 && my field [size] -> type == UI_LABEL)
+	//	size --;   // ignore trailing fields without a value
 	for (int i = 1; i <= size; i ++) {
 		if (my field [i] -> type == UI_LABEL)
 			continue;   // ignore non-trailing fields without a value
@@ -1397,7 +1255,120 @@ void UiForm_call (UiForm me, int narg, Stackel args, Interpreter interpreter) {
 	my okCallback (me, 0, nullptr, nullptr, interpreter, nullptr, false, my buttonClosure);
 }
 
+/*
+	DEPRECATED_2014 (i.e. remove in 2036)
+*/
+static void UiField_stringToValue (UiField me, const char32 *string, Interpreter interpreter) {
+	/*
+		This belongs to the deprecated dots-based syntax described below at `UiForm_parseString`.
+		This is included for backward compatibility (until 2036),
+		but does not support newer expression types such as numeric vectors and matrices.
+	*/
+	switch (my type) {
+		case UI_REAL: case UI_REAL_OR_UNDEFINED: case UI_POSITIVE: {
+			if (str32spn (string, U" \t") == str32len (string))
+				Melder_throw (U"Argument “", my name, U"” empty.");
+			Interpreter_numericExpression (interpreter, string, & my realValue);
+			if (isundef (my realValue) && my type != UI_REAL_OR_UNDEFINED)
+				Melder_throw (U"\"", my name, U"\" has the value \"undefined\".");
+			if (my type == UI_POSITIVE && my realValue <= 0.0)
+				Melder_throw (U"\"", my name, U"\" must be greater than 0.");
+			if (my realVariable) *my realVariable = my realValue;
+		} break; case UI_INTEGER: case UI_NATURAL: case UI_CHANNEL: {
+			if (str32spn (string, U" \t") == str32len (string))
+				Melder_throw (U"Argument “", my name, U"” empty.");
+			if (my type == UI_CHANNEL && (str32equ (string, U"All") || str32equ (string, U"Average"))) {
+				my integerValue = 0;
+			} else if (my type == UI_CHANNEL && (str32equ (string, U"Left") || str32equ (string, U"Mono"))) {
+				my integerValue = 1;
+			} else if (my type == UI_CHANNEL && (str32equ (string, U"Right") || str32equ (string, U"Stereo"))) {
+				my integerValue = 2;
+			} else {
+				double realValue;
+				Interpreter_numericExpression (interpreter, string, & realValue);
+				my integerValue = lround (realValue);
+			}
+			if (my type == UI_NATURAL && my integerValue < 1)
+				Melder_throw (U"\"", my name, U"\" must be a positive whole number.");
+			if (my integerVariable) *my integerVariable = my integerValue;
+		} break; case UI_WORD: case UI_SENTENCE: case UI_TEXT: {
+			Melder_free (my stringValue);
+			my stringValue = Melder_dup_f (string);
+			if (my stringVariable) *my stringVariable = my stringValue;
+		} break; case UI_BOOLEAN: {
+			if (! string [0])
+				Melder_throw (U"Empty argument for toggle button.");
+			my integerValue = string [0] == U'1' || string [0] == U'y' || string [0] == U'Y' ||
+				string [0] == U't' || string [0] == U'T';
+			if (my boolVariable) *my boolVariable = my integerValue;
+		} break; case UI_RADIO: case UI_OPTIONMENU: {
+			my integerValue = 0;
+			for (int i = 1; i <= my options.size; i ++) {
+				UiOption b = my options.at [i];
+				if (str32equ (string, b -> name))
+					my integerValue = i;
+			}
+			if (my integerValue == 0) {
+				/*
+					Retry with different case.
+				*/
+				for (int i = 1; i <= my options.size; i ++) {
+					UiOption b = my options.at [i];
+					char32 name2 [100];
+					str32cpy (name2, b -> name);
+					if (islower32 (name2 [0])) name2 [0] = toupper32 (name2 [0]);
+					else if (isupper32 (name2 [0])) name2 [0] = tolower32 (name2 [0]);
+					if (str32equ (string, name2))
+						my integerValue = i;
+				}
+			}
+			if (my integerValue == 0) {
+				Melder_throw (U"Field \"", my name, U"\" must not have the value \"", string, U"\".");
+			}
+			if (my intVariable) *my intVariable = my integerValue - my subtract;
+			if (my stringVariable) *my stringVariable = my options.at [my integerValue] -> name;
+		} break; case UI_LIST: {
+			integer i = 1;
+			for (; i <= my numberOfStrings; i ++)
+				if (str32equ (string, my strings [i])) break;
+			if (i > my numberOfStrings)
+				Melder_throw (U"Field \"", my name, U"\" must not have the value \"", string, U"\".");
+			my integerValue = i;
+			if (my integerVariable) *my integerVariable = my integerValue;
+			if (my stringVariable) *my stringVariable = (char32 *) my strings [my integerValue];
+		} break; case UI_COLOUR: {
+			autostring32 string2 = Melder_dup_f (string);
+			if (colourToValue (me, string2.peek())) {
+				/* OK */
+			} else {
+				try {
+					Interpreter_numericExpression (interpreter, string2.peek(), & my colourValue. red);
+					my colourValue. green = my colourValue. blue = my colourValue. red;
+				} catch (MelderError) {
+					Melder_clearError ();
+					Melder_throw (U"Cannot compute a colour from \"", string2.peek(), U"\".");
+				}
+			}
+			if (my colourVariable) *my colourVariable = my colourValue;
+		} break; default: {
+			Melder_throw (U"Unknown field type ", my type, U".");
+		}
+	}
+}
+
+/*
+	DEPRECATED_2014 (i.e. remove in 2036)
+*/
 void UiForm_parseString (UiForm me, const char32 *arguments, Interpreter interpreter) {
+	/*
+		This implements the dots-based scripting style
+			Create Sound from formula... sineWithNoise 1 0 1 44100 0.5 * sin (2*pi*377*x)
+		This was deprecated with the advent of the colon-based scripting style
+			Create Sound from formula: "sineWithNoise", 1, 0, 1, 44100, "0.5 * sin (2*pi*377*x)"
+		in 2014, i.e. 22 years after Praat started.
+		If we want to conservatively support old scripts, we will have
+		to continue to support the dots-based scripting style until 2036.
+	*/
 	int size = my numberOfFields;
 	while (size >= 1 && my field [size] -> type == UI_LABEL)
 		size --;   // ignore trailing fields without a value
@@ -1460,116 +1431,219 @@ void UiForm_parseStringE (EditorCommand cmd, int narg, Stackel args, const char3
 		UiForm_parseString (cmd -> d_uiform.get(), arguments, interpreter);
 }
 
-static UiField findField (UiForm me, const char32 *fieldName) {
-	for (int ifield = 1; ifield <= my numberOfFields; ifield ++)
-		if (str32equ (fieldName, my field [ifield] -> name)) return my field [ifield];
-	return nullptr;
-}
-
 static void fatalField (UiForm dia) {
 	Melder_fatal (U"Wrong field in command window \"", dia -> name, U"\".");
 }
 
-void UiForm_setReal (UiForm me, const char32 *fieldName, double value) {
-	UiField field = findField (me, fieldName);
-	if (! field) Melder_fatal (U"(UiForm_setReal:) No field \"", fieldName, U"\" in command window \"", my name, U"\".");
-	switch (field -> type) {
-		case UI_REAL: case UI_REAL_OR_UNDEFINED: case UI_POSITIVE: {
-			if (value == Melder_atof (field -> stringDefaultValue)) {
-				GuiText_setString (field -> text, field -> stringDefaultValue);
-			} else {
-				char32 s [40];
-				str32cpy (s, Melder_double (value));
-				/*
-				 * If the default is overtly real, the shown value must be as well.
-				 */
-				if ((str32chr (field -> stringDefaultValue, U'.') || str32chr (field -> stringDefaultValue, U'e')) &&
-					! (str32chr (s, U'.') || str32chr (s, U'e')))
-				{
-					str32cpy (s + str32len (s), U".0");
+void UiForm_setReal (UiForm me, double *p_variable, double value) {
+	for (int ifield = 1; ifield <= my numberOfFields; ifield ++) {
+		UiField field = my field [ifield];
+		if (field -> realVariable == p_variable) {
+			switch (field -> type) {
+				case UI_REAL: case UI_REAL_OR_UNDEFINED: case UI_POSITIVE: {
+					if (value == Melder_atof (field -> stringDefaultValue)) {
+						GuiText_setString (field -> text, field -> stringDefaultValue);
+					} else {
+						char32 s [40];
+						str32cpy (s, Melder_double (value));
+						/*
+							If the default is overtly real, the shown value should be as well.
+						*/
+						if ((str32chr (field -> stringDefaultValue, U'.') || str32chr (field -> stringDefaultValue, U'e')) &&
+							! (str32chr (s, U'.') || str32chr (s, U'e')))
+						{
+							str32cpy (s + str32len (s), U".0");
+						}
+						GuiText_setString (field -> text, s);
+					}
+				} break; default: {
+					fatalField (me);
 				}
-				GuiText_setString (field -> text, s);
 			}
-		} break; case UI_COLOUR: {
-			GuiText_setString (field -> text, Melder_double (value));   // some grey value
-		} break; default: {
-			Melder_fatal (U"Wrong field in command window \"", my name, U"\".");
+			return;
 		}
 	}
+	Melder_fatal (U"Real field not found in command window \"", my name, U"\".");
 }
 
-void UiForm_setInteger (UiForm me, const char32 *fieldName, long value) {
-	UiField field = findField (me, fieldName);
-	if (! field) Melder_fatal (U"(UiForm_setInteger:) No field \"", fieldName, U"\" in command window \"", my name, U"\".");
-	switch (field -> type) {
-		case UI_INTEGER: case UI_NATURAL: case UI_CHANNEL: {
-			if (value == Melder_atoi (field -> stringDefaultValue)) {
-				GuiText_setString (field -> text, field -> stringDefaultValue);
-			} else {
-				GuiText_setString (field -> text, Melder_integer (value));
+void UiForm_setRealAsString (UiForm me, double *p_variable, const char32 *stringValue) {
+	for (int ifield = 1; ifield <= my numberOfFields; ifield ++) {
+		UiField field = my field [ifield];
+		if (field -> realVariable == p_variable) {
+			switch (field -> type) {
+				case UI_REAL: case UI_REAL_OR_UNDEFINED: case UI_POSITIVE: {
+					GuiText_setString (field -> text, stringValue);
+				} break; default: {
+					fatalField (me);
+				}
 			}
-		} break; case UI_BOOLEAN: {
-			GuiCheckButton_setValue (field -> checkButton, value);
-		} break; case UI_RADIO: {
-			if (value < 1 || value > field -> options.size) value = 1;   // guard against incorrect prefs file
-			for (int i = 1; i <= field -> options.size; i ++) {
-				if (i == value) {
-					UiOption b = field -> options.at [i];
-					GuiRadioButton_set (b -> radioButton);
+			return;
+		}
+	}
+	Melder_fatal (U"Real field not found in command window \"", my name, U"\".");
+}
+
+void UiForm_setInteger (UiForm me, integer *p_variable, integer value) {
+	for (int ifield = 1; ifield <= my numberOfFields; ifield ++) {
+		UiField field = my field [ifield];
+		if (field -> integerVariable == p_variable) {
+			switch (field -> type) {
+				case UI_INTEGER: case UI_NATURAL: case UI_CHANNEL: {
+					if (value == Melder_atoi (field -> stringDefaultValue)) {
+						GuiText_setString (field -> text, field -> stringDefaultValue);
+					} else {
+						GuiText_setString (field -> text, Melder_integer (value));
+					}
+				} break; case UI_LIST: {
+					if (value < 1 || value > field -> numberOfStrings) value = 1;   // guard against incorrect prefs file
+					GuiList_selectItem (field -> list, value);
+				} break; default: {
+					fatalField (me);
 				}
 			}
-		} break; case UI_OPTIONMENU: {
-			if (value < 1 || value > field -> options.size) value = 1;   // guard against incorrect prefs file
-			GuiOptionMenu_setValue (field -> optionMenu, value);
-		} break; case UI_LIST: {
-			if (value < 1 || value > field -> numberOfStrings) value = 1;   // guard against incorrect prefs file
-			GuiList_selectItem (field -> list, value);
-		} break; default: {
-			fatalField (me);
+			return;
 		}
 	}
+	Melder_fatal (U"Integer field not found in command window \"", my name, U"\".");
 }
 
-void UiForm_setString (UiForm me, const char32 *fieldName, const char32 *value /* cattable */) {
-	UiField field = findField (me, fieldName);
-	if (! field) Melder_fatal (U"(UiForm_setString:) No field \"", fieldName, U"\" in command window \"", my name, U"\".");
+void UiForm_setIntegerAsString (UiForm me, integer *p_variable, const char32 *stringValue /* cattable */) {
+	for (int ifield = 1; ifield <= my numberOfFields; ifield ++) {
+		UiField field = my field [ifield];
+		if (field -> integerVariable == p_variable) {
+			switch (field -> type) {
+				case UI_INTEGER: case UI_NATURAL: case UI_CHANNEL: {
+					GuiText_setString (field -> text, stringValue);
+				} break; case UI_LIST: {
+					integer i = 1;
+					for (; i <= field -> numberOfStrings; i ++)
+						if (str32equ (stringValue, field -> strings [i])) break;
+					if (i > field -> numberOfStrings) i = 1;   // guard against incorrect prefs file
+					GuiList_selectItem (field -> list, i);
+				} break; default: {
+					fatalField (me);
+				}
+			}
+			return;
+		}
+	}
+	Melder_fatal (U"Integer field not found in command window \"", my name, U"\".");
+}
+
+void UiForm_setBoolean (UiForm me, bool *p_variable, bool value) {
+	for (int ifield = 1; ifield <= my numberOfFields; ifield ++) {
+		UiField field = my field [ifield];
+		if (field -> boolVariable == p_variable) {
+			switch (field -> type) {
+				case UI_BOOLEAN: {
+					GuiCheckButton_setValue (field -> checkButton, value);
+				} break; default: {
+					fatalField (me);
+				}
+			}
+			return;
+		}
+	}
+	Melder_fatal (U"Boolean field not found in command window \"", my name, U"\".");
+}
+
+void UiForm_setOption (UiForm me, int *p_variable, int value) {
+	for (int ifield = 1; ifield <= my numberOfFields; ifield ++) {
+		UiField field = my field [ifield];
+		if (field -> intVariable == p_variable) {
+			switch (field -> type) {
+				case UI_RADIO: {
+					if (value < 1 || value > field -> options.size) value = 1;   // guard against incorrect prefs file
+					UiOption option = field -> options.at [value];
+					GuiRadioButton_set (option -> radioButton);
+				} break; case UI_OPTIONMENU: {
+					if (value < 1 || value > field -> options.size) value = 1;   // guard against incorrect prefs file
+					GuiOptionMenu_setValue (field -> optionMenu, value);
+				} break; default: {
+					fatalField (me);
+				}
+			}
+			return;
+		}
+	}
+	Melder_fatal (U"Option field not found in command window \"", my name, U"\".");
+}
+
+void UiForm_setOptionAsString (UiForm me, int *p_variable, const char32 *stringValue) {
+	for (int ifield = 1; ifield <= my numberOfFields; ifield ++) {
+		UiField field = my field [ifield];
+		if (field -> intVariable == p_variable) {
+			switch (field -> type) {
+				case UI_RADIO: {
+					for (int i = 1; i <= field -> options.size; i ++) {
+						UiOption b = field -> options.at [i];
+						if (str32equ (stringValue, b -> name)) {
+							GuiRadioButton_set (b -> radioButton);
+						}
+					}
+					/* If not found: do nothing (guard against incorrect prefs file). */
+				} break; case UI_OPTIONMENU: {
+					int optionValue = 0;
+					for (int i = 1; i <= field -> options.size; i ++) {
+						UiOption b = field -> options.at [i];
+						if (str32equ (stringValue, b -> name)) {
+							optionValue = i;
+							break;
+						}
+					}
+					GuiOptionMenu_setValue (field -> optionMenu, optionValue);
+					/* If not found: do nothing (guard against incorrect prefs file). */
+				} break; default: {
+					fatalField (me);
+				}
+			}
+			return;
+		}
+	}
+	Melder_fatal (U"Option field not found in command window \"", my name, U"\".");
+}
+
+void UiForm_setString (UiForm me, char32 **p_variable, const char32 *value /* cattable */) {
 	if (! value) value = U"";   // accept null strings
-	switch (field -> type) {
-		case UI_REAL: case UI_REAL_OR_UNDEFINED: case UI_POSITIVE: case UI_INTEGER: case UI_NATURAL:
-			case UI_WORD: case UI_SENTENCE: case UI_COLOUR: case UI_CHANNEL: case UI_TEXT:
-		{
-			GuiText_setString (field -> text, value);
-		} break; case UI_LABEL: {
-			GuiLabel_setText (field -> label, value);
-		} break; case UI_RADIO: {
-			for (int i = 1; i <= field -> options.size; i ++) {
-				UiOption b = field -> options.at [i];
-				if (str32equ (value, b -> name)) {
-					GuiRadioButton_set (b -> radioButton);
+	for (int ifield = 1; ifield <= my numberOfFields; ifield ++) {
+		UiField field = my field [ifield];
+		if (field -> stringVariable == p_variable) {
+			switch (field -> type) {
+				case UI_WORD: case UI_SENTENCE: case UI_COLOUR: case UI_TEXT: {
+					GuiText_setString (field -> text, value);
+				} break; case UI_LABEL: {
+					GuiLabel_setText (field -> label, value);
+				} break; default: {
+					fatalField (me);
 				}
 			}
-			/* If not found: do nothing (guard against incorrect prefs file). */
-		} break; case UI_OPTIONMENU: {
-			int integerValue = 0;
-			for (int i = 1; i <= field -> options.size; i ++) {
-				UiOption b = field -> options.at [i];
-				if (str32equ (value, b -> name)) {
-					integerValue = i;
-					break;
+			return;
+		}
+	}
+	Melder_fatal (U"Text field not found in command window \"", my name, U"\".");
+}
+
+void UiForm_setColourAsGreyValue (UiForm me, Graphics_Colour *p_variable, double greyValue) {
+	for (int ifield = 1; ifield <= my numberOfFields; ifield ++) {
+		UiField field = my field [ifield];
+		if (field -> colourVariable == p_variable) {
+			switch (field -> type) {
+				case UI_COLOUR: {
+					GuiText_setString (field -> text, Melder_double (greyValue));
+				} break; default: {
+					fatalField (me);
 				}
 			}
-			GuiOptionMenu_setValue (field -> optionMenu, integerValue);
-			/* If not found: do nothing (guard against incorrect prefs file). */
-		} break; case UI_LIST: {
-			long i;
-			for (i = 1; i <= field -> numberOfStrings; i ++)
-				if (str32equ (value, field -> strings [i])) break;
-			if (i > field -> numberOfStrings) i = 1;   // guard against incorrect prefs file
-			GuiList_selectItem (field -> list, i);
-		} break; default: {
-			fatalField (me);
+			return;
 		}
 	}
+	Melder_fatal (U"Colour field not found in command window \"", my name, U"\".");
+}
+
+static UiField findField (UiForm me, const char32 *fieldName) {
+	for (int ifield = 1; ifield <= my numberOfFields; ifield ++)
+		if (str32equ (fieldName, my field [ifield] -> name)) return my field [ifield];
+	return nullptr;
 }
 
 static UiField findField_check (UiForm me, const char32 *fieldName) {
@@ -1582,19 +1656,6 @@ static UiField findField_check (UiForm me, const char32 *fieldName) {
 	return result;
 }
 
-double UiForm_getReal (UiForm me, const char32 *fieldName) {
-	UiField field = findField (me, fieldName);
-	if (! field) Melder_fatal (U"(UiForm_getReal:) No field \"", fieldName, U"\" in command window \"", my name, U"\".");
-	switch (field -> type) {
-		case UI_REAL: case UI_REAL_OR_UNDEFINED: case UI_POSITIVE: {
-			return field -> realValue;
-		} break; default: {
-			fatalField (me);
-		}
-	}
-	return 0.0;
-}
-
 double UiForm_getReal_check (UiForm me, const char32 *fieldName) {
 	UiField field = findField_check (me, fieldName);
 	switch (field -> type) {
@@ -1609,7 +1670,7 @@ double UiForm_getReal_check (UiForm me, const char32 *fieldName) {
 	return 0.0;
 }
 
-long UiForm_getInteger (UiForm me, const char32 *fieldName) {
+integer UiForm_getInteger (UiForm me, const char32 *fieldName) {
 	UiField field = findField (me, fieldName);
 	if (! field) Melder_fatal (U"(UiForm_getInteger:) No field \"", fieldName, U"\" in command window \"", my name, U"\".");
 	switch (field -> type) {
@@ -1624,7 +1685,7 @@ long UiForm_getInteger (UiForm me, const char32 *fieldName) {
 	return 0L;
 }
 
-long UiForm_getInteger_check (UiForm me, const char32 *fieldName) {
+integer UiForm_getInteger_check (UiForm me, const char32 *fieldName) {
 	UiField field = findField_check (me, fieldName);
 	switch (field -> type) {
 		case UI_INTEGER: case UI_NATURAL: case UI_CHANNEL: case UI_BOOLEAN: case UI_RADIO:
@@ -1677,19 +1738,6 @@ char32 * UiForm_getString_check (UiForm me, const char32 *fieldName) {
 	return nullptr;
 }
 
-Graphics_Colour UiForm_getColour (UiForm me, const char32 *fieldName) {
-	UiField field = findField (me, fieldName);
-	if (! field) Melder_fatal (U"(UiForm_getColour:) No field \"", fieldName, U"\" in command window \"", my name, U"\".");
-	switch (field -> type) {
-		case UI_COLOUR: {
-			return field -> colourValue;
-		} break; default: {
-			fatalField (me);
-		}
-	}
-	return Graphics_BLACK;
-}
-
 Graphics_Colour UiForm_getColour_check (UiForm me, const char32 *fieldName) {
 	UiField field = findField_check (me, fieldName);
 	switch (field -> type) {
diff --git a/sys/Ui.h b/sys/Ui.h
index e2a0dfb..2313c36 100644
--- a/sys/Ui.h
+++ b/sys/Ui.h
@@ -2,7 +2,7 @@
 #define _Ui_h_
 /* Ui.h
  *
- * Copyright (C) 1992-2011,2012,2013,2015 Paul Boersma
+ * Copyright (C) 1992-2011,2012,2013,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -31,41 +31,46 @@ Thing_declare (EditorCommand);
 	if (! dia) {
 		UiField radio;
 		dia = UiForm_create
-		  (topShell,   // The parent GuiWindow of the dialog window.
-			U"Create a new person",   // The window title.
-			DO_Person_create,   // The routine to call when the user clicks OK.
-			nullptr,   // The last argument to the OK routine (also for the other buttons). Could be a ScriptEditor, or an EditorCommand, or an Interpreter, or null.
-			U"Create person...",   // The invoking button title.
-			U"Create person...");   // The help string; may be null.
-		UiForm_addNatural (dia, U"Age (years)", U"18");
-		UiForm_addPositive (dia, U"Length (metres)", U"1.68 (average)");
-		UiForm_addBoolean (dia, U"Beard", false);
-		radio = UiForm_addRadio (dia, U"Sex", 1);
+		  (topShell,   // the parent GuiWindow of the dialog window
+			U"Create a new person",   // the window title
+			DO_Person_create,   // the function to call when the user clicks OK
+			nullptr,   // the last argument to the OK routine (also for the other buttons); could be a ScriptEditor, or an EditorCommand, or an Interpreter, or nullptr
+			U"Create person...",   // the invoking button title
+			U"Create person...");   // the help string; may be nullptr
+		static integer age;
+		UiForm_addNatural (dia, & age, U"age", U"Age (years)", U"18");
+		static double length;
+		UiForm_addPositive (dia, & length, U"length", U"Length (metres)", U"1.68 (= average)");
+		static bool beard;
+		UiForm_addBoolean (dia, & beard, U"beard", U"Beard", false);
+		static int sex;
+		radio = UiForm_addRadio (dia, & sex, U"sex", U"Sex", 1);
 			UiRadio_addButton (radio, U"Female");
 			UiRadio_addButton (radio, U"Male");
-		UiForm_addWord (dia, U"Colour", U"black");
+		UiForm_addWord (dia, colour, U"colour", U"Colour", U"black");
 		UiForm_addLabel (dia, U"features", U"Some less conspicuous features:");
-		UiForm_addNatural (dia, U"Number of birth marks", U"28");
-		UiForm_addSentence (dia, U"Favourite greeting", U"Good morning");
+		static integer numberOfBirthMarks;
+		UiForm_addNatural (dia, & numberOfBirthMarks, U"numberOfBirthMarks", U"Number of birth marks", U"28");
+		static char *favouriteGreeting;
+		UiForm_addSentence (dia, & favouriteGreeting, U"favouriteGreeting", U"Favourite greeting", U"Good morning");
 		UiForm_finish (dia);
 	}
-	UiForm_setReal (dia, U"Length", myLength);
-	UiForm_setInteger (dia, U"Number of birth marks", 30);
-	UiForm_do (dia, 0);   // Show dialog box.
+	UiForm_setReal (dia, & length, myLength);
+	UiForm_setInteger (dia, & numberOfBirthMarks, 30);
+	UiForm_do (dia, false);   // show dialog box
 }
-	Real, Positive, Integer, Natural, Word, and Sentence
-		show a label (name) and an editable text field (value).
-	Radio shows a label (name) and has Button children.
-	OptionMenu shows a label (name) and has Button children in a menu.
+	Real, Positive, Integer, Natural, Channel, Word, and Sentence show a label and an editable text field.
+	Radio shows a label and has Button children stacked below it.
+	OptionMenu shows a label and has Button children in a menu.
 	Label only shows its value.
-	Text only shows an editable text field (value).
-	Boolean shows a labeled toggle button which is on (1) or off (0).
+	Text, Numvec and Nummat show an editable text field over the whole width of the form.
+	Boolean shows a labeled toggle button which is on (true) or off (false).
 	Button does the same inside a radio box or option menu.
 	List shows a scrollable list.
-	Colour shows a label (name) and an editable text field for a grey value between 0 and 1, a colour name, ar {r,g,b}.
-	Channel shows a label (name) and an editable text field for a natural number or the text Left or Right.
-	As shown in the example, Real, Positive, Integer, Natural, and Word may contain extra text;
-	this text is considered as comments and is erased as soon as you click OK.
+	Colour shows a label and an editable text field for a grey value between 0.0 and 1.0, a colour name, or {r,g,b}.
+	Channel shows a label and an editable text field for a natural number or one of the texts "Left", "Right", "Mono" or "Stereo".
+	As shown in the example, Real, Positive, Integer, and Natural may contain extra text;
+	this text is considered a comment.
 	When you click "Standards", the standard values (including comments)
 	are restored to all items in the form.
 */
@@ -79,14 +84,14 @@ Thing_define (UiField, Thing) {
 	int type;
 	const char32 *formLabel;
 	double realValue;
-	long integerValue, integerDefaultValue;
+	integer integerValue, integerDefaultValue;
 	char32 *stringValue; const char32 *stringDefaultValue;
 	autonumvec numericVectorValue;
 	autonummat numericMatrixValue;
 	Graphics_Colour colourValue;
 	char *stringValueA;
 	OrderedOf<structUiOption> options;
-	long numberOfStrings;
+	integer numberOfStrings;
 	const char32 **strings;
 	GuiLabel label;
 	GuiText text;
@@ -98,12 +103,16 @@ Thing_define (UiField, Thing) {
 
 	const char32 *variableName;
 	double *realVariable;
-	long *longVariable;
+	integer *integerVariable;
 	int *intVariable;
 	bool *boolVariable;
 	char32 **stringVariable;
-	autonumvec *numericVectorVariable;
-	autonummat *numericMatrixVariable;
+	Graphics_Colour *colourVariable;
+
+	numvec *numericVectorVariable;
+	nummat *numericMatrixVariable;
+	bool owned;
+
 	int subtract;
 
 	void v_destroy () noexcept
@@ -154,42 +163,29 @@ Thing_define (UiForm, Thing) {
 		override;
 };
 
-/* The following routines work on the screen and from batch. */
+/* The following functions work on the screen and from batch. */
 UiForm UiForm_create (GuiWindow parent, const char32 *title,
 	UiCallback okCallback, void *buttonClosure,
 	const char32 *invokingButtonTitle, const char32 *helpTitle);
-UiField UiForm_addReal (UiForm me, const char32 *label, const char32 *defaultValue);
-UiField UiForm_addReal4 (UiForm me, double *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue);
-UiField UiForm_addRealOrUndefined (UiForm me, const char32 *label, const char32 *defaultValue);
-UiField UiForm_addRealOrUndefined4 (UiForm me, double *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue);
-UiField UiForm_addPositive (UiForm me, const char32 *label, const char32 *defaultValue);
-UiField UiForm_addPositive4 (UiForm me, double *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue);
-UiField UiForm_addInteger (UiForm me, const char32 *label, const char32 *defaultValue);
-UiField UiForm_addInteger4 (UiForm me, long *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue);
-UiField UiForm_addNatural (UiForm me, const char32 *label, const char32 *defaultValue);
-UiField UiForm_addNatural4 (UiForm me, long *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue);
-UiField UiForm_addWord (UiForm me, const char32 *label, const char32 *defaultValue);
-UiField UiForm_addWord4 (UiForm me, char32 **variable, const char32 *variableName, const char32 *label, const char32 *defaultValue);
-UiField UiForm_addSentence (UiForm me, const char32 *label, const char32 *defaultValue);
-UiField UiForm_addSentence4 (UiForm me, char32 **variable, const char32 *variableName, const char32 *label, const char32 *defaultValue);
-UiField UiForm_addLabel (UiForm me, const char32 *name, const char32 *label);
-UiField UiForm_addBoolean (UiForm me, const char32 *label, int defaultValue);
-UiField UiForm_addBoolean4 (UiForm me, bool *variable, const char32 *variableName, const char32 *label, int defaultValue);
-UiField UiForm_addText (UiForm me, const char32 *name, const char32 *defaultValue);
-UiField UiForm_addText4 (UiForm me, char32 **variable, const char32 *variableName, const char32 *name, const char32 *defaultValue);
-UiField UiForm_addNumvec (UiForm me, autonumvec *variable, const char32 *variableName, const char32 *name, const char32 *defaultValue);
-UiField UiForm_addNummat (UiForm me, autonummat *variable, const char32 *variableName, const char32 *name, const char32 *defaultValue);
-UiField UiForm_addRadio (UiForm me, const char32 *label, int defaultValue);
-UiField UiForm_addRadio4 (UiForm me, int *intVariable, char32 **stringVariable, const char32 *variableName, const char32 *label, int defaultValue, int base);
+UiField UiForm_addReal (UiForm me, double *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue);
+UiField UiForm_addRealOrUndefined (UiForm me, double *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue);
+UiField UiForm_addPositive (UiForm me, double *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue);
+UiField UiForm_addInteger (UiForm me, integer *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue);
+UiField UiForm_addNatural (UiForm me, integer *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue);
+UiField UiForm_addWord (UiForm me, char32 **variable, const char32 *variableName, const char32 *label, const char32 *defaultValue);
+UiField UiForm_addSentence (UiForm me, char32 **variable, const char32 *variableName, const char32 *label, const char32 *defaultValue);
+UiField UiForm_addLabel (UiForm me, char32 **variable, const char32 *label);
+UiField UiForm_addBoolean (UiForm me, bool *variable, const char32 *variableName, const char32 *label, int defaultValue);
+UiField UiForm_addText (UiForm me, char32 **variable, const char32 *variableName, const char32 *name, const char32 *defaultValue);
+UiField UiForm_addNumvec (UiForm me, numvec *variable, const char32 *variableName, const char32 *name, const char32 *defaultValue);
+UiField UiForm_addNummat (UiForm me, nummat *variable, const char32 *variableName, const char32 *name, const char32 *defaultValue);
+UiField UiForm_addRadio (UiForm me, int *intVariable, char32 **stringVariable, const char32 *variableName, const char32 *label, int defaultValue, int base);
 UiOption UiRadio_addButton (UiField me, const char32 *label);
-UiField UiForm_addOptionMenu (UiForm me, const char32 *label, int defaultValue);
-UiField UiForm_addOptionMenu4 (UiForm me, int *intVariable, char32 **stringVariable, const char32 *variableName, const char32 *label, int defaultValue, int base);
+UiField UiForm_addOptionMenu (UiForm me, int *intVariable, char32 **stringVariable, const char32 *variableName, const char32 *label, int defaultValue, int base);
 UiOption UiOptionMenu_addButton (UiField me, const char32 *label);
-UiField UiForm_addList (UiForm me, const char32 *label, long numberOfStrings, const char32 **strings, long defaultValue);
-UiField UiForm_addList4 (UiForm me, long *longVariable, char32 **stringVariable, const char32 *variableName, const char32 *label, long numberOfStrings, const char32 **strings, long defaultValue);
-UiField UiForm_addColour (UiForm me, const char32 *label, const char32 *defaultValue);
-UiField UiForm_addChannel (UiForm me, const char32 *label, const char32 *defaultValue);
-UiField UiForm_addChannel4 (UiForm me, long *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue);
+UiField UiForm_addList (UiForm me, integer *integerVariable, char32 **stringVariable, const char32 *variableName, const char32 *label, integer numberOfStrings, const char32 **strings, integer defaultValue);
+UiField UiForm_addColour (UiForm me, Graphics_Colour *colourVariable, const char32 *variableName, const char32 *label, const char32 *defaultValue);
+UiField UiForm_addChannel (UiForm me, integer *variable, const char32 *variableName, const char32 *label, const char32 *defaultValue);
 void UiForm_finish (UiForm me);
 
 void UiForm_destroyWhenUnmanaged (UiForm me);
@@ -201,16 +197,26 @@ void UiForm_setPauseForm (UiForm me,
 	const char32 *continue10,
 	void (*cancelCallback) (UiForm dia, void *closure));
 
-/* The following three routines set values in widgets. */
+/* The following nine functions set values in widgets. */
 /* Do not call from batch. */
 /* 'fieldName' is name from UiForm_addXXXXXX (), */
 /* without anything from and including the first " (" or ":". */
-void UiForm_setString (UiForm me, const char32 *fieldName, const char32 *text /* cattable */);
-	/* Real, Positive, Integer, Natural, Word, Sentence, Label, Text, Radio, List. */
-void UiForm_setReal (UiForm me, const char32 *fieldName, double value);
-	/* Real, Positive. */
-void UiForm_setInteger (UiForm me, const char32 *fieldName, long value);
-	/* Integer, Natural, Boolean, Radio, List. */
+
+/* Real, RealOrUndefined, and Positive fields: */
+	void UiForm_setReal (UiForm me, double *p_variable, double value);
+	void UiForm_setRealAsString (UiForm me, double *p_variable, const char32 *stringValue /* cattable */);
+/* Integer, Natural, Channel, and List fields: */
+	void UiForm_setInteger (UiForm me, integer *p_variable, integer value);
+	void UiForm_setIntegerAsString (UiForm me, integer *p_variable, const char32 *stringValue /* cattable */);
+/* Word, Sentence, Text, and Label fields: */
+	void UiForm_setString (UiForm me, char32 **p_variable, const char32 *text /* cattable */);
+/* Boolean fields: */
+	void UiForm_setBoolean (UiForm me, bool *p_variable, bool value);
+/* Radio and OptionMenu fields: */
+	void UiForm_setOption (UiForm me, int *p_variable, int value);
+	void UiForm_setOptionAsString (UiForm me, int *p_variable, const char32 *stringValue /* cattable */);
+/* Colour fields: */
+	void UiForm_setColourAsGreyValue (UiForm me, Graphics_Colour *p_variable, double greyValue);
 
 void UiForm_do (UiForm me, bool modified);
 /*
@@ -218,42 +224,42 @@ void UiForm_do (UiForm me, bool modified);
 		put the form on the screen.
 	Behaviour:
 		If the user clicks "OK",
-		the form will call the okCallback that was registered with UiForm_create ().
-		   If the okCallback then returns 1, the form will disappear from the screen;
+		the form will call the `okCallback` that was registered with UiForm_create ().
+		   If the `okCallback` then returns 1, the form will disappear from the screen;
 		if it returns 0, the form will stay on the screen; this can be used
 		for enabling the user to repair mistakes in the form.
 
 		If the user clicks "Apply",
-		the form will call the okCallback that was registered with UiForm_create (),
+		the form will call the `okCallback` that was registered with UiForm_create (),
 		and the form disappears from the screen.
 
 		If the user clicks "Cancel", the form disappears from the screen.
 
-		If the user clicks "Help", the form calls "help" with the "helpTitle"
+		If the user clicks "Help", the form calls `help` with the `helpTitle`
 		and stays on the screen.
 
 		When the form disappears from the screen, the values in the fields
 		will remain until the next invocation of UiForm_do () for the same form.
 	Arguments:
-		the above behaviour describes the action when 'modified' is 0.
-		If 'modified' is set, the user does not have to click OK.
+		the above behaviour describes the action when `modified` is false.
+		If `modified` is true, the user does not have to click OK.
 		The form will still appear on the screen,
-		but the okCallback will be called immediately.
+		but the `okCallback` will be called immediately.
 */
 void UiForm_info (UiForm me, int narg);
 
-/* The 'okCallback' can use the following four routines to ask arguments. */
-/* The field names are the 'label' or 'name' arguments to UiForm_addXXXXXX (), */
-/* without anything from parentheses or from a colon. */
-/* These routines work from the screen and from batch. */
-double UiForm_getReal (UiForm me, const char32 *fieldName);	  // Real, Positive
-long UiForm_getInteger (UiForm me, const char32 *fieldName);   // Integer, Natural, Boolean, Radio, List
-char32 * UiForm_getString (UiForm me, const char32 *fieldName);   // Word, Sentence, Text, Radio, List
-Graphics_Colour UiForm_getColour (UiForm me, const char32 *fieldName);   // Colour
+/*
+	The `okCallback` can use the following seven functions to ask arguments.
+	The field names are the `label` or `name` arguments to UiForm_addXXXXXX (),
+	without anything from parentheses or from a colon.
+	These functions work from the GUI as well as from a script.
+*/
+integer UiForm_getInteger (UiForm me, const char32 *fieldName);   // Integer, Natural, Boolean, Radio, List
+char32 * UiForm_getString (UiForm me, const char32 *fieldName);   // Word, Sentence, Text, Numvec, Nummat, Radio, List
 MelderFile UiForm_getFile (UiForm me, const char32 *fieldName);   // FileIn, FileOut
 
 double UiForm_getReal_check (UiForm me, const char32 *fieldName);
-long UiForm_getInteger_check (UiForm me, const char32 *fieldName);
+integer UiForm_getInteger_check (UiForm me, const char32 *fieldName);
 char32 * UiForm_getString_check (UiForm me, const char32 *fieldName);
 Graphics_Colour UiForm_getColour_check (UiForm me, const char32 *fieldName);
 
diff --git a/sys/UiFile.cpp b/sys/UiFile.cpp
index c09f31a..d3fae78 100644
--- a/sys/UiFile.cpp
+++ b/sys/UiFile.cpp
@@ -47,7 +47,7 @@ UiForm UiInfile_create (GuiWindow parent, const char32 *title,
 void UiInfile_do (UiForm me) {
 	try {
 		autoStringSet infileNames = GuiFileSelect_getInfileNames (my d_dialogParent, my name, my allowMultipleFiles);
-		for (long ifile = 1; ifile <= infileNames->size; ifile ++) {
+		for (integer ifile = 1; ifile <= infileNames->size; ifile ++) {
 			SimpleString infileName = infileNames->at [ifile];
 			Melder_pathToFile (infileName -> string, & my file);
 			UiHistory_write (U"\n");
diff --git a/sys/UiPause.cpp b/sys/UiPause.cpp
index dd9f458..ab1ff9c 100644
--- a/sys/UiPause.cpp
+++ b/sys/UiPause.cpp
@@ -54,52 +54,52 @@ void UiPause_begin (GuiWindow topShell, const char32 *title, Interpreter interpr
 void UiPause_real (const char32 *label, const char32 *defaultValue) {
 	if (! thePauseForm)
 		Melder_throw (U"The function \"real\" has to be between a \"beginPause\" and an \"endPause\".");
-	UiForm_addReal (thePauseForm, label, defaultValue);
+	UiForm_addReal (thePauseForm, nullptr, nullptr, label, defaultValue);
 }
 void UiPause_positive (const char32 *label, const char32 *defaultValue) {
 	if (! thePauseForm)
 		Melder_throw (U"The function \"positive\" has to be between a \"beginPause\" and an \"endPause\".");
-	UiForm_addPositive (thePauseForm, label, defaultValue);
+	UiForm_addPositive (thePauseForm, nullptr, nullptr, label, defaultValue);
 }
 void UiPause_integer (const char32 *label, const char32 *defaultValue) {
 	if (! thePauseForm)
 		Melder_throw (U"The function \"integer\" has to be between a \"beginPause\" and an \"endPause\".");
-	UiForm_addInteger (thePauseForm, label, defaultValue);
+	UiForm_addInteger (thePauseForm, nullptr, nullptr, label, defaultValue);
 }
 void UiPause_natural (const char32 *label, const char32 *defaultValue) {
 	if (! thePauseForm)
 		Melder_throw (U"The function \"natural\" has to be between a \"beginPause\" and an \"endPause\".");
-	UiForm_addNatural (thePauseForm, label, defaultValue);
+	UiForm_addNatural (thePauseForm, nullptr, nullptr, label, defaultValue);
 }
 void UiPause_word (const char32 *label, const char32 *defaultValue) {
 	if (! thePauseForm)
 		Melder_throw (U"The function \"word\" has to be between a \"beginPause\" and an \"endPause\".");
-	UiForm_addWord (thePauseForm, label, defaultValue);
+	UiForm_addWord (thePauseForm, nullptr, nullptr, label, defaultValue);
 }
 void UiPause_sentence (const char32 *label, const char32 *defaultValue) {
 	if (! thePauseForm)
 		Melder_throw (U"The function \"sentence\" has to be between a \"beginPause\" and an \"endPause\".");
-	UiForm_addSentence (thePauseForm, label, defaultValue);
+	UiForm_addSentence (thePauseForm, nullptr, nullptr, label, defaultValue);
 }
 void UiPause_text (const char32 *label, const char32 *defaultValue) {
 	if (! thePauseForm)
 		Melder_throw (U"The function \"text\" has to be between a \"beginPause\" and an \"endPause\".");
-	UiForm_addText (thePauseForm, label, defaultValue);
+	UiForm_addText (thePauseForm, nullptr, nullptr, label, defaultValue);
 }
 void UiPause_boolean (const char32 *label, int defaultValue) {
 	if (! thePauseForm)
 		Melder_throw (U"The function \"boolean\" has to be between a \"beginPause\" and an \"endPause\".");
-	UiForm_addBoolean (thePauseForm, label, defaultValue);
+	UiForm_addBoolean (thePauseForm, nullptr, nullptr, label, defaultValue);
 }
 void UiPause_choice (const char32 *label, int defaultValue) {
 	if (! thePauseForm)
 		Melder_throw (U"The function \"choice\" has to be between a \"beginPause\" and an \"endPause\".");
-	thePauseFormRadio = UiForm_addRadio (thePauseForm, label, defaultValue);
+	thePauseFormRadio = UiForm_addRadio (thePauseForm, nullptr, nullptr, nullptr, label, defaultValue, 1);
 }
 void UiPause_optionMenu (const char32 *label, int defaultValue) {
 	if (! thePauseForm)
 		Melder_throw (U"The function \"optionMenu\" has to be between a \"beginPause\" and an \"endPause\".");
-	thePauseFormRadio = UiForm_addOptionMenu (thePauseForm, label, defaultValue);
+	thePauseFormRadio = UiForm_addOptionMenu (thePauseForm, nullptr, nullptr, nullptr, label, defaultValue, 1);
 }
 void UiPause_option (const char32 *label) {
 	if (! thePauseForm)
@@ -113,7 +113,7 @@ void UiPause_option (const char32 *label) {
 void UiPause_comment (const char32 *label) {
 	if (! thePauseForm)
 		Melder_throw (U"The function \"comment\" has to be between a \"beginPause\" and an \"endPause\".");
-	UiForm_addLabel (thePauseForm, U"", label);
+	UiForm_addLabel (thePauseForm, nullptr, label);
 }
 int UiPause_end (int numberOfContinueButtons, int defaultContinueButton, int cancelContinueButton,
 	const char32 *continueText1, const char32 *continueText2, const char32 *continueText3,
diff --git a/sys/abcio.cpp b/sys/abcio.cpp
index e193b85..cbdd70d 100644
--- a/sys/abcio.cpp
+++ b/sys/abcio.cpp
@@ -688,7 +688,7 @@ void binputi8 (int u, FILE *f) {
 	}
 }
 
-bool bingeteb (FILE *f) {
+bool bingetbool8 (FILE *f) {
 	try {
 		int externalValue = getc (f);
 		if (externalValue < 0) readError (f, U"a byte.");
@@ -698,7 +698,7 @@ bool bingeteb (FILE *f) {
 	}
 }
 
-void binputeb (bool value, FILE *f) {
+void binputbool8 (bool value, FILE *f) {
 	try {
 		if (putc (value, f) < 0) writeError (U"a byte.");
 	} catch (MelderError) {
@@ -824,7 +824,7 @@ uint16 bingetu16LE (FILE *f) {
 	}
 }
 
-int bingete2 (FILE *f, int min, int max, const char32 *type) {
+int bingete16 (FILE *f, int min, int max, const char32 *type) {
 	try {
 		int16 result;
 		if (binario_16bitBE && Melder_debug != 18) {
diff --git a/sys/abcio.h b/sys/abcio.h
index a2f2dbb..e889012 100644
--- a/sys/abcio.h
+++ b/sys/abcio.h
@@ -133,15 +133,17 @@ void bingetb (FILE *f);   void binputb (FILE *f);
 
 int bingete8 (FILE *f, int min, int max, const char32 *type);
 int bingete16 (FILE *f, int min, int max, const char32 *type);
-bool bingeteb (FILE *f);
-#define bingeteq bingeteb
-#define bingetex bingeteb
+bool bingetbool8 (FILE *f);
+#define bingeteb bingetbool8
+#define bingeteq bingetbool8
+#define bingetex bingetbool8
 
 void binpute8 (int value, FILE *f);
 void binpute16 (int value, FILE *f);
-void binputeb (bool value, FILE *f);
-#define binputeq binputeb
-#define binputex binputeb
+void binputbool8 (bool value, FILE *f);
+#define binputeb binputbool8
+#define binputeq binputbool8
+#define binputex binputbool8
 
 double bingetr32 (FILE *f);   void binputr32 (double x, FILE *f);
 /*
diff --git a/sys/enums.h b/sys/enums.h
index c1d8bdc..97194b0 100644
--- a/sys/enums.h
+++ b/sys/enums.h
@@ -20,7 +20,7 @@
 
 typedef int (*enum_generic_getValue) (const char32 *text);
 
-#define enums_begin(kType,minimum)  enum class kType { MIN = minimum,
+#define enums_begin(kType,minimum)  enum class kType { UNDEFINED = -1, MIN = minimum,
 #define enums_add(kType,value,which,text)  which = value,
 #define enums_alt(kType,which,text)
 #define enums_end(kType,maximum,default) MAX = maximum, \
diff --git a/sys/enums_getValue.h b/sys/enums_getValue.h
index ab4f763..bcf590a 100644
--- a/sys/enums_getValue.h
+++ b/sys/enums_getValue.h
@@ -29,7 +29,7 @@
 #define enums_alt(kType,which,text)  if (Melder_equ_firstCharacterCaseInsensitive (testText, text)) return kType::which;
 #define enums_end(kType,maximum,def) \
 	if (str32equ (testText, U"\t")) return kType::DEFAULT; \
-	if (str32equ (testText, U"\n")) return (kType) maximum; \
-	return (kType) -1; }
+	if (str32equ (testText, U"\n")) return kType::MAX; \
+	return kType::UNDEFINED; }
 
 /* End of file enums_getValue.h */
diff --git a/sys/melder.cpp b/sys/melder.cpp
index 3426af2..df7c686 100644
--- a/sys/melder.cpp
+++ b/sys/melder.cpp
@@ -771,11 +771,11 @@ void Melder_assert_ (const char *fileName, int lineNumber, const char *condition
 	 */
 	MelderThread_LOCK (theMelder_fatal_mutex);
 	static char32 fileNameBuffer [1000], conditionBuffer [1000], lineNumberBuffer [40];
-	Melder_8to32_inline (fileName, fileNameBuffer, (int) kMelder_textInputEncoding::UTF8);
-	Melder_8to32_inline (condition, conditionBuffer, (int) kMelder_textInputEncoding::UTF8);
+	Melder_8to32_inline (fileName, fileNameBuffer, kMelder_textInputEncoding::UTF8);
+	Melder_8to32_inline (condition, conditionBuffer, kMelder_textInputEncoding::UTF8);
 	static char lineNumberBuffer8 [40];
 	sprintf (lineNumberBuffer8, "%d", lineNumber);
-	Melder_8to32_inline (lineNumberBuffer8, lineNumberBuffer, (int) kMelder_textInputEncoding::UTF8);
+	Melder_8to32_inline (lineNumberBuffer8, lineNumberBuffer, kMelder_textInputEncoding::UTF8);
 	str32cpy (theFatalBuffer, theCrashMessage);
 	str32cpy (theFatalBuffer + str32len (theFatalBuffer), U"Assertion failed in file \"");
 	str32cpy (theFatalBuffer + str32len (theFatalBuffer), fileNameBuffer);
diff --git a/sys/melder.h b/sys/melder.h
index 2e05f0d..cfc57d8 100644
--- a/sys/melder.h
+++ b/sys/melder.h
@@ -43,6 +43,7 @@ typedef int16_t int16;
 typedef int32_t int32;
 typedef int64_t int64;
 typedef intptr_t integer;   // the default size of an integer (a "long" is only 32 bits on 64-bit Windows)
+typedef long long_not_integer;   // for cases where we explicitly need the type "long", such as when printfing to %ld
 typedef uintptr_t uinteger;
 typedef uint8_t uint8;
 typedef uint16_t uint16;
@@ -397,7 +398,7 @@ kMelder_textOutputEncoding Melder_getOutputEncoding ();
  * these constants should stay separate from the above encoding constants
  * because they occur in the same fields of struct MelderFile.
  */
-const uint32 kMelder_textInputEncoding_FLAC = 0x464C4143;
+//const uint32 kMelder_textInputEncoding_FLAC = 0x464C4143;
 const uint32 kMelder_textOutputEncoding_ASCII = 0x41534349;
 const uint32 kMelder_textOutputEncoding_ISO_LATIN1 = 0x4C415401;
 const uint32 kMelder_textOutputEncoding_FLAC = 0x464C4143;
@@ -420,9 +421,9 @@ size_t str32len_utf8  (const char32 *string, bool nativizeNewlines);
 size_t str32len_utf16 (const char32 *string, bool nativizeNewlines);
 
 extern "C" char32 * Melder_peek8to32 (const char *string);
-void Melder_8to32_inline (const char *source, char32 *target, int inputEncoding);
+void Melder_8to32_inline (const char *source, char32 *target, kMelder_textInputEncoding inputEncoding);
 	// errors: Text is not valid UTF-8.
-char32 * Melder_8to32 (const char *string, int inputEncoding);
+char32 * Melder_8to32 (const char *string, kMelder_textInputEncoding inputEncoding);
 	// errors: Out of memory; Text is not valid UTF-8.
 char32 * Melder_8to32 (const char *string);
 	// errors: Out of memory; Text is not valid UTF-8.
@@ -481,7 +482,7 @@ struct structMelderFile {
 	char32 path [kMelder_MAXPATH+1];
 	enum class Format { none = 0, binary = 1, text = 2 } format;
 	bool openForReading, openForWriting, verbose, requiresCRLF;
-	unsigned long outputEncoding;
+	uint32 outputEncoding;
 	int indent;
 	struct FLAC__StreamEncoder *flacEncoder;
 };
@@ -540,7 +541,7 @@ const char32 * MelderFile_messageName (MelderFile file);   // calls Melder_peekE
 struct structMelderReadText {
 	char32 *string32, *readPointer32;
 	char *string8, *readPointer8;
-	unsigned long input8Encoding;
+	kMelder_textInputEncoding input8Encoding;
 };
 typedef struct structMelderReadText *MelderReadText;
 
@@ -783,13 +784,13 @@ integer NUM_getTotalNumberOfArrays ();   // for debugging
 
 double NUMlnGamma (double x);
 double NUMbeta (double z, double w);
-double NUMbesselI (long n, double x);   // precondition: n >= 0
+double NUMbesselI (integer n, double x);   // precondition: n >= 0
 double NUMbessel_i0_f (double x);
 double NUMbessel_i1_f (double x);
-double NUMbesselK (long n, double x);   // preconditions: n >= 0 && x > 0.0
+double NUMbesselK (integer n, double x);   // preconditions: n >= 0 && x > 0.0
 double NUMbessel_k0_f (double x);
 double NUMbessel_k1_f (double x);
-double NUMbesselK_f (long n, double x);
+double NUMbesselK_f (integer n, double x);
 double NUMsigmoid (double x);   // correct also for large positive or negative x
 double NUMinvSigmoid (double x);
 double NUMerfcc (double x);
@@ -799,7 +800,7 @@ double NUMincompleteGammaP (double a, double x);
 double NUMincompleteGammaQ (double a, double x);
 double NUMchiSquareP (double chiSquare, double degreesOfFreedom);
 double NUMchiSquareQ (double chiSquare, double degreesOfFreedom);
-double NUMcombinations (long n, long k);
+double NUMcombinations (integer n, integer k);
 double NUMincompleteBeta (double a, double b, double x);   // incomplete beta function Ix(a,b). Preconditions: a, b > 0; 0 <= x <= 1
 double NUMbinomialP (double p, double k, double n);
 double NUMbinomialQ (double p, double k, double n);
@@ -823,13 +824,13 @@ double NUMerbToHertz (double erb);
 
 /********** Sorting (NUMsort.cpp) **********/
 
-void NUMsort_d (long n, double ra []);   // heap sort
-void NUMsort_i (long n, int ra []);
-void NUMsort_l (long n, long ra []);
-void NUMsort_str (long n, char32 *a []);
-void NUMsort_p (long n, void *a [], int (*compare) (const void *, const void *));
+void NUMsort_d (integer n, double ra []);   // heap sort
+void NUMsort_i (integer n, int ra []);
+void NUMsort_integer (integer n, integer ra []);
+void NUMsort_str (integer n, char32 *a []);
+void NUMsort_p (integer n, void *a [], int (*compare) (const void *, const void *));
 
-double NUMquantile (long n, double a [], double factor);
+double NUMquantile (integer n, double a [], double factor);
 /*
 	An estimate of the quantile 'factor' (between 0 and 1) of the distribution
 	from which the set 'a [1..n]' is a sorted array of random samples.
@@ -847,7 +848,7 @@ double NUMquantile (long n, double a [], double factor);
 // Higher values than 2 yield a true sinc interpolation. Here are some examples:
 #define NUM_VALUE_INTERPOLATE_SINC70  70
 #define NUM_VALUE_INTERPOLATE_SINC700  700
-double NUM_interpolate_sinc (double y [], long nx, double x, long interpolationDepth);
+double NUM_interpolate_sinc (double y [], integer nx, double x, integer interpolationDepth);
 
 #define NUM_PEAK_INTERPOLATE_NONE  0
 #define NUM_PEAK_INTERPOLATE_PARABOLIC  1
@@ -855,29 +856,29 @@ double NUM_interpolate_sinc (double y [], long nx, double x, long interpolationD
 #define NUM_PEAK_INTERPOLATE_SINC70  3
 #define NUM_PEAK_INTERPOLATE_SINC700  4
 
-double NUMimproveExtremum (double *y, long nx, long ixmid, int interpolation, double *ixmid_real, int isMaximum);
-double NUMimproveMaximum (double *y, long nx, long ixmid, int interpolation, double *ixmid_real);
-double NUMimproveMinimum (double *y, long nx, long ixmid, int interpolation, double *ixmid_real);
+double NUMimproveExtremum (double *y, integer nx, integer ixmid, int interpolation, double *ixmid_real, int isMaximum);
+double NUMimproveMaximum (double *y, integer nx, integer ixmid, int interpolation, double *ixmid_real);
+double NUMimproveMinimum (double *y, integer nx, integer ixmid, int interpolation, double *ixmid_real);
 
 void NUM_viterbi (
-	long numberOfFrames, long maxnCandidates,
-	long (*getNumberOfCandidates) (long iframe, void *closure),
-	double (*getLocalCost) (long iframe, long icand, void *closure),
-	double (*getTransitionCost) (long iframe, long icand1, long icand2, void *closure),
-	void (*putResult) (long iframe, long place, void *closure),
+	integer numberOfFrames, integer maxnCandidates,
+	integer (*getNumberOfCandidates) (integer iframe, void *closure),
+	double (*getLocalCost) (integer iframe, integer icand, void *closure),
+	double (*getTransitionCost) (integer iframe, integer icand1, integer icand2, void *closure),
+	void (*putResult) (integer iframe, integer place, void *closure),
 	void *closure);
 
 void NUM_viterbi_multi (
-	long nframe, long ncand, int ntrack,
-	double (*getLocalCost) (long iframe, long icand, int itrack, void *closure),
-	double (*getTransitionCost) (long iframe, long icand1, long icand2, int itrack, void *closure),
-	void (*putResult) (long iframe, long place, int itrack, void *closure),
+	integer nframe, integer ncand, integer ntrack,
+	double (*getLocalCost) (integer iframe, integer icand, integer itrack, void *closure),
+	double (*getTransitionCost) (integer iframe, integer icand1, integer icand2, integer itrack, void *closure),
+	void (*putResult) (integer iframe, integer place, integer itrack, void *closure),
 	void *closure);
 
 /********** Metrics (NUM.cpp) **********/
 
 int NUMrotationsPointInPolygon
-	(double x0, double y0, long n, double x [], double y []);
+	(double x0, double y0, integer n, double x [], double y []);
 /*
 	Returns the number of times that the closed polygon
 	(x [1], y [1]), (x [2], y [2]),..., (x [n], y [n]), (x [1], y [1]) encloses the point (x0, y0).
@@ -896,7 +897,7 @@ double NUMrandomFraction_mt (int threadNumber);
 
 double NUMrandomUniform (double lowest, double highest);
 
-long NUMrandomInteger (long lowest, long highest);
+integer NUMrandomInteger (integer lowest, integer highest);
 
 bool NUMrandomBernoulli (double probability);
 double NUMrandomBernoulli_real (double probability);
@@ -909,14 +910,14 @@ double NUMrandomPoisson (double mean);
 uint32 NUMhashString (const char32 *string);
 
 void NUMfbtoa (double formant, double bandwidth, double dt, double *a1, double *a2);
-void NUMfilterSecondOrderSection_a (double x [], long n, double a1, double a2);
-void NUMfilterSecondOrderSection_fb (double x [], long n, double dt, double formant, double bandwidth);
+void NUMfilterSecondOrderSection_a (double x [], integer n, double a1, double a2);
+void NUMfilterSecondOrderSection_fb (double x [], integer n, double dt, double formant, double bandwidth);
 double NUMftopreemphasis (double f, double dt);
-void NUMpreemphasize_a (double x [], long n, double preemphasis);
-void NUMdeemphasize_a (double x [], long n, double preemphasis);
-void NUMpreemphasize_f (double x [], long n, double dt, double frequency);
-void NUMdeemphasize_f (double x [], long n, double dt, double frequency);
-void NUMautoscale (double x [], long n, double scale);
+void NUMpreemphasize_a (double x [], integer n, double preemphasis);
+void NUMdeemphasize_a (double x [], integer n, double preemphasis);
+void NUMpreemphasize_f (double x [], integer n, double dt, double frequency);
+void NUMdeemphasize_f (double x [], integer n, double dt, double frequency);
+void NUMautoscale (double x [], integer n, double scale);
 
 /* The following ANSI-C power trick generates the declarations of 156 functions. */
 #define FUNCTION(type,storage)  \
@@ -931,6 +932,7 @@ void NUMautoscale (double x [], long n, double scale);
 FUNCTION (signed char, i8)
 FUNCTION (int, i16)
 FUNCTION (long, i32)
+FUNCTION (integer, integer)
 FUNCTION (unsigned char, u8)
 FUNCTION (unsigned int, u16)
 FUNCTION (unsigned long, u32)
@@ -982,7 +984,7 @@ void NUMlinprog_addVariable (NUMlinprog me, double lowerBound, double upperBound
 void NUMlinprog_addConstraint (NUMlinprog me, double lowerBound, double upperBound);
 void NUMlinprog_addConstraintCoefficient (NUMlinprog me, double coefficient);
 void NUMlinprog_run (NUMlinprog me);
-double NUMlinprog_getPrimalValue (NUMlinprog me, long ivar);
+double NUMlinprog_getPrimalValue (NUMlinprog me, integer ivar);
 
 template <class T>
 T* NUMvector (integer from, integer to) {
@@ -1615,7 +1617,7 @@ void Melder_trace (const char *fileName, int lineNumber, const char *functionNam
 MelderFile MelderFile_open (MelderFile file);
 MelderFile MelderFile_append (MelderFile file);
 MelderFile MelderFile_create (MelderFile file);
-void * MelderFile_read (MelderFile file, long nbytes);
+void * MelderFile_read (MelderFile file, integer nbytes);
 char * MelderFile_readLine (MelderFile file);
 void MelderFile_writeCharacter (MelderFile file, wchar_t kar);
 void MelderFile_writeCharacter (MelderFile file, char32 kar);
@@ -1779,12 +1781,12 @@ bool Melder_stringMatchesCriterion (const char32 *value, kMelder_string which, c
 		}
 */
 
-long Melder_countTokens (const char32 *string);
+integer Melder_countTokens (const char32 *string);
 char32 *Melder_firstToken (const char32 *string);
 char32 *Melder_nextToken ();
-char32 ** Melder_getTokens (const char32 *string, long *n);
+char32 ** Melder_getTokens (const char32 *string, integer *n);
 void Melder_freeTokens (char32 ***tokens);
-long Melder_searchToken (const char32 *string, char32 **tokens, long n);
+integer Melder_searchToken (const char32 *string, char32 **tokens, integer n);
 
 /********** MESSAGING ROUTINES **********/
 
@@ -2219,16 +2221,16 @@ void MelderAudio_setUseInternalSpeaker (bool useInternalSpeaker);   // for HP-UX
 bool MelderAudio_getUseInternalSpeaker ();
 void MelderAudio_setOutputMaximumAsynchronicity (enum kMelder_asynchronicityLevel maximumAsynchronicity);
 enum kMelder_asynchronicityLevel MelderAudio_getOutputMaximumAsynchronicity ();
-long MelderAudio_getOutputBestSampleRate (long fsamp);
+integer MelderAudio_getOutputBestSampleRate (integer fsamp);
 
 extern bool MelderAudio_isPlaying;
-void MelderAudio_play16 (int16_t *buffer, long sampleRate, long numberOfSamples, int numberOfChannels,
-	bool (*playCallback) (void *playClosure, long numberOfSamplesPlayed),   // return true to continue, false to stop
+void MelderAudio_play16 (int16_t *buffer, integer sampleRate, integer numberOfSamples, int numberOfChannels,
+	bool (*playCallback) (void *playClosure, integer numberOfSamplesPlayed),   // return true to continue, false to stop
 	void *playClosure);
 bool MelderAudio_stopPlaying (bool isExplicit);   // returns true if sound was playing
 #define MelderAudio_IMPLICIT  false
 #define MelderAudio_EXPLICIT  true
-long MelderAudio_getSamplesPlayed ();
+integer MelderAudio_getSamplesPlayed ();
 bool MelderAudio_stopWasExplicit ();
 
 void Melder_audio_prefs ();   // in init file
@@ -2267,26 +2269,26 @@ const char32 * Melder_audioFileTypeString (int audioFileType);   // "AIFF", "AIF
 #define Melder_MPEG_COMPRESSION_24 19
 #define Melder_MPEG_COMPRESSION_32 20
 int Melder_defaultAudioFileEncoding (int audioFileType, int numberOfBitsPerSamplePoint);   /* BIG_ENDIAN, BIG_ENDIAN, LITTLE_ENDIAN, BIG_ENDIAN, LITTLE_ENDIAN */
-void MelderFile_writeAudioFileHeader (MelderFile file, int audioFileType, long sampleRate, long numberOfSamples, int numberOfChannels, int numberOfBitsPerSamplePoint);
-void MelderFile_writeAudioFileTrailer (MelderFile file, int audioFileType, long sampleRate, long numberOfSamples, int numberOfChannels, int numberOfBitsPerSamplePoint);
-void MelderFile_writeAudioFile (MelderFile file, int audioFileType, const short *buffer, long sampleRate, long numberOfSamples, int numberOfChannels, int numberOfBitsPerSamplePoint);
+void MelderFile_writeAudioFileHeader (MelderFile file, int audioFileType, integer sampleRate, integer numberOfSamples, int numberOfChannels, int numberOfBitsPerSamplePoint);
+void MelderFile_writeAudioFileTrailer (MelderFile file, int audioFileType, integer sampleRate, integer numberOfSamples, int numberOfChannels, int numberOfBitsPerSamplePoint);
+void MelderFile_writeAudioFile (MelderFile file, int audioFileType, const short *buffer, integer sampleRate, integer numberOfSamples, int numberOfChannels, int numberOfBitsPerSamplePoint);
 
 int MelderFile_checkSoundFile (MelderFile file, int *numberOfChannels, int *encoding,
-	double *sampleRate, long *startOfData, integer *numberOfSamples);
+	double *sampleRate, integer *startOfData, integer *numberOfSamples);
 /* Returns information about a just opened audio file.
  * The return value is the audio file type, or 0 if it is not a sound file or in case of error.
  * The data start at 'startOfData' bytes from the start of the file.
  */
 int Melder_bytesPerSamplePoint (int encoding);
-void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, double **buffer, long numberOfSamples);
+void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, double **buffer, integer numberOfSamples);
 /* Reads channels into buffer [ichannel], which are base-1.
  */
-void Melder_readAudioToShort (FILE *f, int numberOfChannels, int encoding, short *buffer, long numberOfSamples);
+void Melder_readAudioToShort (FILE *f, int numberOfChannels, int encoding, short *buffer, integer numberOfSamples);
 /* If stereo, buffer will contain alternating left and right values.
  * Buffer is base-0.
  */
-void MelderFile_writeFloatToAudio (MelderFile file, int numberOfChannels, int encoding, double **buffer, long numberOfSamples, int warnIfClipped);
-void MelderFile_writeShortToAudio (MelderFile file, int numberOfChannels, int encoding, const short *buffer, long numberOfSamples);
+void MelderFile_writeFloatToAudio (MelderFile file, int numberOfChannels, int encoding, double **buffer, integer numberOfSamples, int warnIfClipped);
+void MelderFile_writeShortToAudio (MelderFile file, int numberOfChannels, int encoding, const short *buffer, integer numberOfSamples);
 
 /********** QUANTITY **********/
 
@@ -2438,7 +2440,7 @@ public:
 
 class autoMelderTokens {
 	char32 **tokens;
-	long numberOfTokens;
+	integer numberOfTokens;
 public:
 	autoMelderTokens () {
 		tokens = nullptr;
@@ -2448,23 +2450,23 @@ public:
 	}
 	~autoMelderTokens () {
 		if (tokens) {
-			for (long itoken = 1; itoken <= numberOfTokens; itoken ++)
+			for (integer itoken = 1; itoken <= numberOfTokens; itoken ++)
 				Melder_free (tokens [itoken]);
 			Melder_freeTokens (& tokens);
 		}
 	}
-	char32*& operator[] (long i) {
+	char32*& operator[] (integer i) {
 		return tokens [i];
 	}
 	char32 ** peek () const {
 		return tokens;
 	}
-	long count () const {
+	integer count () const {
 		return numberOfTokens;
 	}
 	void reset (const char32 *string) {
 		if (tokens) {
-			for (long itoken = 1; itoken <= numberOfTokens; itoken ++)
+			for (integer itoken = 1; itoken <= numberOfTokens; itoken ++)
 				Melder_free (tokens [itoken]);
 			Melder_freeTokens (& tokens);
 		}
diff --git a/sys/melder_audio.cpp b/sys/melder_audio.cpp
index bd52002..0b42a05 100644
--- a/sys/melder_audio.cpp
+++ b/sys/melder_audio.cpp
@@ -120,7 +120,7 @@ void MelderAudio_setOutputSilenceAfter (double silenceAfter) {
 }
 double MelderAudio_getOutputSilenceAfter () { return preferences. silenceAfter; }
 
-long MelderAudio_getOutputBestSampleRate (long fsamp) {
+integer MelderAudio_getOutputBestSampleRate (integer fsamp) {
 	#if defined (macintosh)
 		return fsamp == 44100 || fsamp == 96000 ? fsamp : 44100;
 	#elif defined (_WIN32)
@@ -173,12 +173,12 @@ typedef struct pulseAudio {
 
 static struct MelderPlay {
 	int16_t *buffer;
-	long sampleRate, numberOfSamples, samplesLeft, samplesSent, samplesPlayed;
+	integer sampleRate, numberOfSamples, samplesLeft, samplesSent, samplesPlayed;
 	kMelder_asynchronicityLevel asynchronicity;
 	int numberOfChannels;
 	bool explicitStop, fakeMono;
 	volatile int volatile_interrupted;
-	bool (*callback) (void *closure, long samplesPlayed);
+	bool (*callback) (void *closure, integer samplesPlayed);
 	void *closure;
 	#if gtk
 		gint workProcId_gtk = 0;
@@ -203,7 +203,7 @@ static struct MelderPlay {
 	#endif
 } thePlay;
 
-long MelderAudio_getSamplesPlayed () {
+integer MelderAudio_getSamplesPlayed () {
 	return thePlay. samplesPlayed;
 }
 
@@ -404,13 +404,13 @@ bool MelderAudio_stopPlaying (bool explicitStop) {
 
 static bool workProc (void *closure) {
 	struct MelderPlay *me = & thePlay;
-//static long n = 0;
+//static integer n = 0;
 //n ++;
 //Melder_casual (U"workProc ", n);
 	if (my usePortAudio) {
 		#if defined (linux)
 			double timeElapsed = Melder_clock () - theStartingTime - Pa_GetStreamInfo (my stream) -> outputLatency;
-			long samplesPlayed = timeElapsed * my sampleRate;
+			integer samplesPlayed = timeElapsed * my sampleRate;
 			if (my callback && ! my callback (my closure, samplesPlayed)) {
 				my volatile_interrupted = 1;
 				return flush ();
@@ -436,7 +436,7 @@ static bool workProc (void *closure) {
 			 */
 		#else
 			double timeElapsed = Melder_clock () - theStartingTime - Pa_GetStreamInfo (my stream) -> outputLatency;
-			my samplesPlayed = (long) floor (timeElapsed * my sampleRate);
+			my samplesPlayed = (integer) floor (timeElapsed * my sampleRate);
 			if (my supports_paComplete && Pa_IsStreamActive (my stream)) {
 				if (my callback && ! my callback (my closure, my samplesPlayed)) {
 					Pa_AbortStream (my stream);
@@ -458,7 +458,7 @@ static bool workProc (void *closure) {
 	} else if (my usePulseAudio) {
 		if (my pulseAudio.mainloop) {
 			pa_threaded_mainloop_lock (my pulseAudio.mainloop);
-			long samplesPlayed = 0;
+			integer samplesPlayed = 0;
 			pa_usec_t diff_usec = 0;
 			if (my pulseAudio.startTime.tv_usec != 0) {
 				diff_usec = pa_timeval_age (& my pulseAudio.startTime);
@@ -500,8 +500,8 @@ static bool workProc (void *closure) {
 			my samplesPlayed = my numberOfSamples;
 			return flush ();
   		} else {
-  			static long previousTime = 0;
-  			unsigned long currentTime = clock ();
+  			static integer previousTime = 0;
+  			uinteger currentTime = clock ();
   			if (Melder_debug == 1) {
 				my samplesPlayed = (Melder_clock () - theStartingTime) * my sampleRate;
   			} else {
@@ -563,7 +563,7 @@ static int thePaStreamCallback (const void *input, void *output,
 		if (Melder_debug == 20) Melder_casual (U"output overflow");
 	}
 	if (my samplesLeft > 0) {
-		long dsamples = my samplesLeft > (long) frameCount ? (long) frameCount : my samplesLeft;
+		integer dsamples = my samplesLeft > (integer) frameCount ? (integer) frameCount : my samplesLeft;
 		if (Melder_debug == 20) Melder_casual (U"play ", dsamples, U" ", Pa_GetStreamCpuLoad (my stream));
 		memset (output, '\0', 2 * frameCount * my numberOfChannels);
 		Melder_assert (my buffer);
@@ -651,7 +651,7 @@ void pulseAudio_server_info_cb (pa_context *context, const pa_server_info *info,
 		MelderInfo_writeLine (U"Default source name: ", Melder_peek8to32 (info -> default_source_name));
 		const pa_channel_map *cm = &(info -> channel_map);
 		MelderInfo_writeLine (U"Channel specification: ");
-		for (long channel = 1; channel <= cm -> channels; channel++) {
+		for (integer channel = 1; channel <= cm -> channels; channel++) {
 			const char *channel_text = pa_channel_position_to_pretty_string (cm -> map[channel - 1]); // 0-..
 			MelderInfo_writeLine (U"\t Channel ", channel, U": ", Melder_peek8to32 (channel_text));
 		}
@@ -755,7 +755,7 @@ void stream_write_cb2 (pa_stream *stream, size_t length, void *userdata) {
 	struct MelderPlay *me = (struct MelderPlay *) userdata;
 	if (stream == my pulseAudio.stream) {
 		//length = my pulseAudio.latency; // overrule length given by server
-		long writeSize_samples = length / (2 * my numberOfChannels);
+		integer writeSize_samples = length / (2 * my numberOfChannels);
 		my samplesLeft = my numberOfSamples - my samplesSent;
 		trace (U"length = ", length, U" left = ", my samplesLeft);
 		MelderAudio_isPlaying = true;
@@ -772,7 +772,7 @@ void stream_write_cb2 (pa_stream *stream, size_t length, void *userdata) {
 				if (pa_stream_write (stream, my buffer + my samplesSent * my numberOfChannels, 2 * writeSize_samples * my numberOfChannels, free_cb, 0, PA_SEEK_RELATIVE) < 0) {
 					 Melder_throw (U"pa_stream_write() failed: ", Melder_peek8to32 (pa_strerror (pa_context_errno (my pulseAudio.context))));
 				}
-				long samplesSent = writeSize_samples;
+				integer samplesSent = writeSize_samples;
 				my samplesSent += samplesSent;
 				my samplesPlayed = my samplesSent; // not true: use timer info
 				trace (U"written ", samplesSent, U" (samples), total ", my samplesSent);
@@ -836,10 +836,10 @@ void stream_write_cb (pa_stream *stream, size_t length, void *userdata) {
 					 Melder_throw (U"pa_stream_write() failed: ", Melder_peek8to32 (pa_strerror (pa_context_errno (my pulseAudio.context))));
 				}
 				Melder_assert (nbytes % (my numberOfChannels * 2) == 0);
-				long samplesSent = nbytes / (my numberOfChannels * 2);
+				integer samplesSent = nbytes / (my numberOfChannels * 2);
 				my samplesSent += samplesSent;
 				my samplesPlayed = my samplesSent; // not true: use timer info
-				trace (U"written ", samplesSent, U" (samples), total ", my samplesSent, U", address = ", (long) pa_buffer);
+				trace (U"written ", samplesSent, U" (samples), total ", my samplesSent, U", address = ", (integer) pa_buffer);
 				if (my samplesSent == my numberOfSamples) {
 					// my samplesLeft = 0; not here because still playing
 					trace (U"nothing left 1");
@@ -997,8 +997,8 @@ void context_state_cb (pa_context *context, void *userdata) {
 }
 #endif
 
-void MelderAudio_play16 (int16_t *buffer, long sampleRate, long numberOfSamples, int numberOfChannels,
-	bool (*playCallback) (void *playClosure, long numberOfSamplesPlayed), void *playClosure)
+void MelderAudio_play16 (int16_t *buffer, integer sampleRate, integer numberOfSamples, int numberOfChannels,
+	bool (*playCallback) (void *playClosure, integer numberOfSamplesPlayed), void *playClosure)
 {
 	struct MelderPlay *me = & thePlay;
 	#ifdef _WIN32
@@ -1063,20 +1063,20 @@ void MelderAudio_play16 (int16_t *buffer, long sampleRate, long numberOfSamples,
 			 */
 			if (numberOfChannels == 4 && my numberOfChannels == 2) {   // a common case
 				int16_t *in = & my buffer [0], *out = & my buffer [0];
-				for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-					long in1 = *in ++, in2 = *in ++, in3 = *in ++, in4 = *in ++;
+				for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+					integer in1 = *in ++, in2 = *in ++, in3 = *in ++, in4 = *in ++;
 					*out ++ = (in1 + in2) / 2;
 					*out ++ = (in3 + in4) / 2;
 				}
 			} else {
 				int16_t *in = & my buffer [0], *out = & my buffer [0];
-				for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-					for (long iout = 1; iout <= my numberOfChannels; iout ++) {
-						long outValue = 0;
-						long numberOfIn = numberOfChannels / my numberOfChannels;
+				for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+					for (integer iout = 1; iout <= my numberOfChannels; iout ++) {
+						integer outValue = 0;
+						integer numberOfIn = numberOfChannels / my numberOfChannels;
 						if (iout == my numberOfChannels)
 							numberOfIn += numberOfChannels % my numberOfChannels;
-						for (long iin = 1; iin <= numberOfIn; iin ++)
+						for (integer iin = 1; iin <= numberOfIn; iin ++)
 							outValue += *in ++;
 						outValue /= numberOfIn;
 						*out ++ = outValue;
@@ -1110,7 +1110,7 @@ void MelderAudio_play16 (int16_t *buffer, long sampleRate, long numberOfSamples,
 					 * A version that doesn't trust that the stream callback will complete.
 					 */
 					double timeElapsed = Melder_clock () - theStartingTime - Pa_GetStreamInfo (my stream) -> outputLatency;
-					long samplesPlayed = (long) floor (timeElapsed * my sampleRate);
+					integer samplesPlayed = (integer) floor (timeElapsed * my sampleRate);
 					if (samplesPlayed >= my numberOfSamples + my sampleRate / 20) {
 						my samplesPlayed = my numberOfSamples;
 						break;
@@ -1197,20 +1197,20 @@ void MelderAudio_play16 (int16_t *buffer, long sampleRate, long numberOfSamples,
 			 */
 			if (numberOfChannels == 4 && my numberOfChannels == 2) {   // a common case
 				int16_t *in = & my buffer [0], *out = & my buffer [0];
-				for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-					long in1 = *in ++, in2 = *in ++, in3 = *in ++, in4 = *in ++;
+				for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+					integer in1 = *in ++, in2 = *in ++, in3 = *in ++, in4 = *in ++;
 					*out ++ = (in1 + in2) / 2;
 					*out ++ = (in3 + in4) / 2;
 				}
 			} else {
 				int16_t *in = & my buffer [0], *out = & my buffer [0];
-				for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-					for (long iout = 1; iout <= my numberOfChannels; iout ++) {
-						long outValue = 0;
-						long numberOfIn = numberOfChannels / my numberOfChannels;
+				for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+					for (integer iout = 1; iout <= my numberOfChannels; iout ++) {
+						integer outValue = 0;
+						integer numberOfIn = numberOfChannels / my numberOfChannels;
 						if (iout == my numberOfChannels)
 							numberOfIn += numberOfChannels % my numberOfChannels;
-						for (long iin = 1; iin <= numberOfIn; iin ++)
+						for (integer iin = 1; iin <= numberOfIn; iin ++)
 							outValue += *in ++;
 						outValue /= numberOfIn;
 						*out ++ = outValue;
@@ -1291,7 +1291,7 @@ void MelderAudio_play16 (int16_t *buffer, long sampleRate, long numberOfSamples,
 					if (my numberOfChannels == 1 && my val == 2) {
 						my fakeMono = true;
 						int16_t *newBuffer = NUMvector <int16_t> (0, 2 * numberOfSamples - 1);
-						for (long isamp = 0; isamp < numberOfSamples; isamp ++) {
+						for (integer isamp = 0; isamp < numberOfSamples; isamp ++) {
 							newBuffer [isamp + isamp] = newBuffer [isamp + isamp + 1] = buffer [isamp];
 						}
 						my buffer = newBuffer;
@@ -1394,20 +1394,20 @@ void MelderAudio_play16 (int16_t *buffer, long sampleRate, long numberOfSamples,
 					 */
 					if (numberOfChannels == 4 && my numberOfChannels == 2) {   // a common case
 						int16_t *in = & my buffer [0], *out = & my buffer [0];
-						for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-							long in1 = *in ++, in2 = *in ++, in3 = *in ++, in4 = *in ++;
+						for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+							integer in1 = *in ++, in2 = *in ++, in3 = *in ++, in4 = *in ++;
 							*out ++ = (in1 + in2) / 2;
 							*out ++ = (in3 + in4) / 2;
 						}
 					} else {
 						int16_t *in = & my buffer [0], *out = & my buffer [0];
-						for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-							for (long iout = 1; iout <= my numberOfChannels; iout ++) {
-								long outValue = 0;
-								long numberOfIn = numberOfChannels / my numberOfChannels;
+						for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+							for (integer iout = 1; iout <= my numberOfChannels; iout ++) {
+								integer outValue = 0;
+								integer numberOfIn = numberOfChannels / my numberOfChannels;
 								if (iout == my numberOfChannels)
 									numberOfIn += numberOfChannels % my numberOfChannels;
-								for (long iin = 1; iin <= numberOfIn; iin ++)
+								for (integer iin = 1; iin <= numberOfIn; iin ++)
 									outValue += *in ++;
 								outValue /= numberOfIn;
 								*out ++ = outValue;
diff --git a/sys/melder_audiofiles.cpp b/sys/melder_audiofiles.cpp
index ccb9951..7a5014b 100644
--- a/sys/melder_audiofiles.cpp
+++ b/sys/melder_audiofiles.cpp
@@ -35,7 +35,7 @@
 #define WAVE_FORMAT_DVI_ADPCM  0x0011
 #define WAVE_FORMAT_EXTENSIBLE 0xFFFE
 
-void MelderFile_writeAudioFileHeader (MelderFile file, int audioFileType, long sampleRate, long numberOfSamples, int numberOfChannels, int numberOfBitsPerSamplePoint) {
+void MelderFile_writeAudioFileHeader (MelderFile file, int audioFileType, integer sampleRate, integer numberOfSamples, int numberOfChannels, int numberOfBitsPerSamplePoint) {
 	try {
 		FILE *f = file -> filePointer;
 		if (! f) return;
@@ -43,7 +43,7 @@ void MelderFile_writeAudioFileHeader (MelderFile file, int audioFileType, long s
 		switch (audioFileType) {
 			case Melder_AIFF: {
 				try {
-					long dataSize = numberOfSamples * numberOfBytesPerSamplePoint * numberOfChannels;
+					integer dataSize = numberOfSamples * numberOfBytesPerSamplePoint * numberOfChannels;
 
 					/* Form Chunk: contains all other chunks. */
 					if (fwrite ("FORM", 1, 4, f) != 4) Melder_throw (U"Error in file while trying to write the FORM statement.");
@@ -74,7 +74,7 @@ void MelderFile_writeAudioFileHeader (MelderFile file, int audioFileType, long s
 			} break;
 			case Melder_AIFC: {
 				try {
-					long dataSize = numberOfSamples * numberOfBytesPerSamplePoint * numberOfChannels;
+					integer dataSize = numberOfSamples * numberOfBytesPerSamplePoint * numberOfChannels;
 
 					/* Form Chunk: contains all other chunks. */
 					if (fwrite ("FORM", 1, 4, f) != 4) Melder_throw (U"Error in file while trying to write the FORM statement.");
@@ -212,7 +212,7 @@ void MelderFile_writeAudioFileHeader (MelderFile file, int audioFileType, long s
 	}
 }
 
-void MelderFile_writeAudioFileTrailer (MelderFile file, int audioFileType, long sampleRate, long numberOfSamples, int numberOfChannels, int numberOfBitsPerSamplePoint) {
+void MelderFile_writeAudioFileTrailer (MelderFile file, int audioFileType, integer sampleRate, integer numberOfSamples, int numberOfChannels, int numberOfBitsPerSamplePoint) {
 	(void) sampleRate;
 	bool shouldPadTheDataToAnEvenNumberOfBytes = audioFileType == Melder_WAV;
 	bool numberOfSamplesIsOdd = (numberOfSamples & 1) != 0;
@@ -249,7 +249,7 @@ int Melder_defaultAudioFileEncoding (int audioFileType, int numberOfBitsPerSampl
 		defaultAudioFileEncoding32 [audioFileType];
 }
 
-void MelderFile_writeAudioFile (MelderFile file, int audioFileType, const short *buffer, long sampleRate, long numberOfSamples, int numberOfChannels, int numberOfBitsPerSamplePoint) {
+void MelderFile_writeAudioFile (MelderFile file, int audioFileType, const short *buffer, integer sampleRate, integer numberOfSamples, int numberOfChannels, int numberOfBitsPerSamplePoint) {
 	try {
 		autoMelderFile mfile = MelderFile_create (file);
 		MelderFile_writeAudioFileHeader (file, audioFileType, sampleRate, numberOfSamples, numberOfChannels, numberOfBitsPerSamplePoint);
@@ -344,7 +344,7 @@ static short alaw2linear[] =
 };
 
 static void Melder_checkAiffFile (FILE *f, int *numberOfChannels, int *encoding,
-	double *sampleRate, long *startOfData, integer *numberOfSamples)
+	double *sampleRate, integer *startOfData, integer *numberOfSamples)
 {
 	char data [8], chunkID [4];
 	bool commonChunkPresent = false, dataChunkPresent = false, isAifc = true;
@@ -362,7 +362,7 @@ static void Melder_checkAiffFile (FILE *f, int *numberOfChannels, int *encoding,
 	/* Search for Common Chunk and Data Chunk. */
 
 	while (fread (chunkID, 1, 4, f) == 4) {
-		long chunkSize = bingeti32 (f);
+		integer chunkSize = bingeti32 (f);
 		if (chunkSize & 1) ++ chunkSize;   // round up to nearest even number
 		/* IN SOUND FILES PRODUCED BY THE SGI'S soundeditor PROGRAM, */
 		/* THE COMMON CHUNK HAS A chunkSize OF 18 INSTEAD OF 38, */
@@ -371,7 +371,7 @@ static void Melder_checkAiffFile (FILE *f, int *numberOfChannels, int *encoding,
 		/* START FIX OF FOREIGN BUG */
 		if(strnequ(chunkID,"NONE",4)&&
 			(chunkSize==(14<<24)+('n'<<16)+('o'<<8)+'t'||chunkSize==('t'<<24)+('o'<<16)+('n'<<8)+14))
-		{Melder_casual(U"Ha! a buggy SGI \"soundeditor\" file...");for(long i=1;i<=20/*diff*/-8/*header*/;i++)fread(data,1,1,f);continue;}
+		{Melder_casual(U"Ha! a buggy SGI \"soundeditor\" file...");for(integer i=1;i<=20/*diff*/-8/*header*/;i++)fread(data,1,1,f);continue;}
 		/* FINISH FIX OF FOREIGN BUG */
 		if (strnequ (chunkID, "COMM", 4)) {
 			/*
@@ -409,7 +409,7 @@ static void Melder_checkAiffFile (FILE *f, int *numberOfChannels, int *encoding,
 				/*
 				 * Read rest of compression info.
 				 */
-				for (long i = 23; i <= chunkSize; i ++)
+				for (integer i = 23; i <= chunkSize; i ++)
 					if (fread (data, 1, 1, f) < 1)
 						Melder_throw (U"File too small: expected chunk of ", chunkSize, U" bytes, but found ", i + 22, U".");
 			}
@@ -421,7 +421,7 @@ static void Melder_checkAiffFile (FILE *f, int *numberOfChannels, int *encoding,
 			*startOfData = ftell (f) + 8;   // ignore "offset" (4 bytes) and "blocksize" (4 bytes)
 			if (commonChunkPresent) break;   // optimization: do not read whole data chunk if we have already read the common chunk
 		} else // ignore Version Chunk and unknown chunks
-			for (long i = 1; i <= chunkSize; i ++)
+			for (integer i = 1; i <= chunkSize; i ++)
 				if (fread (data, 1, 1, f) < 1)
 					Melder_throw (U"File too small: expected ", chunkSize, U" bytes, but found ", i, U".");
 	}
@@ -431,7 +431,7 @@ static void Melder_checkAiffFile (FILE *f, int *numberOfChannels, int *encoding,
 }
 
 static void Melder_checkWavFile (FILE *f, int *numberOfChannels, int *encoding,
-	double *sampleRate, long *startOfData, integer *numberOfSamples)
+	double *sampleRate, integer *startOfData, integer *numberOfSamples)
 {
 	char data [14], chunkID [4];
 	bool formatChunkPresent = false, dataChunkPresent = false;
@@ -533,7 +533,7 @@ static void Melder_checkWavFile (FILE *f, int *numberOfChannels, int *encoding,
 					Melder_throw (U"Unsupported Windows audio encoding ", winEncoding, U".");
 			}
 			if (chunkSize & 1) chunkSize ++;
-			for (long i = 17; i <= chunkSize; i ++)
+			for (integer i = 17; i <= chunkSize; i ++)
 				if (fread (data, 1, 1, f) < 1) Melder_throw (U"File too small: expected ", chunkSize, U" bytes in fmt chunk, but found ", i, U".");
 		} else if (strnequ (chunkID, "data", 4)) {
 			/*
@@ -550,14 +550,14 @@ static void Melder_checkWavFile (FILE *f, int *numberOfChannels, int *encoding,
 				fseeko (f, *startOfData, SEEK_SET);
 			}
 			if (Melder_debug == 23) {
-				for (long i = 1; i <= chunkSize; i ++)
+				for (integer i = 1; i <= chunkSize; i ++)
 					if (fread (data, 1, 1, f) < 1) Melder_throw (U"File too small: expected ", chunkSize, U" bytes of data, but found ", i, U".");
 			} else {
 				if (formatChunkPresent) break;   // OPTIMIZATION: do not read the whole data chunk if we have already read the format chunk
 			}
 		} else {   // ignore other chunks
 			if (chunkSize & 1) chunkSize ++;
-			for (long i = 1; i <= chunkSize; i ++)
+			for (integer i = 1; i <= chunkSize; i ++)
 				if (fread (data, 1, 1, f) < 1)
 					Melder_throw (U"File too small: expected ", chunkSize, U" bytes, but found ", i, U".");
 		}
@@ -570,7 +570,7 @@ static void Melder_checkWavFile (FILE *f, int *numberOfChannels, int *encoding,
 }
 
 static void Melder_checkNextSunFile (FILE *f, int *numberOfChannels, int *encoding,
-	double *sampleRate, long *startOfData, integer *numberOfSamples)
+	double *sampleRate, integer *startOfData, integer *numberOfSamples)
 {
 	char tag [4];
 	fread (tag, 1, 4, f);
@@ -578,17 +578,17 @@ static void Melder_checkNextSunFile (FILE *f, int *numberOfChannels, int *encodi
 	*startOfData = bingeti32 (f);
 	if (*startOfData < 24 || *startOfData > 320)
 		Melder_throw (U"Cannot read header of audio file. Length ", *startOfData, U".");
-	long dataSize = bingeti32 (f);
+	integer dataSize = bingeti32 (f);
 	if (dataSize <= 0) {
 		/*
 		 * Incorrect information. Get it from file length.
 		 */
-		long save = ftell (f);
+		integer save = ftell (f);
 		fseek (f, 0, SEEK_END);
 		dataSize = ftell (f) - *startOfData;
 		fseek (f, save, SEEK_SET);
 	}
-	long sunEncoding = bingeti32 (f);
+	integer sunEncoding = bingeti32 (f);
 	switch (sunEncoding) {
 		case 1: *encoding = Melder_MULAW; break;
 		case 2: *encoding = Melder_LINEAR_8_SIGNED; break;
@@ -602,7 +602,7 @@ static void Melder_checkNextSunFile (FILE *f, int *numberOfChannels, int *encodi
 	if (*numberOfChannels < 1)
 		Melder_throw (U"Wrong number of channels in audio file (", *numberOfChannels, U").");
 	*numberOfSamples = dataSize / Melder_bytesPerSamplePoint (*encoding) / *numberOfChannels;
-	long skip = *startOfData - 24;
+	integer skip = *startOfData - 24;
 	while (skip -- > 0) (void) fgetc (f);
 }
 
@@ -616,7 +616,7 @@ static int nistGetValue (const char *header, const char *object, double *rval, c
 	return 1;
 }
 static void Melder_checkNistFile (FILE *f, int *numberOfChannels, int *encoding,
-	double *sampleRate, long *startOfData, integer *numberOfSamples)
+	double *sampleRate, integer *startOfData, integer *numberOfSamples)
 {
 	char header [1024], sval [100];
  	double rval = 0.0;
@@ -656,7 +656,7 @@ static void Melder_checkNistFile (FILE *f, int *numberOfChannels, int *encoding,
 }
 
 static void Melder_checkFlacFile (MelderFile file, int *numberOfChannels, int *encoding,
-	double *sampleRate, long *startOfData, integer *numberOfSamples)
+	double *sampleRate, integer *startOfData, integer *numberOfSamples)
 {
 	FLAC__StreamMetadata metadata;
 	FLAC__StreamMetadata_StreamInfo *info;
@@ -673,7 +673,7 @@ static void Melder_checkFlacFile (MelderFile file, int *numberOfChannels, int *e
 }
 
 static void Melder_checkMp3File (FILE *f, int *numberOfChannels, int *encoding,
-	double *sampleRate, long *startOfData, integer *numberOfSamples)
+	double *sampleRate, integer *startOfData, integer *numberOfSamples)
 {
 	MP3_FILE mp3f = mp3f_new ();
 	mp3f_set_file (mp3f, f);
@@ -692,7 +692,7 @@ static void Melder_checkMp3File (FILE *f, int *numberOfChannels, int *encoding,
 }
 
 int MelderFile_checkSoundFile (MelderFile file, int *numberOfChannels, int *encoding,
-	double *sampleRate, long *startOfData, integer *numberOfSamples)
+	double *sampleRate, integer *startOfData, integer *numberOfSamples)
 {
 	char data [16];
 	FILE *f = file -> filePointer;
@@ -733,16 +733,16 @@ int MelderFile_checkSoundFile (MelderFile file, int *numberOfChannels, int *enco
 
 typedef struct {
 	FILE *file;
-	int numberOfChannels;
-	long numberOfSamples;
+	integer numberOfChannels;
+	integer numberOfSamples;
 	double *channels [FLAC__MAX_CHANNELS];
 } MelderDecodeFlacContext;
 
 /* The same goes for MP3 */
 
 typedef struct {
-	int numberOfChannels;
-	long numberOfSamples;
+	integer numberOfChannels;
+	integer numberOfSamples;
 	double *channels [2];
 } MelderDecodeMp3Context;
 
@@ -765,7 +765,7 @@ static FLAC__StreamDecoderWriteStatus Melder_DecodeFlac_convert (const FLAC__Str
 {
 	MelderDecodeFlacContext *c = (MelderDecodeFlacContext *) client_data;
 	const FLAC__FrameHeader *header = & frame -> header;
-	long count = header -> blocksize;
+	integer count = header -> blocksize;
 	double multiplier;
 
 	(void) decoder;
@@ -778,24 +778,24 @@ static FLAC__StreamDecoderWriteStatus Melder_DecodeFlac_convert (const FLAC__Str
 		default: return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
 	}
 
-	for (long i = 0; i < c -> numberOfChannels; ++ i) {
+	for (integer i = 0; i < c -> numberOfChannels; ++ i) {
 		const FLAC__int32 *input = buffer [i];
 		double *output = c -> channels [i];
-		for (long j = 0; j < count; ++ j)
-			output [j] = ((long) input [j]) * multiplier;
+		for (integer j = 0; j < count; ++ j)
+			output [j] = ((integer) input [j]) * multiplier;
 		c -> channels [i] += count;
 	}
 	return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
 }
 
-static void Melder_DecodeMp3_convert (const MP3F_SAMPLE *channels [MP3F_MAX_CHANNELS], long count, void *context) {
+static void Melder_DecodeMp3_convert (const MP3F_SAMPLE *channels [MP3F_MAX_CHANNELS], integer count, void *context) {
 	MelderDecodeMp3Context *c = (MelderDecodeMp3Context *) context;
 	const MP3F_SAMPLE *input;
 	double *output;
-	for (long i = 0; i < c -> numberOfChannels; ++ i) {
+	for (integer i = 0; i < c -> numberOfChannels; ++ i) {
 		input = channels [i];
 		output = c -> channels [i];
-		for (long j = 0; j < count; ++ j)
+		for (integer j = 0; j < count; ++ j)
 			output [j] = mp3f_sample_to_float (input [j]);
 		c -> channels [i] += count;
 	}
@@ -807,7 +807,7 @@ static void Melder_DecodeFlac_error (const FLAC__StreamDecoder *decoder, FLAC__S
 	Melder_warning (U"FLAC decoder error: ", Melder_peek8to32 (FLAC__StreamDecoderErrorStatusString [status]));
 }
 
-static void Melder_readFlacFile (FILE *f, int numberOfChannels, double **buffer, long numberOfSamples) {
+static void Melder_readFlacFile (FILE *f, int numberOfChannels, double **buffer, integer numberOfSamples) {
 	FLAC__StreamDecoder *decoder;
 	MelderDecodeFlacContext c;
 	int result = 0;
@@ -835,7 +835,7 @@ end:
 		Melder_throw (U"Error decoding FLAC file.");
 }
 
-static void Melder_readMp3File (FILE *f, int numberOfChannels, double **buffer, long numberOfSamples) {
+static void Melder_readMp3File (FILE *f, int numberOfChannels, double **buffer, integer numberOfSamples) {
 	MelderDecodeMp3Context c;
 	int result = 0;
 	c.numberOfChannels = numberOfChannels;
@@ -852,13 +852,13 @@ static void Melder_readMp3File (FILE *f, int numberOfChannels, double **buffer,
 		Melder_throw (U"Error decoding MP3 file.");
 }
 
-void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, double **buffer, long numberOfSamples) {
+void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, double **buffer, integer numberOfSamples) {
 	try {
 		switch (encoding) {
 			case Melder_LINEAR_8_SIGNED: {
 				try {
-					for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-						for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+					for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+						for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 							int8 value;
 							if (fread (& value, 1, 1, f) < 1) throw MelderError ();
 							buffer [ichan] [isamp] = value * (1.0 / 128);
@@ -871,8 +871,8 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 			} break;
 			case Melder_LINEAR_8_UNSIGNED:
 				try {
-					for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-						for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+					for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+						for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 							buffer [ichan] [isamp] = bingetu8 (f) * (1.0 / 128) - 1.0;
 						}
 					}
@@ -912,21 +912,21 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 				if (numberOfChannels == 1) {
 					switch (encoding) {
 						case Melder_LINEAR_16_BIG_ENDIAN: {
-							for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
+							for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
 								unsigned char byte1 = * bytes ++, byte2 = * bytes ++;
 								int value = (int) (int16_t) (((uint16_t) byte1 << 8) | (uint16_t) byte2);   // extend sign
 								buffer [1] [isamp] = value * (1.0 / 32768);
 							}
 						} break;
 						case Melder_LINEAR_16_LITTLE_ENDIAN: {
-							for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
+							for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
 								unsigned char byte1 = * bytes ++, byte2 = * bytes ++;
 								int value = (int) (int16_t) (((uint16_t) byte2 << 8) | (uint16_t) byte1);   // extend sign
 								buffer [1] [isamp] = value * (1.0 / 32768);
 							}
 						} break;
 						case Melder_LINEAR_24_BIG_ENDIAN: {
-							for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
+							for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
 								unsigned char byte1 = * bytes ++, byte2 = * bytes ++, byte3 = * bytes ++;
 								int32 value = (int32)
 									((uint32) ((uint32) byte1 << 24) |
@@ -936,7 +936,7 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 							}
 						} break;
 						case Melder_LINEAR_24_LITTLE_ENDIAN: {
-							for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
+							for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
 								unsigned char byte1 = * bytes ++, byte2 = * bytes ++, byte3 = * bytes ++;
 								int32 value = (int32)
 									((uint32) ((uint32) byte3 << 24) |
@@ -946,7 +946,7 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 							}
 						} break;
 						case Melder_LINEAR_32_BIG_ENDIAN: {
-							for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
+							for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
 								unsigned char byte1 = * bytes ++, byte2 = * bytes ++, byte3 = * bytes ++, byte4 = * bytes ++;
 								int32 value = (int32)
 									((uint32) ((uint32) byte1 << 24) |
@@ -957,7 +957,7 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 							}
 						} break;
 						case Melder_LINEAR_32_LITTLE_ENDIAN: {
-							for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
+							for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
 								unsigned char byte1 = * bytes ++, byte2 = * bytes ++, byte3 = * bytes ++, byte4 = * bytes ++;
 								int32 value = (int32)
 									((uint32) ((uint32) byte4 << 24) |
@@ -971,8 +971,8 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 				} else if (numberOfChannels <= (int) sizeof (double) / numberOfBytesPerSamplePerChannel) {
 					switch (encoding) {
 						case Melder_LINEAR_16_BIG_ENDIAN: {
-							for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-								for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+							for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+								for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 									uint8 byte1 = * bytes ++, byte2 = * bytes ++;
 									int value = (int) (int16) (uint16) ((uint16) ((uint16) byte1 << 8) | (uint16) byte2);
 									buffer [ichan] [isamp] = value * (1.0 / 32768);
@@ -980,8 +980,8 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 							}
 						} break;
 						case Melder_LINEAR_16_LITTLE_ENDIAN: {
-							for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-								for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+							for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+								for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 									uint8 byte1 = * bytes ++, byte2 = * bytes ++;
 									int value = (int) (int16) (uint16) ((uint16) ((uint16) byte2 << 8) | (uint16) byte1);
 									buffer [ichan] [isamp] = value * (1.0 / 32768);
@@ -989,8 +989,8 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 							}
 						} break;
 						case Melder_LINEAR_24_BIG_ENDIAN: {
-							for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-								for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+							for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+								for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 									uint8 byte1 = * bytes ++, byte2 = * bytes ++, byte3 = * bytes ++;
 									uint32 unsignedValue =
 										(uint32) ((uint32) byte1 << 16) |
@@ -1002,8 +1002,8 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 							}
 						} break;
 						case Melder_LINEAR_24_LITTLE_ENDIAN: {
-							for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-								for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+							for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+								for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 									uint8 byte1 = * bytes ++, byte2 = * bytes ++, byte3 = * bytes ++;
 									uint32 unsignedValue = ((uint32) byte3 << 16) | ((uint32) byte2 << 8) | (uint32) byte1;
 									if ((byte3 & 128) != 0) unsignedValue |= 0xFF000000;
@@ -1012,8 +1012,8 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 							}
 						} break;
 						case Melder_LINEAR_32_BIG_ENDIAN: {
-							for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-								for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+							for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+								for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 									uint8 byte1 = * bytes ++, byte2 = * bytes ++, byte3 = * bytes ++, byte4 = * bytes ++;
 									int32 value = (int32)
 										((uint32) ((uint32) byte1 << 24) |
@@ -1025,8 +1025,8 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 							}
 						} break;
 						case Melder_LINEAR_32_LITTLE_ENDIAN: {
-							for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-								for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+							for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+								for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 									uint8 byte1 = * bytes ++, byte2 = * bytes ++, byte3 = * bytes ++, byte4 = * bytes ++;
 									int32 value = (int32)
 										((uint32) ((uint32) byte4 << 24) |
@@ -1043,8 +1043,8 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 					int32_t *ints = (int32_t *) & buffer [1] [1];
 					switch (encoding) {
 						case Melder_LINEAR_16_BIG_ENDIAN: {
-							for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-								for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+							for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+								for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 									uint8 byte1 = * bytes ++, byte2 = * bytes ++;
 									int32 value = (int32)
 										((uint32) ((uint32) byte1 << 24) |
@@ -1055,8 +1055,8 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 							}
 						} break;
 						case Melder_LINEAR_16_LITTLE_ENDIAN: {
-							for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-								for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+							for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+								for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 									uint8 byte1 = * bytes ++, byte2 = * bytes ++;
 									int32 value = (int32)
 										(((uint32) byte2 << 24) |
@@ -1067,8 +1067,8 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 							}
 						} break;
 						case Melder_LINEAR_24_BIG_ENDIAN: {
-							for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-								for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+							for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+								for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 									uint8 byte1 = * bytes ++, byte2 = * bytes ++, byte3 = * bytes ++;
 									int32 value = (int32)
 										(((uint32) byte1 << 24) |
@@ -1080,8 +1080,8 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 							}
 						} break;
 						case Melder_LINEAR_24_LITTLE_ENDIAN: {
-							for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-								for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+							for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+								for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 									uint8 byte1 = * bytes ++, byte2 = * bytes ++, byte3 = * bytes ++;
 									int32 value = (int32)
 										(((uint32) byte3 << 24) |
@@ -1093,8 +1093,8 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 							}
 						} break;
 						case Melder_LINEAR_32_BIG_ENDIAN: {
-							for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-								for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+							for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+								for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 									uint8 byte1 = * bytes ++, byte2 = * bytes ++, byte3 = * bytes ++, byte4 = * bytes ++;
 									int32 value = (int32)
 										(((uint32) byte1 << 24) |
@@ -1107,8 +1107,8 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 							}
 						} break;
 						case Melder_LINEAR_32_LITTLE_ENDIAN: {
-							for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-								for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+							for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+								for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 									uint8 byte1 = * bytes ++, byte2 = * bytes ++, byte3 = * bytes ++, byte4 = * bytes ++;
 									int32 value = (int32)
 										(((uint32) byte4 << 24) |
@@ -1122,14 +1122,14 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 						}
 					}
 					double *doubles = & buffer [1] [1];
-					long n = numberOfSamples * numberOfChannels;
-					for (long i = 0; i < n; i ++) {
+					integer n = numberOfSamples * numberOfChannels;
+					for (integer i = 0; i < n; i ++) {
 						int32_t *valuePosition = (int32_t *) & doubles [i];
 						int32_t *markerPosition = valuePosition + 1;
 						if (! *markerPosition) {
 							int32_t value = *valuePosition;
-							long ichan = i / numberOfSamples, isamp = i % numberOfSamples;
-							for (long other = isamp * numberOfChannels + ichan; other != i; ) {
+							integer ichan = i / numberOfSamples, isamp = i % numberOfSamples;
+							for (integer other = isamp * numberOfChannels + ichan; other != i; ) {
 								int32_t *otherValuePosition = (int32_t *) & doubles [other];
 								*valuePosition = *otherValuePosition;
 								*markerPosition = 1;
@@ -1142,8 +1142,8 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 							*markerPosition = 1;
 						}
 					}
-					for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-						for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+					for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+						for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 							buffer [ichan] [isamp] = * (int32_t *) & buffer [ichan] [isamp] * (1.0 / 32768 / 65536);
 						}
 					}
@@ -1154,8 +1154,8 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 			} break;
 			case Melder_IEEE_FLOAT_32_BIG_ENDIAN:
 				try {
-					for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-						for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+					for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+						for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 							buffer [ichan] [isamp] = bingetr32 (f);
 						}
 					}
@@ -1166,8 +1166,8 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 				break;
 			case Melder_IEEE_FLOAT_32_LITTLE_ENDIAN:
 				try {
-					for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-						for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+					for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+						for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 							buffer [ichan] [isamp] = bingetr32LE (f);
 						}
 					}
@@ -1178,8 +1178,8 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 				break;
 			case Melder_MULAW:
 				try {
-					for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-						for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+					for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+						for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 							buffer [ichan] [isamp] = ulaw2linear [bingetu8 (f)] * (1.0 / 32768);
 						}
 					}
@@ -1190,8 +1190,8 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 				break;
 			case Melder_ALAW:
 				try {
-					for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-						for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+					for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+						for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 							buffer [ichan] [isamp] = alaw2linear [bingetu8 (f)] * (1.0 / 32768);
 						}
 					}
@@ -1218,9 +1218,9 @@ void Melder_readAudioToFloat (FILE *f, int numberOfChannels, int encoding, doubl
 	}
 }
 
-void Melder_readAudioToShort (FILE *f, int numberOfChannels, int encoding, short *buffer, long numberOfSamples) {
+void Melder_readAudioToShort (FILE *f, int numberOfChannels, int encoding, short *buffer, integer numberOfSamples) {
 	try {
-		long n = numberOfSamples * numberOfChannels, i;
+		integer n = numberOfSamples * numberOfChannels, i;
 		static const unsigned short byteSwapTest = 3 * 256 + 1;
 		switch (encoding) {
 			case Melder_LINEAR_8_SIGNED:
@@ -1302,11 +1302,11 @@ void Melder_readAudioToShort (FILE *f, int numberOfChannels, int encoding, short
 	}
 }
 
-void MelderFile_writeShortToAudio (MelderFile file, int numberOfChannels, int encoding, const short *buffer, long numberOfSamples) {
+void MelderFile_writeShortToAudio (MelderFile file, int numberOfChannels, int encoding, const short *buffer, integer numberOfSamples) {
 	try {
 		FILE *f = file -> filePointer;
 		if (! f) Melder_throw (U"File not open.");
-		long n = numberOfSamples * numberOfChannels, start = 0, step = 1, i;
+		integer n = numberOfSamples * numberOfChannels, start = 0, step = 1, i;
 		if (numberOfChannels < 0) {
 			n = numberOfSamples * 2;   // stereo
 			step = 2;   // only one channel will be  written
@@ -1367,15 +1367,15 @@ void MelderFile_writeShortToAudio (MelderFile file, int numberOfChannels, int en
 	}
 }
 
-void MelderFile_writeFloatToAudio (MelderFile file, int numberOfChannels, int encoding, double **buffer, long numberOfSamples, int warnIfClipped) {
+void MelderFile_writeFloatToAudio (MelderFile file, int numberOfChannels, int encoding, double **buffer, integer numberOfSamples, int warnIfClipped) {
 	try {
 		FILE *f = file -> filePointer;
 		if (! f) Melder_throw (U"File not open.");
-		long nclipped = 0;
+		integer nclipped = 0;
 		switch (encoding) {
 			case Melder_LINEAR_8_SIGNED:
-				for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-					for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+				for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+					for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 						double value = round (buffer [ichan] [isamp] * 128.0);
 						if (value < -128.0) { value = -128.0; nclipped ++; }
 						if (value > 127.0) { value = 127.0; nclipped ++; }
@@ -1384,8 +1384,8 @@ void MelderFile_writeFloatToAudio (MelderFile file, int numberOfChannels, int en
 				}
 				break;
 			case Melder_LINEAR_8_UNSIGNED:
-				for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-					for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+				for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+					for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 						double value = floor ((buffer [ichan] [isamp] + 1.0) * 128.0);
 						if (value < 0.0) { value = 0.0; nclipped ++; }
 						if (value > 255.0) { value = 255.0; nclipped ++; }
@@ -1394,8 +1394,8 @@ void MelderFile_writeFloatToAudio (MelderFile file, int numberOfChannels, int en
 				}
 				break;
 			case Melder_LINEAR_16_BIG_ENDIAN:
-				for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-					for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+				for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+					for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 						double value = round (buffer [ichan] [isamp] * 32768.0);
 						if (value < -32768.0) { value = -32768.0; nclipped ++; }
 						if (value > 32767.0) { value = 32767.0; nclipped ++; }
@@ -1404,8 +1404,8 @@ void MelderFile_writeFloatToAudio (MelderFile file, int numberOfChannels, int en
 				}
 				break;
 			case Melder_LINEAR_16_LITTLE_ENDIAN:
-				for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-					for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+				for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+					for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 						double value = round (buffer [ichan] [isamp] * 32768.0);
 						if (value < -32768.0) { value = -32768.0; nclipped ++; }
 						if (value > 32767.0) { value = 32767.0; nclipped ++; }
@@ -1414,8 +1414,8 @@ void MelderFile_writeFloatToAudio (MelderFile file, int numberOfChannels, int en
 				}
 				break;
 			case Melder_LINEAR_24_BIG_ENDIAN:
-				for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-					for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+				for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+					for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 						double value = round (buffer [ichan] [isamp] * 8388608.0);
 						if (value < -8388608.0) { value = -8388608.0; nclipped ++; }
 						if (value > 8388607.0) { value = 8388607.0; nclipped ++; }
@@ -1424,8 +1424,8 @@ void MelderFile_writeFloatToAudio (MelderFile file, int numberOfChannels, int en
 				}
 				break;
 			case Melder_LINEAR_24_LITTLE_ENDIAN:
-				for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-					for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+				for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+					for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 						double value = round (buffer [ichan] [isamp] * 8388608.0);
 						if (value < -8388608.0) { value = -8388608.0; nclipped ++; }
 						if (value > 8388607.0) { value = 8388607.0; nclipped ++; }
@@ -1434,8 +1434,8 @@ void MelderFile_writeFloatToAudio (MelderFile file, int numberOfChannels, int en
 				}
 				break;
 			case Melder_LINEAR_32_BIG_ENDIAN:
-				for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-					for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+				for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+					for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 						double value = round (buffer [ichan] [isamp] * 2147483648.0);
 						if (value < -2147483648.0) { value = -2147483648.0; nclipped ++; }
 						if (value > 2147483647.0) { value = 2147483647.0; nclipped ++; }
@@ -1444,8 +1444,8 @@ void MelderFile_writeFloatToAudio (MelderFile file, int numberOfChannels, int en
 				}
 				break;
 			case Melder_LINEAR_32_LITTLE_ENDIAN:
-				for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-					for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+				for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+					for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 						double value = round (buffer [ichan] [isamp] * 2147483648.0);
 						if (value < -2147483648.0) { value = -2147483648.0; nclipped ++; }
 						if (value > 2147483647.0) { value = 2147483647.0; nclipped ++; }
@@ -1454,16 +1454,16 @@ void MelderFile_writeFloatToAudio (MelderFile file, int numberOfChannels, int en
 				}
 				break;
 			case Melder_IEEE_FLOAT_32_BIG_ENDIAN:
-				for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-					for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+				for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+					for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 						double value = buffer [ichan] [isamp];
 						binputr32 (value, f);
 					}
 				}
 				break;
 			case Melder_IEEE_FLOAT_32_LITTLE_ENDIAN:
-				for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
-					for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+				for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
+					for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 						double value = buffer [ichan] [isamp];
 						binputr32LE (value, f);
 					}
@@ -1474,9 +1474,9 @@ void MelderFile_writeFloatToAudio (MelderFile file, int numberOfChannels, int en
 			case Melder_FLAC_COMPRESSION_32:
 				if (! file -> flacEncoder)
 					Melder_throw (U"FLAC encoder not initialized.");
-				for (long isamp = 1; isamp <= numberOfSamples; isamp ++) {
+				for (integer isamp = 1; isamp <= numberOfSamples; isamp ++) {
 					FLAC__int32 samples [FLAC__MAX_CHANNELS];
-					for (long ichan = 1; ichan <= numberOfChannels; ichan ++) {
+					for (integer ichan = 1; ichan <= numberOfChannels; ichan ++) {
 						double value = round (buffer [ichan] [isamp] * 32768.0);
 						if (value < -32768.0) { value = -32768.0; nclipped ++; }
 						if (value > 32767.0) { value = 32767.0; nclipped ++; }
diff --git a/sys/melder_debug.cpp b/sys/melder_debug.cpp
index a17311d..3b5fa69 100644
--- a/sys/melder_debug.cpp
+++ b/sys/melder_debug.cpp
@@ -200,7 +200,7 @@ void Melder_writeToConsole (const char32 *message, bool useStderr) {
 		}
 		if (Melder_consoleIsAnsi) {
 			size_t n = str32len (message);
-			for (long i = 0; i < n; i ++) {
+			for (integer i = 0; i < n; i ++) {
 				unsigned int kar = (unsigned short) message [i];
 				fputc (kar, stdout);
 			}
diff --git a/sys/melder_files.cpp b/sys/melder_files.cpp
index 24b5080..c91f03c 100644
--- a/sys/melder_files.cpp
+++ b/sys/melder_files.cpp
@@ -131,15 +131,15 @@ void Melder_8bitFileRepresentationToStr32_inline (const char *path8, char32 *pat
 			/*
 				Probably something wrong, like a disk was disconnected in the meantime.
 			*/
-			Melder_8to32_inline (path8, path32, (int) kMelder_textInputEncoding::UTF8);
+			Melder_8to32_inline (path8, path32, kMelder_textInputEncoding::UTF8);
 			Melder_throw (U"Unusual error finding or creating file ", path32, U".");
 		}
 		CFMutableStringRef cfpath2 = CFStringCreateMutableCopy (nullptr, 0, cfpath);
 		CFRelease (cfpath);
 		CFStringNormalize (cfpath2, kCFStringNormalizationFormC);   // Praat requires composed characters
-		long n_utf16 = CFStringGetLength (cfpath2);
-		long n_utf32 = 0;
-		for (long i = 0; i < n_utf16; i ++) {
+		integer n_utf16 = CFStringGetLength (cfpath2);
+		integer n_utf32 = 0;
+		for (integer i = 0; i < n_utf16; i ++) {
 			char32 kar1 = CFStringGetCharacterAtIndex (cfpath2, i);
 			if (kar1 >= 0x00D800 && kar1 <= 0x00DBFF) {
 				char32 kar2 = (char32) CFStringGetCharacterAtIndex (cfpath2, ++ i);   // convert up
@@ -154,7 +154,7 @@ void Melder_8bitFileRepresentationToStr32_inline (const char *path8, char32 *pat
 		path32 [n_utf32] = U'\0';
 		CFRelease (cfpath2);
 	#else
-		Melder_8to32_inline (path8, path32, (int) kMelder_textInputEncoding::UTF8);
+		Melder_8to32_inline (path8, path32, kMelder_textInputEncoding::UTF8);
 	#endif
 }
 #endif
@@ -829,15 +829,15 @@ MelderFile MelderFile_open (MelderFile me) {
 }
 
 char * MelderFile_readLine (MelderFile me) {
-	long i;
 	static char *buffer;
-	static long capacity;
+	static integer capacity;
 	if (! my filePointer) return nullptr;
 	if (feof (my filePointer)) return nullptr;
 	if (! buffer) {
 		buffer = Melder_malloc (char, capacity = 100);
 	}
-	for (i = 0; true; i ++) {
+	integer i = 0;
+	for (; true; i ++) {
 		if (i >= capacity) {
 			buffer = (char *) Melder_realloc (buffer, capacity *= 2);
 		}
diff --git a/sys/melder_ftoa.cpp b/sys/melder_ftoa.cpp
index 5f68e41..344e94d 100644
--- a/sys/melder_ftoa.cpp
+++ b/sys/melder_ftoa.cpp
@@ -37,8 +37,8 @@ static int ibuffer = 0;
 
 const char * Melder8_integer (int64 value) noexcept {
 	if (++ ibuffer == NUMBER_OF_BUFFERS) ibuffer = 0;
-	if (sizeof (long) == 8) {
-		int n = snprintf (buffers8 [ibuffer], MAXIMUM_NUMERIC_STRING_LENGTH + 1, "%ld", (long) value);   // cast to identical type, to make compiler happy
+	if (sizeof (long_not_integer) == 8) {
+		int n = snprintf (buffers8 [ibuffer], MAXIMUM_NUMERIC_STRING_LENGTH + 1, "%ld", (long_not_integer) value);   // cast to identical type, to make compiler happy
 		Melder_assert (n > 0);
 		Melder_assert (n <= MAXIMUM_NUMERIC_STRING_LENGTH);
 	} else if (sizeof (long long) == 8) {
@@ -135,6 +135,10 @@ const char32 * Melder_boolean (bool value) noexcept {
 	return value ? U"yes" : U"no";
 }
 
+/*@praat
+	assert string$ (1000000000000) = "1000000000000"
+	assert string$ (undefined) = "--undefined--"
+@*/
 const char * Melder8_double (double value) noexcept {
 	if (isundef (value)) return "--undefined--";
 	if (++ ibuffer == NUMBER_OF_BUFFERS) ibuffer = 0;
@@ -306,7 +310,7 @@ const char * Melder8_naturalLogarithm (double lnNumber) noexcept {
 	double log10Number = lnNumber * NUMlog10e;
 	if (log10Number < -41.0) {
 		if (++ ibuffer == NUMBER_OF_BUFFERS) ibuffer = 0;
-		long ceiling = (long) ceil (log10Number);
+		long_not_integer ceiling = (long_not_integer) ceil (log10Number);
 		double remainder = log10Number - ceiling;
 		double remainder10 = pow (10.0, remainder);
 		while (remainder10 < 1.0) {
@@ -318,7 +322,7 @@ const char * Melder8_naturalLogarithm (double lnNumber) noexcept {
 			sprintf (buffers8 [ibuffer], "%.16g", remainder10);
 			if (strtod (buffers8 [ibuffer], nullptr) != remainder10) sprintf (buffers8 [ibuffer], "%.17g", remainder10);
 		}
-		sprintf (buffers8 [ibuffer] + strlen (buffers8 [ibuffer]), "e-%ld", (long) ceiling);
+		sprintf (buffers8 [ibuffer] + strlen (buffers8 [ibuffer]), "e-%ld", (long_not_integer) ceiling);
 	} else {
 		return Melder8_double (exp (lnNumber));
 	}
@@ -357,7 +361,7 @@ const char32 * Melder_numvec (numvec value) {
 	MelderString *string = & theTensorBuffers [iTensorBuffer];
 	MelderString_empty (string);
 	if (value.at) {
-		for (long i = 1; i <= value.size; i ++) {
+		for (integer i = 1; i <= value.size; i ++) {
 			MelderString_append (string, value [i], U'\n');
 		}
 	}
@@ -368,8 +372,8 @@ const char32 * Melder_nummat (nummat value) {
 	MelderString *string = & theTensorBuffers [iTensorBuffer];
 	MelderString_empty (string);
 	if (value.at) {
-		for (long irow = 1; irow <= value.nrow; irow ++) {
-			for (long icol = 1; icol <= value.ncol; icol ++) {
+		for (integer irow = 1; irow <= value.nrow; irow ++) {
+			for (integer icol = 1; icol <= value.ncol; icol ++) {
 				MelderString_append (string, value [irow] [icol]);
 				if (icol < value.ncol) MelderString_appendCharacter (string, U' ');
 			}
diff --git a/sys/melder_readtext.cpp b/sys/melder_readtext.cpp
index 2f025ee..16febe8 100644
--- a/sys/melder_readtext.cpp
+++ b/sys/melder_readtext.cpp
@@ -26,7 +26,7 @@ char32 MelderReadText_getChar (MelderReadText me) {
 		return * my readPointer32 ++;
 	} else {
 		if (* my readPointer8 == '\0') return U'\0';
-		if (my input8Encoding == (unsigned long) kMelder_textInputEncoding::UTF8) {
+		if (my input8Encoding == kMelder_textInputEncoding::UTF8) {
 			char32 kar1 = (char32) (char8) * my readPointer8 ++;
 			if (kar1 <= 0x00007F) {
 				return kar1;
@@ -45,9 +45,9 @@ char32 MelderReadText_getChar (MelderReadText me) {
 			} else {
 				return UNICODE_REPLACEMENT_CHARACTER;
 			}
-		} else if (my input8Encoding == (unsigned long) kMelder_textInputEncoding::MACROMAN) {
+		} else if (my input8Encoding == kMelder_textInputEncoding::MACROMAN) {
 			return Melder_decodeMacRoman [(char8) * my readPointer8 ++];
-		} else if (my input8Encoding == (unsigned long) kMelder_textInputEncoding::WINDOWS_LATIN1) {
+		} else if (my input8Encoding == kMelder_textInputEncoding::WINDOWS_LATIN1) {
 			return Melder_decodeWindowsLatin1 [(char8) * my readPointer8 ++];
 		} else {
 			/* Unknown encoding. */
@@ -214,7 +214,7 @@ static char32 * _MelderFile_readText (MelderFile file, char **string8) {
 				(void) Melder_killReturns_inline (*string8);
 				return nullptr;   // OK
 			} else {
-				text.reset (Melder_8to32 (text8bit.peek(), 0));
+				text.reset (Melder_8to32 (text8bit.peek(), kMelder_textInputEncoding::UNDEFINED));
 			}
 		} else {
 			length = length / 2 - 1;   // Byte Order Mark subtracted. Length = number of UTF-16 codes
@@ -286,22 +286,22 @@ MelderReadText MelderReadText_createFromFile (MelderFile file) {
 	} else {
 		Melder_assert (my string8);
 		my readPointer8 = & my string8 [0];
-		my input8Encoding = (unsigned long) Melder_getInputEncoding ();
-		if (my input8Encoding == (unsigned long) kMelder_textInputEncoding::UTF8 ||
-			my input8Encoding == (unsigned long) kMelder_textInputEncoding::UTF8_THEN_ISO_LATIN1 ||
-			my input8Encoding == (unsigned long) kMelder_textInputEncoding::UTF8_THEN_WINDOWS_LATIN1 ||
-			my input8Encoding == (unsigned long) kMelder_textInputEncoding::UTF8_THEN_MACROMAN)
+		my input8Encoding = Melder_getInputEncoding ();
+		if (my input8Encoding == kMelder_textInputEncoding::UTF8 ||
+			my input8Encoding == kMelder_textInputEncoding::UTF8_THEN_ISO_LATIN1 ||
+			my input8Encoding == kMelder_textInputEncoding::UTF8_THEN_WINDOWS_LATIN1 ||
+			my input8Encoding == kMelder_textInputEncoding::UTF8_THEN_MACROMAN)
 		{
 			if (Melder_str8IsValidUtf8 (my string8)) {
-				my input8Encoding = (unsigned long) kMelder_textInputEncoding::UTF8;
-			} else if (my input8Encoding == (unsigned long) kMelder_textInputEncoding::UTF8) {
+				my input8Encoding = kMelder_textInputEncoding::UTF8;
+			} else if (my input8Encoding == kMelder_textInputEncoding::UTF8) {
 				Melder_throw (U"Text is not valid UTF-8; please try a different text input encoding.");
-			} else if (my input8Encoding == (unsigned long) kMelder_textInputEncoding::UTF8_THEN_ISO_LATIN1) {
-				my input8Encoding = (unsigned long) kMelder_textInputEncoding::ISO_LATIN1;
-			} else if (my input8Encoding == (unsigned long) kMelder_textInputEncoding::UTF8_THEN_WINDOWS_LATIN1) {
-				my input8Encoding = (unsigned long) kMelder_textInputEncoding::WINDOWS_LATIN1;
-			} else if (my input8Encoding == (unsigned long) kMelder_textInputEncoding::UTF8_THEN_MACROMAN) {
-				my input8Encoding = (unsigned long) kMelder_textInputEncoding::MACROMAN;
+			} else if (my input8Encoding == kMelder_textInputEncoding::UTF8_THEN_ISO_LATIN1) {
+				my input8Encoding = kMelder_textInputEncoding::ISO_LATIN1;
+			} else if (my input8Encoding == kMelder_textInputEncoding::UTF8_THEN_WINDOWS_LATIN1) {
+				my input8Encoding = kMelder_textInputEncoding::WINDOWS_LATIN1;
+			} else if (my input8Encoding == kMelder_textInputEncoding::UTF8_THEN_MACROMAN) {
+				my input8Encoding = kMelder_textInputEncoding::MACROMAN;
 			}
 		}
 	}
diff --git a/sys/melder_strings.cpp b/sys/melder_strings.cpp
index e1e969a..d6543b6 100644
--- a/sys/melder_strings.cpp
+++ b/sys/melder_strings.cpp
@@ -768,7 +768,7 @@ int64 MelderString_deallocationSize () {
 }
 
 #define NUMBER_OF_CAT_BUFFERS  33
-static MelderString theCatBuffers [NUMBER_OF_CAT_BUFFERS] = { { 0 } };
+static MelderString theCatBuffers [NUMBER_OF_CAT_BUFFERS] { };
 static int iCatBuffer = 0;
 
 const char32 * Melder_cat (Melder_2_ARGS) {
diff --git a/sys/melder_sysenv.cpp b/sys/melder_sysenv.cpp
index 8680355..fce9fd2 100644
--- a/sys/melder_sysenv.cpp
+++ b/sys/melder_sysenv.cpp
@@ -47,7 +47,7 @@ char32 * Melder_getenv (const char32 *variableName) {
 		static char32 buffer [11] [255];
 		static int ibuffer = 0;
 		if (++ ibuffer == 11) ibuffer = 0;
-		long n = GetEnvironmentVariableW (variableName, buffer [ibuffer], 255);   BUG
+		DWORD n = GetEnvironmentVariableW (variableName, buffer [ibuffer], 255);   BUG
 		if (n == ERROR_ENVVAR_NOT_FOUND) return nullptr;
 		return & buffer [ibuffer] [0];
 	#else
diff --git a/sys/melder_textencoding.cpp b/sys/melder_textencoding.cpp
index 1c6ace5..f004a5f 100644
--- a/sys/melder_textencoding.cpp
+++ b/sys/melder_textencoding.cpp
@@ -193,7 +193,7 @@ char32 * Melder_peek8to32 (const char *textA) {
 	static int ibuffer = 0;
 	if (++ ibuffer == 11) ibuffer = 0;
 	MelderString_empty (& buffers [ibuffer]);
-	unsigned long n = strlen (textA), i, j;
+	uinteger n = strlen (textA), i, j;
 	for (i = 0, j = 0; i <= n; i ++) {
 		char8 kar1 = (char8) textA [i];   // convert sign
 		if (kar1 <= 0x7F) {
@@ -328,43 +328,43 @@ char32 Melder_decodeWindowsLatin1 [256] = {
 	220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
 	240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 };
 
-void Melder_8to32_inline (const char *string8, char32 *string32, int inputEncoding) {
+void Melder_8to32_inline (const char *string8, char32 *string32, kMelder_textInputEncoding inputEncoding) {
 	char32 *q = & string32 [0];
-	if (inputEncoding == 0) {
-		inputEncoding = (int) preferences. inputEncoding;
+	if (inputEncoding == kMelder_textInputEncoding::UNDEFINED) {
+		inputEncoding = preferences. inputEncoding;
 		/*
 		 * In case the preferences weren't initialized yet, use the platform defaults:
 		 */
-		if (inputEncoding == 0) {
+		if (inputEncoding == kMelder_textInputEncoding::UNDEFINED) {
 			#if defined (macintosh)
-				inputEncoding = (int) kMelder_textInputEncoding::UTF8_THEN_MACROMAN;
+				inputEncoding = kMelder_textInputEncoding::UTF8_THEN_MACROMAN;
 			#elif defined (_WIN32)
-				inputEncoding = (int) kMelder_textInputEncoding::UTF8_THEN_WINDOWS_LATIN1;
+				inputEncoding = kMelder_textInputEncoding::UTF8_THEN_WINDOWS_LATIN1;
 			#else
-				inputEncoding = (int) kMelder_textInputEncoding::UTF8_THEN_ISO_LATIN1;
+				inputEncoding = kMelder_textInputEncoding::UTF8_THEN_ISO_LATIN1;
 			#endif
 		}
 	}
-	if (inputEncoding == (int) kMelder_textInputEncoding::UTF8 ||
-		inputEncoding == (int) kMelder_textInputEncoding::UTF8_THEN_ISO_LATIN1 ||
-		inputEncoding == (int) kMelder_textInputEncoding::UTF8_THEN_WINDOWS_LATIN1 ||
-		inputEncoding == (int) kMelder_textInputEncoding::UTF8_THEN_MACROMAN)
+	if (inputEncoding == kMelder_textInputEncoding::UTF8 ||
+		inputEncoding == kMelder_textInputEncoding::UTF8_THEN_ISO_LATIN1 ||
+		inputEncoding == kMelder_textInputEncoding::UTF8_THEN_WINDOWS_LATIN1 ||
+		inputEncoding == kMelder_textInputEncoding::UTF8_THEN_MACROMAN)
 	{
 		if (Melder_str8IsValidUtf8 (string8)) {
-			inputEncoding = (int) kMelder_textInputEncoding::UTF8;
-		} else if (inputEncoding == (int) kMelder_textInputEncoding::UTF8_THEN_ISO_LATIN1) {
-			inputEncoding = (int) kMelder_textInputEncoding::ISO_LATIN1;
-		} else if (inputEncoding == (int) kMelder_textInputEncoding::UTF8_THEN_WINDOWS_LATIN1) {
-			inputEncoding = (int) kMelder_textInputEncoding::WINDOWS_LATIN1;
-		} else if (inputEncoding == (int) kMelder_textInputEncoding::UTF8_THEN_MACROMAN) {
-			inputEncoding = (int) kMelder_textInputEncoding::MACROMAN;
+			inputEncoding = kMelder_textInputEncoding::UTF8;
+		} else if (inputEncoding == kMelder_textInputEncoding::UTF8_THEN_ISO_LATIN1) {
+			inputEncoding = kMelder_textInputEncoding::ISO_LATIN1;
+		} else if (inputEncoding == kMelder_textInputEncoding::UTF8_THEN_WINDOWS_LATIN1) {
+			inputEncoding = kMelder_textInputEncoding::WINDOWS_LATIN1;
+		} else if (inputEncoding == kMelder_textInputEncoding::UTF8_THEN_MACROMAN) {
+			inputEncoding = kMelder_textInputEncoding::MACROMAN;
 		} else {
-			Melder_assert (inputEncoding == (int) kMelder_textInputEncoding::UTF8);
+			Melder_assert (inputEncoding == kMelder_textInputEncoding::UTF8);
 			Melder_throw (U"Text is not valid UTF-8; please try a different text input encoding.");
 		}
 	}
 	const char8 *p = (const char8 *) & string8 [0];
-	if (inputEncoding == (int) kMelder_textInputEncoding::UTF8) {
+	if (inputEncoding == kMelder_textInputEncoding::UTF8) {
 		while (*p != '\0') {
 			char32 kar1 = * p ++;   // convert up without sign extension
 			if (kar1 <= 0x00007F) {
@@ -381,26 +381,26 @@ void Melder_8to32_inline (const char *string8, char32 *string32, int inputEncodi
 				* q ++ = kar;
 			}
 		}
-	} else if (inputEncoding == (int) kMelder_textInputEncoding::ISO_LATIN1) {
+	} else if (inputEncoding == kMelder_textInputEncoding::ISO_LATIN1) {
 		while (*p != '\0') {
 			* q ++ = * p ++;
 		}
-	} else if (inputEncoding == (int) kMelder_textInputEncoding::WINDOWS_LATIN1) {
+	} else if (inputEncoding == kMelder_textInputEncoding::WINDOWS_LATIN1) {
 		while (*p != '\0') {
 			* q ++ = Melder_decodeWindowsLatin1 [* p ++];
 		}
-	} else if (inputEncoding == (int) kMelder_textInputEncoding::MACROMAN) {
+	} else if (inputEncoding == kMelder_textInputEncoding::MACROMAN) {
 		while (*p != '\0') {
 			* q ++ = Melder_decodeMacRoman [* p ++];
 		}
-	} else if (inputEncoding != (int) kMelder_textInputEncoding::UTF8) {
-		Melder_fatal (U"Unknown text input encoding ", inputEncoding, U".");
+	} else if (inputEncoding != kMelder_textInputEncoding::UTF8) {
+		Melder_fatal (U"Unknown text input encoding ", (int) inputEncoding, U".");
 	}
 	* q = U'\0';   // closing null character
 	(void) Melder_killReturns_inlineCHAR <char32> (string32);
 }
 
-char32 * Melder_8to32 (const char *string, int inputEncoding) {
+char32 * Melder_8to32 (const char *string, kMelder_textInputEncoding inputEncoding) {
 	if (! string) return nullptr;
 	autostring32 result = Melder_malloc (char32, (int64) strlen (string) + 1);
 	Melder_8to32_inline (string, result.peek(), inputEncoding);
@@ -410,7 +410,7 @@ char32 * Melder_8to32 (const char *string, int inputEncoding) {
 char32 * Melder_8to32 (const char *string) {
 	if (! string) return nullptr;
 	autostring32 result = Melder_malloc (char32, (int64) strlen (string) + 1);
-	Melder_8to32_inline (string, result.peek(), (int) kMelder_textInputEncoding::UTF8);
+	Melder_8to32_inline (string, result.peek(), kMelder_textInputEncoding::UTF8);
 	return result.transfer();
 }
 
diff --git a/sys/melder_token.cpp b/sys/melder_token.cpp
index b8faf51..f60cbf1 100644
--- a/sys/melder_token.cpp
+++ b/sys/melder_token.cpp
@@ -1,6 +1,6 @@
 /* melder_token.cpp
  *
- * Copyright (C) 2006-2011,2015 Paul Boersma
+ * Copyright (C) 2006-2011,2015,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,8 +18,8 @@
 
 #include "melder.h"
 
-long Melder_countTokens (const char32 *string) {
-	long numberOfTokens = 0;
+integer Melder_countTokens (const char32 *string) {
+	integer numberOfTokens = 0;
 	const char32 *p = & string [0];
 	for (;;) {
 		while (*p == U' ' || *p == U'\t' || *p == U'\n' || *p == U'\r') p ++;
@@ -45,9 +45,9 @@ char32 *Melder_nextToken () {
 	return Melder_tok (nullptr, U" \t\n\r");
 }
 
-char32 ** Melder_getTokens (const char32 *string, long *n) {
+char32 ** Melder_getTokens (const char32 *string, integer *n) {
 	char32 *token;
-	long itoken = 0;
+	integer itoken = 0;
 	*n = Melder_countTokens (string);
 	if (*n == 0) return nullptr;
 	autostring32vector result (1, *n);
@@ -62,8 +62,8 @@ void Melder_freeTokens (char32 ***tokens) {
 	*tokens = nullptr;
 }
 
-long Melder_searchToken (const char32 *string, char32 **tokens, long n) {
-	for (long i = 1; i <= n; i ++) {
+integer Melder_searchToken (const char32 *string, char32 **tokens, integer n) {
+	for (integer i = 1; i <= n; i ++) {
 		if (str32equ (string, tokens [i])) return i;
 	}
 	return 0;
diff --git a/sys/motifEmulator.cpp b/sys/motifEmulator.cpp
index 6c5ca6b..b452008 100644
--- a/sys/motifEmulator.cpp
+++ b/sys/motifEmulator.cpp
@@ -108,8 +108,8 @@ static short theMenuItems [1+MAXIMUM_MENU_ITEM_ID];   // we can freely use and r
 static GuiObject theApplicationShell;   // for global menus
 static int theBackground = False;   // set by suspend and resume events; used by Motif-style activation methods
 static int theDialogHint = False;   // should the shell that is currently being created, have dialog or document looks?
-long numberOfWidgets = 0;
-long Gui_getNumberOfMotifWidgets () { return numberOfWidgets; }
+integer numberOfWidgets = 0;
+integer Gui_getNumberOfMotifWidgets () { return numberOfWidgets; }
 
 /* AppContext level */
 
@@ -121,7 +121,7 @@ static int theNumberOfTimeOuts;
 static XtTimerCallbackProc theTimeOutProcs [10];
 static XtPointer theTimeOutClosures [10];
 static clock_t theTimeOutStarts [10];
-static unsigned long theTimeOutIntervals [10];
+static uinteger theTimeOutIntervals [10];
 
 static void Native_move (GuiObject w, int dx, int dy);   // forward
 
@@ -183,7 +183,7 @@ static int NativeButton_preferredHeight (GuiObject me) {
 
 GuiObject _Gui_initializeWidget (int widgetClass, GuiObject parent, const char32 *name) {
 	GuiObject me = Melder_calloc_f (struct structGuiObject, 1);
-	if (Melder_debug == 34) fprintf (stderr, "from _Gui_initializeWidget\t%p\t%ld\t%ld\n", me, 1L, (long) sizeof (struct structGuiObject));
+	if (Melder_debug == 34) fprintf (stderr, "from _Gui_initializeWidget\t%p\t%ld\t%ld\n", me, 1L, (integer) sizeof (struct structGuiObject));
 	my magicNumber = 15111959;
 	numberOfWidgets ++;
 	my widgetClass = widgetClass;
@@ -1311,8 +1311,8 @@ void XtRemoveWorkProc (XtWorkProcId id) {
 	theNumberOfWorkProcs --;
 }
 
-XtIntervalId GuiAddTimeOut (unsigned long interval, XtTimerCallbackProc proc, XtPointer closure) {
-	long i = 1;
+XtIntervalId GuiAddTimeOut (uinteger interval, XtTimerCallbackProc proc, XtPointer closure) {
+	integer i = 1;
 	while (i < 10 && theTimeOutProcs [i]) i ++;
 	Melder_assert (i < 10);
 	theTimeOutProcs [i] = proc;
@@ -2046,7 +2046,7 @@ static void _motif_update (GuiObject me, void *event) { (void) me; (void) event;
 /***** EVENT *****/
 
 static void _motif_inspectTextWidgets (GuiObject me, GuiObject text,
-	long *p_numberOfTextWidgets, long *p_textWidgetLocation)
+	integer *p_numberOfTextWidgets, integer *p_textWidgetLocation)
 {
 	for (GuiObject sub = my firstChild; sub != NULL; sub = sub -> nextSibling) {
 		if (MEMBER (sub, Shell)) continue;
@@ -2061,7 +2061,7 @@ static void _motif_inspectTextWidgets (GuiObject me, GuiObject text,
 	}
 }
 static GuiObject _motif_getLocatedTextWidget (GuiObject me,
-	long *p_itextWidget, long textWidgetLocation)
+	integer *p_itextWidget, integer textWidgetLocation)
 {
 	for (GuiObject sub = my firstChild; sub != NULL; sub = sub -> nextSibling) {
 		if (MEMBER (sub, Shell)) continue;
@@ -2078,7 +2078,7 @@ static GuiObject _motif_getLocatedTextWidget (GuiObject me,
 	return NULL;
 }
 static GuiObject _motif_getNextTextWidget (GuiObject shell, GuiObject text, bool backward) {
-	long numberOfTextWidgets = 0, textWidgetLocation = 0;
+	integer numberOfTextWidgets = 0, textWidgetLocation = 0;
 	_motif_inspectTextWidgets (shell, text, & numberOfTextWidgets, & textWidgetLocation);
 	trace (U"Found ", numberOfTextWidgets, U" text widgets.");
 	if (numberOfTextWidgets == 0) return NULL;   // no tab navigation if there is no text widget (shouldn't normally occur)
@@ -2092,7 +2092,7 @@ static GuiObject _motif_getNextTextWidget (GuiObject shell, GuiObject text, bool
 		textWidgetLocation ++;   // tab to next text widget
 		if (textWidgetLocation > numberOfTextWidgets) textWidgetLocation = 1;   // if at end, then tab around to first text widget
 	}
-	long itextWidget = 0;
+	integer itextWidget = 0;
 	return _motif_getLocatedTextWidget (shell, & itextWidget, textWidgetLocation);
 }
 
@@ -2125,7 +2125,7 @@ void XtNextEvent (XEvent *xevent) {
 }
 
 static void processWorkProcsAndTimeOuts () {
-	long i;
+	integer i;
 	if (theNumberOfWorkProcs) for (i = 9; i >= 1; i --)
 		if (theWorkProcs [i])
 			if (theWorkProcs [i] (theWorkProcClosures [i])) XtRemoveWorkProc (i);
@@ -2232,7 +2232,7 @@ modifiers & _motif_COMMAND_MASK ? " control" : "",
 modifiers & _motif_OPTION_MASK ? " alt" : "",
 modifiers & _motif_SHIFT_MASK ? " shift" : "", message -> message == WM_KEYDOWN ? "keydown" : "syskeydown", kar);*/
 		if (me && my shell) {
-			unsigned long acc = my shell -> motiff.shell.lowAccelerators [modifiers];
+			uinteger acc = my shell -> motiff.shell.lowAccelerators [modifiers];
 			//if (kar != VK_CONTROL) Melder_casual ("%d %d", acc, kar);
 			if (kar < 48) {
 				if (kar == VK_BACK) {   // shortcut or text
diff --git a/sys/oo.h b/sys/oo.h
index f1ebb8c..51ed395 100644
--- a/sys/oo.h
+++ b/sys/oo.h
@@ -24,7 +24,7 @@
 	The possible storage types give these binary formats:
 		i8: store as signed big-endian integer in 8 bits (-128..+127).
 		i16: store as signed big-endian integer in 16 bits (-32768..+32767).
-		i32: store as signed big-endian integer in 32 bits (-2147483648..+2147483647).
+		integer: store as signed big-endian integer in 32 bits (-2147483648..+2147483647). This will be changed to allow 64 bits.
 		u8: store as unsigned big-endian integer in 8 bits (0..255).
 		u16: store as unsigned big-endian integer in 16 bits (0..65535).
 		u32: store as unsigned big-endian integer in 32 bits (0..4294967295).
@@ -42,11 +42,10 @@
 
 #define oo_BYTE(x)  oo_SIMPLE (signed char, i8, x)
 #define oo_INT(x)  oo_SIMPLE (int, i16, x)
-#define oo_LONG(x)  oo_SIMPLE (long, i32, x)
 #define oo_INTEGER(x)  oo_SIMPLE (integer, integer, x)
 #define oo_UBYTE(x)  oo_SIMPLE (unsigned char, u8, x)
 #define oo_UINT(x)  oo_SIMPLE (unsigned int, u16, x)
-#define oo_ULONG(x)  oo_SIMPLE (unsigned long, u32, x)
+#define oo_UINTEGER(x)  oo_SIMPLE (uinteger, u32, x)
 #define oo_INT8(x)  oo_SIMPLE (int8, i8, x)
 #define oo_INT16(x)  oo_SIMPLE (int16, i16, x)
 #define oo_INT32(x)  oo_SIMPLE (int32, i32, x)
@@ -54,7 +53,6 @@
 #define oo_UINT8(x)  oo_SIMPLE (uint8, u8, x)
 #define oo_UINT16(x)  oo_SIMPLE (uint16, u16, x)
 #define oo_UINT32(x)  oo_SIMPLE (uint32, u32, x)
-#define oo_BOOL(x)  oo_SIMPLE (unsigned char, u8, x)
 #define oo_FLOAT(x)  oo_SIMPLE (double, r32, x)
 #define oo_DOUBLE(x)  oo_SIMPLE (double, r64, x)
 //#define oo_FCOMPLEX(x)  oo_SIMPLE (dcomplex, c64, x)
@@ -69,10 +67,10 @@
 
 //#define oo_BYTE_ARRAY(x,cap,n)  oo_ARRAY (signed char, i8, x, cap, n)
 //#define oo_INT_ARRAY(x,cap,n)  oo_ARRAY (int, i16, x, cap, n)
-//#define oo_LONG_ARRAY(x,cap,n)  oo_ARRAY (long, i32, x, cap, n)
+//#define oo_INTEGER_ARRAY(x,cap,n)  oo_ARRAY (integer, integer, x, cap, n)
 //#define oo_UBYTE_ARRAY(x,cap,n)  oo_ARRAY (unsigned char, u8, x, cap, n)
 //#define oo_UINT_ARRAY(x,cap,n)  oo_ARRAY (unsigned int, u16, x, cap, n)
-//#define oo_ULONG_ARRAY(x,cap,n)  oo_ARRAY (unsigned long, u32, x, cap, n)
+//#define oo_UINTEGER_ARRAY(x,cap,n)  oo_ARRAY (uinteger, u32, x, cap, n)
 //#define oo_BOOL_ARRAY(x,cap,n)  oo_ARRAY (unsigned char, u8, x, cap, n)
 //#define oo_FLOAT_ARRAY(x,cap,n)  oo_ARRAY (double, r32, x, cap, n)
 #define oo_DOUBLE_ARRAY(x,cap,n)  oo_ARRAY (double, r64, x, cap, n)
@@ -85,10 +83,10 @@
 
 //#define oo_BYTE_SET(x,setType)  oo_SET (signed char, i8, x, setType)
 //#define oo_INT_SET(x,setType)  oo_SET (int, i16, x, setType)
-//#define oo_LONG_SET(x,setType)  oo_SET (long, i32, x, setType)
+//#define oo_INTEGER_SET(x,setType)  oo_SET (integer, integer, x, setType)
 //#define oo_UBYTE_SET(x,setType)  oo_SET (unsigned char, u8, x, setType)
 //#define oo_UINT_SET(x,setType)  oo_SET (unsigned int, u16, x, setType)
-//#define oo_ULONG_SET(x,setType)  oo_SET (unsigned long, u32, x, setType)
+//#define oo_UINTEGER_SET(x,setType)  oo_SET (uinteger, u32, x, setType)
 //#define oo_BOOL_SET(x,setType)  oo_SET (unsigned char, u8, x, setType)
 //#define oo_FLOAT_SET(x,setType)  oo_SET (double, r32, x, setType)
 #define oo_DOUBLE_SET(x,setType)  oo_SET (double, r64, x, setType)
@@ -102,10 +100,10 @@
 
 //#define oo_BYTE_VECTOR_FROM(x,min,max)  oo_VECTOR (signed char, i8, x, min, max)
 #define oo_INT_VECTOR_FROM(x,min,max)  oo_VECTOR (int, i16, x, min, max)
-#define oo_LONG_VECTOR_FROM(x,min,max)  oo_VECTOR (long, i32, x, min, max)
+#define oo_INTEGER_VECTOR_FROM(x,min,max)  oo_VECTOR (integer, integer, x, min, max)
 //#define oo_UBYTE_VECTOR_FROM(x,min,max)  oo_VECTOR (unsigned char, u8, x, min, max)
 //#define oo_UINT_VECTOR_FROM(x,min,max)  oo_VECTOR (unsigned int, u16, x, min, max)
-//#define oo_ULONG_VECTOR_FROM(x,min,max)  oo_VECTOR (unsigned long, u32, x, min, max)
+//#define oo_UINTEGER_VECTOR_FROM(x,min,max)  oo_VECTOR (uinteger, u32, x, min, max)
 //#define oo_BOOL_VECTOR_FROM(x,min,max)  oo_VECTOR (unsigned char, u8, x, min, max)
 #define oo_FLOAT_VECTOR_FROM(x,min,max)  oo_VECTOR (double, r32, x, min, max)
 #define oo_DOUBLE_VECTOR_FROM(x,min,max)  oo_VECTOR (double, r64, x, min, max)
@@ -115,10 +113,10 @@
 
 //#define oo_BYTE_MATRIX_FROM(x,row1,row2,col1,col2)  oo_MATRIX (signed char, i8, x, row1, row2, col1, col2)
 //#define oo_INT_MATRIX_FROM(x,row1,row2,col1,col2)  oo_MATRIX (int, i16, x, row1, row2, col1, col2)
-//#define oo_LONG_MATRIX_FROM(x,row1,row2,col1,col2)  oo_MATRIX (long, i32, x, row1, row2, col1, col2)
+//#define oo_INTEGER_MATRIX_FROM(x,row1,row2,col1,col2)  oo_MATRIX (integer, integer, x, row1, row2, col1, col2)
 //#define oo_UBYTE_MATRIX_FROM(x,row1,row2,col1,col2)  oo_MATRIX (unsigned char, u8, x, row1, row2, col1, col2)
 //#define oo_UINT_MATRIX_FROM(x,row1,row2,col1,col2)  oo_MATRIX (unsigned int, u16, x, row1, row2, col1, col2)
-//#define oo_ULONG_MATRIX_FROM(x,row1,row2,col1,col2)  oo_MATRIX (unsigned long, u32, x, row1, row2, col1, col2)
+//#define oo_UINTEGER_MATRIX_FROM(x,row1,row2,col1,col2)  oo_MATRIX (uinteger, u32, x, row1, row2, col1, col2)
 //#define oo_BOOL_MATRIX_FROM(x,row1,row2,col1,col2)  oo_MATRIX (unsigned char, u8, x, row1, row2, col1, col2)
 //#define oo_FLOAT_MATRIX_FROM(x,row1,row2,col1,col2)  oo_MATRIX (double, r32, x, row1, row2, col1, col2)
 #define oo_DOUBLE_MATRIX_FROM(x,row1,row2,col1,col2)  oo_MATRIX (double, r64, x, row1, row2, col1, col2)
@@ -130,10 +128,10 @@
 
 //#define oo_BYTE_VECTOR(x,n)  oo_VECTOR (signed char, i8, x, 1, n)
 #define oo_INT_VECTOR(x,n)  oo_VECTOR (int, i16, x, 1, n)
-#define oo_LONG_VECTOR(x,n)  oo_VECTOR (long, i32, x, 1, n)
+#define oo_INTEGER_VECTOR(x,n)  oo_VECTOR (integer, integer, x, 1, n)
 //#define oo_UBYTE_VECTOR(x,n)  oo_VECTOR (unsigned char, u8, x, 1, n)
 //#define oo_UINT_VECTOR(x,n)  oo_VECTOR (unsigned int, u16, x, 1, n)
-//#define oo_ULONG_VECTOR(x,n)  oo_VECTOR (unsigned long, u32, x, 1, n)
+//#define oo_UINTEGER_VECTOR(x,n)  oo_VECTOR (uinteger, u32, x, 1, n)
 //#define oo_BOOL_VECTOR(x,n)  oo_VECTOR (unsigned char, u8, x, 1, n)
 #define oo_FLOAT_VECTOR(x,n)  oo_VECTOR (double, r32, x, 1, n)
 #define oo_DOUBLE_VECTOR(x,n)  oo_VECTOR (double, r64, x, 1, n)
@@ -143,10 +141,10 @@
 
 //#define oo_BYTE_MATRIX(x,nrow,ncol)  oo_MATRIX (signed char, i8, x, 1, nrow, 1, ncol)
 //#define oo_INT_MATRIX(x,nrow,ncol)  oo_MATRIX (int, i16, x, 1, nrow, 1, ncol)
-#define oo_LONG_MATRIX(x,nrow,ncol)  oo_MATRIX (long, i32, x, 1, nrow, 1, ncol)
+#define oo_INTEGER_MATRIX(x,nrow,ncol)  oo_MATRIX (integer, integer, x, 1, nrow, 1, ncol)
 #define oo_UBYTE_MATRIX(x,nrow,ncol)  oo_MATRIX (unsigned char, u8, x, 1, nrow, 1, ncol)
 //#define oo_UINT_MATRIX(x,nrow,ncol)  oo_MATRIX (unsigned int, u16, x, 1, nrow, 1, ncol)
-//#define oo_ULONG_MATRIX(x,nrow,ncol)  oo_MATRIX (unsigned long, u32, x, 1, nrow, 1, ncol)
+//#define oo_UINTEGER_MATRIX(x,nrow,ncol)  oo_MATRIX (uinteger, u32, x, 1, nrow, 1, ncol)
 //#define oo_BOOL_MATRIX(x,nrow,ncol)  oo_MATRIX (unsigned char, u8, x, 1, nrow, 1, ncol)
 #define oo_FLOAT_MATRIX(x,nrow,ncol)  oo_MATRIX (double, r32, x, 1, nrow, 1, ncol)
 #define oo_DOUBLE_MATRIX(x,nrow,ncol)  oo_MATRIX (double, r64, x, 1, nrow, 1, ncol)
diff --git a/sys/oo_CAN_WRITE_AS_ENCODING.h b/sys/oo_CAN_WRITE_AS_ENCODING.h
index 4653d47..0650b24 100644
--- a/sys/oo_CAN_WRITE_AS_ENCODING.h
+++ b/sys/oo_CAN_WRITE_AS_ENCODING.h
@@ -57,12 +57,12 @@
 
 #define oo_STRINGx_VECTOR(storage,x,min,max)  \
 	if (our x) { \
-		for (long i = min; i <= max; i ++) \
+		for (integer i = min; i <= max; i ++) \
 			if (our x [i] && ! Melder_isEncodable (our x [i], encoding)) return false; \
 	}
 #define oo_STRING32x_VECTOR(storage,x,min,max)  \
 	if (our x) { \
-		for (long i = min; i <= max; i ++) \
+		for (integer i = min; i <= max; i ++) \
 			if (our x [i] && ! Melder_isEncodable (our x [i], encoding)) return false; \
 	}
 
@@ -79,14 +79,14 @@
 
 #define oo_STRUCT_VECTOR_FROM(Type,x,min,max)  \
 	if (our x) { \
-		for (long i = min; i <= max; i ++) \
+		for (integer i = min; i <= max; i ++) \
 			if (! our x [i]. canWriteAsEncoding (encoding)) return false; \
 	}
 
 #define oo_STRUCT_MATRIX_FROM(Type,x,row1,row2,col1,col2)  \
 	if (our x) { \
-		for (long i = row1; i <= row2; i ++) \
-			for (long j = col1; j <= col2; j ++) \
+		for (integer i = row1; i <= row2; i ++) \
+			for (integer j = col1; j <= col2; j ++) \
 				if (! our x [i] [j]. canWriteAsEncoding (encoding)) return false; \
 	}
 
@@ -94,7 +94,7 @@
 	if (our x && ! Data_canWriteAsEncoding (our x.get(), encoding)) return false;
 
 #define oo_COLLECTION_OF(Class,x,ItemClass,version)  \
-	for (long i = 1; i <= x.size; i ++) { \
+	for (integer i = 1; i <= x.size; i ++) { \
 		if (our x.at [i] && ! Data_canWriteAsEncoding (our x.at [i], encoding)) return false; \
 	}
 
diff --git a/sys/oo_COPY.h b/sys/oo_COPY.h
index 1f58afa..843ec26 100644
--- a/sys/oo_COPY.h
+++ b/sys/oo_COPY.h
@@ -61,7 +61,7 @@
 #define oo_STRINGx_VECTOR(storage,x,min,max)  \
 	if (our x) { \
 		thy x = NUMvector <char32*> (min, max); \
-		for (long i = min; i <= max; i ++) \
+		for (integer i = min; i <= max; i ++) \
 			if (our x [i]) thy x [i] = Melder_dup (our x [i]); \
 	}
 
@@ -79,15 +79,15 @@
 #define oo_STRUCT_VECTOR_FROM(Type,x,min,max)  \
 	if (x) { \
 		thy x = NUMvector <struct##Type> (min, max); \
-		for (long i = min; i <= max; i ++) \
+		for (integer i = min; i <= max; i ++) \
 			our x [i]. copy (& thy x [i]); \
 	}
 
 #define oo_STRUCT_MATRIX_FROM(Type,x,row1,row2,col1,col2)  \
 	if (our x) { \
 		thy x = NUMmatrix <struct##Type> (row1, row2, col1, col2); \
-		for (long i = row1; i <= row2; i ++) \
-			for (long j = col1; j <= col2; j ++) \
+		for (integer i = row1; i <= row2; i ++) \
+			for (integer j = col1; j <= col2; j ++) \
 				our x [i] [j]. copy (& thy x [i] [j]); \
 	}
 
@@ -103,7 +103,7 @@
 	thy x._capacity = our x._capacity; \
 	thy x._ownItems = our x._ownItems; \
 	thy x._ownershipInitialized = our x._ownershipInitialized; \
-	for (long i = 1; i <= our x.size; i ++) { \
+	for (integer i = 1; i <= our x.size; i ++) { \
 		if (our x.at [i]) thy x.at [i] = Data_copy (our x.at [i]).releaseToAmbiguousOwner(); \
 	}
 
diff --git a/sys/oo_DESCRIPTION.h b/sys/oo_DESCRIPTION.h
index 4cc24e2..05c8d4c 100644
--- a/sys/oo_DESCRIPTION.h
+++ b/sys/oo_DESCRIPTION.h
@@ -26,18 +26,14 @@
 #define oo_INT(x)  { U"" #x, intwa, Melder_offsetof (ooSTRUCT, x), sizeof (int), 0, 0, 0, nullptr, nullptr, nullptr, nullptr },
 #undef oo_INT32
 #define oo_INT32(x)  { U"" #x, intwa, Melder_offsetof (ooSTRUCT, x), sizeof (int32), 0, 0, 0, nullptr, nullptr, nullptr, nullptr },
-#undef oo_LONG
-#define oo_LONG(x)  { U"" #x, longwa, Melder_offsetof (ooSTRUCT, x), sizeof (long), 0, 0, 0, nullptr, nullptr, nullptr, nullptr },
 #undef oo_INTEGER
 #define oo_INTEGER(x)  { U"" #x, integerwa, Melder_offsetof (ooSTRUCT, x), sizeof (integer), 0, 0, 0, nullptr, nullptr, nullptr, nullptr },
 #undef oo_UBYTE
 #define oo_UBYTE(x)  { U"" #x, ubytewa, Melder_offsetof (ooSTRUCT, x), sizeof (unsigned char), 0, 0, 0, nullptr, nullptr, nullptr, nullptr },
 #undef oo_UINT
 #define oo_UINT(x)  { U"" #x, uintwa, Melder_offsetof (ooSTRUCT, x), sizeof (unsigned int), 0, 0, 0, nullptr, nullptr, nullptr, nullptr },
-#undef oo_ULONG
-#define oo_ULONG(x)  { U"" #x, ulongwa, Melder_offsetof (ooSTRUCT, x), sizeof (unsigned long), 0, 0, 0, nullptr, nullptr, nullptr, nullptr },
-#undef oo_BOOL
-#define oo_BOOL(x)  { U"" #x, boolwa, Melder_offsetof (ooSTRUCT, x), sizeof (bool), 0, 0, 0, nullptr, nullptr, nullptr, nullptr },
+#undef oo_UINTEGER
+#define oo_UINTEGER(x)  { U"" #x, uintegerwa, Melder_offsetof (ooSTRUCT, x), sizeof (uinteger), 0, 0, 0, nullptr, nullptr, nullptr, nullptr },
 #undef oo_FLOAT
 #define oo_FLOAT(x)  { U"" #x, floatwa, Melder_offsetof (ooSTRUCT, x), sizeof (double), 0, 0, 0, nullptr, nullptr, nullptr, nullptr },
 #undef oo_DOUBLE
@@ -51,16 +47,14 @@
 #define oo_BYTE_ARRAY(x,cap,n)  { U"" #x, bytewa, Melder_offsetof (ooSTRUCT, x), sizeof (signed char), 0, 0, - cap, nullptr, U"" #n, nullptr, nullptr },
 #undef oo_INT_ARRAY
 #define oo_INT_ARRAY(x,cap,n)  { U"" #x, intwa, Melder_offsetof (ooSTRUCT, x), sizeof (int), 0, 0, - cap, nullptr, U"" #n, nullptr, nullptr },
-#undef oo_LONG_ARRAY
-#define oo_LONG_ARRAY(x,cap,n)  { U"" #x, longwa, Melder_offsetof (ooSTRUCT, x), sizeof (long), 0, 0, - cap, nullptr, U"" #n, nullptr, nullptr },
+#undef oo_INTEGER_ARRAY
+#define oo_INTEGER_ARRAY(x,cap,n)  { U"" #x, integerwa, Melder_offsetof (ooSTRUCT, x), sizeof (integer), 0, 0, - cap, nullptr, U"" #n, nullptr, nullptr },
 #undef oo_UBYTE_ARRAY
 #define oo_UBYTE_ARRAY(x,cap,n)  { U"" #x, ubytewa, Melder_offsetof (ooSTRUCT, x), sizeof (unsigned char), 0, 0, - cap, nullptr, U"" #n, nullptr, nullptr },
 #undef oo_UINT_ARRAY
 #define oo_UINT_ARRAY(x,cap,n)  { U"" #x, uintwa, Melder_offsetof (ooSTRUCT, x), sizeof (unsigned int), 0, 0, - cap, nullptr, U"" #n, nullptr, nullptr },
-#undef oo_ULONG_ARRAY
-#define oo_ULONG_ARRAY(x,cap,n)  { U"" #x, ulongwa, Melder_offsetof (ooSTRUCT, x), sizeof (unsigned long), 0, 0, - cap, nullptr, U"" #n, nullptr, nullptr },
-#undef oo_BOOL_ARRAY
-#define oo_BOOL_ARRAY(x,cap,n)  { U"" #x, boolwa, Melder_offsetof (ooSTRUCT, x), sizeof (bool), 0, 0, - cap, nullptr, U"" #n, nullptr, nullptr },
+#undef oo_UINTEGER_ARRAY
+#define oo_UINTEGER_ARRAY(x,cap,n)  { U"" #x, uintegerwa, Melder_offsetof (ooSTRUCT, x), sizeof (uinteger), 0, 0, - cap, nullptr, U"" #n, nullptr, nullptr },
 #undef oo_FLOAT_ARRAY
 #define oo_FLOAT_ARRAY(x,cap,n)  { U"" #x, floatwa, Melder_offsetof (ooSTRUCT, x), sizeof (double), 0, 0, - cap, nullptr, U"" #n, nullptr, nullptr },
 #undef oo_DOUBLE_ARRAY
@@ -74,16 +68,14 @@
 #define oo_BYTE_SET(x,setType)  { U"" #x, bytewa, Melder_offsetof (ooSTRUCT, x), sizeof (signed char), 0, 0, 3, (const char32 *) setType##_getText, (const char32 *) setType##_getValue, nullptr, nullptr }, /* BUG function pointer to pointer */
 #undef oo_INT_SET
 #define oo_INT_SET(x,setType)  { U"" #x, intwa, Melder_offsetof (ooSTRUCT, x), sizeof (int), 0, 0, 3, (const char32 *) setType##_getText, (const char32 *) setType##_getValue, nullptr, nullptr },
-#undef oo_LONG_SET
-#define oo_LONG_SET(x,setType)  { U"" #x, longwa, Melder_offsetof (ooSTRUCT, x), sizeof (long), 0, 0, 3, (const char32 *) setType##_getText, (const char32 *) setType##_getValue, nullptr, nullptr },
+#undef oo_INTEGER_SET
+#define oo_INTEGER_SET(x,setType)  { U"" #x, integerwa, Melder_offsetof (ooSTRUCT, x), sizeof (integer), 0, 0, 3, (const char32 *) setType##_getText, (const char32 *) setType##_getValue, nullptr, nullptr },
 #undef oo_UBYTE_SET
 #define oo_UBYTE_SET(x,setType)  { U"" #x, ubytewa, Melder_offsetof (ooSTRUCT, x), sizeof (unsigned char), 0, 0, 3, (const char32 *) setType##_getText, (const char32 *) setType##_getValue, nullptr, nullptr },
 #undef oo_UINT_SET
 #define oo_UINT_SET(x,setType)  { U"" #x, uintwa, Melder_offsetof (ooSTRUCT, x), sizeof (unsigned int), 0, 0, 3, (const char32 *) setType##_getText, (const char32 *) setType##_getValue, nullptr, nullptr },
-#undef oo_ULONG_SET
-#define oo_ULONG_SET(x,setType)  { U"" #x, ulongwa, Melder_offsetof (ooSTRUCT, x), sizeof (unsigned long), 0, 0, 3, (const char32 *) setType##_getText, (const char32 *) setType##_getValue, nullptr, nullptr },
-#undef oo_BOOL_SET
-#define oo_BOOL_SET(x,setType)  { U"" #x, boolwa, Melder_offsetof (ooSTRUCT, x), sizeof (bool), 0, 0, 3, (const char32 *) setType##_getText, (const char32 *) setType##_getValue, nullptr, nullptr },
+#undef oo_UINTEGER_SET
+#define oo_UINTEGER_SET(x,setType)  { U"" #x, uintegerwa, Melder_offsetof (ooSTRUCT, x), sizeof (uinteger), 0, 0, 3, (const char32 *) setType##_getText, (const char32 *) setType##_getValue, nullptr, nullptr },
 #undef oo_FLOAT_SET
 #define oo_FLOAT_SET(x,setType)  { U"" #x, floatwa, Melder_offsetof (ooSTRUCT, x), sizeof (double), 0, 0, 3, (const char32 *) setType##_getText, (const char32 *) setType##_getValue, nullptr, nullptr },
 #undef oo_DOUBLE_SET
@@ -97,16 +89,14 @@
 #define oo_BYTE_VECTOR_FROM(x,min,max)  { U"" #x, bytewa, Melder_offsetof (ooSTRUCT, x), sizeof (signed char), 0, 0, 1, U"" #min, U"" #max, nullptr, nullptr },
 #undef oo_INT_VECTOR_FROM
 #define oo_INT_VECTOR_FROM(x,min,max)  { U"" #x, intwa, Melder_offsetof (ooSTRUCT, x), sizeof (int), 0, 0, 1, U"" #min, U"" #max, nullptr, nullptr },
-#undef oo_LONG_VECTOR_FROM
-#define oo_LONG_VECTOR_FROM(x,min,max)  { U"" #x, longwa, Melder_offsetof (ooSTRUCT, x), sizeof (long), 0, 0, 1, U"" #min, U"" #max, nullptr, nullptr },
+#undef oo_INTEGER_VECTOR_FROM
+#define oo_INTEGER_VECTOR_FROM(x,min,max)  { U"" #x, integerwa, Melder_offsetof (ooSTRUCT, x), sizeof (integer), 0, 0, 1, U"" #min, U"" #max, nullptr, nullptr },
 #undef oo_UBYTE_VECTOR_FROM
 #define oo_UBYTE_VECTOR_FROM(x,min,max)  { U"" #x, ubytewa, Melder_offsetof (ooSTRUCT, x), sizeof (unsigned char), 0, 0, 1, U"" #min, U"" #max, nullptr, nullptr },
 #undef oo_UINT_VECTOR_FROM
 #define oo_UINT_VECTOR_FROM(x,min,max)  { U"" #x, uintwa, Melder_offsetof (ooSTRUCT, x), sizeof (unsigned int), 0, 0, 1, U"" #min, U"" #max, nullptr, nullptr },
-#undef oo_ULONG_VECTOR_FROM
-#define oo_ULONG_VECTOR_FROM(x,min,max)  { U"" #x, ulongwa, Melder_offsetof (ooSTRUCT, x), sizeof (unsigned long), 0, 0, 1, U"" #min, U"" #max, nullptr, nullptr },
-#undef oo_BOOL_VECTOR_FROM
-#define oo_BOOL_VECTOR_FROM(x,min,max)  { U"" #x, boolwa, Melder_offsetof (ooSTRUCT, x), sizeof (bool), 0, 0, 1, U"" #min, U"" #max, nullptr, nullptr },
+#undef oo_UINTEGER_VECTOR_FROM
+#define oo_UINTEGER_VECTOR_FROM(x,min,max)  { U"" #x, uintegerwa, Melder_offsetof (ooSTRUCT, x), sizeof (uinteger), 0, 0, 1, U"" #min, U"" #max, nullptr, nullptr },
 #undef oo_FLOAT_VECTOR_FROM
 #define oo_FLOAT_VECTOR_FROM(x,min,max)  { U"" #x, floatwa, Melder_offsetof (ooSTRUCT, x), sizeof (double), 0, 0, 1, U"" #min, U"" #max, nullptr, nullptr },
 #undef oo_DOUBLE_VECTOR_FROM
@@ -120,16 +110,14 @@
 #define oo_BYTE_MATRIX_FROM(x,r1,r2,c1,c2)  { U"" #x, bytewa, Melder_offsetof (ooSTRUCT, x), sizeof (signed char), 0, 0, 2, U"" #r1, U"" #r2, U"" #c1, U"" #c2 },
 #undef oo_INT_MATRIX_FROM
 #define oo_INT_MATRIX_FROM(x,r1,r2,c1,c2)  { U"" #x, intwa, Melder_offsetof (ooSTRUCT, x), sizeof (int), 0, 0, 2, U"" #r1, U"" #r2, U"" #c1, U"" #c2 },
-#undef oo_LONG_MATRIX_FROM
-#define oo_LONG_MATRIX_FROM(x,r1,r2,c1,c2)  { U"" #x, longwa, Melder_offsetof (ooSTRUCT, x), sizeof (long), 0, 0, 2, U"" #r1, U"" #r2, U"" #c1, U"" #c2 },
+#undef oo_INTEGER_MATRIX_FROM
+#define oo_INTEGER_MATRIX_FROM(x,r1,r2,c1,c2)  { U"" #x, integerwa, Melder_offsetof (ooSTRUCT, x), sizeof (integer), 0, 0, 2, U"" #r1, U"" #r2, U"" #c1, U"" #c2 },
 #undef oo_UBYTE_MATRIX_FROM
 #define oo_UBYTE_MATRIX_FROM(x,r1,r2,c1,c2)  { U"" #x, ubytewa, Melder_offsetof (ooSTRUCT, x), sizeof (unsigned char), 0, 0, 2, U"" #r1, U"" #r2, U"" #c1, U"" #c2 },
 #undef oo_UINT_MATRIX_FROM
 #define oo_UINT_MATRIX_FROM(x,r1,r2,c1,c2)  { U"" #x, uintwa, Melder_offsetof (ooSTRUCT, x), sizeof (unsigned int), 0, 0, 2, U"" #r1, U"" #r2, U"" #c1, U"" #c2 },
-#undef oo_ULONG_MATRIX_FROM
-#define oo_ULONG_MATRIX_FROM(x,r1,r2,c1,c2)  { U"" #x, ulongwa, Melder_offsetof (ooSTRUCT, x), sizeof (unsigned long), 0, 0, 2, U"" #r1, U"" #r2, U"" #c1, U"" #c2 },
-#undef oo_BOOL_MATRIX_FROM
-#define oo_BOOL_MATRIX_FROM(x,r1,r2,c1,c2)  { U"" #x, boolwa, Melder_offsetof (ooSTRUCT, x), sizeof (bool), 0, 0, 2, U"" #r1, U"" #r2, U"" #c1, U"" #c2 },
+#undef oo_UINTEGER_MATRIX_FROM
+#define oo_UINTEGER_MATRIX_FROM(x,r1,r2,c1,c2)  { U"" #x, uintegerwa, Melder_offsetof (ooSTRUCT, x), sizeof (uinteger), 0, 0, 2, U"" #r1, U"" #r2, U"" #c1, U"" #c2 },
 #undef oo_FLOAT_MATRIX_FROM
 #define oo_FLOAT_MATRIX_FROM(x,r1,r2,c1,c2)  { U"" #x, floatwa, Melder_offsetof (ooSTRUCT, x), sizeof (double), 0, 0, 2, U"" #r1, U"" #r2, U"" #c1, U"" #c2 },
 #undef oo_DOUBLE_MATRIX_FROM
@@ -143,16 +131,14 @@
 #define oo_BYTE_VECTOR(x,n)  { U"" #x, bytewa, Melder_offsetof (ooSTRUCT, x), sizeof (signed char), 0, 0, 1, nullptr, U"" #n, nullptr, nullptr },
 #undef oo_INT_VECTOR
 #define oo_INT_VECTOR(x,n)  { U"" #x, intwa, Melder_offsetof (ooSTRUCT, x), sizeof (int), 0, 0, 1, nullptr, U"" #n, nullptr, nullptr },
-#undef oo_LONG_VECTOR
-#define oo_LONG_VECTOR(x,n)  { U"" #x, longwa, Melder_offsetof (ooSTRUCT, x), sizeof (long), 0, 0, 1, nullptr, U"" #n, nullptr, nullptr },
+#undef oo_INTEGER_VECTOR
+#define oo_INTEGER_VECTOR(x,n)  { U"" #x, integerwa, Melder_offsetof (ooSTRUCT, x), sizeof (integer), 0, 0, 1, nullptr, U"" #n, nullptr, nullptr },
 #undef oo_UBYTE_VECTOR
 #define oo_UBYTE_VECTOR(x,n)  { U"" #x, ubytewa, Melder_offsetof (ooSTRUCT, x), sizeof (unsigned char), 0, 0, 1, nullptr, U"" #n, nullptr, nullptr },
 #undef oo_UINT_VECTOR
 #define oo_UINT_VECTOR(x,n)  { U"" #x, uintwa, Melder_offsetof (ooSTRUCT, x), sizeof (unsigned int), 0, 0, 1, nullptr, U"" #n, nullptr, nullptr },
-#undef oo_ULONG_VECTOR
-#define oo_ULONG_VECTOR(x,n)  { U"" #x, ulongwa, Melder_offsetof (ooSTRUCT, x), sizeof (unsigned long), 0, 0, 1, nullptr, U"" #n, nullptr, nullptr },
-#undef oo_BOOL_VECTOR
-#define oo_BOOL_VECTOR(x,n)  { U"" #x, boolwa, Melder_offsetof (ooSTRUCT, x), sizeof (bool), 0, 0, 1, nullptr, U"" #n, nullptr, nullptr },
+#undef oo_UINTEGER_VECTOR
+#define oo_UINTEGER_VECTOR(x,n)  { U"" #x, uintegerwa, Melder_offsetof (ooSTRUCT, x), sizeof (uinteger), 0, 0, 1, nullptr, U"" #n, nullptr, nullptr },
 #undef oo_FLOAT_VECTOR
 #define oo_FLOAT_VECTOR(x,n)  { U"" #x, floatwa, Melder_offsetof (ooSTRUCT, x), sizeof (double), 0, 0, 1, nullptr, U"" #n, nullptr, nullptr },
 #undef oo_DOUBLE_VECTOR
@@ -166,16 +152,14 @@
 #define oo_BYTE_MATRIX(x,nrow,ncol)  { U"" #x, bytewa, Melder_offsetof (ooSTRUCT, x), sizeof (signed char), 0, 0, 2, nullptr, U"" #nrow, (const char32 *) 0, U"" #ncol },
 #undef oo_INT_MATRIX
 #define oo_INT_MATRIX(x,nrow,ncol)  { U"" #x, intwa, Melder_offsetof (ooSTRUCT, x), sizeof (int), 0, 0, 2, nullptr, U"" #nrow, (const char32 *) 0, U"" #ncol },
-#undef oo_LONG_MATRIX
-#define oo_LONG_MATRIX(x,nrow,ncol)  { U"" #x, longwa, Melder_offsetof (ooSTRUCT, x), sizeof (long), 0, 0, 2, nullptr, U"" #nrow, (const char32 *) 0, U"" #ncol },
+#undef oo_INTEGER_MATRIX
+#define oo_INTEGER_MATRIX(x,nrow,ncol)  { U"" #x, integerwa, Melder_offsetof (ooSTRUCT, x), sizeof (integer), 0, 0, 2, nullptr, U"" #nrow, (const char32 *) 0, U"" #ncol },
 #undef oo_UBYTE_MATRIX
 #define oo_UBYTE_MATRIX(x,nrow,ncol)  { U"" #x, ubytewa, Melder_offsetof (ooSTRUCT, x), sizeof (unsigned char), 0, 0, 2, nullptr, U"" #nrow, (const char32 *) 0, U"" #ncol },
 #undef oo_UINT_MATRIX
 #define oo_UINT_MATRIX(x,nrow,ncol)  { U"" #x, uintwa, Melder_offsetof (ooSTRUCT, x), sizeof (unsigned int), 0, 0, 2, nullptr, U"" #nrow, (const char32 *) 0, U"" #ncol },
-#undef oo_ULONG_MATRIX
-#define oo_ULONG_MATRIX(x,nrow,ncol)  { U"" #x, ulongwa, Melder_offsetof (ooSTRUCT, x), sizeof (unsigned long), 0, 0, 2, nullptr, U"" #nrow, (const char32 *) 0, U"" #ncol },
-#undef oo_BOOL_MATRIX
-#define oo_BOOL_MATRIX(x,nrow,ncol)  { U"" #x, boolwa, Melder_offsetof (ooSTRUCT, x), sizeof (bool), 0, 0, 2, nullptr, U"" #nrow, (const char32 *) 0, U"" #ncol },
+#undef oo_UINTEGER_MATRIX
+#define oo_UINTEGER_MATRIX(x,nrow,ncol)  { U"" #x, uintegerwa, Melder_offsetof (ooSTRUCT, x), sizeof (uinteger), 0, 0, 2, nullptr, U"" #nrow, (const char32 *) 0, U"" #ncol },
 #undef oo_FLOAT_MATRIX
 #define oo_FLOAT_MATRIX(x,nrow,ncol)  { U"" #x, floatwa, Melder_offsetof (ooSTRUCT, x), sizeof (double), 0, 0, 2, nullptr, U"" #nrow, (const char32 *) 0, U"" #ncol },
 #undef oo_DOUBLE_MATRIX
diff --git a/sys/oo_DESTROY.h b/sys/oo_DESTROY.h
index 904cd59..5642c8e 100644
--- a/sys/oo_DESTROY.h
+++ b/sys/oo_DESTROY.h
@@ -53,7 +53,7 @@
 
 #define oo_STRINGx_VECTOR(storage,x,min,max)  \
 	if (our x) { \
-		for (long i = min; i <= max; i ++) \
+		for (integer i = min; i <= max; i ++) \
 			Melder_free (our x [i]); \
 		NUMvector_free <char32*> (our x, min); \
 	}
@@ -71,15 +71,15 @@
 
 #define oo_STRUCT_VECTOR_FROM(Type,x,min,max)  \
 	if (our x) { \
-		for (long i = min; i <= max; i ++) \
+		for (integer i = min; i <= max; i ++) \
 			our x [i]. destroy (); \
 		NUMvector_free <struct##Type> (our x, min); \
 	}
 
 #define oo_STRUCT_MATRIX_FROM(Type,x,row1,row2,col1,col2)  \
 	if (our x) { \
-		for (long i = row1; i <= row2; i ++) \
-			for (long j = col1; j <= col2; j ++) \
+		for (integer i = row1; i <= row2; i ++) \
+			for (integer j = col1; j <= col2; j ++) \
 				our x [i] [j]. destroy (); \
 		NUMmatrix_free <struct##Type> (our x, row1, col1); \
 	}
diff --git a/sys/oo_EQUAL.h b/sys/oo_EQUAL.h
index 59279e4..5f36217 100644
--- a/sys/oo_EQUAL.h
+++ b/sys/oo_EQUAL.h
@@ -64,7 +64,7 @@
 #define oo_STRINGx_VECTOR(storage,x,min,max)  \
 	if (! our x != ! thy x) return false; \
 	if (our x) { \
-		for (long i = min; i <= max; i ++) \
+		for (integer i = min; i <= max; i ++) \
 			if (! Melder_equ (our x [i], thy x [i])) return false; \
 	}
 
@@ -82,15 +82,15 @@
 #define oo_STRUCT_VECTOR_FROM(Type,x,min,max)  \
 	if (! our x != ! thy x) return false; \
 	if (our x) { \
-		for (long i = min; i <= max; i ++) \
+		for (integer i = min; i <= max; i ++) \
 			if (! our x [i]. equal (& thy x [i])) return false; \
 	}
 
 #define oo_STRUCT_MATRIX_FROM(Type,x,row1,row2,col1,col2)  \
 	if (! our x != ! thy x) return false; \
 	if (our x) { \
-		for (long i = row1; i <= row2; i ++) \
-			for (long j = col1; j <= col2; j ++) \
+		for (integer i = row1; i <= row2; i ++) \
+			for (integer j = col1; j <= col2; j ++) \
 				if (! our x [i] [j]. equal (& thy x [i] [j])) return false; \
 	}
 
@@ -98,7 +98,7 @@
 	if (! our x != ! thy x || (our x && ! Data_equal (our x.get(), thy x.get()))) return false;
 
 #define oo_COLLECTION_OF(Class,x,ItemClass,version)  \
-	for (long i = 1; i <= our x.size; i ++) { \
+	for (integer i = 1; i <= our x.size; i ++) { \
 		if (! our x.at [i] != ! thy x.at [i] || (our x.at [i] && ! Data_equal (our x.at [i], thy x.at [i]))) return false; \
 	}
 
diff --git a/sys/oo_READ_BINARY.h b/sys/oo_READ_BINARY.h
index baffc06..d648334 100644
--- a/sys/oo_READ_BINARY.h
+++ b/sys/oo_READ_BINARY.h
@@ -80,7 +80,7 @@
 #define oo_STRINGx_VECTOR(storage,x,min,max)  \
 	if (max >= min) { \
 		our x = NUMvector <char32 *> (min, max); \
-		for (long i = min; i <= max; i ++) { \
+		for (integer i = min; i <= max; i ++) { \
 			our x [i] = binget##storage (f); \
 		} \
 	}
@@ -102,7 +102,7 @@
 #define oo_STRUCT_VECTOR_FROM(Type,x,min,max)  \
 	if (max >= min) { \
 		our x = NUMvector <struct##Type> (min, max); \
-		for (long i = min; i <= max; i ++) { \
+		for (integer i = min; i <= max; i ++) { \
 			our x [i]. readBinary (f, formatVersion); \
 		} \
 	}
@@ -110,8 +110,8 @@
 #define oo_STRUCT_MATRIX_FROM(Type,x,row1,row2,col1,col2)  \
 	if (row2 >= row1 && col2 >= col1) { \
 		our x = NUMmatrix <struct##Type> (row1, row2, col1, col2); \
-		for (long i = row1; i <= row2; i ++) { \
-			for (long j = col1; j <= col2; j ++) { \
+		for (integer i = row1; i <= row2; i ++) { \
+			for (integer j = col1; j <= col2; j ++) { \
 				our x [i] [j]. readBinary (f, formatVersion); \
 			} \
 		} \
diff --git a/sys/oo_READ_TEXT.h b/sys/oo_READ_TEXT.h
index 80d6cba..bb35dac 100644
--- a/sys/oo_READ_TEXT.h
+++ b/sys/oo_READ_TEXT.h
@@ -27,7 +27,7 @@
 
 #define oo_ARRAY(type,storage,x,cap,n)  \
 	if (n > cap) Melder_throw (U"Number of \"" #x U"\" (", n, U") greater than ", cap, U"."); \
-	for (long i = 0; i < n; i ++) { \
+	for (integer i = 0; i < n; i ++) { \
 		try { \
 			our x [i] = texget##storage (a_text); \
 		} catch (MelderError) { \
@@ -36,7 +36,7 @@
 	}
 
 #define oo_SET(type,storage,x,setType)  \
-	for (long i = 0; i <= (int) setType::MAX; i ++) { \
+	for (integer i = 0; i <= (int) setType::MAX; i ++) { \
 		try { \
 			our x [i] = texget##storage (a_text); \
 		} catch (MelderError) { \
@@ -85,19 +85,19 @@
 
 #define oo_STRINGx_ARRAY(storage,x,cap,n)  \
 	if (n > cap) Melder_throw (U"Number of \"" #x U"\" (", n, U") greater than ", cap, U"."); \
-	for (long i = 0; i < n; i ++) { \
+	for (integer i = 0; i < n; i ++) { \
 		our x [i] = texget##storage (a_text); \
 	}
 
 #define oo_STRINGx_SET(storage,x,setType)  \
-	for (long i = 0; i <= setType::MAX; i ++) { \
+	for (integer i = 0; i <= setType::MAX; i ++) { \
 		our x [i] = texget##storage (a_text); \
 	}
 
 #define oo_STRINGx_VECTOR(storage,x,min,max)  \
 	if (max >= min) { \
 		our x = NUMvector <char32*> (min, max); \
-		for (long i = min; i <= max; i ++) { \
+		for (integer i = min; i <= max; i ++) { \
 			try { \
 				our x [i] = texget##storage (a_text); \
 			} catch (MelderError) { \
@@ -111,19 +111,19 @@
 
 #define oo_STRUCT_ARRAY(Type,x,cap,n) \
 	if (n > cap) Melder_throw (U"Number of \"" #x U"\" (", n, U") greater than ", cap, U"."); \
-	for (long i = 0; i < n; i ++) { \
+	for (integer i = 0; i < n; i ++) { \
 		our x [i]. readText (a_text, formatVersion); \
 	}
 
 #define oo_STRUCT_SET(Type,x,setType) \
-	for (long i = 0; i <= (int) setType::MAX; i ++) { \
+	for (integer i = 0; i <= (int) setType::MAX; i ++) { \
 		our x [i]. readText (a_text, formatVersion); \
 	}
 
 #define oo_STRUCT_VECTOR_FROM(Type,x,min,max)  \
 	if (max >= min) { \
 		our x = NUMvector <struct##Type> (min, max); \
-		for (long i = min; i <= max; i ++) { \
+		for (integer i = min; i <= max; i ++) { \
 			our x [i]. readText (a_text, formatVersion); \
 		} \
 	}
@@ -131,8 +131,8 @@
 #define oo_STRUCT_MATRIX_FROM(Type,x,row1,row2,col1,col2)  \
 	if (row2 >= row1 && col2 >= col1) { \
 		our x = NUMmatrix <struct##Type> (row1, row2, col1, col2); \
-		for (long i = row1; i <= row2; i ++) { \
-			for (long j = col1; j <= col2; j ++) { \
+		for (integer i = row1; i <= row2; i ++) { \
+			for (integer j = col1; j <= col2; j ++) { \
 				our x [i] [j]. readText (a_text, formatVersion); \
 			} \
 		} \
@@ -146,8 +146,8 @@
 
 #define oo_COLLECTION_OF(Class,x,ItemClass,formatVersion)  \
 	{ \
-		long n = texgeti32 (a_text); \
-		for (long i = 1; i <= n; i ++) { \
+		integer n = texgeti32 (a_text); \
+		for (integer i = 1; i <= n; i ++) { \
 			auto##ItemClass item = Thing_new (ItemClass); \
 			item -> v_readText (a_text, formatVersion); \
 			our x.addItem_move (item.move()); \
@@ -156,9 +156,9 @@
 
 #define oo_AUTO_COLLECTION(Class,x,ItemClass,formatVersion)  \
 	{ \
-		long n = texgeti32 (a_text); \
+		integer n = texgeti32 (a_text); \
 		our x = Class##_create (); \
-		for (long i = 1; i <= n; i ++) { \
+		for (integer i = 1; i <= n; i ++) { \
 			auto##ItemClass item = Thing_new (ItemClass); \
 			item -> v_readText (a_text, formatVersion); \
 			our x -> addItem_move (item.move()); \
diff --git a/sys/oo_WRITE_BINARY.h b/sys/oo_WRITE_BINARY.h
index cfcd842..6858b6f 100644
--- a/sys/oo_WRITE_BINARY.h
+++ b/sys/oo_WRITE_BINARY.h
@@ -64,7 +64,7 @@
 		binput##storage (our x [i], f);
 
 #define oo_STRINGx_VECTOR(storage,x,min,max)  \
-	for (long i = min; i <= max; i ++) \
+	for (integer i = min; i <= max; i ++) \
 		binput##storage (our x [i], f);
 
 #define oo_STRUCT(Type,x)  \
@@ -79,12 +79,12 @@
 		our x [i]. writeBinary (f);
 
 #define oo_STRUCT_VECTOR_FROM(Type,x,min,max)  \
-	for (long i = min; i <= max; i ++) \
+	for (integer i = min; i <= max; i ++) \
 		our x [i]. writeBinary (f);
 
 #define oo_STRUCT_MATRIX_FROM(Type,x,row1,row2,col1,col2)  \
-	for (long i = row1; i <= row2; i ++) \
-		for (long j = col1; j <= col2; j ++) \
+	for (integer i = row1; i <= row2; i ++) \
+		for (integer j = col1; j <= col2; j ++) \
 			our x [i] [j]. writeBinary (f);
 
 #define oo_AUTO_OBJECT(Class,version,x)  \
@@ -94,7 +94,7 @@
 
 #define oo_COLLECTION_OF(Class,x,ItemClass,version)  \
 	binputi32 (our x.size, f); \
-	for (long i = 1; i <= our x.size; i ++) { \
+	for (integer i = 1; i <= our x.size; i ++) { \
 		ItemClass data = our x.at [i]; \
 		data -> struct##ItemClass :: v_writeBinary (f); \
 	}
@@ -102,7 +102,7 @@
 #define oo_AUTO_COLLECTION(Class,x,ItemClass,version)  \
 	binputi32 (our x ? our x->size : 0, f); \
 	if (our x) { \
-		for (long i = 1; i <= our x->size; i ++) { \
+		for (integer i = 1; i <= our x->size; i ++) { \
 			ItemClass data = our x->at [i]; \
 			data -> struct##ItemClass :: v_writeBinary (f); \
 		} \
diff --git a/sys/oo_WRITE_TEXT.h b/sys/oo_WRITE_TEXT.h
index af56bf9..1e0d50a 100644
--- a/sys/oo_WRITE_TEXT.h
+++ b/sys/oo_WRITE_TEXT.h
@@ -58,7 +58,7 @@
 
 //#define oo_ENUMx_VECTOR(kType,storage,x,min,max)  \
 //	texputintro (file, U"" #x U" []: ", max >= min ? nullptr : U"(empty)", 0,0,0,0); \
-//	for (long i = min; i <= max; i ++) \
+//	for (integer i = min; i <= max; i ++) \
 //		texput##storage (file, (int) our x [i], (const char32* (*) (int)) kType##_getText, U"" #x U" [", Melder_integer (i), U"]", 0,0,0); \
 //	texexdent (file);
 
@@ -79,7 +79,7 @@
 
 #define oo_STRINGx_VECTOR(storage,x,min,max)  \
 	texputintro (file, U"" #x U" []: ", max >= min ? nullptr : U"(empty)", 0,0,0,0); \
-	for (long i = min; i <= max; i ++) \
+	for (integer i = min; i <= max; i ++) \
 		texput##storage (file, our x [i], U"" #x U" [", Melder_integer (i), U"]", 0,0,0); \
 	texexdent (file);
 
@@ -108,7 +108,7 @@
 
 #define oo_STRUCT_VECTOR_FROM(Type,x,min,max)  \
 	texputintro (file, U"" #x U" []: ", max >= min ? nullptr : U"(empty)", 0,0,0,0); \
-	for (long i = min; i <= max; i ++) { \
+	for (integer i = min; i <= max; i ++) { \
 		texputintro (file, U"" #x U" [", Melder_integer (i), U"]:", 0,0,0); \
 		our x [i]. writeText (file); \
 		texexdent (file); \
@@ -117,9 +117,9 @@
 
 #define oo_STRUCT_MATRIX_FROM(Type,x,row1,row2,col1,col2)  \
 	texputintro (file, U"" #x U" [] []: ", row2 >= row1 ? nullptr : U"(empty)", 0,0,0,0); \
-	for (long i = row1; i <= row2; i ++) { \
+	for (integer i = row1; i <= row2; i ++) { \
 		texputintro (file, U"" #x U" [", Melder_integer (i), U"]:", 0,0,0); \
-		for (long j = col1; j <= col2; j ++) { \
+		for (integer j = col1; j <= col2; j ++) { \
 			texputintro (file, U"" #x U" [", Melder_integer (i), U"] [", Melder_integer (j), U"]:", 0); \
 			our x [i] [j]. writeText (file); \
 			texexdent (file); \
@@ -135,7 +135,7 @@
 
 #define oo_COLLECTION_OF(Class,x,ItemClass,version)  \
 	texputi32 (file, our x.size, U"" #x U": size", 0,0,0,0,0); \
-	for (long i = 1; i <= our x.size; i ++) { \
+	for (integer i = 1; i <= our x.size; i ++) { \
 		ItemClass data = our x.at [i]; \
 		texputintro (file, U"" #x U" [", Melder_integer (i), U"]:", 0,0,0); \
 		data -> struct##ItemClass :: v_writeText (file); \
@@ -145,7 +145,7 @@
 #define oo_AUTO_COLLECTION(Class,x,ItemClass,version)  \
 	texputi32 (file, our x ? our x->size : 0, U"" #x U": size", 0,0,0,0,0); \
 	if (our x) { \
-		for (long i = 1; i <= our x->size; i ++) { \
+		for (integer i = 1; i <= our x->size; i ++) { \
 			ItemClass data = our x->at [i]; \
 			texputintro (file, U"" #x U" [", Melder_integer (i), U"]:", 0,0,0); \
 			data -> struct##ItemClass :: v_writeText (file); \
diff --git a/sys/praat.cpp b/sys/praat.cpp
index cac8b52..edc5696 100644
--- a/sys/praat.cpp
+++ b/sys/praat.cpp
@@ -108,7 +108,7 @@ static GuiList praatList_objects;
 
 /***** selection *****/
 
-long praat_idOfSelected (ClassInfo klas, int inplace) {
+integer praat_idOfSelected (ClassInfo klas, int inplace) {
 	int place = inplace, IOBJECT;
 	if (place == 0) place = 1;
 	if (place > 0) {
@@ -154,7 +154,7 @@ char32 * praat_nameOfSelected (ClassInfo klas, int inplace) {
 
 int praat_numberOfSelected (ClassInfo klas) {
 	if (! klas) return theCurrentPraatObjects -> totalSelection;
-	long readableClassId = klas -> sequentialUniqueIdOfReadableClass;
+	integer readableClassId = klas -> sequentialUniqueIdOfReadableClass;
 	if (readableClassId == 0) Melder_fatal (U"No sequential unique ID for class ", klas -> className, U".");
 	return theCurrentPraatObjects -> numberOfSelected [readableClassId];
 }
@@ -163,7 +163,7 @@ void praat_deselect (int IOBJECT) {
 	if (! SELECTED) return;
 	SELECTED = false;
 	theCurrentPraatObjects -> totalSelection -= 1;
-	long readableClassId = theCurrentPraatObjects -> list [IOBJECT]. object -> classInfo -> sequentialUniqueIdOfReadableClass;
+	integer readableClassId = theCurrentPraatObjects -> list [IOBJECT]. object -> classInfo -> sequentialUniqueIdOfReadableClass;
 	Melder_assert (readableClassId != 0);
 	theCurrentPraatObjects -> numberOfSelected [readableClassId] -= 1;
 	if (! theCurrentPraatApplication -> batch && ! Melder_backgrounding) {
@@ -181,7 +181,7 @@ void praat_select (int IOBJECT) {
 	theCurrentPraatObjects -> totalSelection += 1;
 	Thing object = theCurrentPraatObjects -> list [IOBJECT]. object;
 	Melder_assert (object);
-	long readableClassId = object -> classInfo -> sequentialUniqueIdOfReadableClass;
+	integer readableClassId = object -> classInfo -> sequentialUniqueIdOfReadableClass;
 	if (readableClassId == 0) Melder_fatal (U"No sequential unique ID for class ", object -> classInfo -> className, U".");
 	theCurrentPraatObjects -> numberOfSelected [readableClassId] += 1;
 	if (! theCurrentPraatApplication -> batch && ! Melder_backgrounding) {
@@ -215,18 +215,31 @@ autoCollection praat_getSelectedObjects () {
 char32 *praat_name (int IOBJECT) { return str32chr (FULL_NAME, U' ') + 1; }
 
 void praat_write_do (UiForm dia, const char32 *extension) {
-	int IOBJECT, found = 0;
-	Daata data = nullptr;
 	static MelderString defaultFileName { };
-	WHERE (SELECTED) { if (! data) data = (Daata) OBJECT; found += 1; }
-	if (found == 1) {
-		MelderString_copy (& defaultFileName, data -> name);
-		if (defaultFileName.length > 200) { defaultFileName.string [200] = U'\0'; defaultFileName.length = 200; }
-		MelderString_append (& defaultFileName, U".", extension ? extension : Thing_className (data));
-	} else if (! extension) {
-		MelderString_copy (& defaultFileName, U"praat.Collection");
+	if (extension && str32chr (extension, '.')) {
+		/*
+			Apparently, the "extension" is a complete file name.
+			This should that this should be used as the default file name.
+			(This case typically occurs when saving a picture.)
+		*/
+		MelderString_copy (& defaultFileName, extension);
 	} else {
-		MelderString_copy (& defaultFileName, U"praat.", extension);
+		/*
+			Apparently, the "extension" is not a complete file name.
+			We are expected to prepend the "extension" with the name of a selected object.
+		*/
+		int IOBJECT, found = 0;
+		Daata data = nullptr;
+		WHERE (SELECTED) { if (! data) data = (Daata) OBJECT; found += 1; }
+		if (found == 1) {
+			MelderString_copy (& defaultFileName, data -> name);
+			if (defaultFileName.length > 200) { defaultFileName.string [200] = U'\0'; defaultFileName.length = 200; }
+			MelderString_append (& defaultFileName, U".", extension ? extension : Thing_className (data));
+		} else if (! extension) {
+			MelderString_copy (& defaultFileName, U"praat.Collection");
+		} else {
+			MelderString_copy (& defaultFileName, U"praat.", extension);
+		}
 	}
 	UiOutfile_do (dia, defaultFileName.string);
 }
@@ -294,7 +307,7 @@ void praat_cleanUpName (char32 *name) {
 /***** objects + commands *****/
 
 static void praat_new_unpackCollection (autoCollection me, const char32* myName) {
-	for (long idata = 1; idata <= my size; idata ++) {
+	for (integer idata = 1; idata <= my size; idata ++) {
 		autoDaata object = autoDaata ((Daata) my at [idata]);
 		my at [idata] = nullptr;   // disown; once the elements are autoThings, the move will handle this
 		const char32 *name = object -> name ? object -> name : myName;
@@ -416,18 +429,18 @@ static void gui_cb_list_selectionChanged (Thing /* boss */, GuiList_SelectionCha
 	bool first = true;
 	WHERE (SELECTED) {
 		SELECTED = false;
-		long readableClassId = theCurrentPraatObjects -> list [IOBJECT]. object -> classInfo -> sequentialUniqueIdOfReadableClass;
+		integer readableClassId = theCurrentPraatObjects -> list [IOBJECT]. object -> classInfo -> sequentialUniqueIdOfReadableClass;
 		theCurrentPraatObjects -> numberOfSelected [readableClassId] --;
 		Melder_assert (theCurrentPraatObjects -> numberOfSelected [readableClassId] >= 0);
 	}
 	theCurrentPraatObjects -> totalSelection = 0;
-	long numberOfSelected;
-	long *selected = GuiList_getSelectedPositions (praatList_objects, & numberOfSelected);
+	integer numberOfSelected;
+	integer *selected = GuiList_getSelectedPositions (praatList_objects, & numberOfSelected);
 	if (selected) {
-		for (long iselected = 1; iselected <= numberOfSelected; iselected ++) {
+		for (integer iselected = 1; iselected <= numberOfSelected; iselected ++) {
 			IOBJECT = selected [iselected];
 			SELECTED = true;
-			long readableClassId = theCurrentPraatObjects -> list [IOBJECT]. object -> classInfo -> sequentialUniqueIdOfReadableClass;
+			integer readableClassId = theCurrentPraatObjects -> list [IOBJECT]. object -> classInfo -> sequentialUniqueIdOfReadableClass;
 			theCurrentPraatObjects -> numberOfSelected [readableClassId] ++;
 			Melder_assert (theCurrentPraatObjects -> numberOfSelected [readableClassId] > 0);
 			UiHistory_write (first ? U"\nselectObject: \"" : U"\nplusObject: \"");
@@ -436,7 +449,7 @@ static void gui_cb_list_selectionChanged (Thing /* boss */, GuiList_SelectionCha
 			first = false;
 			theCurrentPraatObjects -> totalSelection += 1;
 		}
-		NUMvector_free <long> (selected, 1);
+		NUMvector_free (selected, 1);
 	}
 	praat_show ();
 }
@@ -512,7 +525,7 @@ static void praat_exit (int exit_code) {
 					 * which owns the pid (this means sendpraat can only send to the latest Praat if more than one are open).
 					 */
 					autofile f = Melder_fopen (& pidFile, "r");
-					long pid;
+					long_not_integer pid;
 					if (fscanf (f, "%ld", & pid) < 1) throw MelderError ();
 					f.close (& pidFile);
 					if (pid == getpid ()) {   // is the pid in the pid file equal to our pid?
@@ -670,9 +683,9 @@ int praat_installEditorN (Editor editor, DaataList objects) {
 	 * First check whether all objects in the Ordered are also in the List of Objects (Praat crashes if not),
 	 * and check whether there is room to add an editor for each.
 	 */
-	for (long iOrderedObject = 1; iOrderedObject <= objects->size; iOrderedObject ++) {
+	for (integer iOrderedObject = 1; iOrderedObject <= objects->size; iOrderedObject ++) {
 		Daata object = objects->at [iOrderedObject];
-		long iPraatObject = 1;
+		integer iPraatObject = 1;
 		for (; iPraatObject <= theCurrentPraatObjects -> n; iPraatObject ++) {
 			if (object == theCurrentPraatObjects -> list [iPraatObject]. object) {
 				int ieditor = 0;
@@ -693,9 +706,9 @@ int praat_installEditorN (Editor editor, DaataList objects) {
 	/*
 	 * There appears to be room for all elements of the Ordered. The editor window can appear. Install the editor in all objects.
 	 */
-	for (long iOrderedObject = 1; iOrderedObject <= objects->size; iOrderedObject ++) {
+	for (integer iOrderedObject = 1; iOrderedObject <= objects->size; iOrderedObject ++) {
 		Daata object = objects->at [iOrderedObject];
-		long iPraatObject = 1;
+		integer iPraatObject = 1;
 		for (; iPraatObject <= theCurrentPraatObjects -> n; iPraatObject ++) {
 			if (object == theCurrentPraatObjects -> list [iPraatObject]. object) {
 				int ieditor = 0;
@@ -769,7 +782,7 @@ static int publishProc (autoDaata me) {
 /***** QUIT *****/
 
 FORM (DO_Quit, U"Confirm Quit", U"Quit") {
-	LABEL (U"label", U"You have objects in your list!")
+	MUTABLE_LABEL (label, U"You have objects in your list!")
 	OK
 {
 	char32 prompt [300];
@@ -778,10 +791,10 @@ FORM (DO_Quit, U"Confirm Quit", U"Quit") {
 			Melder_sprint (prompt,300, U"You have objects and unsaved scripts! Do you still want to quit ", praatP.title, U"?");
 		else
 			Melder_sprint (prompt,300, U"You have unsaved scripts! Do you still want to quit ", praatP.title, U"?");
-		SET_STRING (U"label", prompt);
+		SET_STRING (label, prompt)
 	} else if (theCurrentPraatObjects -> n) {
 		Melder_sprint (prompt,300, U"You have objects in your list! Do you still want to quit ", praatP.title, U"?");
-		SET_STRING (U"label", prompt);
+		SET_STRING (label, prompt)
 	} else {
 		praat_exit (0);
 	}
@@ -830,7 +843,7 @@ void praat_dontUsePictureWindow () { praatP.dontUsePictureWindow = true; }
 				Melder_clearError ();
 				return true;   // OK
 			}
-			long pid = 0;
+			long_not_integer pid = 0;
 			int narg = fscanf (f, "#%ld", & pid);
 			f.close (& messageFile);
 			{// scope
@@ -1246,7 +1259,7 @@ void praat_init (const char32 *title, int argc, char **argv)
 			 */
 			try {
 				autofile f = Melder_fopen (& pidFile, "w");
-				fprintf (f, "%ld", (long) getpid ());
+				fprintf (f, "%ld", (long_not_integer) getpid ());
 				f.close (& pidFile);
 			} catch (MelderError) {
 				Melder_clearError ();
@@ -1353,9 +1366,9 @@ void praat_init (const char32 *title, int argc, char **argv)
 			try {
 				autofile f = Melder_fopen (& pidFile, "a");
 				#if ALLOW_GDK_DRAWING
-					fprintf (f, " %ld", (long) GDK_WINDOW_XID (GDK_DRAWABLE (GTK_WIDGET (theCurrentPraatApplication -> topShell -> d_gtkWindow) -> window)));
+					fprintf (f, " %ld", (long_not_integer) GDK_WINDOW_XID (GDK_DRAWABLE (GTK_WIDGET (theCurrentPraatApplication -> topShell -> d_gtkWindow) -> window)));
 				#else
-					fprintf (f, " %ld", (long) GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (theCurrentPraatApplication -> topShell -> d_gtkWindow))));
+					fprintf (f, " %ld", (long_not_integer) GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (theCurrentPraatApplication -> topShell -> d_gtkWindow))));
 				#endif
 				f.close (& pidFile);
 			} catch (MelderError) {
@@ -1494,7 +1507,7 @@ void praat_run () {
 		try {
 			autoStrings directoryNames = Strings_createAsDirectoryList (Melder_fileToPath (& searchPattern));
 			if (directoryNames -> numberOfStrings > 0) {
-				for (long i = 1; i <= directoryNames -> numberOfStrings; i ++) {
+				for (integer i = 1; i <= directoryNames -> numberOfStrings; i ++) {
 					structMelderDir pluginDir { };
 					structMelderFile plugin { };
 					MelderDir_getSubdir (& praatDir, directoryNames -> strings [i], & pluginDir);
@@ -1528,7 +1541,7 @@ void praat_run () {
 	}
 	{ uint16 dummy = 40000;
 		Melder_assert ((int) (int16_t) dummy == -25536);   // bingeti16 relies on this
-		Melder_assert ((short) (int16_t) dummy == -25536);   // bingete2 relies on this
+		Melder_assert ((short) (int16_t) dummy == -25536);   // bingete16 relies on this
 		Melder_assert ((double) dummy == 40000.0);
 		Melder_assert ((double) (int16_t) dummy == -25536.0);
 	}
diff --git a/sys/praat.h b/sys/praat.h
index dad91c9..73ddd6c 100644
--- a/sys/praat.h
+++ b/sys/praat.h
@@ -68,13 +68,13 @@ extern "C" void praatlib_init ();   // for use in an application that uses Praat
 #define praat_addAction4(c1,n1,c2,n2,c3,n3,c4,n4,t,a,f,c)  praat_addAction4_ (c1, n1, c2, n2, c3, n3, c4, n4, t, a, f, c, U"" #c)
 
 void praat_addAction1_ (ClassInfo class1, int n1,
-	const char32 *title, const char32 *after, unsigned long flags, UiCallback callback, const char32 *nameOfCallback);
+	const char32 *title, const char32 *after, uint32 flags, UiCallback callback, const char32 *nameOfCallback);
 void praat_addAction2_ (ClassInfo class1, int n1, ClassInfo class2, int n2,
-	const char32 *title, const char32 *after, unsigned long flags, UiCallback callback, const char32 *nameOfCallback);
+	const char32 *title, const char32 *after, uint32 flags, UiCallback callback, const char32 *nameOfCallback);
 void praat_addAction3_ (ClassInfo class1, int n1, ClassInfo class2, int n2, ClassInfo class3, int n3,
-	const char32 *title, const char32 *after, unsigned long flags, UiCallback callback, const char32 *nameOfCallback);
+	const char32 *title, const char32 *after, uint32 flags, UiCallback callback, const char32 *nameOfCallback);
 void praat_addAction4_ (ClassInfo class1, int n1, ClassInfo class2, int n2, ClassInfo class3, int n3, ClassInfo class4, int n4,
-	const char32 *title, const char32 *after, unsigned long flags, UiCallback callback, const char32 *nameOfCallback);
+	const char32 *title, const char32 *after, uint32 flags, UiCallback callback, const char32 *nameOfCallback);
 /*
 	'title' is the name that will appear in the dynamic menu,
 		and also the command that is used in command files;
@@ -144,7 +144,7 @@ void praat_removeAction (ClassInfo class1, ClassInfo class2, ClassInfo class3, c
 
 #define praat_addMenuCommand(w,m,t,a,f,c)  praat_addMenuCommand_ (w, m, t, a, f, c, U"" #c)
 GuiMenuItem praat_addMenuCommand_ (const char32 *window, const char32 *menu, const char32 *title /* cattable */,
-	const char32 *after, unsigned long flags, UiCallback callback, const char32 *nameOfCallback);
+	const char32 *after, uint32 flags, UiCallback callback, const char32 *nameOfCallback);
 /* All strings are reference-copied; 'title', 'after', and 'callback' may be null. */
 
 #define praat_MAXNUM_EDITORS 5
@@ -154,7 +154,7 @@ typedef struct {
 	Daata object;   // the instance
 	char32 *name;   // the name of the object as it appears in the List
 	structMelderFile file;   // is this Object associated with a file?
-	long id;   // the unique number of the object
+	integer id;   // the unique number of the object
 	bool isSelected;   // is the name of the object inverted in the list?
 	Editor editors [praat_MAXNUM_EDITORS];   // are there editors open with this Object in it?
 	bool isBeingCreated;
@@ -173,7 +173,7 @@ typedef struct {   /* Readonly */
 	int totalSelection;   /* The total number of selected objects, <= n. */
 	int numberOfSelected [1 + 1000];   /* For each (readable) class. */
 	int totalBeingCreated;
-	long uniqueId;
+	integer uniqueId;
 } structPraatObjects, *PraatObjects;
 typedef struct {   // readonly
 	Graphics graphics;   /* The Graphics associated with the Picture window or HyperPage window or Demo window. */
@@ -211,34 +211,30 @@ void praat_name2 (char32 *name, ClassInfo klas1, ClassInfo klas2);
 		`proc` is the `cb` argument of the corresponding command call.
 		`title` is the title of the form, shown in its title bar.
 		`helpString` may be null.
-	INTEGER (variable, label, initialString)
-	NATURAL (variable, label, initialString)
-	REAL (variable, label, initialString)
-	REAL_OR_UNDEFINED (variable, label, initialString)
-	POSITIVE (variable, name, initialString)
-	WORD (variable, label, initialString)
-	SENTENCE (variable, label, initialString)
-	COLOUR (variable, label, initialString)
-	CHANNEL (variable, label, initialString)
-	BOOLEAN (variable, label, initialValue)
-		the initial value is 0 (off) or 1 (on).
-	LABEL (invisibleName, initialLabelString)
-		'invisibleName' is not shown but can still be used by the SETs
-	TEXTFIELD (variable, invisibleName, initialString)
-		'invisibleName' is not shown but can still be used by the SETs
-	NUMVEC (variable, invisibleName, initialString)
-		'invisibleName' is not shown but can still be used by the SETs
-	NUMMAT (variable, invisibleName, initialString)
-		'invisibleName' is not shown but can still be used by the SETs
-	RADIO (variable, label, initialValue, base)
+	INTEGER (variable, labelText, defaultStringValue)
+	NATURAL (variable, labelText, defaultStringValue)
+	REAL (variable, labelText, defaultStringValue)
+	REAL_OR_UNDEFINED (variable, labelText, defaultStringValue)
+	POSITIVE (variable, labelText, defaultStringValue)
+	WORD (variable, labelText, defaultStringValue)
+	SENTENCE (variable, labelText, defaultStringValue)
+	COLOUR (variable, labelText, defaultStringValue)
+	CHANNEL (variable, labelText, defaultStringValue)
+	BOOLEAN (variable, labelText, defaultBooleanValue)
+		the value is 0 (off) or 1 (on).
+	LABEL (labelText)
+	TEXTFIELD (variable, labelText, defaultStringValue)
+	NUMVEC (variable, labelText, defaultStringValue)
+	NUMMAT (variable, labelText, defaultStringValue)
+	RADIO (variable, labelText, defaultOptionNumber, base)
 		this should be followed by two or more RADIOBUTTONs;
 		the initial value is between base and the number of radio buttons plus base-1.
-	RADIOBUTTON (label)
-	OPTIONMENU (variable, label, initialValue)
+	RADIOBUTTON (labelText)
+	OPTIONMENU (variable, labelText, defaultOptionNumber)
 		this should be followed by two or more OPTIONs;
 		the initial value is between 1 and the number of options.
-	OPTION (label)
-	LIST (variable, label, number, strings, initialValue)
+	OPTION (labelText)
+	LIST (variable, labelText, numberOfStrings, strings, defaultOptionNumber)
 	OK
 		this statement is obligatory.
 	SET_XXXXXX (name, value)
@@ -271,51 +267,155 @@ void praat_name2 (char32 *name, ClassInfo klas1, ClassInfo klas2);
 		if (dia) goto dia_inited; \
 		dia = UiForm_create (theCurrentPraatApplication -> topShell, name, proc, buttonClosure, invokingButtonTitle, helpTitle);
 
-#define REAL(variable,label,def)  static double variable; UiForm_addReal4 (dia, & variable, U"" #variable, label, def);
-#define REAL_OR_UNDEFINED(variable,label,def)  static double variable; UiForm_addRealOrUndefined4 (dia, & variable, U"" #variable, label, def);
-#define POSITIVE(variable,label,def)  static double variable; UiForm_addPositive4 (dia, & variable, U"" #variable, label, def);
-#define INTEGER(variable,label,def)  static long variable; UiForm_addInteger4 (dia, & variable, U"" #variable, label, def);
-#define NATURAL(variable,label,def)  static long variable; UiForm_addNatural4 (dia, & variable, U"" #variable, label, def);
-#define WORD(variable,label,def)  static char32 *variable; UiForm_addWord4 (dia, & variable, U"" #variable, label, def);
-#define SENTENCE(variable,label,def)  static char32 *variable; UiForm_addSentence4 (dia, & variable, U"" #variable, label, def);
-#define BOOLEAN(variable,label,def)  static bool variable; UiForm_addBoolean4 (dia, & variable, U"" #variable, label, def);
-#define LABEL(name,label)  UiForm_addLabel (dia, name, label);
-#define TEXTFIELD(variable,name,def)  static char32 *variable; UiForm_addText4 (dia, & variable, U"" #variable, name, def);
-#define NUMVEC(variable,name,def)  static autonumvec variable; UiForm_addNumvec (dia, & variable, U"" #variable, name, def);
-#define NUMMAT(variable,name,def)  static autonummat variable; UiForm_addNummat (dia, & variable, U"" #variable, name, def);
-#define RADIO(variable,label,def)  static int variable; radio = UiForm_addRadio4 (dia, & variable, nullptr, U"" #variable, label, def, 1);
-#define RADIOx(variable,label,def,base)  static int variable; radio = UiForm_addRadio4 (dia, & variable, nullptr, U"" #variable, label, def, base);
-#define RADIOSTR(variable,label,def)  static char32 *variable; radio = UiForm_addRadio4 (dia, nullptr, & variable, U"" #variable, label, def, 1);
-#define RADIOBUTTON(label)  UiRadio_addButton (radio, label);
-#define OPTIONMENU(variable,label,def)  static int variable; radio = UiForm_addOptionMenu4 (dia, & variable, nullptr, U"" #variable, label, def, 1);
-#define OPTIONMENUx(variable,label,def,base)  static int variable; radio = UiForm_addOptionMenu4 (dia, & variable, nullptr, U"" #variable, label, def, base);
-#define OPTIONMENUSTR(variable,label,def)  static char32 *variable; radio = UiForm_addOptionMenu4 (dia, nullptr, & variable, U"" #variable, label, def, 1);
-#define OPTION(label)	UiOptionMenu_addButton (radio, label);
-#define RADIO_ENUM(variable,label,kType,def)  \
-	static kType variable; \
-	radio = UiForm_addRadio4 (dia, (int *) & variable, nullptr, U"" #variable, label, (int) kType::def - (int) kType::MIN + 1, (int) kType::MIN); \
-	for (int ienum = (int) kType::MIN; ienum <= (int) kType::MAX; ienum ++) \
-		OPTION (kType##_getText ((kType) ienum))
-#define OPTIONMENU_ENUM(variable,label,kType,def)  \
-	static kType variable; \
-	radio = UiForm_addOptionMenu4 (dia, (int *) & variable, nullptr, U"" #variable, label, (int) kType::def - (int) kType::MIN + 1, (int) kType::MIN); \
-	for (int ienum = (int) kType::MIN; ienum <= (int) kType::MAX; ienum ++) \
-		OPTION (kType##_getText ((kType) ienum))
-#define OPTIONMENU_ENUMSTR(variable,label,kType,def)  \
-	OPTIONMENUSTR (variable, label, (int) kType::def - (int) kType::MIN + 1) \
-	for (int ienum = (int) kType::MIN; ienum <= (int) kType::MAX; ienum ++) \
-		OPTION (kType##_getText ((kType) ienum))
-#define LIST(variable,label,n,str,def)  static long variable; UiForm_addList4 (dia, & variable, nullptr, U"" #variable, label, n, str, def);
-#define LISTSTR(variable,label,n,str,def)  static char32 *variable; UiForm_addList4 (dia, nullptr, & variable, U"" #variable, label, n, str, def);
-#define FILE_IN(label)		UiForm_addFileIn (dia, label);
-#define FILE_OUT(label,def)	UiForm_addFileOut (dia, label, def);
-#define COLOUR(label,def)	UiForm_addColour (dia, label, def);
-#define CHANNEL(variable,label,def)   static long variable; UiForm_addChannel4 (dia, & variable, U"" #variable, label, def);
-#define OK UiForm_finish (dia); dia_inited: if (narg < 0) UiForm_info (dia, narg); else if (! sendingForm && ! args && ! sendingString) {
-#define SET_REAL(name,value)	UiForm_setReal (dia, name, value);
-#define SET_INTEGER(name,value)	UiForm_setInteger (dia, name, value);
-#define SET_STRING(name,value)	UiForm_setString (dia, name, value);
-#define SET_ENUM(name,kType,value)  { kType typeCheckDummy = value; (void) typeCheckDummy; } SET_STRING (name, kType##_getText (value))
+#define REAL(realVariable, labelText, defaultStringValue)  \
+		static double realVariable; \
+		UiForm_addReal (dia, & realVariable, U"" #realVariable, labelText, defaultStringValue);
+
+#define REAL_OR_UNDEFINED(realVariable, labelText, defaultStringValue)  \
+		static double realVariable; \
+		UiForm_addRealOrUndefined (dia, & realVariable, U"" #realVariable, labelText, defaultStringValue);
+
+#define POSITIVE(realVariable, labelText, defaultStringValue)  \
+		static double realVariable; \
+		UiForm_addPositive (dia, & realVariable, U"" #realVariable, labelText, defaultStringValue);
+
+#define INTEGER(integerVariable, labelText, defaultStringValue)  \
+		static integer integerVariable; \
+		UiForm_addInteger (dia, & integerVariable, U"" #integerVariable, labelText, defaultStringValue);
+
+#define NATURAL(integerVariable, labelText, defaultStringValue)  \
+		static integer integerVariable; \
+		UiForm_addNatural (dia, & integerVariable, U"" #integerVariable, labelText, defaultStringValue);
+
+#define WORD(stringVariable, labelText, defaultStringValue)  \
+		static char32 *stringVariable; \
+		UiForm_addWord (dia, & stringVariable, U"" #stringVariable, labelText, defaultStringValue);
+
+#define SENTENCE(stringVariable, labelText, defaultStringValue)  \
+		static char32 *stringVariable; \
+		UiForm_addSentence (dia, & stringVariable, U"" #stringVariable, labelText, defaultStringValue);
+
+#define BOOLEAN(booleanVariable, labelText, defaultBooleanValue)  \
+		static bool booleanVariable; \
+		UiForm_addBoolean (dia, & booleanVariable, U"" #booleanVariable, labelText, defaultBooleanValue);
+
+#define LABEL(labelText)  UiForm_addLabel (dia, nullptr, labelText);
+
+#define MUTABLE_LABEL(stringVariable, labelText) \
+		static char32 *stringVariable; \
+		UiForm_addLabel (dia, & stringVariable, labelText);
+
+#define TEXTFIELD(stringVariable, labelText, defaultStringValue)  \
+		if (labelText != nullptr) /* an explicit nullptr comparison, because string literals don't convert well to bools */ \
+			UiForm_addLabel (dia, nullptr, labelText); \
+		static char32 *stringVariable; \
+		UiForm_addText (dia, & stringVariable, U"" #stringVariable, U"", defaultStringValue);
+
+#define NUMVEC(numericVectorVariable, labelText, defaultStringValue)  \
+		if (labelText != nullptr) /* an explicit nullptr comparison, because string literals don't convert well to bools */ \
+			UiForm_addLabel (dia, nullptr, labelText); \
+		static numvec numericVectorVariable; \
+		UiForm_addNumvec (dia, & numericVectorVariable, U"" #numericVectorVariable, U"", defaultStringValue);
+
+#define NUMMAT(numericMatrixVariable, labelText, defaultStringValue)  \
+		if (labelText != nullptr) /* an explicit nullptr comparison, because string literals don't convert well to bools */ \
+			UiForm_addLabel (dia, nullptr, labelText); \
+		static nummat numericMatrixVariable; \
+		UiForm_addNummat (dia, & numericMatrixVariable, U"" #numericMatrixVariable, U"", defaultStringValue);
+
+#define RADIO(intVariable, labelText, defaultOptionNumber)  \
+		static int intVariable; \
+		radio = UiForm_addRadio (dia, & intVariable, nullptr, U"" #intVariable, labelText, defaultOptionNumber, 1);
+
+#define RADIOx(intVariable, labelText, defaultOptionNumber, base)  \
+		static int intVariable; \
+		radio = UiForm_addRadio (dia, & intVariable, nullptr, U"" #intVariable, labelText, defaultOptionNumber, base);
+
+#define RADIOSTR(stringVariable, labelText, defaultOptionNumber)  \
+		static char32 *stringVariable; \
+		radio = UiForm_addRadio (dia, nullptr, & stringVariable, U"" #stringVariable, labelText, defaultOptionNumber, 1);
+
+#define RADIOBUTTON(labelText)  \
+		UiRadio_addButton (radio, labelText);
+
+#define OPTIONMENU(intVariable, labelText, defaultOptionNumber)  \
+		static int intVariable; \
+		radio = UiForm_addOptionMenu (dia, & intVariable, nullptr, U"" #intVariable, labelText, defaultOptionNumber, 1);
+
+#define OPTIONMENUx(intVariable, labelText, defaultOptionNumber, base)  \
+		static int intVariable; \
+		radio = UiForm_addOptionMenu (dia, & intVariable, nullptr, U"" #intVariable, labelText, defaultOptionNumber, base);
+
+#define OPTIONMENUSTR(stringVariable, labelText, defaultOptionNumber)  \
+		static char32 *stringVariable; \
+		radio = UiForm_addOptionMenu (dia, nullptr, & stringVariable, U"" #stringVariable, labelText, defaultOptionNumber, 1);
+
+#define OPTION(labelText)  \
+		UiOptionMenu_addButton (radio, labelText);
+
+#define RADIO_ENUM(enumeratedVariable, labelText, EnumeratedType, defaultEnumeratedSubvalue)  \
+		static enum EnumeratedType enumeratedVariable; \
+		radio = UiForm_addRadio (dia, (int *) & enumeratedVariable, nullptr, U"" #enumeratedVariable, labelText, \
+			(int) EnumeratedType::defaultEnumeratedSubvalue - (int) EnumeratedType::MIN + 1, (int) EnumeratedType::MIN); \
+		for (int ienum = (int) EnumeratedType::MIN; ienum <= (int) EnumeratedType::MAX; ienum ++) \
+			UiRadio_addButton (radio, EnumeratedType##_getText ((enum EnumeratedType) ienum));
+
+#define OPTIONMENU_ENUM(enumeratedVariable, labelText, EnumeratedType, defaultEnumeratedSubvalue)  \
+		static EnumeratedType enumeratedVariable; \
+		radio = UiForm_addOptionMenu (dia, (int *) & enumeratedVariable, nullptr, U"" #enumeratedVariable, labelText, \
+			(int) EnumeratedType::defaultEnumeratedSubvalue - (int) EnumeratedType::MIN + 1, (int) EnumeratedType::MIN); \
+		for (int ienum = (int) EnumeratedType::MIN; ienum <= (int) EnumeratedType::MAX; ienum ++) \
+			UiOptionMenu_addButton (radio, EnumeratedType##_getText ((enum EnumeratedType) ienum));
+
+#define OPTIONMENU_ENUMSTR(enumeratedVariableAsString, labelText, EnumeratedType, defaultEnumeratedSubvalue)  \
+		static char32 *enumeratedVariableAsString; \
+		radio = UiForm_addOptionMenu (dia, nullptr, & enumeratedVariableAsString, U"" #enumeratedVariableAsString, labelText, \
+			(int) EnumeratedType::defaultEnumeratedSubvalue - (int) EnumeratedType::MIN + 1, (int) EnumeratedType::MIN); \
+		for (int ienum = (int) EnumeratedType::MIN; ienum <= (int) EnumeratedType::MAX; ienum ++) \
+			UiOptionMenu_addButton (radio, EnumeratedType##_getText ((enum EnumeratedType) ienum));
+
+#define LIST(integerVariable, labelText, numberOfStrings, strings, defaultOptionNumber)  \
+		static integer integerVariable; \
+		UiForm_addList (dia, & integerVariable, nullptr, U"" #integerVariable, labelText, numberOfStrings, strings, defaultOptionNumber);
+
+#define LISTSTR(stringVariable, labelText, numberOfStrings, strings, defaultOptionNumber)  \
+		static char32 *stringVariable; \
+		UiForm_addList (dia, nullptr, & stringVariable, U"" #stringVariable, labelText, numberOfStrings, strings, defaultOptionNumber);
+
+#define FILE_IN(labelText)  \
+		UiForm_addFileIn (dia, labelText);
+
+#define FILE_OUT(labelText, defaultStringValue)  \
+		UiForm_addFileOut (dia, labelText, defaultStringValue);
+
+#define COLOUR(colourVariable, labelText, defaultStringValue)  \
+		static Graphics_Colour colourVariable; \
+		UiForm_addColour (dia, & colourVariable, U"" #colourVariable, labelText, defaultStringValue);
+
+#define CHANNEL(integerVariable, labelText, defaultStringValue)  \
+		static integer integerVariable; \
+		UiForm_addChannel (dia, & integerVariable, U"" #integerVariable, labelText, defaultStringValue);
+
+#define OK  \
+		UiForm_finish (dia); \
+	dia_inited: \
+		if (narg < 0) UiForm_info (dia, narg); else if (! args && ! sendingForm && ! sendingString) {
+
+#define SET_REAL(realVariable, realValue)  \
+			UiForm_setReal (dia, & realVariable, realValue);
+
+#define SET_INTEGER(integerVariable, integerValue)  \
+			UiForm_setInteger (dia, & integerVariable, integerValue);
+
+#define SET_BOOLEAN(booleanVariable, booleanValue)  \
+			UiForm_setBoolean (dia, & booleanVariable, booleanValue);
+
+#define SET_STRING(stringVariable, stringValue)  \
+			UiForm_setString (dia, & stringVariable, stringValue);
+
+#define SET_ENUM(enumeratedVariable, EnumeratedType, enumeratedValue)  \
+			enumeratedVariable = enumeratedValue; /* just for typechecking */ \
+			UiForm_setOption (dia, (int *) & enumeratedVariable, (int) enumeratedValue - (int) EnumeratedType::MIN + 1);
 
 #define DO  \
 			UiForm_do (dia, modified); \
@@ -390,19 +490,19 @@ void praat_name2 (char32 *name, ClassInfo klas1, ClassInfo klas2);
 		{ static UiForm dia; \
 		if (! dia) \
 			dia = UiInfile_create (theCurrentPraatApplication -> topShell, title, proc, okClosure, invokingButtonTitle, help, allowMult); \
-		if (narg < 0) UiForm_info (dia, narg); else if (! sendingForm && ! args && ! sendingString) { \
+		if (narg < 0) UiForm_info (dia, narg); else if (! args && ! sendingForm && ! sendingString) { \
 			UiInfile_do (dia); \
 		} else { \
 			try { \
 				MelderFile file; \
 				int IOBJECT = 0; \
-				structMelderFile file2 { }; \
 				(void) IOBJECT; \
+				structMelderFile _file2 { };  /* don't move this into an inner scope, because the contents of a local variable don't persistent into the outer scope */ \
 				if (! args && ! sendingString) { \
 					file = UiFile_getFile (dia); \
 				} else { \
-					Melder_relativePathToFile (args ? args [1]. string : sendingString, & file2); \
-					file = & file2; \
+					Melder_relativePathToFile (args ? args [1]. string : sendingString, & _file2); \
+					file = & _file2; \
 				}
 
 #define FORM_SAVE(proc,title,help,ext)  \
@@ -411,26 +511,21 @@ void praat_name2 (char32 *name, ClassInfo klas1, ClassInfo klas2);
 		{ static UiForm dia; \
 		if (! dia) \
 			dia = UiOutfile_create (theCurrentPraatApplication -> topShell, title, proc, okClosure, invokingButtonTitle, help); \
-		if (narg < 0) UiForm_info (dia, narg); else if (! sendingForm && ! args && ! sendingString) { \
+		if (narg < 0) UiForm_info (dia, narg); else if (! args && ! sendingForm && ! sendingString) { \
 			praat_write_do (dia, ext); \
 		} else { \
 			try { \
 				MelderFile file; \
 				int IOBJECT = 0; \
-				structMelderFile file2 { }; \
 				(void) IOBJECT; \
+				structMelderFile _file2 { };  /* don't move this into an inner scope, because the contents of a local variable don't persistent into the outer scope */ \
 				if (! args && ! sendingString) { \
 					file = UiFile_getFile (dia); \
 				} else { \
-					Melder_relativePathToFile (args ? args [1]. string : sendingString, & file2); \
-					file = & file2; \
+					Melder_relativePathToFile (args ? args [1]. string : sendingString, & _file2); \
+					file = & _file2; \
 				}
 
-#define GET_REAL(name)  UiForm_getReal (dia, name)
-#define GET_INTEGER(name)  UiForm_getInteger (dia, name)
-#define GET_STRING(name)  UiForm_getString (dia, name)
-#define GET_ENUM(enum,name)  (enum) enum##_getValue (GET_STRING (name))
-#define GET_COLOUR(name)  UiForm_getColour (dia, name)
 #define GET_FILE(name)  UiForm_getFile (dia, name)
 #define REQUIRE(c,t)  if (! (c)) Melder_throw (t);
 
diff --git a/sys/praatP.h b/sys/praatP.h
index 828d4a4..a461d4b 100644
--- a/sys/praatP.h
+++ b/sys/praatP.h
@@ -1,6 +1,6 @@
 /* praatP.h
  *
- * Copyright (C) 1992-2012,2013,2014,2015,2016 Paul Boersma
+ * Copyright (C) 1992-2012,2013,2014,2015,2016,2017 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -92,7 +92,7 @@ Thing_define (Praat_Command, Thing) {
 #define praat_HANDLING_EVENTS  3
 
 int praat_numberOfSelected (ClassInfo klas);
-long praat_idOfSelected (ClassInfo klas, int inplace);
+integer praat_idOfSelected (ClassInfo klas, int inplace);
 char32 * praat_nameOfSelected (ClassInfo klas, int inplace);
 
 /* Used by praat.cpp; defined in praat_picture.cpp.
@@ -123,7 +123,7 @@ void praat_list_foreground ();   // updates the list of objects after background
 void praat_background ();
 void praat_foreground ();
 Editor praat_findEditorFromString (const char32 *string);
-Editor praat_findEditorById (long id);
+Editor praat_findEditorById (integer id);
 
 void praat_showLogo (bool autoPopDown);
 
@@ -132,8 +132,8 @@ void praat_menuCommands_init ();
 void praat_menuCommands_exit ();
 int praat_doMenuCommand (const char32 *command, const char32 *arguments, Interpreter interpreter);   // 0 = not found
 int praat_doMenuCommand (const char32 *command, int narg, Stackel args, Interpreter interpreter);   // 0 = not found
-long praat_getNumberOfMenuCommands ();
-Praat_Command praat_getMenuCommand (long i);
+integer praat_getNumberOfMenuCommands ();
+Praat_Command praat_getMenuCommand (integer i);
 
 /* Communication with praat_actions.cpp: */
 void praat_actions_show ();
@@ -143,8 +143,8 @@ void praat_actions_createDynamicMenu (GuiWindow window);
 void praat_saveAddedActions (MelderString *buffer);
 int praat_doAction (const char32 *command, const char32 *arguments, Interpreter interpreter);   // 0 = not found
 int praat_doAction (const char32 *command, int narg, Stackel args, Interpreter interpreter);   // 0 = not found
-long praat_getNumberOfActions ();   // for ButtonEditor
-Praat_Command praat_getAction (long i);   // for ButtonEditor
+integer praat_getNumberOfActions ();   // for ButtonEditor
+Praat_Command praat_getAction (integer i);   // for ButtonEditor
 
 /* Communication with praat_statistics.cpp: */
 void praat_statistics_prefs ();   // at init time
diff --git a/sys/praat_actions.cpp b/sys/praat_actions.cpp
index 9b034e4..184c728 100644
--- a/sys/praat_actions.cpp
+++ b/sys/praat_actions.cpp
@@ -66,13 +66,13 @@ static void fixSelectionSpecification (ClassInfo *class1, int *n1, ClassInfo *cl
 	}
 }
 
-static long lookUpMatchingAction (ClassInfo class1, ClassInfo class2, ClassInfo class3, ClassInfo class4, const char32 *title) {
+static integer lookUpMatchingAction (ClassInfo class1, ClassInfo class2, ClassInfo class3, ClassInfo class4, const char32 *title) {
 /*
  * An action command is fully specified by its environment (the selected classes) and its title.
  * Precondition:
  *	class1, class2, and class3 must be in sorted order.
  */
-	for (long i = 1; i <= theActions.size; i ++) {
+	for (integer i = 1; i <= theActions.size; i ++) {
 		Praat_Command action = theActions.at [i];
 		if (class1 == action -> class1 && class2 == action -> class2 &&
 		    class3 == action -> class3 && class4 == action -> class4 &&
@@ -82,24 +82,24 @@ static long lookUpMatchingAction (ClassInfo class1, ClassInfo class2, ClassInfo
 }
 
 void praat_addAction1_ (ClassInfo class1, int n1,
-	const char32 *title, const char32 *after, unsigned long flags, UiCallback callback, const char32 *nameOfCallback)
+	const char32 *title, const char32 *after, uint32 flags, UiCallback callback, const char32 *nameOfCallback)
 { praat_addAction4_ (class1, n1, nullptr, 0, nullptr, 0, nullptr, 0, title, after, flags, callback, nameOfCallback); }
 
 void praat_addAction2_ (ClassInfo class1, int n1, ClassInfo class2, int n2,
-	const char32 *title, const char32 *after, unsigned long flags, UiCallback callback, const char32 *nameOfCallback)
+	const char32 *title, const char32 *after, uint32 flags, UiCallback callback, const char32 *nameOfCallback)
 { praat_addAction4_ (class1, n1, class2, n2, nullptr, 0, nullptr, 0, title, after, flags, callback, nameOfCallback); }
 
 void praat_addAction3_ (ClassInfo class1, int n1, ClassInfo class2, int n2, ClassInfo class3, int n3,
-	const char32 *title, const char32 *after, unsigned long flags, UiCallback callback, const char32 *nameOfCallback)
+	const char32 *title, const char32 *after, uint32 flags, UiCallback callback, const char32 *nameOfCallback)
 { praat_addAction4_ (class1, n1, class2, n2, class3, n3, nullptr, 0, title, after, flags, callback, nameOfCallback); }
 
 void praat_addAction4_ (ClassInfo class1, int n1, ClassInfo class2, int n2, ClassInfo class3, int n3, ClassInfo class4, int n4,
-	const char32 *title, const char32 *after, unsigned long flags, UiCallback callback, const char32 *nameOfCallback)
+	const char32 *title, const char32 *after, uint32 flags, UiCallback callback, const char32 *nameOfCallback)
 {
 	try {
 		int depth = flags, key = 0;
 		bool unhidable = false, hidden = false, attractive = false;
-		unsigned long guiFlags = 0;
+		uint32 guiFlags = 0;
 		if (flags > 7) {
 			depth = ((flags & praat_DEPTH_7) >> 16);
 			unhidable = (flags & praat_UNHIDABLE) != 0;
@@ -123,9 +123,9 @@ void praat_addAction4_ (ClassInfo class1, int n1, ClassInfo class2, int n2, Clas
 		/*
 		 * Determine the position of the new command.
 		 */
-		long position;
+		integer position;
 		if (after && after [0] != U'*') {   // search for existing command with same selection
-			long found = lookUpMatchingAction (class1, class2, class3, class4, after);
+			integer found = lookUpMatchingAction (class1, class2, class3, class4, after);
 			if (found == 0)
 				Melder_throw (U"The action command \"", title, U"\" cannot be put after \"", after, U"\",\n"
 					U"because the latter command does not exist.");
@@ -168,9 +168,9 @@ void praat_addAction4_ (ClassInfo class1, int n1, ClassInfo class2, int n2, Clas
 static void deleteDynamicMenu () {
 	if (praatP.phase != praat_HANDLING_EVENTS) return;
 	if (actionsInvisible) return;
-	static long numberOfDeletions;
+	static integer numberOfDeletions;
 	trace (U"deletion #", ++ numberOfDeletions);
-	for (long i = 1; i <= theActions.size; i ++) {
+	for (integer i = 1; i <= theActions.size; i ++) {
 		Praat_Command action = theActions.at [i];
 		if (action -> button) {
 			trace (U"trying to destroy action ", i, U" of ", theActions.size, U": ", action -> title);
@@ -245,7 +245,7 @@ void praat_addActionScript (const char32 *className1, int n1, const char32 *clas
 		 * If the button already exists, remove it.
 		 */
 		{// scope
-			long found = lookUpMatchingAction (class1, class2, class3, nullptr, title);
+			integer found = lookUpMatchingAction (class1, class2, class3, nullptr, title);
 			if (found) {
 				theActions. removeItem (found);
 			}
@@ -254,9 +254,9 @@ void praat_addActionScript (const char32 *className1, int n1, const char32 *clas
 		/*
 		 * Determine the position of the new command.
 		 */
-		long position;
+		integer position;
 		if (str32len (after)) {   // search for existing command with same selection
-			long found = lookUpMatchingAction (class1, class2, class3, nullptr, after);
+			integer found = lookUpMatchingAction (class1, class2, class3, nullptr, after);
 			if (found) {
 				position = found + 1;   // after 'after'
 			} else {
@@ -290,7 +290,7 @@ void praat_addActionScript (const char32 *className1, int n1, const char32 *clas
 		action -> after = str32len (after) ? Melder_dup_f (after) : nullptr;
 		action -> phase = praatP.phase;
 		if (praatP.phase >= praat_READING_BUTTONS) {
-			static long uniqueID = 0;
+			static integer uniqueID = 0;
 			action -> uniqueID = ++ uniqueID;
 		}
 
@@ -308,7 +308,7 @@ void praat_removeAction (ClassInfo class1, ClassInfo class2, ClassInfo class3, c
 	try {
 		int n1, n2, n3;
 		fixSelectionSpecification (& class1, & n1, & class2, & n2, & class3, & n3);
-		long found = lookUpMatchingAction (class1, class2, class3, nullptr, title);
+		integer found = lookUpMatchingAction (class1, class2, class3, nullptr, title);
 		if (! found) {
 			Melder_throw (U"Action command \"", class1 -> className,
 				class2 ? U" & ": U"", class2 -> className,
@@ -347,7 +347,7 @@ void praat_hideAction (ClassInfo class1, ClassInfo class2, ClassInfo class3, con
 	try {
 		int n1, n2, n3;
 		fixSelectionSpecification (& class1, & n1, & class2, & n2, & class3, & n3);
-		long found = lookUpMatchingAction (class1, class2, class3, nullptr, title);
+		integer found = lookUpMatchingAction (class1, class2, class3, nullptr, title);
 		if (! found) {
 			Melder_throw (U"Praat: action command \"", class1 ? class1 -> className : nullptr,
 				class2 ? U" & ": nullptr, class2 ? class2 -> className : nullptr,
@@ -390,7 +390,7 @@ void praat_showAction (ClassInfo class1, ClassInfo class2, ClassInfo class3, con
 	try {
 		int n1, n2, n3;
 		fixSelectionSpecification (& class1, & n1, & class2, & n2, & class3, & n3);
-		long found = lookUpMatchingAction (class1, class2, class3, nullptr, title);
+		integer found = lookUpMatchingAction (class1, class2, class3, nullptr, title);
 		if (! found) {
 			Melder_throw (U"Action command \"", class1 ? class1 -> className : nullptr,
 				class2 ? U" & ": nullptr, class2 ? class2 -> className : nullptr,
@@ -468,8 +468,8 @@ static const char32 *objectString (int number) {
 static bool allowExecutionHook (void *closure) {
 	UiCallback callback = (UiCallback) closure;
 	Melder_assert (sizeof (callback) == sizeof (void *));
-	long numberOfMatchingCallbacks = 0, firstMatchingCallback = 0;
-	for (long i = 1; i <= theActions.size; i ++) {
+	integer numberOfMatchingCallbacks = 0, firstMatchingCallback = 0;
+	for (integer i = 1; i <= theActions.size; i ++) {
 		Praat_Command me = theActions.at [i];
 		if (my callback == callback) {
 			int sel1, sel2 = 0, sel3 = 0, sel4 = 0;
@@ -556,7 +556,7 @@ void praat_actions_show () {
 		if (theCurrentPraatObjects -> totalSelection != 0 && ! Melder_backgrounding)
 			GuiThing_setSensitive (praat_writeMenu, true);
 	}
-	for (long i = 1; i <= theActions.size; i ++) {
+	for (integer i = 1; i <= theActions.size; i ++) {
 		Praat_Command action = theActions.at [i];
 		int sel1 = 0, sel2 = 0, sel3 = 0, sel4 = 0;
 		int n1 = action -> n1, n2 = action -> n2, n3 = action -> n3, n4 = action -> n4;
@@ -590,7 +590,7 @@ void praat_actions_show () {
 		GuiMenu currentSubmenu1 = nullptr, currentSubmenu2 = nullptr;
 		bool writeMenuGoingToSeparate = false;
 		int y = Machine_getMenuBarHeight () + 10;
-		for (long i = 1; i <= theActions.size; i ++) {   // add buttons or make existing buttons sensitive (executable)
+		for (integer i = 1; i <= theActions.size; i ++) {   // add buttons or make existing buttons sensitive (executable)
 			Praat_Command me = theActions.at [i];
 			if (my depth == 0) currentSubmenu1 = nullptr, currentSubmenu2 = nullptr;   // prevent attachment of later deep actions to earlier submenus after removal of label
 			if (my depth == 1) currentSubmenu2 = nullptr;   // prevent attachment of later deep actions to earlier submenus after removal of label
@@ -678,14 +678,14 @@ void praat_actions_createDynamicMenu (GuiWindow window) {
 }
 
 void praat_saveAddedActions (MelderString *buffer) {
-	long maxID = 0;
-	for (long iaction = 1; iaction <= theActions.size; iaction ++) {
+	integer maxID = 0;
+	for (integer iaction = 1; iaction <= theActions.size; iaction ++) {
 		Praat_Command action = theActions.at [iaction];
 		if (action -> uniqueID > maxID)
 			maxID = action -> uniqueID;
 	}
-	for (long ident = 1; ident <= maxID; ident ++)
-		for (long iaction = 1; iaction <= theActions.size; iaction ++) {
+	for (integer ident = 1; ident <= maxID; ident ++)
+		for (integer iaction = 1; iaction <= theActions.size; iaction ++) {
 			Praat_Command me = theActions.at [iaction];
 			if (my uniqueID == ident && ! my hidden && my title) {
 				MelderString_append (buffer, U"Add action command...",
@@ -697,7 +697,7 @@ void praat_saveAddedActions (MelderString *buffer) {
 				break;
 			}
 		}
-	for (long iaction = 1; iaction <= theActions.size; iaction ++) {
+	for (integer iaction = 1; iaction <= theActions.size; iaction ++) {
 		Praat_Command me = theActions.at [iaction];
 		if (my toggled && my title && ! my uniqueID && ! my script) {
 			MelderString_append (buffer, ( my hidden ? U"Hide" : U"Show" ), U" action command...",
@@ -710,7 +710,7 @@ void praat_saveAddedActions (MelderString *buffer) {
 }
 
 int praat_doAction (const char32 *command, const char32 *arguments, Interpreter interpreter) {
-	long i = 1;
+	integer i = 1;
 	while (i <= theActions.size && (! theActions.at [i] -> executable || str32cmp (theActions.at [i] -> title, command))) i ++;
 	if (i > theActions.size) return 0;   // not found
 	theActions.at [i] -> callback (nullptr, 0, nullptr, arguments, interpreter, command, false, nullptr);
@@ -718,16 +718,16 @@ int praat_doAction (const char32 *command, const char32 *arguments, Interpreter
 }
 
 int praat_doAction (const char32 *command, int narg, Stackel args, Interpreter interpreter) {
-	long i = 1;
+	integer i = 1;
 	while (i <= theActions.size && (! theActions.at [i] -> executable || str32cmp (theActions.at [i] -> title, command))) i ++;
 	if (i > theActions.size) return 0;   // not found
 	theActions.at [i] -> callback (nullptr, narg, args, nullptr, interpreter, command, false, nullptr);
 	return 1;
 }
 
-long praat_getNumberOfActions () { return theActions.size; }
+integer praat_getNumberOfActions () { return theActions.size; }
 
-Praat_Command praat_getAction (long i)
+Praat_Command praat_getAction (integer i)
 	{ return i < 0 || i > theActions.size ? nullptr : theActions.at [i]; }
 
 void praat_background () {
diff --git a/sys/praat_menuCommands.cpp b/sys/praat_menuCommands.cpp
index 4b94da9..84f055c 100644
--- a/sys/praat_menuCommands.cpp
+++ b/sys/praat_menuCommands.cpp
@@ -43,18 +43,18 @@ static int compareMenuCommands (const void *void_me, const void *void_thee) {
 }
 
 void praat_sortMenuCommands () {
-	for (long i = 1; i <= theCommands.size; i ++) {
+	for (integer i = 1; i <= theCommands.size; i ++) {
 		Praat_Command command = theCommands.at [i];
 		command -> sortingTail = i;
 	}
 	qsort (& theCommands.at [1], theCommands.size, sizeof (Praat_Command), compareMenuCommands);
 }
 
-static long lookUpMatchingMenuCommand (const char32 *window, const char32 *menu, const char32 *title) {
+static integer lookUpMatchingMenuCommand (const char32 *window, const char32 *menu, const char32 *title) {
 /*
  * A menu command is fully specified by its environment (window + menu) and its title.
  */
-	for (long i = 1; i <= theCommands.size; i ++) {
+	for (integer i = 1; i <= theCommands.size; i ++) {
 		Praat_Command command = theCommands.at [i];
 		const char32 *tryWindow = command -> window;
 		const char32 *tryMenu = command -> menu;
@@ -66,7 +66,7 @@ static long lookUpMatchingMenuCommand (const char32 *window, const char32 *menu,
 	return 0;   // not found
 }
 
-static void do_menu (Praat_Command me, unsigned long modified) {
+static void do_menu (Praat_Command me, uint32 modified) {
 	if (my callback == DO_RunTheScriptFromAnyAddedMenuCommand) {
 		UiHistory_write (U"\nrunScript: ");
 		try {
@@ -105,13 +105,13 @@ static GuiMenu windowMenuToWidget (const char32 *window, const char32 *menu) {
 }
 
 GuiMenuItem praat_addMenuCommand_ (const char32 *window, const char32 *menu, const char32 *title /* cattable */,
-	const char32 *after, unsigned long flags, UiCallback callback, const char32 *nameOfCallback)
+	const char32 *after, uint32 flags, UiCallback callback, const char32 *nameOfCallback)
 {
-	long position;
+	integer position;
 	int depth = flags, key = 0;
 	bool unhidable = false, hidden = false, noApi = false, forceApi = false;
 	int deprecationYear = 0;
-	unsigned long guiFlags = 0;
+	uint32 guiFlags = 0;
 	if (flags > 7) {
 		depth = ((flags & praat_DEPTH_7) >> 16);
 		unhidable = (flags & praat_UNHIDABLE) != 0;
@@ -131,7 +131,7 @@ GuiMenuItem praat_addMenuCommand_ (const char32 *window, const char32 *menu, con
 	 * Determine the position of the new command.
 	 */
 	if (after && after [0] != U'*') {   // search for existing command with same selection
-		long found = lookUpMatchingMenuCommand (window, menu, after);
+		integer found = lookUpMatchingMenuCommand (window, menu, after);
 		if (found) {
 			position = found + 1;   // after 'after'
 		} else {
@@ -182,7 +182,7 @@ GuiMenuItem praat_addMenuCommand_ (const char32 *window, const char32 *menu, con
 			 * Put the new command in a submenu.
 			 * The supermenu to put the new command in is the first menu that we find when going up.
 			 */
-			for (long parentPosition = position - 1; parentPosition > 0; parentPosition --) {
+			for (integer parentPosition = position - 1; parentPosition > 0; parentPosition --) {
 				Praat_Command parentCommand = theCommands.at [parentPosition];
 				if (parentCommand -> depth == depth - 1) {
 					/*
@@ -239,9 +239,9 @@ void praat_addMenuCommandScript (const char32 *window, const char32 *menu, const
 		/*
 		 * Determine the position of the new command.
 		 */
-		long position;
+		integer position;
 		if (str32len (after) && after [0] != U'*') {   // search for existing command with same selection
-			long found = lookUpMatchingMenuCommand (window, menu, after);
+			integer found = lookUpMatchingMenuCommand (window, menu, after);
 			if (found) {
 				position = found + 1;   // after 'after'
 			} else {
@@ -274,7 +274,7 @@ void praat_addMenuCommandScript (const char32 *window, const char32 *menu, const
 		}
 		command -> after = str32len (after) ? Melder_dup_f (after) : nullptr;
 		if (praatP.phase >= praat_READING_BUTTONS) {
-			static long uniqueID = 0;
+			static integer uniqueID = 0;
 			command -> uniqueID = ++ uniqueID;
 		}
 
@@ -289,7 +289,7 @@ void praat_addMenuCommandScript (const char32 *window, const char32 *menu, const
 			if (depth == 0) {
 				parentMenu = windowMenuToWidget (window, menu);   // not a subitem: in the top menu
 			} else {
-				for (long parentPosition = position - 1; parentPosition > 0; parentPosition --) {
+				for (integer parentPosition = position - 1; parentPosition > 0; parentPosition --) {
 					Praat_Command parentCommand = theCommands.at [parentPosition];
 					if (parentCommand -> depth == depth - 1) {
 						if (! parentCommand -> callback && parentCommand -> title && parentCommand -> title [0] != U'-') {
@@ -325,7 +325,7 @@ void praat_addMenuCommandScript (const char32 *window, const char32 *menu, const
 
 void praat_hideMenuCommand (const char32 *window, const char32 *menu, const char32 *title) {
 	if (theCurrentPraatApplication -> batch || ! window || ! menu || ! title) return;
-	long found = lookUpMatchingMenuCommand (window, menu, title);
+	integer found = lookUpMatchingMenuCommand (window, menu, title);
 	if (! found) return;
 	Praat_Command command = theCommands.at [found];
 	if (! command -> hidden && ! command -> unhidable) {
@@ -337,7 +337,7 @@ void praat_hideMenuCommand (const char32 *window, const char32 *menu, const char
 
 void praat_showMenuCommand (const char32 *window, const char32 *menu, const char32 *title) {
 	if (theCurrentPraatApplication -> batch || ! window || ! menu || ! title) return;
-	long found = lookUpMatchingMenuCommand (window, menu, title);
+	integer found = lookUpMatchingMenuCommand (window, menu, title);
 	if (! found) return;
 	Praat_Command command = theCommands.at [found];
 	if (command -> hidden) {
@@ -348,14 +348,14 @@ void praat_showMenuCommand (const char32 *window, const char32 *menu, const char
 }
 
 void praat_saveMenuCommands (MelderString *buffer) {
-	long maxID = 0;
-	for (long i = 1; i <= theCommands.size; i ++) {
+	integer maxID = 0;
+	for (integer i = 1; i <= theCommands.size; i ++) {
 		Praat_Command command = theCommands.at [i];
 		if (command -> uniqueID > maxID)
 			maxID = command -> uniqueID;
 	}
-	for (long id = 1; id <= maxID; id ++)   // sorted
-		for (long i = 1; i <= theCommands.size; i ++) {
+	for (integer id = 1; id <= maxID; id ++)   // sorted
+		for (integer i = 1; i <= theCommands.size; i ++) {
 			Praat_Command me = theCommands.at [i];
 			if (my uniqueID == id && ! my hidden && my window && my menu && my title) {
 				MelderString_append (buffer, U"Add menu command... \"", my window, U"\" \"", my menu, U"\" \"", my title, U"\" \"",
@@ -363,7 +363,7 @@ void praat_saveMenuCommands (MelderString *buffer) {
 				break;
 			}
 		}
-	for (long i = 1; i <= theCommands.size; i ++) {
+	for (integer i = 1; i <= theCommands.size; i ++) {
 		Praat_Command me = theCommands.at [i];
 		if (my toggled && my window && my menu && my title && ! my uniqueID && ! my script)
 			MelderString_append (buffer, my hidden ? U"Hide" : U"Show", U" menu command... \"",
@@ -395,7 +395,7 @@ void praat_addFixedButtonCommand_ (GuiForm parent, const char32 *title, UiCallba
 
 void praat_sensitivizeFixedButtonCommand (const char32 *title, int sensitive) {
 	Praat_Command commandFound = nullptr;
-	for (long i = 1; i <= theCommands.size; i ++) {
+	for (integer i = 1; i <= theCommands.size; i ++) {
 		Praat_Command command = theCommands.at [i];
 		if (str32equ (command -> title, title)) {
 			commandFound = command;
@@ -410,7 +410,7 @@ void praat_sensitivizeFixedButtonCommand (const char32 *title, int sensitive) {
 
 int praat_doMenuCommand (const char32 *title, const char32 *arguments, Interpreter interpreter) {
 	Praat_Command commandFound = nullptr;
-	for (long i = 1; i <= theCommands.size; i ++) {
+	for (integer i = 1; i <= theCommands.size; i ++) {
 		Praat_Command command = theCommands.at [i];
 		if (command -> executable && str32equ (command -> title, title) &&
 			(str32equ (command -> window, U"Objects") || str32equ (command -> window, U"Picture")))
@@ -426,7 +426,7 @@ int praat_doMenuCommand (const char32 *title, const char32 *arguments, Interpret
 
 int praat_doMenuCommand (const char32 *title, int narg, Stackel args, Interpreter interpreter) {
 	Praat_Command commandFound = nullptr;
-	for (long i = 1; i <= theCommands.size; i ++) {
+	for (integer i = 1; i <= theCommands.size; i ++) {
 		Praat_Command command = theCommands.at [i];
 		if (command -> executable && str32equ (command -> title, title) &&
 			(str32equ (command -> window, U"Objects") || str32equ (command -> window, U"Picture")))
@@ -440,14 +440,14 @@ int praat_doMenuCommand (const char32 *title, int narg, Stackel args, Interprete
 	return 1;
 }
 
-long praat_getNumberOfMenuCommands () { return theCommands.size; }
+integer praat_getNumberOfMenuCommands () { return theCommands.size; }
 
-Praat_Command praat_getMenuCommand (long i)
+Praat_Command praat_getMenuCommand (integer i)
 	{ return i < 1 || i > theCommands.size ? nullptr : theCommands.at [i]; }
 
 void praat_addCommandsToEditor (Editor me) {
 	const char32 *windowName = my classInfo -> className;
-	for (long i = 1; i <= theCommands.size; i ++) {
+	for (integer i = 1; i <= theCommands.size; i ++) {
 		Praat_Command command = theCommands.at [i];
 		if (str32equ (command -> window, windowName)) {
 			Editor_addCommandScript (me, command -> menu, command -> title, 0, command -> script);
@@ -499,11 +499,11 @@ static const char32 * getReturnType (Praat_Command command) {
 void praat_menuCommands_writeC (bool isInHeaderFile, bool includeCreateAPI, bool includeReadAPI,
 	bool includeRecordAPI, bool includePlayAPI, bool includeDrawAPI, bool includeHelpAPI, bool includeWindowAPI)
 {
-	long numberOfApiMenuCommands = 0;
+	integer numberOfApiMenuCommands = 0;
 	#define xstr(s) str(s)
 	#define str(s) #s
 	MelderInfo_writeLine (U"/* C API, version ", U"" xstr (PRAAT_MONTH), U" ", PRAAT_DAY, U", ", PRAAT_YEAR, U" */");
-	for (long i = 1; i <= theCommands.size; i ++) {
+	for (integer i = 1; i <= theCommands.size; i ++) {
 		Praat_Command command = theCommands.at [i];
 		bool deprecated = ( command -> deprecationYear > 0 );
 		if (! commandIsToBeIncluded (command, deprecated, includeCreateAPI, includeReadAPI,
diff --git a/sys/praat_objectMenus.cpp b/sys/praat_objectMenus.cpp
index 0601973..23ed091 100644
--- a/sys/praat_objectMenus.cpp
+++ b/sys/praat_objectMenus.cpp
@@ -40,10 +40,9 @@ DIRECT (PRAAT_Remove) {
 END }
 
 FORM (MODIFY_Rename, U"Rename object", U"Rename...") {
-	LABEL (U"rename object", U"New name:")
-	TEXTFIELD (newName, U"newName", U"")
+	TEXTFIELD (newName, U"New name:", U"")
 OK
-	WHERE (SELECTED) SET_STRING (U"newName", NAME)
+	WHERE (SELECTED) SET_STRING (newName, NAME)
 DO
 	if (theCurrentPraatObjects -> totalSelection == 0)
 		Melder_throw (U"Selection changed!\nNo object selected. Cannot rename.");
@@ -67,10 +66,9 @@ DO
 END }
 
 FORM (NEW1_Copy, U"Copy object", U"Copy...") {
-	LABEL (U"copy object", U"Name of new object:")
-	TEXTFIELD (newName, U"newName", U"")
+	TEXTFIELD (newName, U"Name of new object:", U"")
 OK
-	WHERE (SELECTED) SET_STRING (U"newName", NAME)
+	WHERE (SELECTED) SET_STRING (newName, NAME)
 DO
 	if (theCurrentPraatObjects -> totalSelection == 0)
 		Melder_throw (U"Selection changed!\nNo object selected. Cannot copy.");
@@ -168,8 +166,7 @@ FORM (PRAAT_addMenuCommand, U"Add menu command", U"Add menu command...") {
 	SENTENCE (command, U"Command", U"Hallo...")
 	SENTENCE (afterCommand, U"After command", U"")
 	INTEGER (depth, U"Depth", U"0")
-	LABEL (U"", U"Script file:")
-	TEXTFIELD (script, U"script", U"/u/miep/hallo.praat")
+	TEXTFIELD (script, U"Script file:", U"/u/miep/hallo.praat")
 	OK
 DO
 	praat_addMenuCommandScript (window, menu, command, afterCommand, depth, script);
@@ -203,8 +200,7 @@ FORM (PRAAT_addAction, U"Add action command", U"Add action command...") {
 	SENTENCE (command, U"Command", U"Play reverse")
 	SENTENCE (afterCommand, U"After command", U"Play")
 	INTEGER (depth, U"Depth", U"0")
-	LABEL (U"", U"Script file:")
-	TEXTFIELD (script, U"script", U"/u/miep/playReverse.praat")
+	TEXTFIELD (script, U"Script file:", U"/u/miep/playReverse.praat")
 	OK
 DO
 	praat_addActionScript (class1, number1, class2, number2, class3, number3, command, afterCommand, depth, script);
@@ -235,7 +231,7 @@ END }
 FORM (PREFS_TextInputEncodingSettings, U"Text reading preferences", U"Unicode") {
 	RADIO_ENUM (encodingOf8BitTextFiles, U"Encoding of 8-bit text files", kMelder_textInputEncoding, DEFAULT)
 OK
-	SET_ENUM (U"Encoding of 8-bit text files", kMelder_textInputEncoding, Melder_getInputEncoding ())
+	SET_ENUM (encodingOf8BitTextFiles, kMelder_textInputEncoding, Melder_getInputEncoding ())
 DO
 	Melder_setInputEncoding ((kMelder_textInputEncoding) encodingOf8BitTextFiles);
 END }
@@ -243,7 +239,7 @@ END }
 FORM (PREFS_TextOutputEncodingSettings, U"Text writing preferences", U"Unicode") {
 	RADIO_ENUM (outputEncoding, U"Output encoding", kMelder_textOutputEncoding, DEFAULT)
 OK
-	SET_ENUM (U"Output encoding", kMelder_textOutputEncoding, Melder_getOutputEncoding ())
+	SET_ENUM (outputEncoding, kMelder_textOutputEncoding, Melder_getOutputEncoding ())
 DO
 	Melder_setOutputEncoding ((kMelder_textOutputEncoding) outputEncoding);
 END }
@@ -251,7 +247,7 @@ END }
 FORM (PREFS_GraphicsCjkFontStyleSettings, U"CJK font style preferences", nullptr) {
 	OPTIONMENU_ENUM (cjkFontStyle, U"CJK font style", kGraphics_cjkFontStyle, DEFAULT)
 OK
-	SET_ENUM (U"CJK font style", kGraphics_cjkFontStyle, theGraphicsCjkFontStyle)
+	SET_ENUM (cjkFontStyle, kGraphics_cjkFontStyle, theGraphicsCjkFontStyle)
 DO
 	theGraphicsCjkFontStyle = (kGraphics_cjkFontStyle) cjkFontStyle;
 END }
@@ -259,11 +255,11 @@ END }
 /********** Callbacks of the Goodies menu. **********/
 
 FORM (STRING_praat_calculator, U"Calculator", U"Calculator") {
-	LABEL (U"", U"Type any numeric formula or string formula:")
-	TEXTFIELD (expression, U"expression", U"5*5")
-	LABEL (U"", U"Note that you can include many special functions in your formula,")
-	LABEL (U"", U"including statistical functions and acoustics-auditory conversions.")
-	LABEL (U"", U"For details, click Help.")
+	LABEL (U"Type any numeric formula or string formula:")
+	TEXTFIELD (expression, nullptr, U"5*5")
+	LABEL (U"Note that you can include many special functions in your formula,")
+	LABEL (U"including statistical functions and acoustics-auditory conversions.")
+	LABEL (U"For details, click Help.")
 	OK
 DO
 	Formula_Result result;
@@ -342,8 +338,8 @@ END }
 /********** Callbacks of the Technical menu. **********/
 
 FORM (PRAAT_debug, U"Set debugging options", nullptr) {
-	LABEL (U"", U"If you switch Tracing on, Praat will write lots of detailed ")
-	LABEL (U"", U"information about what goes on in Praat")
+	LABEL (U"If you switch Tracing on, Praat will write lots of detailed ")
+	LABEL (U"information about what goes on in Praat")
 	structMelderDir dir;
 	Melder_getPrefDir (& dir);
 	structMelderFile file;
@@ -352,15 +348,15 @@ FORM (PRAAT_debug, U"Set debugging options", nullptr) {
 	#else
 		MelderDir_getFile (& dir, U"Tracing.txt", & file);
 	#endif
-	LABEL (U"", Melder_cat (U"to ", Melder_fileToPath (& file), U"."))
+	LABEL (Melder_cat (U"to ", Melder_fileToPath (& file), U"."))
 	BOOLEAN (tracing, U"Tracing", false)
-	LABEL (U"", U"Setting the following to anything other than zero")
-	LABEL (U"", U"will alter the behaviour of Praat")
-	LABEL (U"", U"in unpredictable ways.")
+	LABEL (U"Setting the following to anything other than zero")
+	LABEL (U"will alter the behaviour of Praat")
+	LABEL (U"in unpredictable ways.")
 	INTEGER (debugOption, U"Debug option", U"0")
 OK
-	SET_INTEGER (U"Tracing", Melder_isTracing)
-	SET_INTEGER (U"Debug option", Melder_debug)
+	SET_BOOLEAN (tracing, Melder_isTracing)
+	SET_INTEGER (debugOption, Melder_debug)
 DO
 	Melder_setTracing (tracing);
 	Melder_debug = debugOption;
@@ -482,12 +478,11 @@ FORM_SAVE (SAVE_Data_writeToBinaryFile, U"Save Object(s) as one binary file", nu
 END }
 
 FORM (PRAAT_ManPages_saveToHtmlDirectory, U"Save all pages as HTML files", nullptr) {
-	LABEL (U"", U"Type a directory name:")
-	TEXTFIELD (directory, U"directory", U"")
+	TEXTFIELD (directory, U"Directory:", U"")
 OK
 	structMelderDir currentDirectory { };
 	Melder_getDefaultDir (& currentDirectory);
-	SET_STRING (U"directory", Melder_dirToPath (& currentDirectory))
+	SET_STRING (directory, Melder_dirToPath (& currentDirectory))
 DO
 	LOOP {
 		iam (ManPages);
@@ -511,8 +506,7 @@ END }
 /********** Callbacks of the Help menu. **********/
 
 FORM (HELP_SearchManual, U"Search manual", U"Manual") {
-	LABEL (U"", U"Search for strings (separate with spaces):")
-	TEXTFIELD (query, U"query", U"")
+	TEXTFIELD (query, U"Search for strings (separate with spaces):", U"")
 	OK
 DO
 	if (theCurrentPraatApplication -> batch)
@@ -523,7 +517,7 @@ DO
 END }
 
 FORM (HELP_GoToManualPage, U"Go to manual page", nullptr) {
-	static long numberOfPages;
+	static integer numberOfPages;
 	static const char32 **pages = ManPages_getTitles (theCurrentPraatApplication -> manPages, & numberOfPages);
 	LIST (pageNumber, U"Page", numberOfPages, pages, 1)
 	OK
@@ -536,12 +530,11 @@ DO
 END }
 
 FORM (HELP_WriteManualToHtmlDirectory, U"Save all pages as HTML files", nullptr) {
-	LABEL (U"", U"Type a directory name:")
-	TEXTFIELD (directory, U"directory", U"")
+	TEXTFIELD (directory, U"Directory:", U"")
 OK
 	structMelderDir currentDirectory { };
 	Melder_getDefaultDir (& currentDirectory);
-	SET_STRING (U"directory", Melder_dirToPath (& currentDirectory))
+	SET_STRING (directory, Melder_dirToPath (& currentDirectory))
 DO
 	ManPages_writeAllToHtmlDir (theCurrentPraatApplication -> manPages, directory);
 END }
diff --git a/sys/praat_picture.cpp b/sys/praat_picture.cpp
index d0a01b6..9af6dd8 100644
--- a/sys/praat_picture.cpp
+++ b/sys/praat_picture.cpp
@@ -99,7 +99,7 @@ DIRECT (GRAPHICS_24) { setFontSize (24); END }
 FORM (GRAPHICS_Font_size, U"Praat picture: Font size", U"Font menu") {
 	NATURAL (fontSize, U"Font size (points)", U"10")
 OK
-	SET_INTEGER (U"Font size", (long) theCurrentPraatPicture -> fontSize);
+	SET_INTEGER (fontSize, (integer) theCurrentPraatPicture -> fontSize);
 DO
 	setFontSize (fontSize);
 END }
@@ -158,10 +158,10 @@ DIRECT (GRAPHICS_MouseSelectsOuterViewport) {
 END }
 
 FORM (GRAPHICS_SelectInnerViewport, U"Praat picture: Select inner viewport", U"Select inner viewport...") {
-	LABEL (U"", U"The viewport is the selected rectangle in the Picture window.")
-	LABEL (U"", U"It is where your next drawing will appear.")
-	LABEL (U"", U"The rectangle you select here will not include the margins.")
-	LABEL (U"", U"")
+	LABEL (U"The viewport is the selected rectangle in the Picture window.")
+	LABEL (U"It is where your next drawing will appear.")
+	LABEL (U"The rectangle you select here will not include the margins.")
+	LABEL (U"")
 	REAL (left, U"left Horizontal range (inches)", U"0.0")
 	REAL (right, U"right Horizontal range (inches)", U"6.0")
 	REAL (top, U"left Vertical range (inches)", U"0.0")
@@ -172,16 +172,16 @@ OK
 		ymargin = 0.4 * (theCurrentPraatPicture -> y2NDC - theCurrentPraatPicture -> y1NDC);
 	if (xmargin > 0.4 * (theCurrentPraatPicture -> x2NDC - theCurrentPraatPicture -> x1NDC))
 		xmargin = 0.4 * (theCurrentPraatPicture -> x2NDC - theCurrentPraatPicture -> x1NDC);
-	SET_REAL (U"left Horizontal range", theCurrentPraatPicture -> x1NDC + xmargin)
-	SET_REAL (U"right Horizontal range", theCurrentPraatPicture -> x2NDC - xmargin)
-	SET_REAL (U"left Vertical range", 12 - theCurrentPraatPicture -> y2NDC + ymargin)
-	SET_REAL (U"right Vertical range", 12 - theCurrentPraatPicture -> y1NDC - ymargin)
+	SET_REAL (left, theCurrentPraatPicture -> x1NDC + xmargin)
+	SET_REAL (right, theCurrentPraatPicture -> x2NDC - xmargin)
+	SET_REAL (top, 12 - theCurrentPraatPicture -> y2NDC + ymargin)
+	SET_REAL (bottom, 12 - theCurrentPraatPicture -> y1NDC - ymargin)
 DO
 	//if (theCurrentPraatObjects != & theForegroundPraatObjects) Melder_throw (U"Viewport commands are not available inside manuals.");
 	double xmargin = theCurrentPraatPicture -> fontSize * 4.2 / 72.0, ymargin = theCurrentPraatPicture -> fontSize * 2.8 / 72.0;
 	trace (U"1: xmargin ", xmargin, U" ymargin ", ymargin);
 	if (theCurrentPraatPicture != & theForegroundPraatPicture) {
-		long x1DC, x2DC, y1DC, y2DC;
+		integer x1DC, x2DC, y1DC, y2DC;
 		Graphics_inqWsViewport (GRAPHICS, & x1DC, & x2DC, & y1DC, & y2DC);
 		double x1wNDC, x2wNDC, y1wNDC, y2wNDC;
 		Graphics_inqWsWindow (GRAPHICS, & x1wNDC, & x2wNDC, & y1wNDC, & y2wNDC);
@@ -229,19 +229,19 @@ DO
 END }
 
 FORM (GRAPHICS_SelectOuterViewport, U"Praat picture: Select outer viewport", U"Select outer viewport...") {
-	LABEL (U"", U"The viewport is the selected rectangle in the Picture window.")
-	LABEL (U"", U"It is where your next drawing will appear.")
-	LABEL (U"", U"The rectangle you select here will include the margins.")
-	LABEL (U"", U"")
+	LABEL (U"The viewport is the selected rectangle in the Picture window.")
+	LABEL (U"It is where your next drawing will appear.")
+	LABEL (U"The rectangle you select here will include the margins.")
+	LABEL (U"")
 	REAL (left, U"left Horizontal range (inches)", U"0.0")
 	REAL (right, U"right Horizontal range (inches)", U"6.0")
 	REAL (top, U"left Vertical range (inches)", U"0.0")
 	REAL (bottom, U"right Vertical range (inches)", U"6.0")
 OK
-	SET_REAL (U"left Horizontal range", theCurrentPraatPicture -> x1NDC);
-	SET_REAL (U"right Horizontal range", theCurrentPraatPicture -> x2NDC);
-	SET_REAL (U"left Vertical range", 12 - theCurrentPraatPicture -> y2NDC);
-	SET_REAL (U"right Vertical range", 12 - theCurrentPraatPicture -> y1NDC);
+	SET_REAL (left, theCurrentPraatPicture -> x1NDC)
+	SET_REAL (right, theCurrentPraatPicture -> x2NDC)
+	SET_REAL (top, 12 - theCurrentPraatPicture -> y2NDC)
+	SET_REAL (bottom, 12 - theCurrentPraatPicture -> y1NDC)
 DO
 	//if (theCurrentPraatObjects != & theForegroundPraatObjects) Melder_throw (U"Viewport commands are not available inside manuals.");
 	if (left == right) {
@@ -283,7 +283,7 @@ FORM (GRAPHICS_ViewportText, U"Praat picture: Viewport text", U"Viewport text...
 		RADIOBUTTON (U"Half")
 		RADIOBUTTON (U"Top")
 	REAL (rotation, U"Rotation (degrees)", U"0")
-	TEXTFIELD (text, U"text", U"")
+	TEXTFIELD (text, U"Text:", U"")
 OK
 DO
 	double x1WC, x2WC, y1WC, y2WC;
@@ -348,7 +348,7 @@ DIRECT (GRAPHICS_Dashed_dotted_line) { setLineType (Graphics_DASHED_DOTTED); END
 FORM (GRAPHICS_Line_width, U"Praat picture: Line width", nullptr) {
 	POSITIVE (lineWidth, U"Line width", U"1.0")
 OK
-	SET_REAL (U"Line width", theCurrentPraatPicture -> lineWidth);
+	SET_REAL (lineWidth, theCurrentPraatPicture -> lineWidth)
 DO
 	{// scope
 		autoPraatPicture picture;
@@ -360,7 +360,7 @@ END }
 FORM (GRAPHICS_Arrow_size, U"Praat picture: Arrow size", nullptr) {
 	POSITIVE (arrowSize, U"Arrow size", U"1.0")
 OK
-	SET_REAL (U"Arrow size", theCurrentPraatPicture -> arrowSize);
+	SET_REAL (arrowSize, theCurrentPraatPicture -> arrowSize)
 DO
 	{// scope
 		autoPraatPicture picture;
@@ -370,11 +370,11 @@ DO
 END }
 
 FORM (GRAPHICS_Speckle_size, U"Praat picture: Speckle size", nullptr) {
-	LABEL (U"", U"Here you determine the diameter (in millimetres)")
-	LABEL (U"", U"of the dots that are drawn by \"speckle\" commands.")
+	LABEL (U"Here you determine the diameter (in millimetres)")
+	LABEL (U"of the dots that are drawn by \"speckle\" commands.")
 	POSITIVE (speckleSize, U"Speckle size (mm)", U"1.0")
 OK
-	SET_REAL (U"Speckle size", theCurrentPraatPicture -> speckleSize);
+	SET_REAL (speckleSize, theCurrentPraatPicture -> speckleSize)
 DO
 	{// scope
 		autoPraatPicture picture;
@@ -412,10 +412,9 @@ DIRECT (GRAPHICS_Silver)  { setColour (Graphics_SILVER);  END }
 DIRECT (GRAPHICS_Grey)    { setColour (Graphics_GREY);    END }
 
 FORM (GRAPHICS_Colour, U"Praat picture: Colour", nullptr) {
-	COLOUR (U"Colour (0-1, name, or {r,g,b})", U"0.0")
+	COLOUR (colour, U"Colour (0-1, name, or {r,g,b})", U"0.0")
 OK
 DO
-	Graphics_Colour colour = GET_COLOUR (U"Colour");
 	{// scope
 		autoPraatPicture picture;
 		Graphics_setColour (GRAPHICS, colour);
@@ -428,145 +427,65 @@ END }
 
 /***** "File" MENU *****/
 
-FORM_READ (GRAPHICS_Picture_readFromPraatPictureFile, U"Read picture from praat picture file", 0, false) {
+FORM_READ (GRAPHICS_Picture_readFromPraatPictureFile, U"Read picture from praat picture file", nullptr, false) {
 	Picture_readFromPraatPictureFile (praat_picture.get(), file);
 END }
 
-static void GRAPHICS_Picture_writeToEpsFile (UiForm sendingForm, int narg, Stackel args, const char32 *sendingString,
-	Interpreter /* interpreter */, const char32 *invokingButtonTitle, bool /* modified */, void *)
-{
-	static UiForm dia;
-	if (! dia) dia = UiOutfile_create (theCurrentPraatApplication -> topShell, U"Save as EPS file",
-		GRAPHICS_Picture_writeToEpsFile, nullptr, invokingButtonTitle, nullptr);
-	if (narg < 0) UiForm_info (dia, narg); else if (! sendingForm && ! args && ! sendingString) {
-		UiOutfile_do (dia, U"praat.eps");
-	} else { MelderFile file; structMelderFile file2 { };
-		if (! args && ! sendingString) file = UiFile_getFile (dia);
-		else { Melder_relativePathToFile (args ? args [1]. string : sendingString, & file2); file = & file2; }
-		Picture_writeToEpsFile (praat_picture.get(), file, true, false);
-	}
-}
-/*FORM_SAVE (GRAPHICS_Picture_writeToEpsFile, U"Save picture as Encapsulated PostScript file", 0, U"praat.eps")
-	if (! Picture_writeToEpsFile (praat_picture, fileName, true, false)) return 0;
-END*/
+FORM_SAVE (GRAPHICS_Picture_writeToEpsFile, U"Save picture as Encapsulated PostScript file", nullptr, U"praat.eps") {
+	Picture_writeToEpsFile (praat_picture.get(), file, true, false);
+END }
 
-static void GRAPHICS_Picture_writeToFontlessEpsFile_xipa (UiForm sendingForm, int narg, Stackel args, const char32 *sendingString,
-	Interpreter /* interpreter */, const char32 *invokingButtonTitle, bool /* modified */, void *)
-{
-	static UiForm dia;
-	if (! dia) dia = UiOutfile_create (theCurrentPraatApplication -> topShell, U"Save as fontless EPS file",
-		GRAPHICS_Picture_writeToFontlessEpsFile_xipa, nullptr, invokingButtonTitle, nullptr);
-	if (narg < 0) UiForm_info (dia, narg); else if (! sendingForm && ! args && ! sendingString) {
-		UiOutfile_do (dia, U"praat.eps");
-	} else { MelderFile file; structMelderFile file2 { };
-		if (! args && ! sendingString) file = UiFile_getFile (dia);
-		else { Melder_relativePathToFile (args ? args [1]. string : sendingString, & file2); file = & file2; }
-		Picture_writeToEpsFile (praat_picture.get(), file, false, false);
-	}
-}
+FORM_SAVE (GRAPHICS_Picture_writeToFontlessEpsFile_xipa, U"Save as fontless EPS file", nullptr, U"praat.eps") {
+	Picture_writeToEpsFile (praat_picture.get(), file, false, false);
+END }
 
-static void GRAPHICS_Picture_writeToFontlessEpsFile_silipa (UiForm sendingForm, int narg, Stackel args, const char32 *sendingString,
-	Interpreter /* interpreter */, const char32 *invokingButtonTitle, bool /* modified */, void *)
-{
-	static UiForm dia;
-	if (! dia) dia = UiOutfile_create (theCurrentPraatApplication -> topShell, U"Save as fontless EPS file",
-		GRAPHICS_Picture_writeToFontlessEpsFile_silipa, nullptr, invokingButtonTitle, nullptr);
-	if (narg < 0) UiForm_info (dia, narg); else if (! sendingForm && ! args && ! sendingString) {
-		UiOutfile_do (dia, U"praat.eps");
-	} else { MelderFile file; structMelderFile file2 { };
-		if (! args && ! sendingString) file = UiFile_getFile (dia);
-		else { Melder_relativePathToFile (args ? args [1]. string : sendingString, & file2); file = & file2; }
-		Picture_writeToEpsFile (praat_picture.get(), file, false, true);
-	}
-}
+FORM_SAVE (GRAPHICS_Picture_writeToFontlessEpsFile_silipa, U"Save as fontless EPS file", nullptr, U"praat.eps") {
+	Picture_writeToEpsFile (praat_picture.get(), file, false, true);
+END }
 
-static void GRAPHICS_Picture_writeToPdfFile (UiForm sendingForm, int narg, Stackel args, const char32 *sendingString,
-	Interpreter /* interpreter */, const char32 *invokingButtonTitle, bool /* modified */, void *)
-{
-	static UiForm dia;
-	if (! dia) dia = UiOutfile_create (theCurrentPraatApplication -> topShell, U"Save as PDF file",
-		GRAPHICS_Picture_writeToPdfFile, nullptr, invokingButtonTitle, nullptr);
-	if (narg < 0) UiForm_info (dia, narg); else if (! sendingForm && ! args && ! sendingString) {
-		UiOutfile_do (dia, U"praat.pdf");
-	} else { MelderFile file; structMelderFile file2 { };
-		if (! args && ! sendingString) file = UiFile_getFile (dia);
-		else { Melder_relativePathToFile (args ? args [1]. string : sendingString, & file2); file = & file2; }
-		if (theCurrentPraatPicture == & theForegroundPraatPicture) {
-			Picture_writeToPdfFile (praat_picture.get(), file);
-		} else {
-			try {
-				//autoPraatPicture picture;
-				autoGraphics graphics = Graphics_create_pdffile (file, 300, undefined, 10.24, undefined, 7.68);
-				Graphics_play (GRAPHICS, graphics.get());
-			} catch (MelderError) {
-				Melder_throw (U"Picture not written to PDF file ", file, U".");
-			}
+FORM_SAVE (GRAPHICS_Picture_writeToPdfFile, U"Save as PDF file", nullptr, U"praat.pdf") {
+	if (theCurrentPraatPicture == & theForegroundPraatPicture) {
+		Picture_writeToPdfFile (praat_picture.get(), file);
+	} else {
+		try {
+			//autoPraatPicture picture;
+			autoGraphics graphics = Graphics_create_pdffile (file, 300, undefined, 10.24, undefined, 7.68);
+			Graphics_play (GRAPHICS, graphics.get());
+		} catch (MelderError) {
+			Melder_throw (U"Picture not written to PDF file ", file, U".");
 		}
 	}
-}
+END }
 
-static void GRAPHICS_Picture_writeToPngFile_300 (UiForm sendingForm, int narg, Stackel args, const char32 *sendingString,
-	Interpreter /* interpreter */, const char32 *invokingButtonTitle, bool /* modified */, void *)
-{
-	static UiForm dia;
-	if (! dia) dia = UiOutfile_create (theCurrentPraatApplication -> topShell, U"Save as PNG file",
-		GRAPHICS_Picture_writeToPngFile_300, nullptr, invokingButtonTitle, nullptr);
-	if (narg < 0) UiForm_info (dia, narg); else if (! sendingForm && ! args && ! sendingString) {
-		UiOutfile_do (dia, U"praat.png");
-	} else { MelderFile file; structMelderFile file2 { };
-		if (! args && ! sendingString) file = UiFile_getFile (dia);
-		else { Melder_relativePathToFile (args ? args [1]. string : sendingString, & file2); file = & file2; }
-		if (theCurrentPraatPicture == & theForegroundPraatPicture) {
-			Picture_writeToPngFile_300 (praat_picture.get(), file);
-		} else {
-			try {
-				autoGraphics graphics = Graphics_create_pngfile (file, 300, 0.0, 10.24, 0.0, 7.68);
-				Graphics_play (GRAPHICS, graphics.get());
-			} catch (MelderError) {
-				Melder_throw (U"Picture not written to PNG file ", file, U".");
-			}
+FORM_SAVE (GRAPHICS_Picture_writeToPngFile_300, U"Save as PNG file", nullptr, U"praat.png") {
+	if (theCurrentPraatPicture == & theForegroundPraatPicture) {
+		Picture_writeToPngFile_300 (praat_picture.get(), file);
+	} else {
+		try {
+			autoGraphics graphics = Graphics_create_pngfile (file, 300, 0.0, 10.24, 0.0, 7.68);
+			Graphics_play (GRAPHICS, graphics.get());
+		} catch (MelderError) {
+			Melder_throw (U"Picture not written to PNG file ", file, U".");
 		}
 	}
-}
+END }
 
-static void GRAPHICS_Picture_writeToPngFile_600 (UiForm sendingForm, int narg, Stackel args, const char32 *sendingString,
-	Interpreter /* interpreter */, const char32 *invokingButtonTitle, bool /* modified */, void *)
-{
-	static UiForm dia;
-	if (! dia) dia = UiOutfile_create (theCurrentPraatApplication -> topShell, U"Save as PNG file",
-		GRAPHICS_Picture_writeToPngFile_600, nullptr, invokingButtonTitle, nullptr);
-	if (narg < 0) UiForm_info (dia, narg); else if (! sendingForm && ! args && ! sendingString) {
-		UiOutfile_do (dia, U"praat.png");
-	} else { MelderFile file; structMelderFile file2 { };
-		if (! args && ! sendingString) file = UiFile_getFile (dia);
-		else { Melder_relativePathToFile (args ? args [1]. string : sendingString, & file2); file = & file2; }
-		if (theCurrentPraatPicture == & theForegroundPraatPicture) {
-			Picture_writeToPngFile_600 (praat_picture.get(), file);
-		} else {
-			try {
-				autoGraphics graphics = Graphics_create_pngfile (file, 600, 0.0, 10.24, 0.0, 7.68);
-				Graphics_play (GRAPHICS, graphics.get());
-			} catch (MelderError) {
-				Melder_throw (U"Picture not written to PNG file ", file, U".");
-			}
+FORM_SAVE (GRAPHICS_Picture_writeToPngFile_600, U"Save as PNG file", nullptr, U"praat.png") {
+	if (theCurrentPraatPicture == & theForegroundPraatPicture) {
+		Picture_writeToPngFile_600 (praat_picture.get(), file);
+	} else {
+		try {
+			autoGraphics graphics = Graphics_create_pngfile (file, 600, 0.0, 10.24, 0.0, 7.68);
+			Graphics_play (GRAPHICS, graphics.get());
+		} catch (MelderError) {
+			Melder_throw (U"Picture not written to PNG file ", file, U".");
 		}
 	}
-}
+END }
 
-static void GRAPHICS_Picture_writeToPraatPictureFile (UiForm sendingForm, int narg, Stackel args, const char32 *sendingString,
-	Interpreter /* interpreter */, const char32 *invokingButtonTitle, bool /* modified */, void *)
-{
-	static UiForm dia;
-	if (! dia) dia = UiOutfile_create (theCurrentPraatApplication -> topShell, U"Save as Praat picture file",
-		GRAPHICS_Picture_writeToPraatPictureFile, nullptr, invokingButtonTitle, nullptr);
-	if (narg < 0) UiForm_info (dia, narg); else if (! sendingForm && ! args && ! sendingString) {
-		UiOutfile_do (dia, U"praat.prapic");
-	} else { MelderFile file; structMelderFile file2 { };
-		if (! args && ! sendingString) file = UiFile_getFile (dia);
-		else { Melder_relativePathToFile (args ? args [1]. string : sendingString, & file2); file = & file2; }
-		Picture_writeToPraatPictureFile (praat_picture.get(), file);
-	}
-}
+FORM_SAVE (GRAPHICS_Picture_writeToPraatPictureFile, U"Save as Praat picture file", nullptr, U"praat.prapic") {
+	Picture_writeToPraatPictureFile (praat_picture.get(), file);
+END }
 
 #ifdef macintosh
 DIRECT (GRAPHICS_Page_setup) {
@@ -580,29 +499,28 @@ FORM (GRAPHICS_PostScript_settings, U"PostScript settings", U"PostScript setting
 	#endif
 	RADIO_ENUM (greyResolution, U"Grey resolution", kGraphicsPostscript_spots, DEFAULT)
 	#if defined (UNIX)
-		RADIO_ENUM (paperSize, U"Paper size", kGraphicsPostscript_paperSize, DEFAULT);
-		RADIO_ENUM (orientation, U"Orientation", kGraphicsPostscript_orientation, DEFAULT);
+		RADIO_ENUM (paperSize, U"Paper size", kGraphicsPostscript_paperSize, DEFAULT)
+		RADIO_ENUM (orientation, U"Orientation", kGraphicsPostscript_orientation, DEFAULT)
 		POSITIVE (magnification, U"Magnification", U"1.0");
-		LABEL (U"label", U"Print command:");
 		#if defined (linux)
-			TEXTFIELD (printCommand, U"printCommand", U"lpr %s");
+			TEXTFIELD (printCommand, U"Print command:", U"lpr %s")
 		#else
-			TEXTFIELD (printCommand, U"printCommand", U"lp -c %s");
+			TEXTFIELD (printCommand, U"Print command:", U"lp -c %s")
 		#endif
 	#endif
 	RADIO_ENUM (fontChoiceStrategy, U"Font choice strategy", kGraphicsPostscript_fontChoiceStrategy, DEFAULT)
 OK
 	#if defined (_WIN32)
-		SET_INTEGER (U"Allow direct PostScript", thePrinter. allowDirectPostScript);
+		SET_BOOLEAN (allowDirectPostscript, thePrinter. allowDirectPostScript)
 	#endif
-	SET_ENUM (U"Grey resolution", kGraphicsPostscript_spots, thePrinter. spots);
+	SET_ENUM (greyResolution, kGraphicsPostscript_spots, thePrinter. spots)
 	#if defined (UNIX)
-		SET_ENUM (U"Paper size", kGraphicsPostscript_paperSize, thePrinter. paperSize);
-		SET_ENUM (U"Orientation", kGraphicsPostscript_orientation, thePrinter. orientation);
-		SET_REAL (U"Magnification", thePrinter. magnification);
-		SET_STRING (U"printCommand", Site_getPrintCommand ());
+		SET_ENUM (paperSize, kGraphicsPostscript_paperSize, thePrinter. paperSize)
+		SET_ENUM (orientation, kGraphicsPostscript_orientation, thePrinter. orientation)
+		SET_REAL (magnification, thePrinter. magnification)
+		SET_STRING (printCommand, Site_getPrintCommand ())
 	#endif
-	SET_ENUM (U"Font choice strategy", kGraphicsPostscript_fontChoiceStrategy, thePrinter. fontChoiceStrategy);
+	SET_ENUM (fontChoiceStrategy, kGraphicsPostscript_fontChoiceStrategy, thePrinter. fontChoiceStrategy)
 DO
 	INFO_NONE
 		#if defined (_WIN32)
@@ -634,20 +552,9 @@ DIRECT (GRAPHICS_Print) {
 END }
 
 #ifdef _WIN32
-	static void GRAPHICS_Picture_writeToWindowsMetafile (UiForm sendingForm, int /* narg */, Stackel args, const char32 *sendingString,
-		Interpreter /* interpreter */, const char32 *invokingButtonTitle, bool /* modified */, void *)
-	{
-		static UiForm dia;
-		if (! dia) dia = UiOutfile_create (theCurrentPraatApplication -> topShell, U"Save as Windows metafile",
-			GRAPHICS_Picture_writeToWindowsMetafile, nullptr, invokingButtonTitle, nullptr);
-		if (! sendingForm && ! args && ! sendingString) {
-			UiOutfile_do (dia, U"praat.emf");
-		} else { MelderFile file; structMelderFile file2 { };
-			if (! args && ! sendingString) file = UiFile_getFile (dia);
-			else { Melder_relativePathToFile (args ? args [1]. string : sendingString, & file2); file = & file2; }
-			Picture_writeToWindowsMetafile (praat_picture.get(), file);
-		}
-	}
+	FORM_SAVE (GRAPHICS_Picture_writeToWindowsMetafile, U"Save as Windows metafile", nullptr, U"praat.emf") {
+		Picture_writeToWindowsMetafile (praat_picture.get(), file);
+	END }
 #endif
 
 #if defined (_WIN32) || defined (macintosh)
@@ -700,8 +607,7 @@ FORM (GRAPHICS_Text, U"Praat picture: Text", U"Text...") {
 		OPTION (U"Bottom")
 		OPTION (U"Half")
 		OPTION (U"Top")
-	LABEL (U"", U"Text:")
-	TEXTFIELD (text, U"text", U"")
+	TEXTFIELD (text, U"Text:", U"")
 	OK
 DO
 	GRAPHICS_NONE
@@ -726,8 +632,7 @@ FORM (GRAPHICS_TextSpecial, U"Praat picture: Text special", nullptr) {
 	OPTIONMENU_ENUM (font, U"Font", kGraphics_font, DEFAULT)
 	NATURAL (fontSize, U"Font size", U"10")
 	SENTENCE (rotation, U"Rotation (degrees or dx;dy)", U"0")
-	LABEL (U"", U"Text:")
-	TEXTFIELD (text, U"text", U"")
+	TEXTFIELD (text, U"Text:", U"")
 OK
 DO
 	kGraphics_font currentFont = Graphics_inqFont (GRAPHICS);
@@ -796,24 +701,23 @@ Thing_define (PraatPictureFunction, Daata) {
 	// new data:
 	public:
 		double xmin, xmax, dx, x1;
-		long nx;
+		integer nx;
 	// overridden methods:
-		virtual bool v_hasGetXmin () { return true; }   virtual double v_getXmin ()        { return xmin; }
-		virtual bool v_hasGetXmax () { return true; }   virtual double v_getXmax ()        { return xmax; }
-		virtual bool v_hasGetNx   () { return true; }   virtual double v_getNx   ()        { return nx; }
-		virtual bool v_hasGetDx   () { return true; }   virtual double v_getDx   ()        { return dx; }
-		virtual bool v_hasGetX    () { return true; }   virtual double v_getX    (long ix) { return x1 + (ix - 1) * dx; }
+		virtual bool v_hasGetXmin () { return true; }   virtual double v_getXmin ()           { return xmin; }
+		virtual bool v_hasGetXmax () { return true; }   virtual double v_getXmax ()           { return xmax; }
+		virtual bool v_hasGetNx   () { return true; }   virtual double v_getNx   ()           { return nx; }
+		virtual bool v_hasGetDx   () { return true; }   virtual double v_getDx   ()           { return dx; }
+		virtual bool v_hasGetX    () { return true; }   virtual double v_getX    (integer ix) { return x1 + (ix - 1) * dx; }
 };
 Thing_implement (PraatPictureFunction, Daata, 0);
 
 FORM (GRAPHICS_DrawFunction, U"Praat picture: Draw function", nullptr) {
-	LABEL (U"", U"This command assumes that the x and y axes")
-	LABEL (U"", U"have been set by a Draw command or by \"Axes...\".")
+	LABEL (U"This command assumes that the x and y axes")
+	LABEL (U"have been set by a Draw command or by \"Axes...\".")
 	REAL (fromX, U"From x", U"0.0")
 	REAL (toX, U"To x", U"0.0 (= all)")
 	NATURAL (numberOfHorizontalSteps, U"Number of horizontal steps", U"1000")
-	LABEL (U"", U"Formula:")
-	TEXTFIELD (formula, U"formula", U"x^2 - x^4")
+	TEXTFIELD (formula, U"Formula:", U"x^2 - x^4")
 	OK
 DO
 	double x1WC, x2WC, y1WC, y2WC;
@@ -828,7 +732,7 @@ DO
 	function -> x1 = fromX;
 	function -> dx = (toX - fromX) / (numberOfHorizontalSteps - 1);
 	Formula_compile (interpreter, function.get(), formula, kFormula_EXPRESSION_TYPE_NUMERIC, true);
-	for (long i = 1; i <= numberOfHorizontalSteps; i ++) {
+	for (integer i = 1; i <= numberOfHorizontalSteps; i ++) {
 		Formula_Result result;
 		Formula_run (1, i, & result);
 		y [i] = result. numericResult;
@@ -855,7 +759,7 @@ DO
 }
 
 FORM (GRAPHICS_PaintRectangle, U"Praat picture: Paint rectangle", nullptr) {
-	COLOUR (U"Colour (0-1, name, or {r,g,b})", U"0.5")
+	COLOUR (colour, U"Colour (0-1, name, or {r,g,b})", U"0.5")
 	REAL (fromX, U"From x", U"0.0")
 	REAL (toX, U"To x", U"1.0")
 	REAL (fromY, U"From y", U"0.0")
@@ -864,7 +768,7 @@ FORM (GRAPHICS_PaintRectangle, U"Praat picture: Paint rectangle", nullptr) {
 DO
 	GRAPHICS_NONE
 		Graphics_setInner (GRAPHICS);
-		Graphics_setColour (GRAPHICS, GET_COLOUR (U"Colour"));
+		Graphics_setColour (GRAPHICS, colour);
 		Graphics_fillRectangle (GRAPHICS, fromX, toX, fromY, toY);
 		Graphics_unsetInner (GRAPHICS);
 	GRAPHICS_NONE_END
@@ -886,7 +790,7 @@ DO
 }
 
 FORM (GRAPHICS_PaintRoundedRectangle, U"Praat picture: Paint rounded rectangle", nullptr) {
-	COLOUR (U"Colour (0-1, name, or {r,g,b})", U"0.5")
+	COLOUR (colour, U"Colour (0-1, name, or {r,g,b})", U"0.5")
 	REAL (fromX, U"From x", U"0.0")
 	REAL (toX, U"To x", U"1.0")
 	REAL (fromY, U"From y", U"0.0")
@@ -896,7 +800,7 @@ FORM (GRAPHICS_PaintRoundedRectangle, U"Praat picture: Paint rounded rectangle",
 DO
 	GRAPHICS_NONE
 		Graphics_setInner (GRAPHICS);
-		Graphics_setColour (GRAPHICS, GET_COLOUR (U"Colour"));
+		Graphics_setColour (GRAPHICS, colour);
 		Graphics_fillRoundedRectangle (GRAPHICS, fromX, toX, fromY, toY, radius);
 		Graphics_unsetInner (GRAPHICS);
 	GRAPHICS_NONE_END
@@ -932,7 +836,7 @@ DO
 }
 
 FORM (GRAPHICS_PaintEllipse, U"Praat picture: Paint ellipse", nullptr) {
-	COLOUR (U"Colour (0-1, name, or {r,g,b})", U"0.5")
+	COLOUR (colour, U"Colour (0-1, name, or {r,g,b})", U"0.5")
 	REAL (fromX, U"From x", U"0.0")
 	REAL (toX, U"To x", U"1.0")
 	REAL (fromY, U"From y", U"0.0")
@@ -941,7 +845,7 @@ FORM (GRAPHICS_PaintEllipse, U"Praat picture: Paint ellipse", nullptr) {
 DO
 	GRAPHICS_NONE
 		Graphics_setInner (GRAPHICS);
-		Graphics_setColour (GRAPHICS, GET_COLOUR (U"Colour"));
+		Graphics_setColour (GRAPHICS, colour);
 		Graphics_fillEllipse (GRAPHICS, fromX, toX, fromY, toY);
 		Graphics_unsetInner (GRAPHICS);
 	GRAPHICS_NONE_END
@@ -961,7 +865,7 @@ DO
 }
 
 FORM (GRAPHICS_PaintCircle, U"Praat picture: Paint circle", nullptr) {
-	COLOUR (U"Colour (0-1, name, or {r,g,b})", U"0.5")
+	COLOUR (colour, U"Colour (0-1, name, or {r,g,b})", U"0.5")
 	REAL (centreX, U"Centre x", U"0.0")
 	REAL (centreY, U"Centre y", U"0.0")
 	POSITIVE (radius, U"Radius (along x)", U"1.0")
@@ -969,7 +873,7 @@ FORM (GRAPHICS_PaintCircle, U"Praat picture: Paint circle", nullptr) {
 DO
 	GRAPHICS_NONE
 		Graphics_setInner (GRAPHICS);
-		Graphics_setColour (GRAPHICS, GET_COLOUR (U"Colour"));
+		Graphics_setColour (GRAPHICS, colour);
 		Graphics_fillCircle (GRAPHICS, centreX, centreY, radius);
 		Graphics_unsetInner (GRAPHICS);
 	GRAPHICS_NONE_END
@@ -989,7 +893,7 @@ DO
 }
 
 FORM (GRAPHICS_PaintCircle_mm, U"Praat picture: Paint circle (mm)", nullptr) {
-	COLOUR (U"Colour (0-1, name, or {r,g,b})", U"0.5")
+	COLOUR (colour, U"Colour (0-1, name, or {r,g,b})", U"0.5")
 	REAL (centreX, U"Centre x", U"0.0")
 	REAL (centreY, U"Centre y", U"0.0")
 	POSITIVE (diameter, U"Diameter (mm)", U"5.0")
@@ -997,15 +901,14 @@ FORM (GRAPHICS_PaintCircle_mm, U"Praat picture: Paint circle (mm)", nullptr) {
 DO
 	GRAPHICS_NONE
 		Graphics_setInner (GRAPHICS);
-		Graphics_setColour (GRAPHICS, GET_COLOUR (U"Colour"));
+		Graphics_setColour (GRAPHICS, colour);
 		Graphics_fillCircle_mm (GRAPHICS, centreX, centreY, diameter);
 		Graphics_unsetInner (GRAPHICS);
 	GRAPHICS_NONE_END
 }
 
 FORM (GRAPHICS_InsertPictureFromFile, U"Praat picture: Insert picture from file", U"Insert picture from file...") {
-	LABEL (U"", U"File name:")
-	TEXTFIELD (fileName, U"fileName", U"~/Desktop/paul.jpg")
+	TEXTFIELD (fileName, U"File name:", U"~/Desktop/paul.jpg")
 	REAL (fromX, U"From x", U"0.0")
 	REAL (toX, U"To x", U"1.0")
 	REAL (fromY, U"From y", U"0.0")
@@ -1027,10 +930,10 @@ FORM (GRAPHICS_Axes, U"Praat picture: Axes", U"Axes...") {
 OK
 	double x1WC, x2WC, y1WC, y2WC;
 	Graphics_inqWindow (GRAPHICS, & x1WC, & x2WC, & y1WC, & y2WC);
-	SET_REAL (U"left Left and right", x1WC);
-	SET_REAL (U"right Left and right", x2WC);
-	SET_REAL (U"left Bottom and top", y1WC);
-	SET_REAL (U"right Bottom and top", y2WC);
+	SET_REAL (left, x1WC)
+	SET_REAL (right, x2WC)
+	SET_REAL (top, y1WC)
+	SET_REAL (bottom, y2WC)
 DO
 	if (left == right) Melder_throw (U"Left and right should not be equal.");
 	if (top == bottom) Melder_throw (U"Top and bottom should not be equal.");
@@ -1049,7 +952,7 @@ DIRECT (GRAPHICS_DrawInnerBox) {
 
 FORM (GRAPHICS_TextLeft, U"Praat picture: Text left", U"Text left/right/top/bottom...") {
 	BOOLEAN (farr, U"Far", true)
-	TEXTFIELD (text, U"text", U"")
+	TEXTFIELD (text, U"Text:", U"")
 	OK
 DO
 	GRAPHICS_NONE
@@ -1059,7 +962,7 @@ DO
 
 FORM (GRAPHICS_TextRight, U"Praat picture: Text right", U"Text left/right/top/bottom...") {
 	BOOLEAN (farr, U"Far", true)
-	TEXTFIELD (text, U"text", U"")
+	TEXTFIELD (text, U"Text:", U"")
 	OK
 DO
 	GRAPHICS_NONE
@@ -1069,7 +972,7 @@ DO
 
 FORM (GRAPHICS_TextTop, U"Praat picture: Text top", U"Text left/right/top/bottom...") {
 	BOOLEAN (farr, U"Far", true)
-	TEXTFIELD (text, U"text", U"")
+	TEXTFIELD (text, U"Text:", U"")
 	OK
 DO
 	GRAPHICS_NONE
@@ -1079,7 +982,7 @@ DO
 
 FORM (GRAPHICS_TextBottom, U"Praat picture: Text bottom", U"Text left/right/top/bottom...") {
 	BOOLEAN (farr, U"Far", true)
-	TEXTFIELD (text, U"text", U"")
+	TEXTFIELD (text, U"Text:", U"")
 	OK
 DO
 	GRAPHICS_NONE
@@ -1229,8 +1132,7 @@ FORM (GRAPHICS_OneMarkLeft, U"Praat picture: One mark left", U"One mark left/rig
 	BOOLEAN (writeNumber, U"Write number", true)
 	BOOLEAN (drawTick, U"Draw tick", true)
 	BOOLEAN (drawDottedLine, U"Draw dotted line", true)
-	LABEL (U"", U"Draw text:")
-	TEXTFIELD (text, U"text", U"")
+	TEXTFIELD (text, U"Draw text:", U"")
 	OK
 DO
 	double x1WC, x2WC, y1WC, y2WC, dy;
@@ -1252,8 +1154,7 @@ FORM (GRAPHICS_OneMarkRight, U"Praat picture: One mark right", U"One mark left/r
 	BOOLEAN (writeNumber, U"Write number", true)
 	BOOLEAN (drawTick, U"Draw tick", true)
 	BOOLEAN (drawDottedLine, U"Draw dotted line", true)
-	LABEL (U"", U"Draw text:")
-	TEXTFIELD (text, U"text", U"")
+	TEXTFIELD (text, U"Draw text:", U"")
 	OK
 DO
 	double x1WC, x2WC, y1WC, y2WC, dy;
@@ -1275,8 +1176,7 @@ FORM (GRAPHICS_OneMarkTop, U"Praat picture: One mark top", U"One mark left/right
 	BOOLEAN (writeNumber, U"Write number", true)
 	BOOLEAN (drawTick, U"Draw tick", true)
 	BOOLEAN (drawDottedLine, U"Draw dotted line", true)
-	LABEL (U"", U"Draw text:")
-	TEXTFIELD (text, U"text", U"")
+	TEXTFIELD (text, U"Draw text:", U"")
 	OK
 DO
 	double x1WC, x2WC, y1WC, y2WC, dx;
@@ -1298,8 +1198,7 @@ FORM (GRAPHICS_OneMarkBottom, U"Praat picture: One mark bottom", U"One mark left
 	BOOLEAN (writeNumber, U"Write number", true)
 	BOOLEAN (drawTick, U"Draw tick", true)
 	BOOLEAN (drawDottedLine, U"Draw dotted line", true)
-	LABEL (U"", U"Draw text:")
-	TEXTFIELD (text, U"text", U"")
+	TEXTFIELD (text, U"Draw text:", U"")
 	OK
 DO
 	double x1WC, x2WC, y1WC, y2WC, dx;
@@ -1321,8 +1220,7 @@ FORM (GRAPHICS_OneLogarithmicMarkLeft, U"Praat picture: One logarithmic mark lef
 	BOOLEAN (writeNumber, U"Write number", 1)
 	BOOLEAN (drawTick, U"Draw tick", 1)
 	BOOLEAN (drawDottedLine, U"Draw dotted line", 1)
-	LABEL (U"", U"Draw text:")
-	TEXTFIELD (text, U"text", U"")
+	TEXTFIELD (text, U"Draw text:", U"")
 	OK
 DO
 	double x1WC, x2WC, y1WC, y2WC, dy;
@@ -1344,8 +1242,7 @@ FORM (GRAPHICS_OneLogarithmicMarkRight, U"Praat picture: One logarithmic mark ri
 	BOOLEAN (writeNumber, U"Write number", 1)
 	BOOLEAN (drawTick, U"Draw tick", 1)
 	BOOLEAN (drawDottedLine, U"Draw dotted line", 1)
-	LABEL (U"", U"Draw text:")
-	TEXTFIELD (text, U"text", U"")
+	TEXTFIELD (text, U"Draw text:", U"")
 	OK
 DO
 	double x1WC, x2WC, y1WC, y2WC, dy;
@@ -1367,8 +1264,7 @@ FORM (GRAPHICS_OneLogarithmicMarkTop, U"Praat picture: One logarithmic mark top"
 	BOOLEAN (writeNumber, U"Write number", 1)
 	BOOLEAN (drawTick, U"Draw tick", 1)
 	BOOLEAN (drawDottedLine, U"Draw dotted line", 1)
-	LABEL (U"", U"Draw text:")
-	TEXTFIELD (text, U"text", U"")
+	TEXTFIELD (text, U"Draw text:", U"")
 	OK
 DO
 	double x1WC, x2WC, y1WC, y2WC, dx;
@@ -1390,8 +1286,7 @@ FORM (GRAPHICS_OneLogarithmicMarkBottom, U"Praat picture: One logarithmic mark b
 	BOOLEAN (writeNumber, U"Write number", 1)
 	BOOLEAN (drawTick, U"Draw tick", 1)
 	BOOLEAN (drawDottedLine, U"Draw dotted line", 1)
-	LABEL (U"", U"Draw text:")
-	TEXTFIELD (text, U"text", U"")
+	TEXTFIELD (text, U"Draw text:", U"")
 	OK
 DO
 	double x1WC, x2WC, y1WC, y2WC, dx;
@@ -1457,7 +1352,7 @@ DO
 END }
 
 FORM (GRAPHICS_TextWidth_worldCoordinates, U"Text width in world coordinates", nullptr) {
-	TEXTFIELD (text, U"text", U"Hello world")
+	TEXTFIELD (text, U"Text:", U"Hello world")
 	OK
 DO
 	Graphics_setFont (GRAPHICS, static_cast<kGraphics_font> (theCurrentPraatPicture -> font));
@@ -1470,7 +1365,7 @@ DO
 END }
 
 FORM (GRAPHICS_TextWidth_mm, U"Text width in millimetres", nullptr) {
-	TEXTFIELD (text, U"text", U"Hello world")
+	TEXTFIELD (text, U"Text:", U"Hello world")
 	OK
 DO
 	Graphics_setFont (GRAPHICS, static_cast<kGraphics_font> (theCurrentPraatPicture -> font));
@@ -1486,7 +1381,7 @@ FORM (GRAPHICS_PostScriptTextWidth_worldCoordinates, U"PostScript text width in
 	RADIOx (phoneticFont, U"Phonetic font", 1, 0)
 		RADIOBUTTON (U"XIPA")
 		RADIOBUTTON (U"SILIPA")
-	TEXTFIELD (text, U"text", U"Hello world")
+	TEXTFIELD (text, U"Text:", U"Hello world")
 	OK
 DO
 	Graphics_setFont (GRAPHICS, static_cast<kGraphics_font> (theCurrentPraatPicture -> font));
@@ -1502,7 +1397,7 @@ FORM (GRAPHICS_PostScriptTextWidth_mm, U"PostScript text width in millimetres",
 	RADIOx (phoneticFont, U"Phonetic font", 1, 0)
 		RADIOBUTTON (U"XIPA")
 		RADIOBUTTON (U"SILIPA")
-	TEXTFIELD (text, U"text", U"Hello world")
+	TEXTFIELD (text, U"Text:", U"Hello world")
 	OK
 DO
 	Graphics_setFont (GRAPHICS, static_cast<kGraphics_font> (theCurrentPraatPicture -> font));
@@ -1535,7 +1430,7 @@ DIRECT (GRAPHICS_Picture_settings_report) {
 	MelderInfo_writeLine (U"Font size: ", theCurrentPraatPicture -> fontSize, U" points");
 	double xmargin = theCurrentPraatPicture -> fontSize * 4.2 / 72.0, ymargin = theCurrentPraatPicture -> fontSize * 2.8 / 72.0;
 	if (theCurrentPraatPicture != & theForegroundPraatPicture) {
-		long x1DC, x2DC, y1DC, y2DC;
+		integer x1DC, x2DC, y1DC, y2DC;
 		Graphics_inqWsViewport (GRAPHICS, & x1DC, & x2DC, & y1DC, & y2DC);
 		double x1wNDC, x2wNDC, y1wNDC, y2wNDC;
 		Graphics_inqWsWindow (GRAPHICS, & x1wNDC, & x2wNDC, & y1wNDC, & y2wNDC);
diff --git a/sys/praat_script.cpp b/sys/praat_script.cpp
index 87bbf56..849f9b5 100644
--- a/sys/praat_script.cpp
+++ b/sys/praat_script.cpp
@@ -60,7 +60,7 @@ static int praat_findObjectFromString (Interpreter interpreter, const char32 *st
 			 */
 			double value;
 			Interpreter_numericExpression (interpreter, string, & value);
-			long id = (long) value;
+			integer id = (integer) value;
 			WHERE (ID == id)
 				return IOBJECT;
 			Melder_throw (U"No object with number ", id, U".");
@@ -98,7 +98,7 @@ Editor praat_findEditorFromString (const char32 *string) {
 	Melder_throw (U"Editor \"", string, U"\" does not exist.");
 }
 
-Editor praat_findEditorById (long id) {
+Editor praat_findEditorById (integer id) {
 	int IOBJECT;
 	WHERE (1) {
 		if (ID == id) {
@@ -123,8 +123,8 @@ static int parseCommaSeparatedArguments (Interpreter interpreter, char32 *argume
 			Interpreter_anyExpression (interpreter, arguments, & result);
 			narg ++;
 			/*
-			 * First remove the old contents.
-			 */
+				First remove the old contents.
+			*/
 			switch (args [narg]. which) {
 				case Stackel_NUMBER: {
 					// do nothing
@@ -132,10 +132,16 @@ static int parseCommaSeparatedArguments (Interpreter interpreter, char32 *argume
 				case Stackel_STRING: {
 					Melder_free (args [narg].string);
 				} break;
+				case Stackel_NUMERIC_VECTOR: {
+					//if (args [narg]. owned) args [narg].numericVector.reset();   // we don't own this; the form's autonumvec does, after UiField_argToValue()
+				} break;
+				case Stackel_NUMERIC_MATRIX: {
+					//if (args [narg]. owned) args [narg].numericMatrix.reset();   // we don't own this; the form's autonummat does, after UiField_argToValue()
+				} break;
 			}
 			/*
-			 * Then copy in the new contents.
-			 */
+				Then copy in the new contents.
+			*/
 			switch (result. expressionType) {
 				case kFormula_EXPRESSION_TYPE_NUMERIC: {
 					args [narg]. which = Stackel_NUMBER;
@@ -145,6 +151,16 @@ static int parseCommaSeparatedArguments (Interpreter interpreter, char32 *argume
 					args [narg]. which = Stackel_STRING;
 					args [narg]. string = result. stringResult;
 				} break;
+				case kFormula_EXPRESSION_TYPE_NUMERIC_VECTOR: {
+					args [narg]. which = Stackel_NUMERIC_VECTOR;
+					args [narg]. numericVector = result. numericVectorResult;
+					args [narg]. owned = result. owned;   // 
+				} break;
+				case kFormula_EXPRESSION_TYPE_NUMERIC_MATRIX: {
+					args [narg]. which = Stackel_NUMERIC_MATRIX;
+					args [narg]. numericMatrix = result. numericMatrixResult;
+					args [narg]. owned = result. owned;
+				} break;
 			}
 			arguments = p + 1;
 		} else if (*p == U'(' || *p == U'[' || *p == U'{') {
diff --git a/sys/praat_statistics.cpp b/sys/praat_statistics.cpp
index 35171af..ff992a8 100644
--- a/sys/praat_statistics.cpp
+++ b/sys/praat_statistics.cpp
@@ -21,14 +21,14 @@
 #include "praatP.h"
 
 static struct {
-	long batchSessions, interactiveSessions;
+	integer batchSessions, interactiveSessions;
 	double memory;
 	char32 dateOfFirstSession [Preferences_STRING_BUFFER_SIZE];
 } statistics;
 
 void praat_statistics_prefs () {
-	Preferences_addLong (U"PraatShell.batchSessions", & statistics.batchSessions, 0);
-	Preferences_addLong (U"PraatShell.interactiveSessions", & statistics.interactiveSessions, 0);
+	Preferences_addInteger (U"PraatShell.batchSessions", & statistics.batchSessions, 0);
+	Preferences_addInteger (U"PraatShell.interactiveSessions", & statistics.interactiveSessions, 0);
 	Preferences_addDouble (U"PraatShell.memory", & statistics.memory, 0.0);
 	Preferences_addString (U"PraatShell.dateOfFirstSession", & statistics.dateOfFirstSession [0], U"");
 }
@@ -51,6 +51,14 @@ void praat_statistics_exit () {
 	statistics.memory += Melder_allocationSize ();
 }
 
+/*@praat
+	report$ = Report integer properties
+	sizeOfInteger = extractNumber (report$, "An indexing integer is ")
+	sizeOfPointer = extractNumber (report$, "A pointer is ")
+	assert sizeOfInteger = sizeOfPointer
+	sizeOfFileOffset = extractNumber (report$, "A file offset is ")
+	assert sizeOfFileOffset = 64
+@*/
 void praat_reportIntegerProperties () {
 	MelderInfo_open ();
 	MelderInfo_writeLine (U"Integer properties of this edition of Praat on this computer:\n");
@@ -59,6 +67,7 @@ void praat_reportIntegerProperties () {
 	MelderInfo_writeLine (U"An \"integer\" is ",           sizeof (int)         * 8, U" bits.");
 	MelderInfo_writeLine (U"A \"long integer\" is ",       sizeof (long)        * 8, U" bits.");
 	MelderInfo_writeLine (U"A \"long long integer\" is ",  sizeof (long long)   * 8, U" bits.");
+	MelderInfo_writeLine (U"An indexing integer is ",      sizeof (integer)     * 8, U" bits.");
 	MelderInfo_writeLine (U"A pointer is ",                sizeof (void *)      * 8, U" bits.");
 	MelderInfo_writeLine (U"A memory object size is ",     sizeof (size_t)      * 8, U" bits.");
 	MelderInfo_writeLine (U"A file offset is ",            sizeof (off_t)       * 8, U" bits.");
diff --git a/sys/praat_version.h b/sys/praat_version.h
index 0f5fb05..c7d6857 100644
--- a/sys/praat_version.h
+++ b/sys/praat_version.h
@@ -1,5 +1,5 @@
-#define PRAAT_VERSION_STR 6.0.33
-#define PRAAT_VERSION_NUM 6033
+#define PRAAT_VERSION_STR 6.0.34
+#define PRAAT_VERSION_NUM 6034
 #define PRAAT_YEAR 2017
-#define PRAAT_MONTH September
-#define PRAAT_DAY 26
+#define PRAAT_MONTH October
+#define PRAAT_DAY 10
diff --git a/sys/prefs.h b/sys/prefs.h
index e51161d..598ff30 100644
--- a/sys/prefs.h
+++ b/sys/prefs.h
@@ -32,12 +32,12 @@
 	private: static int s_##name; public: int & pref_##name () override { return s_##name; } \
 	private: static const char32 * sdefault_##name; public: const char32 * default_##name () override { return sdefault_##name; }
 
-#define prefs_add_long(Klas,name,version,default) \
-	private: static long s_##name; public: virtual long & pref_##name () { return s_##name; } \
+#define prefs_add_integer(Klas,name,version,default) \
+	private: static integer s_##name; public: virtual integer & pref_##name () { return s_##name; } \
 	private: static const char32 * sdefault_##name; public: virtual const char32 * default_##name () { return sdefault_##name; }
-#define prefs_add_long_with_data(Klas,name,version,default)  public: long p_##name; prefs_add_long (Klas, name, version, default)
-#define prefs_override_long(Klas,name,version,default) \
-	private: static long s_##name; public: long & pref_##name () override { return s_##name; } \
+#define prefs_add_integer_with_data(Klas,name,version,default)  public: integer p_##name; prefs_add_integer (Klas, name, version, default)
+#define prefs_override_integer(Klas,name,version,default) \
+	private: static integer s_##name; public: integer & pref_##name () override { return s_##name; } \
 	private: static const char32 * sdefault_##name; public: const char32 * default_##name () override { return sdefault_##name; }
 
 #define prefs_add_bool(Klas,name,version,default) \
diff --git a/sys/prefs_copyToInstance.h b/sys/prefs_copyToInstance.h
index 2f006c5..83414a5 100644
--- a/sys/prefs_copyToInstance.h
+++ b/sys/prefs_copyToInstance.h
@@ -22,9 +22,9 @@
 #undef prefs_add_int
 #undef prefs_add_int_with_data
 #undef prefs_override_int
-#undef prefs_add_long
-#undef prefs_add_long_with_data
-#undef prefs_override_long
+#undef prefs_add_integer
+#undef prefs_add_integer_with_data
+#undef prefs_override_integer
 #undef prefs_add_bool
 #undef prefs_add_bool_with_data
 #undef prefs_override_bool
@@ -47,9 +47,9 @@
 #define prefs_add_int_with_data(Klas,name,version,default)  p_##name = pref_##name ();
 #define prefs_override_int(Klas,name,version,default)
 
-#define prefs_add_long(Klas,name,version,default)
-#define prefs_add_long_with_data(Klas,name,version,default)  p_##name = pref_##name ();
-#define prefs_override_long(Klas,name,version,default)
+#define prefs_add_integer(Klas,name,version,default)
+#define prefs_add_integer_with_data(Klas,name,version,default)  p_##name = pref_##name ();
+#define prefs_override_integer(Klas,name,version,default)
 
 #define prefs_add_bool(Klas,name,version,default)
 #define prefs_add_bool_with_data(Klas,name,version,default)  p_##name = pref_##name ();
diff --git a/sys/prefs_define.h b/sys/prefs_define.h
index 0a075cf..a286e75 100644
--- a/sys/prefs_define.h
+++ b/sys/prefs_define.h
@@ -22,9 +22,9 @@
 #undef prefs_add_int
 #undef prefs_add_int_with_data
 #undef prefs_override_int
-#undef prefs_add_long
-#undef prefs_add_long_with_data
-#undef prefs_override_long
+#undef prefs_add_integer
+#undef prefs_add_integer_with_data
+#undef prefs_override_integer
 #undef prefs_add_bool
 #undef prefs_add_bool_with_data
 #undef prefs_override_bool
@@ -49,12 +49,12 @@
 	int struct##Klas :: s_##name; \
 	const char32 * struct##Klas :: sdefault_##name = default;
 
-#define prefs_add_long(Klas,name,version,default) \
-	long struct##Klas :: s_##name; \
+#define prefs_add_integer(Klas,name,version,default) \
+	integer struct##Klas :: s_##name; \
 	const char32 * struct##Klas :: sdefault_##name = default;
-#define prefs_add_long_with_data(Klas,name,version,default)  prefs_add_long (Klas, name, version, default)
-#define prefs_override_long(Klas,name,version,default) \
-	long struct##Klas :: s_##name; \
+#define prefs_add_integer_with_data(Klas,name,version,default)  prefs_add_integer (Klas, name, version, default)
+#define prefs_override_integer(Klas,name,version,default) \
+	integer struct##Klas :: s_##name; \
 	const char32 * struct##Klas :: sdefault_##name = default;
 
 #define prefs_add_bool(Klas,name,version,default) \
diff --git a/sys/prefs_install.h b/sys/prefs_install.h
index d3e1703..f945556 100644
--- a/sys/prefs_install.h
+++ b/sys/prefs_install.h
@@ -1,6 +1,6 @@
 /* prefs_install.h
  *
- * Copyright (C) 2013,2015 Paul Boersma
+ * Copyright (C) 2013,2015,2017 Paul Boersma
  *
  * This code 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,9 @@
 #undef prefs_add_int
 #undef prefs_add_int_with_data
 #undef prefs_override_int
-#undef prefs_add_long
-#undef prefs_add_long_with_data
-#undef prefs_override_long
+#undef prefs_add_integer
+#undef prefs_add_integer_with_data
+#undef prefs_override_integer
 #undef prefs_add_bool
 #undef prefs_add_bool_with_data
 #undef prefs_override_bool
@@ -48,11 +48,11 @@
 #define prefs_override_int(Klas,name,version,default) \
 	Preferences_addInt (Melder_cat (U"" #Klas U"." #name, version >= 2 ? U"." #version : U""), & s_##name, Melder_atoi (sdefault_##name));
 
-#define prefs_add_long(Klas,name,version,default) \
-	Preferences_addLong (Melder_cat (U"" #Klas U"." #name, version >= 2 ? U"." #version : U""), & s_##name, Melder_atoi (sdefault_##name));
-#define prefs_add_long_with_data(Klas,name,version,default)  prefs_add_long (Klas, name, version, default)
-#define prefs_override_long(Klas,name,version,default) \
-	Preferences_addLong (Melder_cat (U"" #Klas U"." #name, version >= 2 ? U"." #version : U""), & s_##name, Melder_atoi (sdefault_##name));
+#define prefs_add_integer(Klas,name,version,default) \
+	Preferences_addInteger (Melder_cat (U"" #Klas U"." #name, version >= 2 ? U"." #version : U""), & s_##name, Melder_atoi (sdefault_##name));
+#define prefs_add_integer_with_data(Klas,name,version,default)  prefs_add_integer (Klas, name, version, default)
+#define prefs_override_integer(Klas,name,version,default) \
+	Preferences_addInteger (Melder_cat (U"" #Klas U"." #name, version >= 2 ? U"." #version : U""), & s_##name, Melder_atoi (sdefault_##name));
 
 #define prefs_add_bool(Klas,name,version,default) \
 	Preferences_addBool (Melder_cat (U"" #Klas U"." #name, version >= 2 ? U"." #version : U""), & s_##name, default);
diff --git a/test/createPraatTests.praat b/test/createPraatTests.praat
index 0faee7a..5271c99 100644
--- a/test/createPraatTests.praat
+++ b/test/createPraatTests.praat
@@ -1,9 +1,10 @@
 # Praat script createTests.praat
-# Paul Boersma 2017-09-13
+# Paul Boersma 2017-10-08
 
 # This script extracts tests from C++ source code files
 # in which Praat script snippets have been inserted
-# between a "/*@praat" line and a "@*/" line.
+# between a "/*@praat" line and a "@*/" line,
+# or after "//@praat " at the end of a line.
 #
 # For instance, the tests in the source code file sys/Formula.cpp
 # are put into the new file test/sys/Formula.cpp.praat.
@@ -52,21 +53,25 @@ procedure createTest: .folder$, .file$
 	.numberOfTestsInThisFile = 0
 	for .iline to .numberOfLines - 2
 		.line$ = Get string: .iline
-		if index (.line$, "/*@praat")
+		if index (.line$, "/*@praat") or index (.line$, "//@praat")
 			if .numberOfTestsInThisFile = 0
 				writeFileLine: .targetFile$, "# File ", .folder$, "/", .file$, ".praat"
 				appendFileLine: .targetFile$, "# Generated by test/createTests.praat"
 				appendFileLine: .targetFile$, "# ", date$ ()
 			endif
 			.numberOfTestsInThisFile += 1
-			.numberOfLeadingTabs = index (.line$, "/*@praat")
 			appendFileLine: .targetFile$, ""
-			label again
-			.iline += 1
-			.line$ = Get string: .iline
-			goto finish index (.line$, "@*/")
-			appendFileLine: .targetFile$, mid$ (.line$, .numberOfLeadingTabs + 1, 1000)
-			goto again
+			if index (.line$, "//@praat")
+				appendFileLine: .targetFile$, mid$ (.line$, index (.line$, "//@praat") + 9, 1000)
+			else
+				.numberOfLeadingTabs = index (.line$, "/*@praat")
+				label again
+				.iline += 1
+				.line$ = Get string: .iline
+				goto finish index (.line$, "@*/")
+				appendFileLine: .targetFile$, mid$ (.line$, .numberOfLeadingTabs + 1, 1000)
+				goto again
+			endif
 		endif
 		label finish
 	endfor
diff --git a/test/fon/manual_Script.cpp.praat b/test/fon/manual_Script.cpp.praat
new file mode 100644
index 0000000..50a0445
--- /dev/null
+++ b/test/fon/manual_Script.cpp.praat
@@ -0,0 +1,39 @@
+# File fon/manual_Script.cpp.praat
+# Generated by test/createTests.praat
+# Sun Oct  8 15:07:02 2017
+
+assert --6 = 6
+assert 2^6 = 64
+
+assert 2^-6 = 0.015625
+
+assert -(1+1)^6 = -64
+
+assert 4^3^2 = 262144
+
+assert 4^3 ^ 2 = 262144
+
+assert (4 ^ 3) ^ 2 = 4096
+
+assert string$ (sqrt (2)) = "1.4142135623730951"
+
+assert fixed$ (sqrt (2), 3) = "1.414"
+
+assert fixed$ (sqrt (2), 0) = "1"
+
+jitter = 0.0156789
+assert percent$ (jitter, 3) = "1.568%"
+jitter = -0.0156789
+assert percent$ (jitter, 3) = "-1.568%"
+
+assert percent$ (0, 3) = "0"
+jitter = 0.000000156789
+assert percent$ (jitter, 3) = "0.00002%"
+jitter *= -1
+assert percent$ (jitter, 3) = "-0.00002%"
+
+fgh = 567
+assert variableExists ("fgh")
+assert not variableExists ("jhfwbfejfgcds")
+
+appendInfoLine: "fon/manual_Script.cpp.praat", " OK"
diff --git a/test/stat/logisticRegression.praat b/test/stat/logisticRegression.praat
index eb6bfdf..8c91bb9 100644
--- a/test/stat/logisticRegression.praat
+++ b/test/stat/logisticRegression.praat
@@ -4,7 +4,7 @@ echo Logistic regression
 printline Spec & Dur table
 table = Read Table from table file... logisticRegression/rh.Table
 logreg = To logistic regression: "Spec Dur", "/I/", "/i/"
-logreg2 = Read from file: "logisticRegression/rh.logisticRegression"
+logreg2 = Read from file: "logisticRegression/rh.LogisticRegression"
 assert objectsAreIdentical (logreg, logreg2)
 info$ = Info
 intercept = extractNumber (info$, "Intercept: ")
diff --git a/test/sys/Formula.cpp.praat b/test/sys/Formula.cpp.praat
index 1184af1..171be64 100644
--- a/test/sys/Formula.cpp.praat
+++ b/test/sys/Formula.cpp.praat
@@ -1,6 +1,6 @@
 # File sys/Formula.cpp.praat
 # Generated by test/createTests.praat
-# Wed Sep 13 22:42:24 2017
+# Sun Oct  8 15:07:00 2017
 
 #
 # result = x + y
diff --git a/test/sys/melder_ftoa.cpp.praat b/test/sys/melder_ftoa.cpp.praat
new file mode 100644
index 0000000..69e14e8
--- /dev/null
+++ b/test/sys/melder_ftoa.cpp.praat
@@ -0,0 +1,8 @@
+# File sys/melder_ftoa.cpp.praat
+# Generated by test/createTests.praat
+# Sun Oct  8 15:07:01 2017
+
+assert string$ (1000000000000) = "1000000000000"
+assert string$ (undefined) = "--undefined--"
+
+appendInfoLine: "sys/melder_ftoa.cpp.praat", " OK"
diff --git a/test/sys/praat_statistics.cpp.praat b/test/sys/praat_statistics.cpp.praat
new file mode 100644
index 0000000..1fbfa24
--- /dev/null
+++ b/test/sys/praat_statistics.cpp.praat
@@ -0,0 +1,12 @@
+# File sys/praat_statistics.cpp.praat
+# Generated by test/createTests.praat
+# Sun Oct  8 15:07:01 2017
+
+report$ = Report integer properties
+sizeOfInteger = extractNumber (report$, "An indexing integer is ")
+sizeOfPointer = extractNumber (report$, "A pointer is ")
+assert sizeOfInteger = sizeOfPointer
+sizeOfFileOffset = extractNumber (report$, "A file offset is ")
+assert sizeOfFileOffset = 64
+
+appendInfoLine: "sys/praat_statistics.cpp.praat", " OK"

-- 
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