with proper if conditions
production version