Modified to take all previous alignments into account