refactor dns lookup
if the IP is passed in then use it
Merge pull request #418 from racker/fixes/refactor_dns_lookup

refactor dns lookup