Improve logic a bit.