simplify else if block