Modifying logic slightly