rename reward to reward_fn for clarity, some more ocamldoc