Simplified the applyDiscount method.