move locking to a provider