Rework the PI implementation to resolve the previous issues.