Remove unused controllers, apply substitutions to TOS.