Restructure if else