simplify the logic