Multiple instances: move module name creation into function and use it

This replaces all instances of MI-aware module label generation into function calls (how it should have been done initially).
I'm not 100% about masks part - there were some inconsistencies between using module name vs. MI module name.