use name if cname does not exist
Remove unused variable
Refactor elb name resolution
Beautify code