s/res/browser, plus comments

I wanted to make the code easier to read so I can understand it. I changed the variable `res` to `browser` because I wasn't sure what `res` really is. (If I'm way off here, by all means clue me in!)