modified with logical operators