simple boolean optimizations (thanks /u/PlainSight)