fixed the code structure of the PID a little