refactor balance