reconstruct if-else statement