Adding user agent detection