Minor cleanup. Add ability to set UserAgent.

Some sites ban default curl UA. By default, I set it to firefox. Minor code cleanup as well.