I\'m getting the incorrect output from my program and I think it\'s because of the the updating function, but I can\'t see why it shouldn\'t give the correct output.