Simplify repeatZeros function