Rework executable script so that it uses a main