added precedence to logical operators