Improvements to the reward function