Implemented the better next() function.
Fixed problem with it replacing an initial value.
Implemented the CS-3 algorithm.