Fix up discount function