removed excess elements and updated user agent detection