check hostname for urls
basic auth support
code cleanup