reduce duplicate else clauses