Data structures and helper functions for calculating alignments