Update register.js
Refactor on register.js