minor refactor of the top level doctor method