DNS and error refactor