The plugins array needs to be initialised inside the loop 

Otherwise plugins that are disabled in one config but not in another still appear.

My editor removed trailing whitespace hence lots of line changes. Relevant lines are 35 and 40.