Added code to better handle config changes.