added Balance class and updateBalance function