refactored the and;or operatons