CPID Algorithm2