Reward system operational

+ various optimizations and code cleaning