Reorganize and clean up based on review feedback
Fix for #1: catch errors on DNS lookup