Avoiding impurity accumulation is a requirement for steady-state stellarator operation. The accumulation of impurities can be heavily affected by variations in their density on the flux-surface. Using recently derived semi-analytic expressions for the transport of a collisional impurity species with high-$Z$ and flux-surface density-variation in the presence of a low-collisionality bulk ion species, we numerically optimize the impurity density-variation on the flux-surface to minimize the radial peaking factor of the impurities. These optimized density-variations can reduce the core impurity density by $0.75^Z$ (with $Z$ the impurity charge number) in the Large Helical Device case considered here, and by $0.89^Z$ in a Wendelstein 7-X standard configuration case. On the other hand, when the same procedure is used to find density-variations that maximize the peaking factor, it is notably increased compared to the case with no density-variation. This highlights the potential importance of measuring and controlling these variations in experiments.