locking code rewrite.