Add locking to prevent multiple runs at same time