Added locking.