modify the main function