Major simplification in order to decouple code concepts.
Assigned variable to avoid repeated computation.
Simplifies DNS functions for now; caching can be added later.