Fixed rot_m bug in generate_data2, added comments