ProfileView.js: code refactor