Tweaked wildcard checking
Moved most debugging code to the logging module

Added some code to identify which thread queries a given subdomain