Suggested refactorings to complicated methods in AccountsLogic

@ymoctavia check these refactorings. They pass existing tests, but existing cases may not be enough. If no bugs, merge to your branch.