modified implementation of operator && and ||