Refactoring of ModuleDeployer

* Addressed thread safety issues
* Optimized iteration of plugins for modules