Code style fixes and make sure that the log file gets written.
Add support for loading modules based on configuration.