Improved configuration logic.