I rewrote the if statements to avoid nesting in a similar manner to what you suggested.