Moves browser agent type to the end in order to avoid issues with envJS and Rhino
Moves browser agent handling logic to the end of the file so that it does
not interfere with rhino