add code to prevent concurrency