inline logical procedures, change binary operand to right child, delete few ifs