This condition can be merged with previous "if" which will reduce nesting.