Scoped the main function