rewrite for better truthtables