Bug Fixes + Code cleanup for module generator

Fixed a few (weird) bugs that caused the application to throw
exceptions, seems that I forgot to tag the configuration class to each
config item in the list.

Also some code clean up