rewrite ugly user agent function
Merge pull request #1 from vdebergue/master

rewrite ugly user agent function