Refactoring installation of modules