update balance calculation