a major update: now alignment is done on the fly