cleaned version with working repeated_add