refactored and simplified account.js