improve config code to read config dynamically from settings.