worked on alignment algorithm