DNS resolution code cleanup