Logic improvement