Implemented populateAccounts() and removed some redundant code.