More efficient degapping and gapping of alignments