rebuild msg parts and modified the sturcture of output data