simplify boolean logic