created class CTPAction. Some other code refactoring and documentation