refactor the account handling