refactor profile.js