Fix warnings and remove unused code.