Modification of cps.cpp

Added test cases for lots of things.