Make doctor script invocation cleaner and more flexible