Remove unused code and fix build.