function [file_name download_error] = retrieveABAImage(gene_name, slice, folders)
    download_error = 1000;
    file_name = '';
    folder_index = 1;
    while download_error && folder_index <= length(folders)
        lookfor = dir(strcat(char(folders{folder_index}),'/',gene_name,'_*_',num2str(slice),'.jpg'));
        if ~isempty(lookfor)
            file_name = lookfor(1).name;
            if check_image(strcat(char(folders{folder_index}),'/',file_name)) == 0
                download_error = 1000;
                folder_index = folder_index + 1;
            else
                download_error = 0;
            end
        else
            download_error = 1000;
            folder_index = folder_index + 1;
        end
    end
    
end