If you put this check before the if (it == master_it) check above, you don't need to repeat it in the master-specific block above.