Remove unused functions, libs, imports, etc for externals