refactering in CalculateAlignmentScore