implemented commit phi for loop