refactored resolveCNAMEs