Added factored rewards. Fixed a few small bugs. Also, includes factored rewards' unit tests.