finish writting rhelper.js, and add more checks in register function in service.js, need debug next