function alignment = multiple_align(alignment)

%---------------------------DESCRIPTION-----------------------------------%
%This method carry all processes involved in creating multiple alignment
%from calling consensus sequence method to pairwise alignment of consensus
%seq with another sequence from data set based on distance matrix
%-------------------------------------------------------------------------%

%Save original distance matrix since it will be adjusted during the run.
alignment.orig_distance_matrix = alignment.distance_matrix;

%Alignment cycle
for i = 1 : (alignment.seq_number - 1)
    
%Retrive sequences to be aligned
    alignment = get_seq_to_align(alignment);
    
    %Check if we have ever assembled consensus sequence
    check = isempty(alignment.consensus_seq);
    
    %If so we will fill first sequence to be aligned with nucleotides from
    %consensus sequence, so we are sure, that multiple alignment will be
    %assembled properly
    if check == 1
        
        alignment.consensus_seq = alignment.seq_to_align_01;
        
    end
    
    %Necessary for proper pairwise alignment function
    alignment.seq01 = alignment.consensus_seq;
    alignment.seq02 = alignment.seq_to_align_02;
    
    %Call of function for pairwise alignment, returns aligned
    %pair
    alignment = initialize_pairwise(alignment);
    alignment = pairwise_alignment(alignment);    
      
    %Add aligned pair to total (second one of sequence), except for the
    %first run of cycle. In that case we have to save both of sequences to
    %be saved
    if i == 1
        
        %Save whole alignment because this is first run
        alignment.multiple_seq_alignment{1} = alignment.temporary_pair_align(1,:);
        alignment.multiple_seq_alignment{2} = alignment.temporary_pair_align(2,:);
        
    else
        
        alignment = adjust_mult_align(alignment);
        
        %Add only second of aligned sequences to the pack
        alignment.multiple_seq_alignment{i+1} = alignment.temporary_pair_align(2,:);
        
    end
    
    %Calculate consensus
        alignment = create_consensus_seq(alignment);
    
end
