add balance calculation