Move more things into D, delete more redundant C++ code.