Added proper handling of settings.