Documentation and refactoring in CCS related code