Code added for length and repetition stats