Implemented simple alignment algorithm