added ScopedLock and docs