I would just put all of the $replacex stuff into one command rather than multiple IFs and $replacex's.

if([ isin %mud.info) { %mud.info = $replacex(%mud.info,code1,$ctrl,code2,$ctrl,code3,$ctrl,etc,etc) }

Of course, you can also do that without the IF.