discount function updated