modified a bit how massRepeat detection works