Moved DNS lookup into method and added wildcard support