improved algorithm for calculating repetition weights