Patch for using a group name multiple times

I've added a small feature to the code making named groups slightly more powerful.

Previously, if you used the same group name multiple times, it would have just used the value stored in the last group of that name (even if it failed to find that group).

Now it will only use the last successfully found group.