This block of code took several readings to understand :) I think it could use a comment.

I think all it needs is a description that index is tracking which of the given names is currently being tested to ensure that it's in the right order in the the namespace list