Conforming modules to new protocol, implemented graceful shutdown of threads.