    function GUI_load
    %% main window
    % full screen, main window parameters
    scrsz = get(0,'ScreenSize');

    main_window = figure('Visible','on',...
                         'Units','normalized',...
                         'Outerposition',[0 0 1 1],...
                         'name','Data','numbertitle','off',...
                         'ResizeFcn',@figResize);

    set(main_window,'units','pixels'); 
    set(main_window,'MenuBar','none');

    % new menu
    menu_new = uimenu(main_window,'Label','Load data');
    menu_marks = uimenu(main_window,'Label','Load marks');
    menu_analysis = uimenu(main_window,'Label','Wave analysis');
    menu_compare = uimenu(main_window,'Label','Compare waves');
    menu_cut = uimenu(main_window,'Label','Cut signals');
    
    % objects in the new menus
    load_data = uimenu(menu_new,'Label','Load',... 
              'Callback',{@browsebutton_Callback});
          
    reload_data = uimenu(menu_new,'Label','ReLoad',... 
              'Callback',{@reload_Callback});      

    load_marks = uimenu(menu_marks,'Label','Load',... 
              'Callback',{@load_Callback});
          
    choose_segment = uimenu(menu_analysis,'Label','Choose',... 
          'Callback',{@choose_segmentace_Callback});

      
    compare = uimenu(menu_compare,'Label','Compare waves',... 
          'Callback',{@compare_Callback});
      
    compare = uimenu(menu_cut,'Label','Cut signals',... 
          'Callback',{@cut_Callback});  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% global variables
    freq = 200; % frequency of input data

    % init variables for slider
    data_length = 10000;
    krok = 8*60/data_length;
    max_slide = data_length;
    min_slide = 0; 
    time_axis = 60;
    n_samp = data_length;
    min_bound = 1;
    max_bound = data_length;
    time_vektor = [];

    % for plot
    osa = nan; 
    fullpathname = nan; 
    data_channel = nan;
    data_show = nan;
    
    % default setting for sgignals
    delka = 0;
    pocet_sign = 0;
    
    % variables for marks
    vector_marks = [];
    i = 1;


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% two main panels
    Data_Panel_width = scrsz(3)/1.5;
    Data_Panel_height = scrsz(4)/1.1;
    Data_Panel_offset = 30;

    Data_Panel = uipanel('BorderType','etchedin',...
                'Units','characters',...
                'Parent',main_window, ...
                'Title','Graph', ...
                'Units','pixels', ...
                'Position',[Data_Panel_offset Data_Panel_offset+30 Data_Panel_width Data_Panel_height],...
                'TitlePosition','centertop');

    Data_Buttons = uipanel('BorderType','etchedin',...
                'Units','characters',...
                'Parent',main_window, ...
                'Title','Analysis', ...
                'Units','pixels', ...
                'Position',[Data_Panel_offset+Data_Panel_width+10 Data_Panel_offset+30 scrsz(3)-Data_Panel_width-50 Data_Panel_height],...
                'TitlePosition','centertop');     

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% time scale

    hlist_time = uicontrol('Position',[10 scrsz(4)/1.32 scrsz(3)/5 20],...
                 'Parent',Data_Buttons,'style','popup','string',{'1s','2s','5s','10s','20s','30s','Complete'},...
                 'value',7,'Callback',{@time_callback});
