Could you abstract the common code between the else if and the else?