Module cleanup, error handling, and reporting