Fix refactoring bugs
Refactor dns callback handling into own module