Refactored modules to avoid unecessary use of shared pointers