Code changes for amount calculations. And preserving the amount balance.