Modmanager removing duplicates: Use a standard looping pattern.

This is hopefully easier to understand and this piece of code is not
critical for performance, so let's just have it written as easy as possible.