Follow up to r203488. Code clean up to eliminate a lot of copy+paste.