remove duplicat else and end