r20670: Make the logic more clear