add the pid algorithm