removed redundant remainingAmount