Simplify if/else logic