Added more error handling, updated User-Agent class