Instead of templating the `main` function, check if there exists a function `main` already initialized. If not, then make one and add the module body to it.