refactored the rewards dict calculation to make it more readable