diff --git a/3_pairmatching/gtGetSummedDifSpot.m b/3_pairmatching/gtGetSummedDifSpot.m
index 7003903d5e4dda2ae1c71c223ac9ea36f6b2fdd5..7081d5058d322aedb8065bc1c5ca9d2041102b17 100644
--- a/3_pairmatching/gtGetSummedDifSpot.m
+++ b/3_pairmatching/gtGetSummedDifSpot.m
@@ -1,50 +1,63 @@
-function [spot, bb] = gtGetSummedDifSpot(difID, parameters, connected, info)
-% returns the summed difspot image (saved as difspot%05d.edf) or in difblobtable
+function [spot, bb] = gtGetSummedDifSpot(difspotID, parameters, connected, info)
+% GTGETSUMMEDDIFSPOT  Returns the summed difspot image (saved as *0000/difspot%05d.edf) or in difblobtable
+% [spot, bb] = gtGetSummedDifSpot(difspotID, parameters, connected, info)
+% -----------------------------------------------------------------------
+% INPUT:
+%   difspotID  = <double>   diffraction spot ID
+%   parameters = <struct>   parameters.mat
+%   connected  = <logical>  true if already connected to the database {false}
+%   info       = <struct>   image header info {[]}
+%
+% OUTPUT:
+%   spot       = <double>   diffraction spot image
+%   bb         = <double>   diffraction spot bounding box
+%
 % 360degree scan convention - ak 10/2007
 % speed up by providing edfheader info
 
-    if ~exist('parameters','var')
-        disp('loading parameters...');
-        load('parameters.mat');
-    end
+if ~exist('parameters','var')
+    parameters = [];
+    load('parameters.mat');
+end
 
-    % connect to database
-    if (~exist('connected', 'var'))
-        connected = false;
-    end
+% connect to database
+if ~exist('connected', 'var')
+    connected = false;
+end
 
-    if (~connected)
-        gtDBConnect()
-    end
+if (~connected)
+    gtDBConnect()
+end
 
-    if (~exist('info', 'var'))
-        info = [];
-    end
+if (~exist('info', 'var'))
+    info = [];
+end
+
+bb = [];
 
-    bb = [];
-
-    base_dir = fullfile(parameters.acq.dir, '2_difspot');
-    sub_dir = fullfile(base_dir, sprintf('%05d', difID - mod(difID, 1e4)));
-    filename = fullfile(sub_dir, sprintf('difspot%05d.edf', difID) );
-
-    if (exist(filename, 'file'))
-        % read the edf file
-        spot = edf_read(filename, [], [], info);
-        if (nargout == 2)
-            query = sprintf([ ...
-                'SELECT BoundingBoxXOrigin, BoundingBoxYOrigin, ' ...
-                '       BoundingBoxXSize, BoundingBoxYSize' ...
-                '   FROM %sdifspot' ...
-                '   WHERE difspotID = %d'], parameters.acq.name, difID);
-            [bb(1), bb(2), bb(3), bb(4)] = mym(query);
-        end
-    else
-        try
-            tablename = parameters.acq.name;
-            [vol, bb] = gtDBBrowseDiffractionVolume(tablename, difID);
-            spot = sum(vol, 3);
-        catch Mexc
-            gtPrintException(Mexc, 'cannot find difspot as edf or as difblob!')
-        end
+base_dir = fullfile(parameters.acq.dir, '2_difspot');
+sub_dir  = fullfile(base_dir, sprintf('%05d', difspotID - mod(difspotID, 1e4)));
+filename = fullfile(sub_dir, sprintf('difspot%05d.edf', difspotID) );
+
+if exist(filename, 'file')
+    % read the edf file
+    spot = edf_read(filename, [], [], info);
+    if (nargout == 2)
+        query = sprintf([ ...
+            'SELECT BoundingBoxXOrigin, BoundingBoxYOrigin, ' ...
+            '       BoundingBoxXSize, BoundingBoxYSize' ...
+            '   FROM %sdifspot' ...
+            '   WHERE difspotID = %d'], parameters.acq.name, difspotID);
+        [bb(1), bb(2), bb(3), bb(4)] = mym(query);
+    end
+else
+    try
+        tablename = parameters.acq.name;
+        [vol, bb] = gtDBBrowseDiffractionVolume(tablename, difspotID);
+        spot = sum(vol, 3);
+    catch Mexc
+        gtPrintException(Mexc, 'cannot find difspot as edf or as difblob!')
     end
 end
+
+end % end of function