See comment on line 52 below.