%% checkboxes for filtering the data         
    
    checkbox_low = uicontrol('Parent',Data_Buttons,'Style','checkbox','Value',0,'String','Low-pass filter [Hz]',...
                   'Units','pixels','Position',[20 scrsz(4)/1.5+30 scrsz(3)/10 20]);    

    cut_off_low = uicontrol(Data_Buttons,'Style','edit','String','10',...
                     'Parent',Data_Buttons,'Units','pixels', ...
                     'BackgroundColor','white',...
                     'Position',[20+scrsz(3)/10 scrsz(4)/1.5+30 scrsz(3)/10 20]);           
               
    checkbox_high = uicontrol('Parent',Data_Buttons,'Style','checkbox','Value',0,'String','High-pass filter [Hz]',...
                   'Units','pixels','Position',[20 scrsz(4)/1.5 scrsz(3)/10 20]);   
               
    cut_off_high = uicontrol(Data_Buttons,'Style','edit','String','50',...
                     'Parent',Data_Buttons,'Units','pixels', ...
                     'BackgroundColor','white',...
                     'Position',[20+scrsz(3)/10 scrsz(4)/1.5 scrsz(3)/10 20]);    
               
               
    checkbox_isoline = uicontrol('Parent',Data_Buttons,'Style','checkbox','Value',0,'String','Isoline filter',...
                   'Units','pixels','Position',[20 scrsz(4)/1.5-30 scrsz(3)/10 20]);    

    checkbox_brum = uicontrol('Parent',Data_Buttons,'Style','checkbox','Value',0,'String','Brum filter',...
                   'Units','pixels','Position',[20 scrsz(4)/1.5-60 scrsz(3)/10 20]);            
   

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% confirm buttons
    % for filtering
    filter_button = uicontrol('Style','pushbutton','String','Filter',...
                          'Parent',Data_Buttons,...
                          'Position',[20 scrsz(4)/1.5-110 scrsz(3)/5 30],...
                          'Callback',{@filter_Callback});

    % for creation of the marks                  
    mark_button = uicontrol('Style','pushbutton','String','Create marks',...
                          'Parent',Data_Buttons,...
                          'Position',[20 scrsz(4)/1.5-200 scrsz(3)/5 30],...
                          'Callback',{@mark_Callback});   
    % saving the marks
    save_button = uicontrol('Style','pushbutton','String','Save marks',...
                          'Parent',Data_Buttons,...
                          'Position',[20 scrsz(4)/1.5-240 scrsz(3)/5 30],...
                          'Callback',{@save_Callback});   

   
    clear_button = uicontrol('Style','pushbutton','String','Delete marks',...
                          'Parent',Data_Buttons,...
                          'Position',[20 scrsz(4)/1.5-280 scrsz(3)/5 30],...
                          'Callback',{@clear_Callback});
      
    nadpis_time = uicontrol(Data_Buttons,'Style','text','String','Set sampling frequency for Input data',...
                     'Parent',Data_Buttons,'Units','pixels', ...
                     'Position',[80 scrsz(4)/1.5-340 scrsz(3)/10 30]);
                 
    freq_set = uicontrol(Data_Buttons,'Style','edit','String','200',...
                     'Parent',Data_Buttons,'Units','pixels', ...
                     'BackgroundColor','white',...
                     'Position',[20 scrsz(4)/1.5-380 scrsz(3)/5 30]);                    
                      
                      
    freq_button = uicontrol('Style','pushbutton','String','Change frequency',...
                          'Parent',Data_Buttons,...
                          'Position',[20 scrsz(4)/1.5-420 scrsz(3)/5 30],...
                          'Callback',{@freq_Callback});                  
                                       
                      
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% screen size for slider

    slider_size = get(0,'ScreenSize');
    slider_size(1) = Data_Panel_offset; % from left
    slider_size(2) = 20; % from bottom
    slider_size(3) = Data_Panel_width;
    slider_size(4) = 20; % height


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% slider

    sh = uicontrol(main_window,'Style','slider',...
                'Max',max_slide,'Min',min_slide,'Value',0,...
                'SliderStep',[krok 2*krok],...
                'Position',slider_size,...
                'Callback',@slider_callback);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% figure resize

    function figResize(src,evt)
            fpos = get(main_window,'Position');

            set(Data_Panel,'units','pixels','Position', ...
                [Data_Panel_offset Data_Panel_offset fpos(3)/1.5 fpos(4)-50]);

            set(Data_Buttons,'units','pixels','Position',...
                [Data_Panel_offset+Data_Panel_width+10 Data_Panel_offset fpos(3)-fpos(3)/1.3 fpos(4)-50]);

    end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% plot the data

function plot_signals()
    
%         if(strcmp(get(sh,'Visible'),'off'))
%             min_bound = 1;
%             max_bound = data_length;
%         end   
%         
%         time_vektor = (min_bound/freq:1/freq:max_bound/freq);
%         data_show = data_channel(min_bound:max_bound);
%         plot(osa,time_vektor,data_show);
%         zoom on;
%         
%         %% showing the marks        
%         if(~isnan(vector_marks))
%                         yMax = get(osa,'YLim');
%                         for k=1:length(vector_marks)
%                             if(vector_marks(k)>=min_bound && vector_marks(k)<=max_bound)
%                                 line([(vector_marks(k))/freq,(vector_marks(k))/freq],yMax,'Color','r','Parent',osa);
%                             end
%                         end
%         end

        if(strcmp(get(sh,'Visible'),'off'))
            min_bound = 1;
            max_bound = data_length;
            max_bound
        end   
        
        for i=1:pocet_sign
            time_vektor = (min_bound/freq:1/freq:max_bound/freq);
            data_show = data_channel(min_bound:max_bound,i);
            plot(osa(i),time_vektor,data_show);
            xlabel(osa(i),'t [s]');
            ylabel(osa(i),'Amplitude [-]')
            zoom on;

            %% showing the marks        
            if(~isnan(vector_marks))
                            yMax = get(osa(i),'YLim');
                            for k=1:length(vector_marks)
                                if(vector_marks(k)>=min_bound && vector_marks(k)<=max_bound)
                                    line([(vector_marks(k))/freq,(vector_marks(k))/freq],yMax,'Color','r','Parent',osa(i));
                                end
                            end
            end
        end
                          
                        
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
%% clear marks

    function clear_Callback(source,eventdata)
        
        vector_marks = [];
        plot_signals();
        
    end 

