Improved module generation. Refactor of namespaces.