rewrote PID class.