%% set smapling frequency

    function freq_Callback(source,eventdata)
        
        freq = str2double(get(freq_set,'String'));
        plot_signals();
        
    end 

%% choosing a place for a mark

    function mark_Callback(source,eventdata)
        if(isempty(vector_marks)==1)
            i = 1;
        else
            i = length(vector_marks)+1;
        end
        
        [x,y] = ginput(1);            
         vector_marks(i) = x*freq;  
         i = i+1;
         vector_marks
         plot_signals();     
    end 
    
%% saving marks into m-file

    function save_Callback(source,eventdata)  
        if(isnan(vector_marks)==1)
            msgbox('Neni vytvorena segmentace');
            return;
        end

        FileName = uiputfile;

        if(FileName==0)
        msgbox('neni vybran zadny soubor');
              return;
        end

        vector_marks = sort(vector_marks);
        fullname = [FileName '.mat'];
        save(fullname,'vector_marks');
        msgbox('Data ulozena');
    end

%% loading marks

    function load_Callback(source,eventdata)
        % choose your marks
        [name file_path] = uigetfile({'*.mat'},'Vyber');
        if(name==0)
              msgbox('There is no chosen file');
              return;
        end
        path = strcat(file_path,name);

        %you have to load data before loading the marks    
        if(isnan(fullpathname)==1)
           msgbox('There is no channel'); 
           return;
        end

        vector_marks = importdata(path);    
        plot_signals();      
    end

%% choose segmatation
% new window, where we mark the beginning and the end of the vawe, than we
% do the interpolation and the waves will have the same length

function choose_segmentace_Callback(source,eventdata)
    
    % podminky pro spravne fungovani casti analyzy
    
     if(isnan(fullpathname)==1)
        msgbox('There are no loaded channels'); 
        return;
     end
    
     
    % ginput 
     [x,y] = ginput(1);
     x=round(x);      
     % find the grpah, where user clicked  
     handle_axes = gca;
     
     for i=1:pocet_sign
         if(handle_axes==osa(i))
            klik = i;
         end
     end

     vector_marks
      % nactu si jen data z daneho useku a poslu je k vykresleni     
     if(isempty(vector_marks)==1)
        msgbox('There are no marks in the graph, loaded whole channel');
        dolni_hranice = 1;
        segment_data = data_channel(dolni_hranice:end,klik);
        segment_data
        'bla'
     
     else


         vector_marks = sort(vector_marks);

         horni = find(vector_marks>x*freq,1,'first');
         dolni = find(vector_marks<x*freq,1,'last');

         horni_hranice = vector_marks(horni);
         dolni_hranice = vector_marks(dolni);

         if(isempty(dolni_hranice)==1)
         dolni_hranice = 1;
         end

         segment_data = data_channel(dolni_hranice:horni_hranice,klik);  
      
     
     end
 
     
%      segment_data = data_channel(dolni_hranice:horni_hranice,klik);
     
     % zavolam nove okno, kde vykreslim dany segment.     
%      GUI_analysis(segment_data,freq);
       GUI_analysis_new(segment_data,freq);
          
end


%% filter data
    
    function filter_Callback(source,eventdata)
                value_iso = get(checkbox_isoline,'Value');
                value_brum = get(checkbox_brum,'Value');
                value_high = get(checkbox_high,'Value');
                value_low = get(checkbox_low,'Value');

 % need to filter all the signals
 % it is slow, but i will use for cycle for the first time, if i have more
 % time, i will use another techinque to filter signals
            for i=1:pocet_sign
                if(value_iso==1)               
