The above changes preserve the existing behavior of the code (i.e., no functional changes) but, are you assuming there could be multiple Range headers? I do not believe that is legal according to spec but I could be wrong:

The Atmos Programmer's Manual has a link to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35. There is also https://svn.tools.ietf.org/svn/wg/httpbis/draft-ietf-httpbis/latest/p1-messaging.html#field.order.