Removed nested if statements. Establishing precedence by order of if sta...

...tements.

@CHenrie Lets review this