Agent first commit.

New version of KS
Refactoring stuff.

randGen -> rGen