modified the discount amount calculation