using logical AND for parity
fix operator precedence bug