siplifying logic