function s = renameStructFields( s, varargin )
    for i=1:2:length(varargin)
        oldfn = varargin{i};
        if isfield( s, oldfn )
            newfn = varargin{i+1};
            s.(newfn) = s.(oldfn);
            s = rmfield( s, oldfn );
        end
    end
end
