changed vaiables thisAmount and each in amountFor