refactoring to use Account class