[R]Rewrite some Functions

[R]Rewrite some Functions, should modify init function