pollthread retries once after all errors
new class config to hold configuration data
most globals moved to config class