format main flow