PID with functions