Refactoring some logic out of account#index view and getting it into controller/models