refactor and set custom user agent