Improvements to startup and shutdown of module.