sped up PID toggling dramatically by switching to straight SQL statement