Modified main function body as recommended by Christian Contreras-Campana