Move config to struct, fix starttls hang