all in main function