Refactored code to use discount hash