Scope'd the main function