CHANGE PC algorithm closer to the correct implementation