Add comments and make "if" statemnet clearer.
Merge pull request #6183 from openscholar/6179-1

Add comments and make "if" statemnet clearer.