Update register.js

rafactor