Move sanitize config into a #sanitize_config method.

(For improved customizability.)
Remove obsolete code from #sanitize.