refactor user.js