Refactor entry points so that they all have a `main` function.