Separating out replace param logic in a method