reordered some boolean expressions