Finished RMERGE_T
Move fuctions from AA, which help me finish RMERGE_T and RMERGE_R