refactor dns generator