main function uses fork