Altered according to avgRewardSarsaReplacing.c