(cherry picked from commit df3f5a78d5)
df3f5a78d5
(cherry picked from commit 529add316c)
529add316c
Also, random cleanup to argument handling.