added shutdown module hook
refactored shutdown handler registration