Added support for username and password. Also, cleaned http errors.