% %                   % filter isoline, spoatnej
%                   f0= 0.5; 
%                   [b,a] = butter(2,2*f0/freq,'high');
%                   data_channel = filter(b,a,data_channel);
% 
%                 fs_new=20; % nová frekvence vzorkování
%                 r=round(freq/fs_new); % decimaèní, interpolaèní faktor
%                 dx=decimate(data_channel(:,i),r,'fir'); % decimace signálu x
%                 fdx=medfilt1(dx,10); % nelineární mediánová filtrace (odstraní
%                 izolinie=interp(fdx,r); % interpolace tvaru izolinie na pùvodní fs
%                 izolinie=izolinie(1:length(data_channel)); % uøíznutí konce po interpolaci
%                 data_channel(:,i)=data_channel(:,i)-izolinie; % pùvodní signál bez izolinie 
%                     
 %% druhej pokus o filtrovani isolinie dle internetu
                    
                    
                    opol = 20;
                    t = (1:length(data_channel(:,i)))';
                    [p,s,mu] = polyfit(t,data_channel(:,i),opol);
                    f_y = polyval(p,t,[],mu);

                    data_channel(:,i) = data_channel(:,i) - f_y;
            
            
%              POM = data_channel(1,i)-data_channel(end,i);        
%              vector = fliplr(1:length(data_channel(:,i)));
%              data_channel(1:end) = data_channel(1:end)-vector'*(POM/length(vector));
% 

                end

                if(value_high==1)
                  high_freq = str2double(get(cut_off_high,'String'));
                  Wn = high_freq/(freq/2);       
                  [b,a] = butter(9,Wn,'high');
                    
                  % filter high frequency
                  %[b,a] = butter(8,2*40/freq); 
                  %
                  data_channel(:,i) = filter(b,a,data_channel(:,i));
                end
                
                if(value_low==1)
                  low_freq = str2double(get(cut_off_low,'String'));  
                  % filter low frequency
                  [b,a] = butter(6,low_freq/(freq/2));
                  %[b,a] = butter(8,2*40/freq); 
                  data_channel(:,i) = filter(b,a,data_channel(:,i));
                end
                
                if(value_brum==1)
                  % filter 50 Hz
                  R = 1; r = 0.98;
                  f0 = 50;%Hz
                  b = [1 -2*R*cos(2*pi*f0/freq) R*R];
                  a = [1 -2*r*cos(2*pi*f0/freq) r*r]; 
                  data_channel(:,i) = filter(b,a,data_channel(:,i));
                end
            end

                plot_signals();
  
                % if you want another filration, you have to check the
                % boxes again
                set(checkbox_isoline,'Value',0);
                set(checkbox_brum,'Value',0);
                set(checkbox_high,'Value',0);
    end

%% load data
    function browsebutton_Callback(source,eventdata) 
          % measured data are in .txt
          [filename pathname] = uigetfile({'*.txt';'*.csv'},'File Selector');
          [pth, nam, ext] = fileparts(filename);
          
          if(strcmp(ext,'.txt')||(strcmp(ext,'.csv')))
              'OKEY'
          else
              msgbox('Wrong input format, try again');
              pause(2);
              browsebutton_Callback();  
              return;
          end
          
          if(filename==0)
              msgbox('There is no file to load');
              return;
          end
           
          % rewriting initialized data
          fullpathname = strcat(pathname,filename);      
          data_channel = load(fullpathname);

          [delka pocet_sign] = size(data_channel);
          length(data_channel)
          
          % init for slider
          set(sh,'Visible','off');
          data_length = length(data_channel);
          max_bound = data_length;
          krok = 8*60/data_length;
          max_slide = data_length;
          time_vektor = 1/freq:1/freq:length(data_channel)/freq;
          
          if(pocet_sign>1)
              
          % make a new tab, where i will choose, how many and which
          % channels i will load
          frekvence = str2double(get(freq_set,'String'));
          load_more_signals(data_channel, frekvence);
          'more signals'
             
          else

          % init for plot          
          osa = scrollsubplot(1,1,1);
          set(osa,'Parent',Data_Panel);
              
          %% plot function
          plot(osa,time_vektor,data_channel);
          xlabel(osa,'t [s]');  
          ylabel(osa,'Amplitude [-]')
          zoom on;
          end
    end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% time callback

    function time_callback(source,eventdata) 
          % get value from list
          % chosing the time axis of plot
            scale = get(hlist_time,'Value');
            switch scale
                case 1
                    set(sh,'Visible','on');  
                    time_axis = 1;
                    n_samp = time_axis*freq;
                    set(sh,'Max',data_length);
                    krok = (freq*time_axis)/data_length;
                    set(sh,'SliderStep',[krok 2*krok]);  
                case 2
                    set(sh,'Visible','on');  
                    time_axis = 2;
                    n_samp = time_axis*freq;
                    set(sh,'Max',data_length);
                    krok = (freq*time_axis)/data_length;
                    set(sh,'SliderStep',[krok 2*krok]);      
                case 3
                    set(sh,'Visible','on');  
                    time_axis = 5;
                    n_samp = time_axis*freq;
                    set(sh,'Max',data_length);
                    krok = (freq*time_axis)/data_length;
                    set(sh,'SliderStep',[krok 2*krok]);             
                case 4
                    set(sh,'Visible','on');  
                    time_axis = 10;
                    n_samp = time_axis*freq;
                    set(sh,'Max',data_length);
                    krok = (freq*time_axis)/data_length;
                    set(sh,'SliderStep',[krok 2*krok]);  
                case 5
                    set(sh,'Visible','on');  
                    time_axis = 20;
                    n_samp = time_axis*freq;
                    set(sh,'Max',data_length);
                    krok = (freq*time_axis)/data_length;
                    set(sh,'SliderStep',[krok 2*krok]);  
                case 6
                    set(sh,'Visible','on');  
                    time_axis = 30;
                    n_samp = time_axis*freq;
                    set(sh,'Max',data_length);
                    krok = (freq*time_axis)/data_length;
                    set(sh,'SliderStep',[krok 2*krok]);   
                case 7
                    set(sh,'Visible','off');  
            end

       % replot the data and change of the slider

                sliderValue = get(sh,'Value');  
                min_bound = round(sliderValue);
                max_bound = round(sliderValue+n_samp);

                if(sliderValue == 0)
                    min_bound = 1;
                    max_bound = n_samp;
                end

                plot_signals();

    end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% slider callback
    function slider_callback(source,eventdata) 

            if(isnan(fullpathname)==1)
               msgbox('There is no channel'); 
               return;
            end 

        % number of samples in the time axis
        
        sliderValue = get(sh,'Value');
        min_bound = round(sliderValue);
        max_bound = round(sliderValue+n_samp);

        if(sliderValue == 0)
            min_bound = 1;
            max_bound = n_samp;
        end

        if(min_bound>=data_length)
            min_bound=data_length-n_samp;
        end

        if(max_bound>=data_length)
            max_bound=data_length;
        end
        
        plot_signals();

    end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% function for comparsion waves
    function compare_Callback(source,~)
        
        GUI_compare();
        
    end 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% function for plotting more than one channel
    function load_more_signals(data,frekvence)
        %'mame vice kanalu'
                
%         length(data_channel)
%        
%         k = 1;
%         for j=1:pocet_sign  
%         osa(k) = scrollsubplot(round(pocet_sign/4),1,k);
%         plot(osa(k),time_vektor,data(:,j));
%         set(osa,'Parent',Data_Panel);
%         k = k+1;
%         end

%% pokus o vybrani si kanalu
      % zavolani okna pro nacteni novych dat - jiz prevzorkovanych
      GUI_data(data,frekvence);
      
      % pocka dokud se nezavre okno s nacitanim dat a ziskam si z nej data
      uiwait(gcf);

      % na praci s daty mezi jednotlivymi okny jsou pouzity funkce
      % setappdata a getappdata
      
      % ziskal jsem nova data, jiz upravena
      new_data = getappdata(0,'NewData');
      new_data
      rozmer = size(new_data);
      pocet_sign = rozmer(2);
      data_channel = [];
      
      %%
      
      pocet_nan = 0;
      for i=1:length(new_data)
          
          if(isnan(new_data{i}))
              pocet_nan = pocet_nan +1;
          end
      end
     
      k=1;
      num_used = pocet_sign-pocet_nan;
      %data_channel = nan;
      for j=1:pocet_sign  
       
          if(isnan(new_data{j}))
%               data(:,j) = nan;
              continue;
          else    
      
            pocet_sign
            osa(k) = scrollsubplot(round(num_used/2),1,k);
            plot(osa(k),time_vektor,data(:,j));
            set(osa,'Parent',Data_Panel);
            data_channel(:,k) = data(:,j);
            k = k+1;
            zoom on;
          end
      end
      
      pocet_sign = k-1;
      pocet_sign
      plot_signals();
    end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% cut signals, use only the important data, not noise
    function cut_Callback(source,eventdata)
        
        GUI_cut(data_channel,time_vektor,freq);
        
      uiwait(gcf);
% 
%       % na praci s daty mezi jednotlivymi okny jsou pouzity funkce
%       % setappdata a getappdata
      
      % ziskal jsem nova data, jiz upravena
      data_channel = getappdata(0,'NewData'); 
      time_vektor = getappdata(0,'TimeVector');
      data_length = length(data_channel);
      % nacetl jsem si frekvnece jednotlivych kanalu, budu potrebovat pro
      % vykreslovani - parada!
      plot_signals();

        
    end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% reload callback

    function reload_Callback(source,eventdata)
        
        close all;
        clear all;
        clc;
        GUI_load();
        
    end
end