Made the User-Agent configurable
Improve invalid login detection