Simplify logic, improve perfs.
Simplify logic.