diff --git a/UPGRADE.txt b/UPGRADE.txt
index 2f541588ce5d3c07d9dbf8dc85b69d72142c5126..e337850312c33551d34376a5194394a8481b45ae 100644
--- a/UPGRADE.txt
+++ b/UPGRADE.txt
@@ -33,6 +33,7 @@ Configuration Files:
    with what is expected across modules.
 
    - cdr.conf: [general] section
+   - dnsmgr.conf
 
 SIP
 ===
diff --git a/main/dnsmgr.c b/main/dnsmgr.c
index 999bd92f4758db3bfbde5c97a0e0a79c5143e4a9..a62c37185c2aab01bb97e559806d06ba7f270837 100644
--- a/main/dnsmgr.c
+++ b/main/dnsmgr.c
@@ -109,8 +109,9 @@ struct ast_dnsmgr_entry *ast_dnsmgr_get(const char *name, struct ast_sockaddr *r
 
 void ast_dnsmgr_release(struct ast_dnsmgr_entry *entry)
 {
-	if (!entry)
+	if (!entry) {
 		return;
+	}
 
 	AST_RWLIST_WRLOCK(&entry_list);
 	AST_RWLIST_REMOVE(&entry_list, entry, list);
@@ -143,12 +144,12 @@ int ast_dnsmgr_lookup(const char *name, struct ast_sockaddr *result, struct ast_
 
 	/* do a lookup now but add a manager so it will automagically get updated in the background */
 	ast_get_ip_or_srv(result, name, service);
-	
+
 	/* if dnsmgr is not enable don't bother adding an entry */
 	if (!enabled) {
 		return 0;
 	}
-	
+
 	ast_verb(3, "adding dns manager for '%s'\n", name);
 	*dnsmgr = ast_dnsmgr_get(name, result, service);
 	return !*dnsmgr;
@@ -198,7 +199,7 @@ int ast_dnsmgr_refresh(struct ast_dnsmgr_entry *entry)
 /*
  * Check if dnsmgr entry has changed from since last call to this function
  */
-int ast_dnsmgr_changed(struct ast_dnsmgr_entry *entry) 
+int ast_dnsmgr_changed(struct ast_dnsmgr_entry *entry)
 {
 	int changed;
 
@@ -208,7 +209,7 @@ int ast_dnsmgr_changed(struct ast_dnsmgr_entry *entry)
 	entry->changed = 0;
 
 	ast_mutex_unlock(&entry->lock);
-	
+
 	return changed;
 }
 
@@ -230,16 +231,18 @@ static int refresh_list(const void *data)
 
 	/* if a refresh or reload is already in progress, exit now */
 	if (ast_mutex_trylock(&refresh_lock)) {
-		if (info->verbose)
+		if (info->verbose) {
 			ast_log(LOG_WARNING, "DNS Manager refresh already in progress.\n");
+		}
 		return -1;
 	}
 
 	ast_verb(3, "Refreshing DNS lookups.\n");
 	AST_RWLIST_RDLOCK(info->entries);
 	AST_RWLIST_TRAVERSE(info->entries, entry, list) {
-		if (info->regex_present && regexec(&info->filter, entry->name, 0, NULL, 0))
-		    continue;
+		if (info->regex_present && regexec(&info->filter, entry->name, 0, NULL, 0)) {
+			continue;
+		}
 
 		dnsmgr_refresh(entry, info->verbose);
 	}
@@ -266,15 +269,16 @@ static char *handle_cli_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_
 	switch (cmd) {
 	case CLI_INIT:
 		e->command = "dnsmgr reload";
-		e->usage = 
+		e->usage =
 			"Usage: dnsmgr reload\n"
 			"       Reloads the DNS manager configuration.\n";
 		return NULL;
 	case CLI_GENERATE:
-		return NULL;	
+		return NULL;
 	}
-	if (a->argc > 2)
+	if (a->argc > 2) {
 		return CLI_SHOWUSAGE;
+	}
 
 	do_reload(0);
 	return CLI_SUCCESS;
@@ -289,13 +293,13 @@ static char *handle_cli_refresh(struct ast_cli_entry *e, int cmd, struct ast_cli
 	switch (cmd) {
 	case CLI_INIT:
 		e->command = "dnsmgr refresh";
-		e->usage = 
+		e->usage =
 			"Usage: dnsmgr refresh [pattern]\n"
 			"       Peforms an immediate refresh of the managed DNS entries.\n"
 			"       Optional regular expression pattern is used to filter the entries to refresh.\n";
 		return NULL;
 	case CLI_GENERATE:
-		return NULL;	
+		return NULL;
 	}
 
 	if (!enabled) {
@@ -331,16 +335,17 @@ static char *handle_cli_status(struct ast_cli_entry *e, int cmd, struct ast_cli_
 	switch (cmd) {
 	case CLI_INIT:
 		e->command = "dnsmgr status";
-		e->usage = 
+		e->usage =
 			"Usage: dnsmgr status\n"
 			"       Displays the DNS manager status.\n";
 		return NULL;
 	case CLI_GENERATE:
-		return NULL;	
+		return NULL;
 	}
 
-	if (a->argc > 2)
+	if (a->argc > 2) {
 		return CLI_SHOWUSAGE;
+	}
 
 	ast_cli(a->fd, "DNS Manager: %s\n", enabled ? "enabled" : "disabled");
 	ast_cli(a->fd, "Refresh Interval: %d seconds\n", refresh_interval);
@@ -377,16 +382,15 @@ int dnsmgr_reload(void)
 static int do_reload(int loading)
 {
 	struct ast_config *config;
+	struct ast_variable *v;
 	struct ast_flags config_flags = { loading ? 0 : CONFIG_FLAG_FILEUNCHANGED };
-	const char *interval_value;
-	const char *enabled_value;
 	int interval;
 	int was_enabled;
-	int res = -1;
+	int res = 0;
 
 	config = ast_config_load2("dnsmgr.conf", "dnsmgr", config_flags);
 	if (config == CONFIG_STATUS_FILEMISSING || config == CONFIG_STATUS_FILEUNCHANGED || config == CONFIG_STATUS_FILEINVALID) {
-		return 0;
+		return res;
 	}
 
 	/* ensure that no refresh cycles run while the reload is in progress */
@@ -399,23 +403,24 @@ static int do_reload(int loading)
 
 	AST_SCHED_DEL(sched, refresh_sched);
 
-	if (config) {
-		if ((enabled_value = ast_variable_retrieve(config, "general", "enable"))) {
-			enabled = ast_true(enabled_value);
-		}
-		if ((interval_value = ast_variable_retrieve(config, "general", "refreshinterval"))) {
-			if (sscanf(interval_value, "%30d", &interval) < 1)
-				ast_log(LOG_WARNING, "Unable to convert '%s' to a numeric value.\n", interval_value);
-			else if (interval < 0)
+	for (v = ast_variable_browse(config, "general"); v; v = v->next) {
+		if (!strcasecmp(v->name, "enable")) {
+			enabled = ast_true(v->value);
+		} else if (!strcasecmp(v->name, "refreshinterval")) {
+			if (sscanf(v->value, "%30d", &interval) < 1) {
+				ast_log(LOG_WARNING, "Unable to convert '%s' to a numeric value.\n", v->value);
+			} else if (interval < 0) {
 				ast_log(LOG_WARNING, "Invalid refresh interval '%d' specified, using default\n", interval);
-			else
+			} else {
 				refresh_interval = interval;
+			}
 		}
-		ast_config_destroy(config);
 	}
+	ast_config_destroy(config);
 
-	if (enabled && refresh_interval)
+	if (enabled && refresh_interval) {
 		ast_log(LOG_NOTICE, "Managed DNS entries will be refreshed every %d seconds.\n", refresh_interval);
+	}
 
 	/* if this reload enabled the manager, create the background thread
 	   if it does not exist */
@@ -427,20 +432,14 @@ static int do_reload(int loading)
 		}
 		/* make a background refresh happen right away */
 		refresh_sched = ast_sched_add_variable(sched, 100, refresh_list, &master_refresh_info, 1);
-		res = 0;
-	}
-	/* if this reload disabled the manager and there is a background thread,
-	   kill it */
-	else if (!enabled && was_enabled && (refresh_thread != AST_PTHREADT_NULL)) {
+	/* if this reload disabled the manager and there is a background thread, kill it */
+	} else if (!enabled && was_enabled && (refresh_thread != AST_PTHREADT_NULL)) {
 		/* wake up the thread so it will exit */
 		pthread_cancel(refresh_thread);
 		pthread_kill(refresh_thread, SIGURG);
 		pthread_join(refresh_thread, NULL);
 		refresh_thread = AST_PTHREADT_NULL;
-		res = 0;
 	}
-	else
-		res = 0;
 
 	ast_mutex_unlock(&refresh_lock);
 	manager_event(EVENT_FLAG_SYSTEM, "Reload", "Module: DNSmgr\r\nStatus: %s\r/nMessage: DNSmgr reload Requested\r\n", enabled ? "Enabled" : "Disabled");