Refractored reward code