simplify logic block