added some older RL code which is generalized enough to be re-usable.