refactoring to allow for a search term to return multiple modules.
It groups them by the module name.