add r# file
remove some redundant code