finds repetition direction
Merge conflict fixed.