refactored user agent into class
fixed a bug on link detection