break get_module_by_id into a seperate method

for clarity but also to avoid overwriting the `module` variable in local scope