Refactored dns relay server