function order in main js