Fixed modules plugin

Still needs heavy refactoring.