[*] adding the user-agent header to request, minor refactoring