Minor optimization

Move loop invariant code.
I just wanted to avoid the assignment in case `excludes` _is_ an array :)
You don't like that code style, do you?