added user agent detection