Replace hard-coded conditions

Replace hard-coded conditions with the ones defined in settings.