replace_repeated_code