Some code cleanups to the module implementations