add code in rsm.cc
complete code in step 2
pass test of step 3