More improvements to func group substitution code.