refactored.
small bugfix with reward calculating.