Reduce multiple replaces to loops

Dunno why I didn't think of this sooner, sure I'll realize why I didn't
later later :o: