refactors get_total_rewards