Added a PID locking mechanism to avoid multiple grabs