Adding conditional logic within the widget