Update Doctor largely finished, and *major* code cleanup

The cleanup should continue...