Refactor address to dns format translation and add test harness.