add support for alternative module naming schemes

This PR is far from finished, but intends to solve #173 when it's done.

Comments/suggestions w.r.t. the current draft, which works and even includes a unit test to check the functionality, are welcome.

I will keep updating this when I find time, and will request a full (re)review when I consider it ready for merging.