Move load_module to separate function