refactored sequence alignment to be more generic