Small tweaks to logic