Merge back in some code changes made in the Ryu patch that really belong
here, in preparation for rebasing Ryu on top of this (since this is
really a separate functional change). Posting this mainly to let cfbot
take a look at it.
--
Andrew (irc:RhodiumToad)