added global alignment algorithm