advanced PID handling