Fixed issue with nested if-else statements.