simplify logic