simplify logic a bit