Incorporate the fix for issue 1181 without breaking 2217.
Fix Albert Wong's nits.
Begin addressing review comments.