Set the main function.