Refactor base command to reduce duplication
Add the --prefix name so module directories can differ from module names
Tidy up a bit