[core] Rework enumerate_modules to be neater and more sensible

Fixes issue #209. Makes pull request #251 unneeded.
Merge branch 'master' of github.com:embolalia/willie