PetersonLock made more generic.