This logic looks cleaner to me.
Fixed documentation typo