move sort_rewards code to new js framework