A refactor to get a separate scan_module and invoke method, as well
as slightly simpler code.