Modified couple of conditions.
Comparing a BOOL against YES is dangerous.