Move code from getAllAlignments() into getDeviationWeight()