Shouldn't these instances of "res" variables be "ret" as in return?  I noticed it here first but there are a few new instances of these in the ad_plfs layer that I think should probably be named "ret_[rest of variable name]" rather than res.