Addressed 7 comments from codereview. ::do_types might be wrong.