update balance function