restructure nested if statement
remove extraneous braces